context = new LoggerContext();
logger = context.getLogger("logger-" + getName());
// A FileAppender is created according to the buffering and
// immediate flush setting of this IO instance.
FileAppender fa = new FileAppender();
if (longMessage) {
PatternLayout pa = new PatternLayout();
pa.setPattern("%r %5p %c [%t] - %m%n");
fa.setLayout(pa);
} else {
fa.setLayout(new EchoLayout());
}
fa.setFile(getName() + ".log");
fa.setAppend(false);
fa.setImmediateFlush(immediateFlush);
fa.setBufferedIO(buffered);
fa.setContext(context);
fa.start();
}