You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Radovan Raszka <ra...@hasam.cz> on 2009/07/30 16:14:57 UTC

Rollingfileappender doesn't roll over

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



RE: Rollingfileappender doesn't roll over

Posted by Radovan Raszka <ra...@hasam.cz>.
Hello,
thanks for proposal, but I don't think it is problem as it works well on windows XP. Problem is only on windows 2003.
But I try this parameter, miracle can happen :-}
RR 

________________________________

Od: Pascal ROZE [mailto:pascal.roze@gmail.com] 
Odesláno: 30. července 2009 16:21
Komu: Log4NET User
Předmět: Re: Rollingfileappender doesn't roll over


Hi

There is no datePattern in your appender definition.
Maybe this is the problem.

Pascal


2009/7/30 Radovan Raszka <ra...@hasam.cz>


	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 <http://www.hasam.cz>  




Re: Rollingfileappender doesn't roll over

Posted by Pascal ROZE <pa...@gmail.com>.
Hi

There is no datePattern in your appender definition.
Maybe this is the problem.

Pascal

2009/7/30 Radovan Raszka <ra...@hasam.cz>

>  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* <http://www.hasam.cz>
>
>