Do you want to persist the user's selection to disk so that it is
remembered the next time the application runs? If so you will need to
store that information in a user specific location. The application's
.config file is stored next to the application binary, for example under
the Program Files folder. You should not assume that the user (and
therefore the application running with the user's credentials) has
permission to write to the .config file.

You can treat the application's .config file as the starting point, load
it and then make user specific changes afterwards. You will need store
and load these changes yourself as log4net has no mechanism to export
its configuration. To programmatically change the logging levels you can
do:

log4net.ILog log = log4net.LogManager.GetLogger("my.logger.name");
log4net.Repository.Hierarchy.Logger l =
(log4net.Repository.Hierarchy.Logger)log.Logger;
l.Level = l.Hierarchy.LevelMap["INFO"];

Cheers,
Nicko

> -----Original Message-----
> From: Oded Ouaknine [mailto:[EMAIL PROTECTED] 
> Sent: 15 February 2006 19:47
> To: log4net-user@logging.apache.org
> Subject: Question: Changing Log Settings in run time
> 
> Is there a way to change the log settings after application started?
> 
>  
> 
> Log Settings are loaded from App.Config file.
> 
>  
> 
> I would like to change the log level according to user 
> selection while the application runs.
> 
> So if he selected info and error, I will only output those.
> 
>  
> 
> And then, once he changed that, is there a way to persist his 
> selection without manipulating the XML file myself?
> 
>  
> 
> Thank you
> 
>  
> 
> Oded
> 
> 

Reply via email to