LocalFileHandler.java 文件源码

java
阅读 39 收藏 0 点赞 0 评论 0

项目:enviroCar-app 作者:
@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;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号