Search code examples
log4netlog4net-configuration

log4net on godaddy hosted MVC site not working


I have log4net logging working beautifully on my development machine

I have now deployed to goDaddy and it doesn't appear to do anything. I have tried the suggestion here

Log4Net works on Dev machine, fails when deployed to shared host (using same db/connstring)

But still no luck

I don't get any error but I don't get a log file created either

I have tried to use the absolute path as per godaddy help files here

https://au.godaddy.com/help/what-is-my-absolute-path-16024

Here is the config I have in my web config file

<log4net debug="true">
     <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="G:\PleskVhosts\mydomain\httpdocs\logs\log4net.txt" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="10MB" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout">
         <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
      </layout>
    </appender>

    <root>
      <level value="ALL" />
      <appender-ref ref="RollingLogFileAppender" />
    </root>
  </log4net>
  <system.diagnostics>
    <trace autoflush="true" indentsize="4">
      <listeners>
        <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="G:\PleskVhosts\mydomain\httpdocs\logs\TextWriterOutput.log" />
        <remove name="Default" />  
     </listeners>
    </trace>
  </system.diagnostics>

I do not get any log4net.txt file or TraceWriterOutput log file

Not sure what to try next?


Solution

  • Have you checked the access permissions on the logs directory?

    You can check by using file manager through plesk select the dropdown arrow agains the directory and select change permissions and ensure iis processes have write/read access