Project

General

Profile

Actions

Bug #26446

closed

User story #26303: Migrate logback.xml to new fixed logfile

Every time webapp starts the logback file gets duplicate XML to configure fixed log file

Added by Clark ANDRIANASOLO about 1 month ago. Updated 28 days ago.

Status:
Released
Priority:
N/A
Category:
Web - Maintenance
Target version:
Severity:
Trivial - no functional impact | cosmetic
UX impact:
User visibility:
Operational - other Techniques | Rudder settings | Plugins
Effort required:
Small
Priority:
0
Name check:
To do
Fix check:
To do
Regression:
No

Description

The parent does not actually take into account that the configuration already exists and adds many lines to the file :

<if condition="property(&quot;run.mode&quot;).equalsIgnoreCase(&quot;production&quot;)">
        <then>
            <appender name="STDOUT" class="ch.qos.logback.core.rolling.RollingFileAppender">
                <file>${WEBAPP_DIR}/webapp.log</file>
                <append>true</append>
                <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                    <fileNamePattern>${WEBAPP_DIR}/webapp-%d{yyyy-MM-dd}.log.gz</fileNamePattern>
                    <maxHistory>30</maxHistory>
                </rollingPolicy>
                <encoder>
                    <pattern>%d{[yyyy-MM-dd HH:mm:ssZ]} %-5level %logger - %msg%n%ex{full}</pattern>
                </encoder>
            </appender>
        </then>
        <else>
            <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
                <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                    <Pattern>%d{[yyyy-MM-dd HH:mm:ssZ]} %-5level %logger - %msg%n%ex{full}</Pattern>
                </encoder>
            </appender>
        </else>
    </if>
    <property value="/var/log/rudder/webapp" name="WEBAPP_DIR"/>
    <if condition="property(&quot;run.mode&quot;).equalsIgnoreCase(&quot;production&quot;)">
        <then>
            <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="STDOUT">
                <file>${WEBAPP_DIR}/webapp.log</file>
                <append>true</append>
                <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                    <fileNamePattern>${WEBAPP_DIR}/webapp-%d{yyyy-MM-dd}.log.gz</fileNamePattern>
                    <maxHistory>30</maxHistory>

                </rollingPolicy>
                <encoder>
                    <pattern>%d{[yyyy-MM-dd HH:mm:ssZ]} %-5level %logger - %msg%n%ex{full}</pattern>
                </encoder>
            </appender>
        </then>
        <else>
            <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
                <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                    <Pattern>%d{[yyyy-MM-dd HH:mm:ssZ]} %-5level %logger - %msg%n%ex{full}</Pattern>
                </encoder>
            </appender>
        </else>
    </if>
    <property value="/var/log/rudder/webapp" name="WEBAPP_DIR"/>
    <if condition="property(&quot;run.mode&quot;).equalsIgnoreCase(&quot;production&quot;)">
        <then>
            <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="STDOUT">
                <file>${WEBAPP_DIR}/webapp.log</file>
                <append>true</append>
                <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                    <fileNamePattern>${WEBAPP_DIR}/webapp-%d{yyyy-MM-dd}.log.gz</fileNamePattern>
                    <maxHistory>30</maxHistory>
                </rollingPolicy>
                <encoder>
                    <pattern>%d{[yyyy-MM-dd HH:mm:ssZ]} %-5level %logger - %msg%n%ex{full}</pattern>
                </encoder>
            </appender>
        </then>
        <else>
            <appender class="ch.qos.logback.core.ConsoleAppender" name="STDOUT">
                <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                    <Pattern>%d{[yyyy-MM-dd HH:mm:ssZ]} %-5level %logger - %msg%n%ex{full}</Pattern>
                </encoder>
            </appender>
        </else>
    </if>
Actions

Also available in: Atom PDF