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文件中