I'd like to programmatically adjust my logging file locations. Thus I want to overwrite the default values in my log4j.properties
file. This is not opposing any problems I am using LogManager.resetConfiguration()
and PropertyConfigurator.configure(props)
so that my file locations are updated (stored in props). This methodology works, logging files are from this point onward written to a new file location.
My problem occurs when using Weld. This is due the fact that Weld internally is using a logger as well, stated in my logging-file: 2014-08-13 12:55:15.589 [main:0] DEBUG Weld.java:84 Method: <clinit> - Logging Provider: org.jboss.logging.Log4jLoggerProvider
.
Since I'm using org.jboss.weld.environment.se.StartMain
as main class, I do not have any influence on the logging capabilities of Weld. I now end up with 3 logging files (as described in my log4j.properties) on 2 different locations. Whereas one contains some Weld debug information and the other contains all the logging information from initialization and onward.
Thus logically I'd like to end up with only 1 directory with logging files, thus that Weld adjusts to the new log4j file location. Or to have log4j to copy the old logging contents, create new logging files + with old content and to delete the old logging files.
I do not want to use VM arguments, since I need to programmatically assign the logging locations.