/** 设置配置路径从环境变量读取
    * PropertyConfigurator类加载.properties文件的配置
    * DOMConfigurator加载.xml文件的配置
    */

public class LogInfo {
    static {
        try {
            PropertyConfigurator.configure(new FileInputStream("D:\\code\\first\\Log4JProject\\config\\log4j.properties"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
    private static Logger logger=Logger.getLogger(LogInfo.class);
    public static void LogInformation(String info) {
        logger.info(info);
        logger.debug(info);
        logger.error(info);
    }
}

相关文章:

  • 2022-02-08
  • 2022-01-24
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
  • 2022-01-30
  • 2021-11-13
猜你喜欢
  • 2022-12-23
  • 2021-04-23
  • 2022-12-23
  • 2021-08-13
  • 2021-12-01
  • 2022-12-23
相关资源
相似解决方案