import java.util.ArrayList;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
hierarchyRootName = hierarchyName;
Logger rootLogger = Logger.getLogger(hierarchyName);
rootLogger.addHandler(logHandler);
+ Handler consoleHandler = new ConsoleHandler();
+ consoleHandler.setLevel(Level.ALL);
+ consoleHandler.setFormatter(new Formatter() {
+ private StringBuffer recordBuffer = new StringBuffer();
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public synchronized String format(LogRecord record) {
+ recordBuffer.setLength(0);
+ recordBuffer.append(new Date(record.getMillis())).append(' ').append(record.getLevel().getName()).append(' ');
+ recordBuffer.append(record.getSourceClassName()).append('.').append(record.getSourceMethodName()).append(' ');
+ recordBuffer.append(record.getMessage());
+ recordBuffer.append("\r\n");
+ return recordBuffer.toString();
+ }
+ });
+ rootLogger.addHandler(consoleHandler);
rootLogger.setUseParentHandlers(false);
rootLogger.setLevel(Level.ALL);
}