I am configuration a commom.logging in windows service program.For now,it can generate the log file but no content in it.
I am using common.logging and log4net.
Here is my common.logging conf script:
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
<arg key="level" value="info" />
<arg key="showLogName" value="true" />
<arg key="showDataTime" value="true" />
<arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />
</factoryAdapter>
</logging>
</common>
</configuration>
and this is my log4net conf script:
<log4net xsi:noNamespaceSchemaLocation="http://csharptest.net/downloads/schema/log4net.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<root>
<level value="ALL"/>
<appender-ref ref="rollingFile"/>
</root>
<logger name="ApplicationInfoLog">
<level value="ALL"/>
<appender-ref ref="rollingFile"/>
</logger>
<appender name="rollingFile" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Logs/a.txt"/>
<param name="AppendToFile" value="true"/>
<param name="RollingStyle" value="Date"/>
<param name="DatePattern" value="yyyy.MM.dd".txt""/>
<param name="StaticLogFileName" value="true"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n"/>
</layout>
</appender>
</log4net>
and this is the code who write content to the log:
namespace jsptpd
{
public partial class jsptpdJobScheduler : ServiceBase
{
private readonly ILog logger;
private IScheduler scheduler;
public jsptpdJobScheduler()
{
InitializeComponent();
logger = LogManager.GetCurrentClassLogger();
logger.Info("dfsfsd");
logger.Debug("dsfsgg");
}
}
}
Where proberbly wrong and i can't find it,please help me thank you.