logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Francisco" <a...@recombulator.net>
Subject RE: How to use a custom level in logger interface...
Date Wed, 08 Apr 2015 13:28:41 GMT
You'll want to use:
	Log.Logger.Log(..., level, ...)

I had to dig around to find this because the documentation doesn't readily
expose that inherited methods and properties. (Been spoiled by MSDN
documentation, I suppose.) ILog derives from ILogWrapper that exposes the
Logger property. The Logger property is an ILogger that has the Log() method
that takes the level value.

- Ants

-----Original Message-----
From: Brown, Michael A [mailto:mab@purdue.edu] 
Sent: Tuesday, 07 April, 2015 22:57
To: Log4NET User
Subject: RE: How to use a custom level in logger interface...

Been a while since I've looked at this, but I think there is a Log()
function which takes a level parameter in addition to the parameters you'd
pass to Error(). Error() and related methods are just wrappers for Log()
that add the appropriate level parameter. So try using Log() and passing in
your custom level.
From: karlkras [karlkras@yahoo.com]
Sent: Tuesday, April 07, 2015 19:13
To: log4net-user@logging.apache.org
Subject: How to use a custom level in logger interface...

So I've found a sample that states to add a custom level to the log4net xml
configuration as such:
                <name value="AUDIT" />
                <value value="80000" />

and I'm guessing I can define my logger to use it like this:

                <logger name="RollingFile" additivity="False">
                        <level value="AUDIT"/>

in in the C# code, how do I specify to call the logger to call the logger
with the "AUDIT" level? e.g., for an Error level message I perform an
log4net.ILog.Error(...) call.

what do I do for the custom level since this support isn't built in, i.e.,
how/where do I inject the handlers for interact with the log4net process?


View this message in context:
Sent from the Log4net - Users mailing list archive at Nabble.com.

View raw message