日志框架的实时变化,即日起,思维详细框架(4)
2015-12-11 11:02
288 查看
代码下一页(3)章
fw.write(ENTER_CODE);
for (LogConfigBean lc : list) {
writeLogWithModule(fw, lc);
fw.write(ENTER_CODE);
}
} catch (FileNotFoundException e) {
LOG.error("file " + backFile.getAbsolutePath() + " not found \n"
+ e.getMessage());
} catch (IOException e) {
LOG.error("file " + backFile.getAbsolutePath() + " IOException \n"
+ e.getMessage());
} finally {
// 关闭流
if (null != fw) {
try {
fw.close();
} catch (IOException e) {
LOG.error("close file " + backFile.getAbsolutePath()
+ " IO error\n" + e.getMessage());
}
}
}
String log4j = WEB_INF_PATH + LOG4J_PROPERTIES_NAME;
backFile.renameTo(new File(log4j));
}
private void initData(FileWriter fw, String key, String value)
throws IOException {
fw.write(key + "=" + value + ENTER_CODE);
}
private String initPropsData(Properties props, String key,
String defaultValue) {
String value = props.getProperty(key);
value = (value == null || "".equals(value.trim())) ? defaultValue
: value;
return key + "=" + value + ENTER_CODE;
}
fw.write(ENTER_CODE);
for (LogConfigBean lc : list) {
writeLogWithModule(fw, lc);
fw.write(ENTER_CODE);
}
} catch (FileNotFoundException e) {
LOG.error("file " + backFile.getAbsolutePath() + " not found \n"
+ e.getMessage());
} catch (IOException e) {
LOG.error("file " + backFile.getAbsolutePath() + " IOException \n"
+ e.getMessage());
} finally {
// 关闭流
if (null != fw) {
try {
fw.close();
} catch (IOException e) {
LOG.error("close file " + backFile.getAbsolutePath()
+ " IO error\n" + e.getMessage());
}
}
}
String log4j = WEB_INF_PATH + LOG4J_PROPERTIES_NAME;
backFile.renameTo(new File(log4j));
}
private void initData(FileWriter fw, String key, String value)
throws IOException {
fw.write(key + "=" + value + ENTER_CODE);
}
private String initPropsData(Properties props, String key,
String defaultValue) {
String value = props.getProperty(key);
value = (value == null || "".equals(value.trim())) ? defaultValue
: value;
return key + "=" + value + ENTER_CODE;
}
相关文章推荐
- FORM界面批量处理-全选框实现
- HashMap源码分析
- shp与json互转
- Android应用开发之APK版本更新的SDK及API
- 8.storm中不同的流分组方式
- Java IO
- 搭建Hadoop集群中遇到的坑
- JSON使用DateFormatHandling 序列化与反序列化日期设置
- 模拟实现Spring中的注解装配
- 判断一颗二叉树是否对称
- 电脑双显示器主分屏,巨鲨显示器不亮
- webservice引用注意事项
- opencv 读取rgb.txt 并显示出来
- 7.虚拟机搭建Storm"真"分布式环境心的得
- java微信公众号开发总结(3)——调试方法总结(包括本地调试)
- Jenkins Job 自杀 groovy
- JavaScript学习笔记之——js在页面中的位置、语句、符号、注释
- iOS开发之网络编程(一)
- java框架使用场景理解
- React的第一个例子