Additional log files other than App.Log

I’ve been looking into the logging of the application and it appears everything goes into the App.log file. We are using Apache Camel inside of Cuba for integration purposes and we were hoping that we could have a separate log file related just to integration to help separate concerns. Is there a way that I can specify a different log file for different sources? Thanks.

Hi,
The platform uses logback library as a backend of slf4j logging library. You can customize tomcat/conf/logback.xml file in your local deployment or in a production environment using the following JVM argument (it should be set in tomcat script or in CATALINA_OPTS):

-Dlogback.configurationFile=../conf/logback.xml

In this file you can split your loggers by multiple files using logback appender-ref parameter. For instance, we could move com.haulmont.cuba logs to a separate file cuba-platform.log using this appender and logger settings:

...   
    <appender name="PLATFORM-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${logDir}/cuba-platform.log</file>

        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>DEBUG</level>
        </filter>

        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- daily rollover -->
            <fileNamePattern>${logDir}/cuba-platform.%d{yyyy-MM-dd}.log</fileNamePattern>
            <!-- keep 30 days' worth of history -->
            <maxHistory>30</maxHistory>
            <cleanHistoryOnStart>true</cleanHistoryOnStart>
        </rollingPolicy>

        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level &#91;%thread%X{cubaApp}%X{cubaUser}&#93; %logger - %msg%n</pattern>
        </encoder>
    </appender>

...

    <!-- additivity=false ensures logs only goes to the cuba-platform log -->
    <logger name="com.haulmont.cuba" level="DEBUG" additivity="false">
        <appender-ref ref="PLATFORM-FILE"/> <!-- Log CUBA to separate file -->
    </logger>

logback.xml (5.6K)