Hello,

I have created a windows service, installed it to use the (at first) the local system admin account, then the local system account. I have verified that I have the necessary permissions (by simply creating a file & writing to it), but log4net is showing Is...Enabled = false on all levels.

my config looks like this:

<configuration>
  <configSections>
      <section
            name="log4net"
            type="System.Configuration.IgnoreSectionHandler" />
  </configSections>
  <appSettings>
     <!-- other settings ->
  </appSettings>
  <log4net>
      <appender
            name="RollingLogFileAppender"
            type="log4net.Appender.RollingFileAppender">
          <file
value="${windir}/System32/LogFiles/CompanyName/ServiceName/ServiceName.log" />
          <appendToFile value="true" />
          <rollingStyle value="Date" />
          <datePattern value="yyyy-MM-dd" />
          <staticLogFileName value="true" />
          <layout type="log4net.Layout.PatternLayout">
              <header value="[Header]&#13;&#10;" />
              <footer value="[Footer]&#13;&#10;" />
              <conversionPattern value="...(removed for email)" />
          </layout>
      </appender>
      <root>
          <level value="ALL" />
          <appender-ref ref="RollingLogFileAppender" />
      </root>
  </log4net>
</configuration>


I have the assembly level attribute to look for the config info in AssemblyInfo.cs

using log4net.Config;

[assembly: XmlConfigurator(Watch=true)]

If I run the executable as a normal executable, all logging happens as it should, but when it runs as a service nothing happens (debugging shows that's because the Is...Enabled is false).

anything I've left out that would enable my service to log?

thanks,
Steve

Reply via email to