spring-bootlogbackglassfish-4java.util.loggingpayara

Deploying a logback enabled spring boot app to Glassfish 4/Payara generates gigs of logging


When I attempt to deploy a Spring Boot app to Payara (Glassfish 4) I'm getting huge logs that eventually use up all my disk space.

The logging seem to be in some sort of recursive loop like this (see below).

Although I can get a deploy working by turning off logging for unknown.jul.logger I'd rather not have it attempt to log in the first place. Also shown is the logback config.

Any ideas as to what might be going on here ?

Some more info:

It's SLF4JBridgeHandler that's defining the unknown.jul.logger.

15:29:50.448000 INFO 1296 --- [ing output pump] unknown.jul.logger : 2017-01-24 15:29:50.421000 INFO 1296 --- [ing output pump] unknown.jul.logger : 2017-01-24 15:29:50.399000 INFO 1296 --- [ing output pump] unknown.jul.logger : 2017-01-24 15:29:50.378000 INFO 1296 --- [ing output pump] unknown.jul.logger : 2017-01-24 15:29:50.350000 INFO 1296 --- [ing output pump] unknown.jul.logger : 2017-01-24 15:29:50.328000 INFO 1296 --- [ing output pump] unknown.jul.logger : 2017-01-24 15:29:50.307000 INFO 1296 --- [ing output pump] unknown.jul.logger : 2017-01-24

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
    <!-- Defined variables etc. -->
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>

    <!-- overridden two properties -->
    <property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}000){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%logger){cyan} %clr(:){faint} %m%n%wex"/>
    <property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS}000 %5p ${PID:- } --- [%t] %logger : %m%n%wex"/>

    <!--  copied from base.xml -->
    <property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}spring.log}"/>
    <include resource="org/springframework/boot/logging/logback/console-appender.xml" />
    <jmxConfigurator/>

    <appender name="FILE"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <encoder>
            <pattern>${FILE_LOG_PATTERN}</pattern>
        </encoder>
        <file>${LOG_FILE}</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_FILE}.%d</fileNamePattern>
        </rollingPolicy>
    </appender>

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

Solution

  • Confirmed that this is caused by the following:

    This is caused by Payara highjacking console output and redirecting to a logger, which the logging bridges that Spring Boot supplies as dependencies will then pipe out to whatever unified logger you pick (e.g. logback). If logback is configured to log to the console it goes into a cycle of never ending logging.

    The solution is to make sure logback doesn't log to the console.