search cancel

CDD Plugin Logs : How to configure log size or number of logs kept

book

Article ID: 215139

calendar_today

Updated On:

Products

Continuous Delivery Director

Issue/Introduction

The Jenkins plugin logs are rotating very quickly. The log file, and those stored in the archived sub folder, are rolling over every hour. How can we increase the number of logs kept and/or the size of the logs? 

 

Environment

Release : 8.0.0

Component : CONTINUOUS DELIVERY DIRECTOR

 

Resolution

At this time, this cannot be configured via the settings.properties file as described in the Working with Log Files product documentation. 

If changing the log file size or rotation is absolutely necessary then these settings can be found in: <tomcat_home>/webapps/<plugin-name-folder>/WEB-INF/classes/logback.xml

Note: Tomcat will need to be stopped and started after making changes to the plugin's logback.xml. 

 

logback.xml example:

In <tomcat_home>/webapps/cdd-jenkins-plugin/WEB-INF/classes/logback.xml, the minIndex, maxIndex and maxFileSize properties are shown below:

    <appender name="FILE-LOG"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_HOME}/cdd_jenkins_plugin.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <!-- rollover daily -->
            <fileNamePattern>${LOG_HOME}/archived/cdd_jenkins_plugin.%i.log</fileNamePattern>
            <minIndex>1</minIndex>
            <maxIndex>2</maxIndex>
        </rollingPolicy>
        <triggeringPolicy
                class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <maxFileSize>100MB</maxFileSize>
        </triggeringPolicy >
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <Pattern>
                %d{yyyy-MM-dd HH:mm:ss} [jenkins] [%thread] [%X{tenantId}] %-5level %logger{36} - %msg%n
            </Pattern>
        </encoder>
    </appender>