Search code examples
tracespringsource-dm-server

Configure trace for SpringServer dm 2


According to the Spring documentation,

By default, the dm Server trace file is called $SERVER_HOME/serviceability/logs/dm-server/log_i.log ... The index i varies from 1 to 4, on a rolling basis, as each log file exceeds 10Mb.

I'm aware that the default trace file name can be changed in server.config. Is it possible to change the number of log files that are kept before rolling over and/or the maximum log file size? How?


Solution

  • Yes. Edit config/servicability.xml and restart the server. The Virgo (donation of dm Server to Eclipse.org) documentation gives some more detail.

    The elements to edit are MaxIndex and MaxFileSize as shown in the extract below:

    <appender name="${applicationName}_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>serviceability/logs/${applicationName}/log.log</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
                    <FileNamePattern>serviceability/logs/${applicationName}/log_%i.log</FileNamePattern>
                    <MinIndex>1</MinIndex>
                    <MaxIndex>4</MaxIndex>
            </rollingPolicy>
            <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
                    <MaxFileSize>10MB</MaxFileSize>
            </triggeringPolicy>
            <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                    <Pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %-28.28thread %-64.64logger{64} %X{medic.eventCode} %msg %ex%n</Pattern>
            </encoder>
    </appender>