Excellent
Hopefully I'll have a couple appenders to contribute back after working with them for a while.
Thank you much.
Rich
Ron Grabowski <[EMAIL PROTECTED]> wrote:
Ron Grabowski <[EMAIL PROTECTED]> wrote:
Log4net has built-in support for the following levels:
EMERGENCY
FATAL
ALERT
CRITICAL
SEVERE
ERROR
WARN
NOTICE
INFO
DEBUG
FINE
TRACE
FINER
VERBOSE
FINEST
Here's a quick and dirty way to send a message with one of those
levels:
log.Logger.Log(GetType(), Level.Notice, "Hello World", null);
A better way you be to create your own ILog and LogManager that expose
the additional levels. Here's an example:
http://tinyurl.com/ry2c3
http://svn.apache.org/viewvc/logging/log4net/trunk/extensions/net/1.0/log4net.Ext.Trace/cs/src/
You don't need to implement all the methods on the LogManager class.
GetLogger(Type) and GetLogger(string) should be good enough. In other
words:
private readonly static Company.Logging.ILog log =
Company.Logging.LogManager.GetLogger(typeof(Class1));
if (log.IsAuditEnabled)
{
log.Audit("Hello World");
}
Its also possible to define new levels in code as well as in an XML
config file:
// untested
ILoggerRepository repository = LogManager.GetRepository();
int betweenDebugAndInfo = (Level.Debug.Value + Level.Info.Value) / 2;
repository.LevelMap.Add(new Level(betweenDebugAndInfo, "AUDIT"));
--- Richard Collette <[EMAIL PROTECTED]>wrote:
> Hi,
>
> I need a logging level that is between Info and Debug. For
> example, I
> have a process that runs and I need to log the details of the process
> using Info
> (ex. What records were updated for Sarbanes Oxley requirements).
> However, I
> also need to log summary information such as how many records were
> updated,
> how many of a particular action were taken during that run, etc.
> The summary
> information would be emailed or stored separately but I do not want
> to
> include the detailed info entries in that email.
>
> The LevelMap property of the LoggerReporitory seems to provide a
> place
> where additional Levels could be mapped, but the ILog interface
> doesn't provide
> specific methods or a generic Log(lvl as Level, message) method.
>
> How can I used the additional levels like FINE, FINER, Trace etc.
> when ILog
> does not provide a way to create a logentry at those levels?
>
> The only other thing I can think of is to create a separate logger
> prefixing my type names with "Application." which would allow me to
> potentially use warn to log summary information and info to log
> detail information. It seems more obtrusive this way through both in
> code and configuration.
>
> Why doesn't ILog support a method like log(lvl as Level, message)?
> Wouldn't this provide more flexibility?
>
> Much appreciated,
> Rich
>
>
Richard P. Collette
Certified Lotus Notes Principal Developer
Certified Lotus Notes Principal Developer
