Log4net 114322
Platform .Net framework 1.1 VS 2003
I have a windows service and I am logging events to a file and a console
appender. Log4net is watching the app config file. (using an attribute)
The File appenders work fine but I get no events in the output window.
(The console appender works fine when I debug an application. If I run
my service like an exe (by creating a new instance of the service and
running OnStart), the console output shows up). It is only when I attach
the debugger to a running service that the console appender does not
work. The file appenders do, thw watching works as well. The
System.Diagnostics.Debug.Writeline does show up. Also I have an install
program for the service so that it is installed in an application
directory not in the funky obj\\Debug directory it runs from when you
use the command line installer... What am I MISSING?
This is my config file.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="StandardAppender"
type="log4net.Appender.FileAppender">
<!--To change the file this level of logging
goes to change the File value-->
<param name="File"
value="C:\Log4netRedAlertLog.txt" />
<param name="AppendToFile" value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{MM/dd/yy
HH:mm:ss:fff} [%thread] %-5level %logger [%property{Switch}]
[%property{Cid}] - %message%newline" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<!--Set the filter for this appender
here-->
<levelMin value="DEBUG" />
<levelMax value="FATAL" />
</filter>
</appender>
<appender name="ConsoleAppender"
type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{MM/dd/yy
HH:mm:ss:fff} [%thread] %-5level %logger [%property{Switch}]
[%property{Cid}] - %message%newline" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<!--Set the filter for this appender here-->
<levelMin value="DEBUG" />
<levelMax value="FATAL" />
</filter>
</appender>
<appender name="ExceptionAppender"
type="log4net.Appender.FileAppender">
<!--To change the file this level of logging
goes to change the File value-->
<param name="File"
value="C:\RedAlertExceptions.txt" />
<param name="AppendToFile" value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{MM/dd/yy
HH:mm:ss:fff} [%thread] %-5level %logger [%property{Switch}]
[%property{Cid}] %newline%exception" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<!--Set the filter for this appender
here-->
<levelMin value="ERROR" />
<levelMax value="FATAL" />
</filter>
</appender>
<root>
<level value="DEBUG" />
<!--To remove an appender from log4net logger
comment the appender-ref line-->
<appender-ref ref="StandardAppender" />
<appender-ref ref="ExceptionAppender" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
</configuration>