You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Steve Wagner <li...@lanwin.de> on 2006/02/01 09:40:16 UTC

Bug using ColoredConsoleAppender in Windows-Service

Hello NG,

the ColoredConsoleAppender has a bug when it used in a windows service. The
Appender accepts some logging entrys and then it runs in a deathlock when a
logmessage is called ( i.e. Log.Warn("xxx") ). 

Ok, you will say "Then, dont use the ColoredConsoleAppender in a windows
service application" but my app can start in console and service mode and i
only want to have one configfile for all. It took me a while to find why
the app run into a deadlock. I dont know it exactly, but i assume the beta8
donsnt had this problem.

In my app i solve the bug on the folowing way:

foreach( log4net.Repository.ILoggerRepository repository in
log4net.LogManager.GetAllRepositories() )
  foreach( log4net.Appender.IAppender appender in new ArrayList(
repository.GetAppenders()) )
{
	if(appender is log4net.Appender.ColoredConsoleAppender||appender is
log4net.Appender.ConsoleAppender)
		appender.Close();
}

Greets 
Steve Wagner