I have the following log4net configuration:
<log4net>
<appender name="Console" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<!-- Pattern to output the caller's file name and line number -->
<conversionPattern value="%date [%thread] %-5level %ndc - %message%newline" />
</layout>
</appender>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="C:/logs/mysystem.log" />
<appendToFile value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<maximumFileSize value="1024MB" />
<maxSizeRollBackups value="30" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level - %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="Console" />
<appender-ref ref="RollingFile" />
</root>
in the local machine it works fine, but when I deploy the web site to the remote server (IIS 6.0) it does not create the log file despite the fact that the system is running.
The AppPool identity is configured to “Network Service”.
Any idea?
You can grant access “Network Service” access to the logs folder by create a ACE on the folder using the machines name as the principle. Changing the pool identity to “Local System” can have undesirable effects so I would avoid that.
Another approach is to create a domain user and add this user to the machine IIS_WPG group. Change the pool identity to use this user. You can then grant appropriate folder access to this user.