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 David Cruwys <mu...@yahoo.com.au> on 2004/05/12 10:10:34 UTC

LogFileAppender and Windows Service

I would like to use log4net on a windows service, the log4net
configuration that I have used is the same as I would use for a windows
or asp.net application, but the file does not seem to be getting
written out.

I know that I have the configuration file working ok, as I can access
other config values, but the log4net is not working.

Cheers David

	<log4net>
		<!-- Define some output appenders -->
		<appender name="ConsoleAppender"
type="log4net.Appender.ConsoleAppender" >
			<layout type="log4net.Layout.PatternLayout">
				<param name="ConversionPattern" value="%d [%t] %-5p %c [%x]
ID=%P{EventID} - %m%n" />
			</layout>
		</appender>

		<appender name="LogFileAppender"
type="log4net.Appender.FileAppender">
<!--
			<param name="File"
value="C:\_AppDev\Mt\MtWinService\bin\Debug\crazy-log.txt" />
-->
			<param name="File" value="crazy-log.txt" />
			<param name="AppendToFile" value="true" />
			<layout type="log4net.Layout.PatternLayout">
				<param name="ConversionPattern" value="%5p %c{1}:%L - %m%n" />
			</layout>
			<!-- Alternate layout using XML			
			<layout type="log4net.Layout.XMLLayout" /> -->
		</appender>

		<!-- Setup the root category, add the appenders and set the default
level -->
		<root>
			<level value="ALL" />
			<appender-ref ref="LogFileAppender" />
		</root>

	</log4net>



Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com