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 sc...@consultant.com on 2010/08/18 11:24:39 UTC

Writing to event viewer only once at login time

Hi,

 I'm writing to the event viewer inside a folder called myApp. My .config looks like the following:

 <appender name="DebugEventLog" type="log4net.Appender.EventLogAppender">
  <param name="ApplicationName" value="myApp" />
  <layout type="log4net.Layout.PatternLayout">
   <param name="ConversionPattern" value="%d [%t] %-5p %c{3} [%P{sessionID}] [%P{ProjectID}] [%P{PageID}]- %m%n" />
  </layout>
  <mapping>
   <level value="ERROR" />
   <eventLogEntryType value="Error" />
  </mapping>
  <mapping>
   <level value="WARN" />
   <eventLogEntryType value="Warning" />
  </mapping>
  <mapping>
   <level value="DEBUG" />
   <eventLogEntryType value="Information" />
  </mapping>
  <threshold value="ALL"/>
 </appender>

I am making calls like the following:

log4net.ThreadContext.Properties["EventID"] = 15;
log.Info("Info: Hello World");

etc but am noticing that the myapp folder only gets written to at the very beginning when I log into the application. Am I doing something wrong? 

Anyone with any ideas as to why? Would appreciate any suggestions/ideas/comments that you may be able to offer.
Cheers,
S.