Currently it is not possible to set arbitrary properties from the log4net config file. You will need to load this flag yourself probably from the your application's .config file.
I will raise this as an issue on the dev list. So we may make some progress on this. Cheers, Nicko > -----Original Message----- > From: news [mailto:[EMAIL PROTECTED] On Behalf Of Blake Bishop > Sent: 18 October 2005 23:41 > To: log4net-user@logging.apache.org > Subject: Custom global param > > Hi all, > > Does the log4net framework support custom parameters that I > can retrieve in code? Basically, I would like to set a > property called "VERBOSITY" in the log4net config file that I > could retrieve in code and use to manipulate my messages that > get sent to the logger. When this value is "ON" I would > append stack trace info to messages, regardless of the log > level I will log the message at. I've seen a couple of > threads about people adding log levels by rolling their own > extensions, but I'd like to know if there is another way. > Here is a basic example of what I'm trying to accomplish: > > <log4net> > <!-- Custom parameter that can be read by my application --> > <param name="VERBOSITY" value="ON" /> > > <root>...</root> > <logger>...</logger> > ... > </log4net> > > ------------------------- > > class MyClass { > internal static log4net.ILog log = > log4net.LogManager.GetLogger("TestLogging"); > internal static bool isDebug = log.IsDebugEnabled; > internal static bool isVerbose = ??????? // > > public void MyMethod(){ > > // some code in some method that throws an exception > try { //some code to try } > catch (MyException ex) { > string messageString = ex.Message; > if(isVerbose) { > // code that extracts the stack trace > } > > // I could use log.Warn() or log.Info() or whatever -- > verbose-independent > log.Error(messageString); > } > } > } > > Thanks in advance, > Blake > > > > >