?

Log in

log4net - Tyaps ASP [entries|archive|friends|userinfo]
Программирование в ASP.Net

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

log4net [May. 21st, 2012|07:13 pm]
Программирование в ASP.Net

tyaps_asp

[tyaps]
[Tags|, ]

Просто памятка



<configSections>
  <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>

<log4net>
      <root>
           <level value="DEBUG" />
           <appender-ref ref="LogFileAppender" />
        
      </root>
        <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender" >
           <param name="File" value="C:\1\log.txt" />
           <param name="AppendToFile" value="true" />
           <rollingStyle value="Size" />
           <maxSizeRollBackups value="10" />
           <maximumFileSize value="10MB" />
           <staticLogFileName value="true" />
           <layout type="log4net.Layout.PatternLayout">
             <param name="ConversionPattern" value="%-5p %date – %m%n" />
          
        </layout>
        
      </appender>

    </log4net>


* This source code was highlighted with Source Code Highlighter.



private static readonly ILog log = LogManager.GetLogger(typeof(Program));
log4net.Config.XmlConfigurator.Configure();
log.Debug("something");


* This source code was highlighted with Source Code Highlighter.


А еще в Framework 4 нужно в свойствах проекта переключить Target Framework с ".Net Framework 4 Client Profile" на ".Net Framework 4" , иначе он не может зацепить log4net.dll
linkReply