3

I have been trying to put a limit over the size of each log file and even cleaning up if it is older than some specified period as below (I have pasted a small piece).

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
    <!-- Properties -->
    <property name="log.pattern" value="%date %-5level %logger{0} - %message%n"/>
    <property name="log.history" value="7"/>
    <property name="log.folder" value="D:/Tridion/logs/httpupload"/>
    <property name="log.level" value="DEBUG"/>

    <!-- Appenders -->
    <appender name="rollingTransportLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.folder}/cd_transport.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>${log.history}</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <prudent>true</prudent>
    </appender>
    <appender name="rollingDeployerLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.folder}/cd_deployer.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>${log.history}</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <prudent>true</prudent>
    </appender>
</configuration>

Nothing is happening and most importantly cleaning should happen as logs folder is eating huge space on server. Am i doing it in right way?

  • This has already been asked and answered here: tridion.stackexchange.com/questions/253/… – Peter Kjaer Dec 5 '13 at 9:18
  • It doesn't provide an answer for max history – Tridion DEV Dec 5 '13 at 9:24
  • Raúl's answer has both file size and max number of files in it. – Peter Kjaer Dec 5 '13 at 10:37
  • Perhaps irrelevant... but you may want to reconsider using "DEBUG" level, as that indeed will use a lot of disk space (you may have a solid reason to do this, hence my "perhaps irrelevant" comment) – Nuno Linhares Dec 11 '13 at 11:11
2

Add %i in the file name pattern as below.

${log.folder}/cd_deployer.%d{yyyy-MM-dd}.%i.log

We have configured FixedWindowRollingPolicy as below which is working and keeps only 5 files and of max size limit as 50MB.

<appender name="rollingTransportLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${log.folder}/cd_transport.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <fileNamePattern>${log.folder}/cd_transport.%i.log</fileNamePattern>
            <minIndex>1</minIndex>
            <maxIndex>5</maxIndex>
            </rollingPolicy>
            <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
      <maxFileSize>50MB</maxFileSize>
    </triggeringPolicy>
         <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
<prudent>false</prudent>
    </appender>

More details about Logback appenders can be found here. Hope this helps.

2

There are some known issues with Logback which SDL Tridion is using behind the scene for logging. Also, there may be some scenarios where your log history might not get deleted.

You may want to refer below links for further details and scenarios to understand it:

LOGBACK-162

LBCORE-147_1

LBCORE-147_2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.