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);
#endregion

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


--
Walden H Leverich III
Tech Software &
BEC - IRBManager
(516) 627-3800 x3051
WaldenL@TechSoftInc.com<mailto:WaldenL@TechSoftInc.com>
http://www.TechSoftInc.com<https://urldefense.proofpoint.com/v1/url?u=http://www.techsoftinc.com/&k=WP1bMHVseboJL1xhlI0uEw%3D%3D%0A&r=GnLiemISRMhJdRORs%2BauZA%3D%3D%0A&m=thWPQY36Sv%2FJ%2BviYqaY0wBRwadUK8MONZjrQLZheC1M%3D%0A&s=2b03463412bd480492a2b8a923359ef028507388a594a90ebaedaf2912a34618>
http://www.IRBManager.com<https://urldefense.proofpoint.com/v1/url?u=http://www.irbmanager.com/&k=WP1bMHVseboJL1xhlI0uEw%3D%3D%0A&r=GnLiemISRMhJdRORs%2BauZA%3D%3D%0A&m=thWPQY36Sv%2FJ%2BviYqaY0wBRwadUK8MONZjrQLZheC1M%3D%0A&s=b473038fbeaca73729c1fba0ddd743b4adcbb988d7e53ce22e0ef5423630cf63>

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

Mime
View raw message