@SuppressLint("SimpleDateFormat")
protected FileHandler createHandler(String finalPath) throws IOException {
FileHandler h = new FileHandler(finalPath, MAX_SIZE, 3, true);
final DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
final String sep = System.getProperty("line.separator");
h.setFormatter(new Formatter() {
@Override
public String format(LogRecord r) {
String date = format.format(new Date(r.getMillis()));
return String.format(Locale.US, "%s [%s]: (%d) %s%s", date, r.getLevel(), r.getThreadID(), r.getMessage(), sep);
}
});
h.setLevel(Level.ALL);
return h;
}
LocalFileHandler.java 文件源码
java
阅读 39
收藏 0
点赞 0
评论 0
项目:enviroCar-app
作者:
评论列表
文章目录