سؤال

I have an application which uses log4net for logging messages. In the web.config there is a section which looks like this:

<log4net>
   <appender name="smth" type="smthType">
     <file value="name.log" />
   </appender>
</log4net>

My question is: how can I get the value name.log from this section?

I tried this:

Dim section = ConfigurationManager.GetSection("log4net")

but since the value is in the appender section, I am not sure how to get it.

Any help would be greatly appreciated

هل كانت مفيدة؟

المحلول

I believe that, instead of reading from web.config, you should use the log4net API, for example:

Dim appender as IAppender = LogManager.GetRepository().GetAppenders()[0];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top