I'm trying to configure logging for a RESTful / jax-rs java app. The app functions correctly, but I can't get logging configured. in my code I have:
private static Logger logger = Logger.getLogger(Foo.class);
static
{
PropertyConfigurator.configure("log4j.properties");
}
and i have put the usual log4j.properties in WebContent/WEB-INF/, but when I start tomcat with this app, I get in catalina.out:
log4j:ERROR Could not read configuration file [log4j.properties].
java.io.FileNotFoundException: log4j.properties (No such file or directory)
where else can i possibly put the file? sorry if this is a n00b question, but this has been stumping me for a while.
Put it with your application code under /WEB-INF/classes, log4j expects to find it in the classpath. And you don't need to call the configurator, that happens automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With