logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Walden H. Leverich" <Wald...@TechSoftInc.com>
Subject RE: Two logs have the same appenders
Date Mon, 06 Oct 2014 18:37:00 GMT
> then in the code:
>ILog logger1 = log4net.LogManager.GetLogger(typeof(classname));
>ILog logger2 = log4net.LogManager.GetLogger(typeof(classname).FullName + ".sepcial");

The only thing I'd add here is the question of whether you put the differentiator "special"
at the end or the beginning. It's really a matter of being able to turn the logging on or
off in bulk.

We do the same thing, but at the beginning:

#region log4net
static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
static readonly log4net.ILog verbose = log4net.LogManager.GetLogger("Verbose." + log.Logger.Name);

This way we can turn on/off all "Verbose" logging with one config setting. Of course then
we can't turn off all logging for a given class in one shot. Just something to keep in mind,
not a "right" answer one way or the other.


Walden H Leverich III
Tech Software &
BEC - IRBManager
(516) 627-3800 x3051

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)

View raw message