Henrik, > After adding the new level how can you write to it, for > example if i created level "audit"
If you have a logger instance _log then you can write to it using your audiLevel as follows: _log.Logger.Log(this.GetType().FullName, auditLevel, "your message here", null); > i dont have log4net.Audittrail(...) If you want to create your own log4net extension that adds a method like Audit(object) then you should have a look at the example extension in the log4net download that shows how to add a trace level to log4net. Have a look in extensions\net\1.0\log4net.Ext.Trace Cheers, Nicko > > Thanks?? > > Nicko Cadell <[EMAIL PROTECTED]> wrote: > > Henrik, > > You can create a new Level using the Level(int,string) > constructor. As > long as the level is registered with the > LoggerRepository it should be > usable, however you do need to register it before you load the > configuration file otherwise it will not be defined. > You can create a > new level programmatically as follows: > > // Create the new level > log4net.spi.Level level = new log4net.spi.Level(45000, "YYY"); > > // Register with the default LoggerRepository > log4net.LogManager.GetLoggerRepository().LevelMap.Add(level); > > // Configure log4net > log4net.Config.DOMConfigurator.Configure(); > > > Nicko > > > -----Original Message----- > > From: Henrik Johansson [mailto:[EMAIL PROTECTED] > > Sent: 08 August 2004 15:36 > > To: '[email protected]' > > Subject: RE: Adding custom level > > > > Hi, > > > > From an earlier post: > > > > >Nik, > > > > > >There is an example extension in the log4net download that > > shows how to > > >add a trace level to log4net. > > >Have a look in extensions\net\1.0\log4net.Ext.Trace > > > > > >Nicko > > > > But what if I want to add a new level YYY ? It is not > > possible to extend the log4net.spi.Level class (as it is > > sealed)? How should one do ? > > > > Regards, > > > > Henrik > > > > > > > Ran Davidovitz > Web Developer > http://www.verint.com <http://www.verint.com/> >
