Wrong log4j.xml used
It appears log4j loads the log4j.xml embedded in nuxeo-launcher.jar as opposed to the one in lib/. Is this the intended behavior? It makes lib/log4j.xml essentially useless. A workaround is to use -Dlog4j.configuration to directly reference lib/log4j.xml.
You can easily check this by adding -Dlog4j.debug as property to the launching JVM (in nuxeoctl).
(this is with latest published 5.7-SNAPSHOT).
Hello,
Are you sure you have an issue?
Instead of editing nuxeoctl, please add the following to nuxeo.conf: JAVA_OPTS=$JAVA_OPTS -Dlog4j.debug
. Then run ./bin/nuxeoctl console
in order to see the server's Log4J initialization.
I activated log4j.debug on the Launcher (in nuxeoctl script) and on Nuxeo (in nuxeo.conf):
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@24ee5d13.
log4j: Using URL [jar:file:/home/julien/.../nuxeo-cap-5.7-SNAPSHOT-tomcat/tmp/nuxeo-launcher-22833.jar!/log4j.xml] for automatic log4j configuration.
Detected Tomcat server.
(...)
Configuration files generated.
log4j: Trying to find [log4j.xml] using context classloader org.apache.catalina.loader.StandardClassLoader@79e4620e
log4j: Using URL [file:/home/julien/.../nuxeo-cap-5.7-SNAPSHOT-tomcat/lib/log4j.xml] for automatic log4j configuration.
It uses the right log4j configuration for each.
As the issue I was trying to troubleshoot happens during the launching process modifying lib/log4j.xml was ineffective (as as expected the one bundled in nuxeo-launcher.jar is picked up).
May I ask why you chose this option? Seems like it could be valuable to change logging configuration for the launching JVM too.
Finally, if you need more customization, you can still use the -Dlog4j.configuration parameter or directly edit nuxeo-launcher.jar.
It works for me, using a snapshot from Friday I get:
>Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@efae3b.
>Using URL [jar:file:/var/lib/openshift/…/app-root/runtime/repo/bin/nuxeo-cap-5.7-I20130322_1136-tomcat/tmp/nuxeo-launcher-22340.jar!/log4j.xml] for automatic log4j configuration.
What's strange is that log4j tries to load the conf using a different ClassLoader than in your case..
Is the log4j.xml file from nuxeo-launcher.jar used in some way? I could remove it if not.
The workaround with log4j.configuration is valid. However, I'd like to understand why you don't have the same classloader in your case (the org.apache.catalina.loader.StandardClassLoader will preferably load the lib/log4j.xml one).
I can reproduce exact same behavior on an OpenShift node and my local MacOSX env using 5.7-SNAPSHOT and latest 5.6 (HF13).
Do you have any idea how I could debug that?