I use the log4net.Appender.AdoNetAppender appender.
My log4net table are the following fields [Date],[Thread],[Level],[Logger],[Message],[Exception]
Three types of logging context available in Log4Net.
Log4Net.GlobalContext :- This context shared across all application threads and domains.If two threads set the same property on GlobalContext, One Value will override the other.
Log4Net.ThreadContext :- This context scope limited to calling thread. Here two threads can set same property to different values without overriding to each other.
Log4Net.ThreadLogicalContext :- This context behaves similarly to the ThreadContext. if you're working with a custom thread pool algorithm or hosting the CLR, you may find some use for this one.
Add the following code to your program.cs file:
static void Main( string[] args )
{
log4net.Config.XmlConfigurator.Configure();
log4net.ThreadContext.Properties[ "myContext" ] = "Logging from Main";
Log.Info( "this is an info message" );
Console.ReadLine();
}
2) Add the parameter definition for the custom column: