Hello to all,
I have interesting problem with RollingFileAppender in ASP.Net webservice. When
webservice run on IIS on Windows XP, all works well, log file is rolled over
days.
But when it was deployed to IIS running on the Windows 2003 Server, logging
still work, but.... Log file is not rolled over, messages are still written
into single file !
Has anybody similar experience or (better) knowledge what goes wrong?
I am not sure if there can be problem with rights, but initially webservice was
able to create log file. What permissions are needed for logging from ASP.Net
applications? And for which accounts? There are differences between Win XP, Win
2003 server and Win 2003 domain controller. My server is win2003 standalone
server, not in any domain.
Here is my code:
public class SyncServ : System.Web.Services.WebService
{
private static log4net.ILog log;
public SyncServ()
{
log4net.Config.XmlConfigurator.Configure();
log = log4net.LogManager.GetLogger(this.GetType());
}
[WebMethod]
public bool SomeMethod()
{
log.Debug("some message");
// do some work
return true;
}
}
Here's my web config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<sectionGroup name="applicationSettings"
type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<appSettings>
<add key="Server" value="." />
<add key="SysPath" value="F:\data\Ivs\" />
<add key="PullBatchSize" value="200" />
</appSettings>
<connectionStrings />
<system.web>
<compilation debug="true" />
<authentication mode="Windows" />
</system.web>
<system.webServer>
<defaultDocument>
<files>
<add value="SyncServ.asmx" />
</files>
</defaultDocument>
</system.webServer>
<log4net>
<!-- Define some output appenders -->
<appender name="LogFileAppender"
type="log4net.Appender.RollingFileAppender">
<file value="Log/Web.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level
%message%newline" />
</layout>
<rollingStyle value="Date" />
<Threshold value="DEBUG" />
</appender>
<root>
<level value="ALL" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
</configuration>
With regards Radovan Raszka
Software development dept.
HaSaM, s.r.o.
Tečovice 45, 763 02 Zlín-4
tel: (+420) 577 101 261
fax: (+420) 577 101 280
www.hasam.cz