use of org.apache.ignite.logger.java.JavaLoggerFormatter in project ignite by apache.
the class CommandHandler method setupJavaLogger.
/**
* @return prepared JULs logger.
*/
private Logger setupJavaLogger() {
Logger result = initLogger(CommandHandler.class.getName() + "Log");
// Adding logging to file.
try {
String absPathPattern = new File(JavaLoggerFileHandler.logDirectory(U.defaultWorkDirectory()), "control-utility-%g.log").getAbsolutePath();
FileHandler fileHandler = new FileHandler(absPathPattern, 5 * 1024 * 1024, 5);
fileHandler.setFormatter(new JavaLoggerFormatter());
result.addHandler(fileHandler);
} catch (Exception e) {
System.out.println("Failed to configure logging to file");
}
// Adding logging to console.
result.addHandler(setupStreamHandler());
return result;
}
Aggregations