Sunday, November 23, 2008
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: Adding properties to a logging event
Prev Next
You are not authorized to post a reply.

Author Messages
Michael Richman

08/06/2008 9:03 PM  
I'm trying to add properties to a logging event so that the adoAppender can=pick up these properties and use them in the insert SQL statement.

I've followed the example of creating a loggingEvent, but for the life of me, I can't figure out what the callStackBoundaryDeclaringType would be. Can someone help me figure out what the first parameter is to pass to the LoggingEvent constructor?

Also, is there a simpler way to add event specific context so that the appender can pick up the properties? I know I can use MDC or NDC or thread context or global context, but these are properties that are specific to the event, not those larger contexts.

My code fragment is as follows:

 

log4net.Core.LoggingEvent loggingEvent =3D new log4net.Core.LoggingEvent(ca= llerStackBoundaryDeclaringType,

log.Logger.Repository,

log.Logger.Name,

log4net.Core.Level.Info,

"This is a Message",

new Exception());

loggingEvent.Properties["Additional"] =3D "Additional info";

log.Logger.Log(loggingEvent);

Ron Grabowski

08/12/2008 5:48 AM  
It should be the Type of the current class that's doing the logging:

private readonly static Type declaringType = typeof(ExtendedLogger);

This is an ok way to add additional properties to a loggingEvent:

 loggingEvent.Properties["Additional"] = "Additional info";
You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > Adding properties to a logging event



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement