Change the log4j files

You can set up the rotation of several log files based on the file size by editing the files listed under Log4j files.

In this example, the configuration file is <FILEDRIVEHOME>/conf/tm-log4j.xml. The example uses FILEDRIVEHOME instead of <FILEDRIVEHOME> to represent the SecureTransport installation directory to avoid confustion with the syntactic use of pointed brackets in XML.

Change:

<appender name="ServerLog" class="com.tumbleweed.st.server.logging.DailyRollingFileAppender">
    <param name="File" value=
        " FILEDRIVEHOME/STServer/var/logs/tm.log" />
    <param name="Append" value="true" />
    <param name="DatePattern" value="'.'yyyy-MM-dd" />
    <param name="RotateDirectory" value=
        " FILEDRIVEHOME/STServer/var/db/hist/logs" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d %p [%t] %c - %m%n" />
    </layout>
</appender>

To:

<appender name="ServerLog" class="org.apache.log4j.RollingFileAppender">
    <param name="File" value=
        " FILEDRIVEHOME/STServer/var/logs/tm.log" />
    <param name="MaxFileSize" value="10485760" />
    <param name="Append" value="true" />
    <param name="DatePattern" value="'.'yyyy-MM-dd" />
    <param name=" MaxBackupIndex " value="5" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d %p [%t] %c - %m%n" />
    </layout>
</appender>

You can use any of the log4j file appenders. com.tumbleweed.st.server.logging.DailyRollingFileAppender supports the RotateDirectory parameter. If you use the Apache RollingFileAppender the file rotates into the same directory as the original file with . <n> appended, where <n> is a number up to the MaxBackupIndex value. You need to use another method to move the backup log files from <FILEDRIVEHOME>/var/logs.

Note For another way to manage log file rotation, see Create a Log Entry Maintenance type application.

Related topics:

Related Links