Search code examples
javalog4jjava.util.loggingbridge

Initialize VM arguments to the static variable


I am working on the JUL - Log4j 1.x bridge. I was follow this steps https://stackoverflow.com/a/4318607. Everything work fine, when I using VM argument:

-Djava.util.logging.manager=org.apache.logging.julbridge.JULBridgeLogManager

But I can't using VM arguments, it is some way how to set this classpath like static variable? For in exmple in Main.class

Or somehow set java.util.logging.manager (LogManager class) to JULBridgeLogManager


Solution

  • I used in Main class static block and delete VM arguments and that worked well:

    static {
        System.setProperty("java.util.logging.manager", "org.apache.logging.julbridge.JULBridgeLogManager");
    }