logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: nothing appearing on ConsoleAppender in web application
Date Wed, 15 Dec 2004 12:46:32 GMT
Jerry,

The ASP.NET runtime (aspnet_wp.exe) is not a console application,
therefore it does not have a Console Window. The output of the
ConsoleAppender goes to the System.Console.Out which by default is
written to the attached Console Window. This is not the same thing as
the Debug output window in the Visual Studio Debugger.

You can redirect the System.Console.Out stream to another target, e.g. a
local file, by setting the Console.SetOut() method.

You can use the TraceAppender to log to the debuggers debug output
window.

Nicko

> -----Original Message-----
> From: Jerry Shea [mailto:jerry_maxtrak@hotmail.com] 
> Sent: 12 December 2004 21:18
> To: log4net-user@logging.apache.org
> Subject: nothing appearing on ConsoleAppender in web application
> 
> Hi,
> 
> I have setup log4net in an ASP.NET application. Logging works 
> perfectly if I use a RollingFileAppender but if I use the 
> ConsoleAppender, output does not appear in the console when 
> running in the debugger (VS.NET 2003). 
> 
> I am configuring log4net with: 
>   [assembly: log4net.Config.DOMConfigurator(Watch=true)]
> 
> And my web.config looks like this:
> 
> 	<log4net>
> 		<appender name="ConsoleAppender"
> type="log4net.Appender.ConsoleAppender" >
> 			<layout type="log4net.Layout.PatternLayout">
> 				<param name="ConversionPattern" 
> value="%d [%t] %-5p %c [%x] - %m%n" />
> 			</layout>
> 		</appender>
> 		<appender name="RollingLogFileAppender"
> type="log4net.Appender.RollingFileAppender,log4net">
> 			<param name="File" value="log.txt" />
> 			<param name="AppendToFile" value="true" />
> 			<layout 
> type="log4net.Layout.PatternLayout,log4net">
> 				<param name="ConversionPattern" 
> value="%d [%t] %-5p %c [%x] - %m%n" />
> 			</layout>
> 		</appender>
>    		<root>
> 			<level value="DEBUG" />
> 			<appender-ref ref="ConsoleAppender" />
> 		</root>
> 	</log4net>
> 
> If I change:
> 
> 			<appender-ref ref="ConsoleAppender" />
> 
> To
> 
> 			<appender-ref ref=" RollingLogFileAppender " />
> 
> Logging works fine to my text file.
> 
> Anyone got any ideas?
> 
> Thanks, Jerry
> 
> 
> 

Mime
View raw message