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: No output from l4n... OR Russell's an idiot...
Date Sun, 14 Aug 2005 19:31:43 GMT
Russell,

Have you got a line of code like:

log4net.Config.XmlConfigurator.Configure();

Or an assembly attribute:

[assembly: log4net.Config.XmlConfigurator()]

If you don't have something like this then log4net won't start.
If you do, then could you post the output of the log4net internal debug?

Cheers,
Nicko

> -----Original Message-----
> From: Russell Haley [mailto:rhaley@axys.com] 
> Sent: 28 July 2005 00:15
> To: log4net-user@logging.apache.org
> Subject: No output from l4n... OR Russell's an idiot...
> 
> Let me start by saying that I am thoroughly impressed with 
> l4n. I had the opportunity to see it work in full action when 
> I added it to a serial driver that was malfunctioning. It 
> filled a file to 400 MB within a couple of minutes without so 
> much as a hickup. I wrote my own 'logging' utility that 
> actually caused more problems than the orginal errors because 
> it couldn't keep up. lol. So anyways, thank you for the great 
> logger. It's impressive what you have done...
> 
> So, that being said, this is probably one of the most painful 
> emails I've had to write for a while. As I noted above, I 
> have been using l4n in an application already and have tried 
> to cut and paste to another application, but I am not getting 
> any output! I even turned on internal debugging and I can't 
> see any errors. I've done this very thing almost EVERY time I 
> try to set up l4n again but I never remember what I'm doing 
> wrong... Details to
> follow:
> 
> App.config settings:
> ...
> <configSections>
> 		<section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, 
> log4net" /> </configSections> ...
> <log4net debug="true">
> 		<appender name="SystemEventInfoLog"
> type="log4net.Appender.RollingFileAppender">
> 			<param name="File" value="./INFO/" />
> 			<param name="AppendToFile" value="true" />
> 			<param name="RollingStyle" value="Date" />
> 			<param name="MaxSizeRollBackups" value="10" />
> 			<param name="DatePattern" 
> value="yyyy/MMMMMMMMM/yyyy-MM-dd.\I\N\F\O"/>
> 			<param name="StaticLogFileName" value="False" />
> 			<filter type="log4net.Filter.LevelMatchFilter">
> 				<LevelToMatch value="INFO" />
> 			</filter>
> 			<filter type="log4net.Filter.DenyAllFilter" />
> 			<layout type="log4net.Layout.PatternLayout">
> 				<Header value="[BEGIN LOGGING 
> AT %date ]%newline "
> type="log4net.Util.PatternString" />
> 				<Footer value="[END LOGGING]" 
> type="log4net.Util.PatternString" />
> 				<param name="ConversionPattern" 
> value="%d - %m%n" />
> 			</layout>
> 		</appender>
> 		<appender name="SystemLog" 
> type="log4net.Appender.RollingFileAppender">
> 			<param name="File" value="./SYSTEM/" />
> 			<param name="Threshold" value="ALL" />
> 			<param name="AppendToFile" value="true" />
> 			<param name="RollingStyle" value="Date" />
> 			<param name="MaxSizeRollBackups" value="10" />
> 			<param name="DatePattern"
> value="yyyy/MMMMMMMMM/yyyy-MM-dd.\S\Y\S\T\E\M"/>
> 			<param name="StaticLogFileName" value="False" />
> 			<layout type="log4net.Layout.PatternLayout">
> 				<header value="[BEGIN LOGGING 
> AT %date ]%newline"
> type="log4net.Util.PatternString" />
> 				<footer value="[END 
> LOGGING]%newline" type="log4net.Util.PatternString"
> />
> 				<param name="ConversionPattern" 
> value="%d [%t] %-5p %c [%x] - %m%n" />
> 			</layout>
> 		</appender>
> 
> 		<root>
> 			<appender-ref ref="SystemLog" />
> 			<appender-ref ref="SystemEventInfoLog"/>
> 		</root>
> </log4net>
> 
> and this is the outline of what I am doing in my classes 
> (note: the throw statement is just as an example, there would 
> be 'real' code in the try
> block):
> 
> using System;
> using log4net;
> 
> 	public class MyNewClass
> 	{
> 
> 		private static ILog l4nSystemLogger =
> LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMe
> thod().Declari
> ngType);
> 
> 
> 		public MyNewClass()
> 		{
> 			try
> 			{
> 				throw new Exception("This is an 
> exception.");
> 			}
> 			catch(Exception ex)
> 			{
> 
> l4nSystemLogger.Error(System.Reflection.MethodInfo.GetCurrentM
> ethod().Name,
> ex);
> 			}
> 		}
> 	}
> 
> 
> This works *beautifully* in my other application. What have I 
> missed????
> The output should be in
> "projectname\bin\debug\SYSTEM\2005\July\2005-07-27.SYSTEM", 
> although I've search high and low for it on my harddrive.
> 
> Thanks for saving my ass once again!
> 
> Cheers
> Russell Haley
> 
> 
> 

Mime
View raw message