/**
* Sets up audit logging to log to a file named based on the current time (in
* ms).
*
* The logger is configured to effectively ignore the log level.
*
* @throws IOException
* if the audit log file could not be opened for writing.
*/
public static void configureAuditLogging() throws IOException {
PatternLayout layout = new PatternLayout(AUDIT_LOG_FORMAT);
// This assumes that no other daemon will be started within 1 millisecond.
String filename = String.format(AUDIT_LOG_FILENAME_FORMAT,
System.currentTimeMillis(), new Random().nextInt(Integer.MAX_VALUE));
FileAppender fileAppender = new FileAppender(layout, filename);
Logger auditLogger = Logger.getLogger(Logging.AUDIT_LOGGER_NAME);
auditLogger.addAppender(fileAppender);
auditLogger.setLevel(Level.ALL);
/*
* We don't want audit messages to be appended to the main appender, which
* is intended for potentially user-facing messages.
*/
auditLogger.setAdditivity(false);
}
Logging.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:eagle
作者:
评论列表
文章目录