Hi!
I have one question again :D!
In my project (for Compact .NET Framework), we need implement a specified
layout to logger. First, we included the log4net library in project and we
extended the Xml like below:
using System;
using System.Collections.Generic;
using System.Text;
using log4net;
using log4net.Util;
using log4net.Core;
namespace MyProject.Log
{
public class MyXMLLayout : log4net.Layout.XmlLayout
{
public override void Format(System.IO.TextWriter writer,
LoggingEvent loggingEvent)
{
//test layout
writer.Write("NEW LOG ENTRY");
}
}
}
I compiled the project and add layout attribute in log4net config file, like
this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<appender name="RollingFileAppender" type="
log4net.Appender.RollingFileAppender">
<bufferSize value="0" />
<file value="mylog.txt" />
<appendToFile value="true" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="100KB" />
<rollingStyle value="Size" />
<staticLogFileName value="true" />
<layout type="MyProject.Log.MyXMLLayout" />
</appender>
<root>
<level value="ALL" />
<appender-ref ref="RollingFileAppender" />
</root>
</log4net>
</configuration>
When I run my project, the mylog.txt not contains the logged events of
system. If I restore the config file with layouts provided by log4net, the
software works fine. We need something else to do work this proprietary
layout?
Sorry for my bad english :(.
Thanks's
Cícero