loggingjvx

JVx application log configuration war file


I have a test application for JVx application framework and already bundled the application and all dependencies in a war file. The deployment (Tomcat 9) worked without any problems and my application also works.

But how is it possible to enable logging? If found some information about logging here but I don't know how to enable logging in my running application?

Created a logging.properties file with some default settings, e.g.

handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = ALL
.level = SEVERE

Solution

  • Change your war file, add a directory

    WEB-INF/classes

    and put your logging.properties in this directory. It's also possible to create the WEB-INF/classes directory in your existing installation, if re-deployment is not possible.

    Your logging.properties file only logs to console. It's better to use a log file. Use following:

        # only file
        handlers = org.apache.juli.FileHandler
        
        # both, console and file
        #handlers = java.util.logging.ConsoleHandler, org.apache.juli.FileHandler  
        
        # handler configuration
        
        java.util.logging.ConsoleHandler.level = ALL
        java.util.logging.ConsoleHandler.formatter = com.sibvisions.util.log.jdk.JdkLineFormatter
        
        org.apache.juli.FileHandler.level = ALL
        org.apache.juli.FileHandler.directory = ${catalina.base}/logs
        org.apache.juli.FileHandler.limit = 10000
        org.apache.juli.FileHandler.count = 5
        org.apache.juli.FileHandler.formatter = com.sibvisions.util.log.jdk.JdkLineFormatter
        org.apache.juli.FileHandler.prefix = myapp.
        
        .level = SEVERE
        
        # logs persistence
        com.sibvisions.rad.persist.level = ALL