• SetLog4j


    //import java.io.BufferedReader;
    import org.apache.log4j.Logger;
    import org.apache.log4j.PropertyConfigurator;
    import com.alibaba.fastjson.JSONObject;
    
    public class SetLog4j {
    	private static final transient Logger log = Logger.getLogger(SetLog4j.class);
    
    	public void loggerError(String message) {
    		PropertyConfigurator.configure("src/log4j.properties");
    		log.error(message);
    	}
    	
    	public void loggerInfo(String string) {
    		PropertyConfigurator.configure("src/log4j.properties");
    		log.info(string);
    	}
    	
    	public void loggerDebug(String message) {
    		PropertyConfigurator.configure("src/log4j.properties");
    		log.debug(message);
    	}
    	
    	public void loggerWarn(String message) {
    		PropertyConfigurator.configure("src/log4j.properties");
    		log.warn(message);
    	}
    
    	public void loggerInfo(boolean message) {
    		// TODO Auto-generated method stub
    		PropertyConfigurator.configure("src/log4j.properties");
    		log.info(message);
    	}
    
    	public void loggerInfo(JSONObject jsonOneNode) {
    		// TODO Auto-generated method stub
    		PropertyConfigurator.configure("src/log4j.properties");
    		log.info(jsonOneNode);
    	}
    
    	public void loggerInfo(int length) {
    		// TODO Auto-generated method stub
    		PropertyConfigurator.configure("src/log4j.properties");
    		log.info(length);
    	}
    
    	public void loggerInfo(net.sf.json.JSONObject jsStr) {
    		// TODO Auto-generated method stub
    		PropertyConfigurator.configure("src/log4j.properties");
    		log.info(jsStr);
    	}
    }
    

      

  • 相关阅读:
    诸暨集训游记
    P2678 跳石头
    P1577 切绳子
    P1328 生活大爆炸版石头剪刀布
    P1067 多项式输出
    分解因数
    【管理篇】团队组织与架构演进方法论
    【状态机】行为状体机和协议状态机
    【数据库】分库分表
    【OLAP】从数仓到Kappa架构
  • 原文地址:https://www.cnblogs.com/by170628/p/8134594.html
Copyright © 2020-2023  润新知