0

EDIT - I think I have discovered the underlying cause - the system admin installed NewRelic on the server which has somehow overwritten my logging. Is there any way to turn this off?

I have a few applications that were logging fine until a few weeks ago - the system admin swears nothing has changed on his end and equally I don't think anything has changed on mine.

App is on Windows Servier 2012 R2, IIS 8.5.

I use log4net, configuration file looks like this:

 <log4net>
  <root>
    <level value="ALL" />
    <appender-ref ref="file" />
  </root>
  <appender name="file" type="log4net.Appender.RollingFileAppender">
    <file type="log4net.Util.PatternString" value="logs/application_log.xml"/>
    <appendToFile value="true" />
    <layout type="log4net.Layout.XmlLayoutSchemaLog4j">
      <locationInfo value="true"/>
    </layout>
    <param name="Encoding" value="utf-8" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="5" />
    <maximumFileSize value="10MB" />
    <staticLogFileName value="true" />
  </appender>
</log4net>

The AssemblyInfo had this appended to the end

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config")]
  • I traditionally had to add a 'logs' folder in the website root, and add 'IIS AppPool\MyAppPool' user to the folder permissions, giving full control.

  • The IIS App Pool is set to ApplicationPoolIdentity.

This would be enough and the logs would start capturing - and the build + logs work fine on my local machine.

  • I have also tried adding NETWORKSERVICE, IIS/IUSRS and others

I've been trying to fix this issue for far too long now so was wondering if there's anything else I can try?

aspirant_sensei
  • 1,568
  • 1
  • 16
  • 36

1 Answers1

2

There sure is! Turn on log4net's debug logging feature.

https://stackoverflow.com/a/756241/4824030

Your config should look something like this.

<configuration>

...

<log4net>
  <root>
    <level value="ALL" />
    <appender-ref ref="file" />
  </root>
  <appender name="file" type="log4net.Appender.RollingFileAppender">
    <file type="log4net.Util.PatternString" value="logs/application_log.xml"/>
    <appendToFile value="true" />
    <layout type="log4net.Layout.XmlLayoutSchemaLog4j">
      <locationInfo value="true"/>
    </layout>
    <param name="Encoding" value="utf-8" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="5" />
    <maximumFileSize value="10MB" />
    <staticLogFileName value="true" />
  </appender>
</log4net>

...

<appSettings>
   <add key="log4net.Internal.Debug" value="true"/>
</appSettings>

...   

<system.diagnostics>
    <trace autoflush="true">
        <listeners>
            <add 
                name="textWriterTraceListener" 
                type="System.Diagnostics.TextWriterTraceListener" 
                initializeData="C:\tmp\log4net.txt" />
        </listeners>
    </trace>
</system.diagnostics>

...

</configuration>
Marisa
  • 732
  • 6
  • 22