I'm experiencing an issue with log4j ConsoleAppender
:
If I initialize it like this:
ConsoleAppender ca = new ConsoleAppender();
ca.setLayout(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN));
it gives an error and breaks the logging.
Error output:
log4j:ERROR No output stream or file set for the appender named [null].
If I initialize it like this it works fine:
ConsoleAppender ca = new ConsoleAppender(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN));
Has anyone experienced this issue? I can't find it in the Bugzilla repository, but if it effectively was an issue it would be quite evident!
Perhaps I'm looking in the wrong place?
Relevant code:
import org.apache.log4j.*;
public class ConsoleAppenderIssue {
private static Logger logger = Logger.getLogger(ConsoleAppenderIssue.class);
public static void main(String [] args) {
ConsoleAppender ca = new ConsoleAppender();
ca.setLayout(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN));
logger.addAppender(ca);
logger.info("log something");
}
}