zoukankan      html  css  js  c++  java
  • 日志框架的实时变化,即日起,思维详细框架(4)

    代码下一页(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 "
    + e.getMessage());
    } catch (IOException e) {
    LOG.error("file " + backFile.getAbsolutePath() + " IOException "
    + e.getMessage());
    } finally {
    // 关闭流
    if (null != fw) {
    try {
    fw.close();
    } catch (IOException e) {
    LOG.error("close file " + backFile.getAbsolutePath()
    + " IO error " + 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;
    }


  • 相关阅读:
    Python_反射
    Python_面向对象_类2
    Python_面向对象_类1
    Python_logging模块
    Python_子进程管理subprocess模块
    Python_python内置加密模块
    Python_configparser模块
    Python_xml
    Python_shelve模块
    Python_shutil模块
  • 原文地址:https://www.cnblogs.com/gcczhongduan/p/5038364.html
Copyright © 2011-2022 走看看