Issue Type: Bug Bug
Affects Versions: 1.0.13
Assignee: Logback dev list
Components: logback-core
Created: 14/Nov/13 6:13 PM
Description:

If an appender like

public class FooAppender extends AppenderBase<ILoggingEvent>
{
	protected void append(ILoggingEvent eventObject)
	{
	}

	public void start()
	{
		super.start();
		System.out.println("############################################################");
		System.out.println("############################################################");
		System.out.println(""+getName()+" started!");
		System.out.println("############################################################");
		System.out.println("############################################################");
	}
	
	public void stop()
	{
		super.stop();
		System.out.println("############################################################");
		System.out.println("############################################################");
		System.out.println(""+getName()+" stopped!");
		System.out.println("############################################################");
		System.out.println("############################################################");
	}

}

is defined in a logback.xml but never attached to any logger then

LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
loggerContext.reset();

will not execute the stop() call. start(), on the other hand, is executed during configuration.

There are two possible solutions to this problem: either Logback should detect that the appender is unused and never call start() (I guess this would make the most sense) or reset should also call stop() on unattached appenders.

While an unattached appender seems like a misconfiguration there are situations where an appender-ref is temporarily removed without even noticing that it was the last use of the appender. An unattached appender should therefore cause a warning but start()/stop() behavior should be consistent even in that case.

Project: logback
Priority: Major Major
Reporter: Joern Huxhorn
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira