I have a JEE, servlet-based application that I have deployed to OpenShift. I am using java.util.logging.
I would like to be able to change the logging level at runtime.
Originally, I thought I could just change the logging.properties file, and the change would be reflected in the logs. But I tried that on local machine, and it did not work. I needed to set up a scheduled task to read the configuration every 10 seconds or so. After that, on my local machine, I could then see the logging levels reflect my change at runtime.
However, that does not work when deployed to OpenShift. I have verified that the scheduled task runs every 10 seconds, reading the configuration with no IOExceptions reported, but the changed logging levels are not reflected in the logs. The logs in question are
- ./app-root/logs/jbossews.log
- ./jbossews/logs/com.haxwell.apps.questions.20YY-MM-DD.log.
Both have identical information logged to them.
To confuse matters, there are several copies of the logging.properties file. First, there is my "Project" logging.properties that I created, and there is the "OpenShift" logging.properties. As a test, I have set various log levels in both files, and deployed them, in order to verify that it is my "Project" logging.properties file controlling the log output.
However, which "Project" logging.properties file is it? Consider the following output:
[ OPENSHIFT_HOME_DIR\ ]\> md5sum 'find . -name logging.properties' | sort
...
926a349aa90021e91868e9b53fcae1da ./jbossews/template/.openshift/config/logging.properties
ba14a684dcddbd436b28d405a461fdb0 ./app-deployments/.../src/main/webapp/WEB-INF/classes/logging.properties
ba14a684dcddbd436b28d405a461fdb0 ./app-deployments/.../target/quizki/WEB-INF/classes/logging.properties
ba14a684dcddbd436b28d405a461fdb0 ./app-root/runtime/repo/src/main/webapp/WEB-INF/classes/logging.properties
ba14a684dcddbd436b28d405a461fdb0 ./app-root/runtime/repo/target/quizki/WEB-INF/classes/logging.properties
ba14a684dcddbd436b28d405a461fdb0 ./jbossews/work/Catalina/localhost/_/WEB-INF/classes/logging.properties
d420b80678109ed2aa9ec47177d28d79 ./app-deployments/.../repo/.openshift/config/logging.properties
d420b80678109ed2aa9ec47177d28d79 ./app-root/runtime/repo/.openshift/config/logging.properties
d420b80678109ed2aa9ec47177d28d79 ./jbossews/conf/logging.properties
There are five copies of the "Project" logging.properties file.
I have made identical changes to each of them, at the same time, yet none of them seem to be the file read when the scheduled task executes LogManager.readConfiguration().
So, to summarize, I have a JEE app running in Tomcat. There is a scheduled task which executes every 10 seconds, calling java.util.logging.LogManager.readConfiguration(). I expect that if I change the ./WEB-INF/classes/logging.properties file, no more than 11 seconds later, I should see that change reflected in what is logged to the output logs.
This works as expected on my local machine. It does not work on OpenShift.
Can anyone tell me how I can change my java.util.logging levels at runtime on OpenShift?
Thank you in advance.