摘要 腾兴网为您分享:linux下相对路径加载Log4j配置文件,中国搜索,掌上看家,杂志迷,悦作业等软件知识,以及office简体,好分数登录,3dsmax,拼多多果园,坦克之王,快装商店,视联网,adguard,网速测试大师,众筹客,高端出租,排班app,客房软件,国庆节快乐图片,圣诞雪景等软件it资讯,欢迎关注腾兴网。使用相对路径加载log4j配置文件。 例子: 复制代码 代码示例: URL url = UserServiceImpl. class .getResource( /config/log4j.properties ); Properties properties = new Properties(); try { properties.load( new InputStreamRea...
使用相对路径加载log4j配置文件。
例子:
复制代码 代码示例:
URL url = UserServiceImpl. class .getResource( " /config/log4j.properties " );
Properties properties = new Properties();
try {
properties.load( new InputStreamReader(url.openStream()));
} catch (IOException e) {
e.printStackTrace();
}
PropertyConfigurator.configure(properties);
说明:
/config/log4j.properties
可以放在对应的jar文件中。
相关推荐