7

I try to manage the internal logs of Tomcat (commons-daemon.log, localhost_access_log, localhost, catalina,...) through slf4j/logback mainly to be able to have a rolling file policy on it.
I put the needed jars in Tomcat lib directory (jul-to-slf4j-1.7.25.jar, logback-classic-1.2.2.jar, logback-core-1.2.2.jar and slf4j-api-1.7.25.jar).
I put a very simple logback.xml in Tomcat lib directory too, just to test :

<?xml version="1.0" encoding="UTF-8"?>
<configuration debug = "true">
    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
        <file>C:/temp/MyLog.log</file>
        <encoder>
            <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
        </encoder>
    </appender>

    <root level="INFO">
    <appender-ref ref="FILE" />
    </root>
</configuration>

In logging.properties, I only put the following line :

handlers = org.slf4j.bridge.SLF4JBridgeHandler

My problem is that the MyLog.log file is created, but it seems to contains only what is normally logged in the localhost.log file.
The commons-daemon.log and localhost_access_log stay in the basic Tomcat logs directory, as before, and the catalina.log, manager.log and host-manager.log arent' there at all.

To be complete, I run my Tomcat as a service and in the Java Options of the service, I have those lines :

-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 8.5.5\conf\logging.properties

I was expecting that all log contents will be in my MyLog.log file.
I guess I miss something, but what ?

Thank you,

Seb

0 Answers0