views:

79

answers:

1

Hi,

I've realised that there is more levels than all, debug, info, warn, error and fatal, they are listed in the log4net.Core.Level class.

But how can I use them? I mean, in the ILog interface you have methods to use the usual ones, but what if you want to use "Fine" or "Emergency", etc?

Cheers.

+4  A: 

In the following example Log is of type ILog.

Log.Logger.Log(null, log4net.Core.Level.Emergency, "Help!", null);

For each level you check their Value in order to know when they are disabled.

For log4net version 1.2.10.0 you have the following levels and associated cut off values:

OFF: 2147483647
EMERGENCY: 120000
FATAL: 110000
ALERT: 100000
CRITICAL: 90000
SEVERE: 80000
ERROR: 70000
WARN: 60000
NOTICE: 50000
INFO: 40000
DEBUG: 30000
FINE: 30000
TRACE: 20000
FINER: 20000
VERBOSE: 10000
FINEST: 10000
ALL: -2147483648

Note that some levels share the same values so disabling one of them will also disable the other, like for example TRACE and FINER.

João Angelo
I must be blind or something, I didn't see that property haha.And can I use those levels also in the configuration file writing them capitalized?Cheers.
vtortola
@vtortola, yes you can use those levels in the configuration.
João Angelo
awesome thank u
vtortola