您的位置:首页 > 其它

日志框架的实时变化,即日起,思维详细框架(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;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: