Log4Net for Compact Framework 2.0

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hi all,

can anyone tell me, if I can use Log4Net on Compact Framework 2.0?
I tried to set up an example from the apache-homepage, but it is
somehow too complicated.
Can anyone tell me very simple how to do it, with a logfile?

Thanks in advance
Daniel
 
Yes, you can.
I'm using log4net in large Compact Framework 2.0 project and it works great.

Sample configuration file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net debug="false">
<appendername="RollingLogFileAppender"type="log4net.Appender.RollingFileAppender">
<file value="\Application\AgileroLog.txt" />
<appendToFile value="true" />
<maxSizeRollBackups value="2" />
<maximumFileSize value="1048576" />
<rollingStyle value="Composite" />
<staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout">
<header value="[Header]
"/>
<footer value="[Footer]
"/>
<conversionPattern value="%newline Date: %date ,Application: %a ,Logger: %logger ,Thread: [%thread] ,Level: %level %newline Message: %message%newline Exception: %exception%newline" />
</layout>
</appender>
<!-- Setup the root category, add the appenders and set the default level -->
<root>
<level value="INFO" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>
</configuration>

File name: application.exe.config or specified in code:
log4net.Config.XmlConfigurator.Configure(new FileInfo(configPath));

Best Regards
Darek
 
Back
Top