Follow

service.log and jms.log growth in Windows

In Windows it is possible to immediately truncate a large Traverse log file by overwriting it with a zero length file.  For example, to create such a file and truncate 'service.log':

cd TRAVERSE_HOME\logs
copy NUL empty.txt
copy empty.txt service.log

 

The following instructions provide an interim solution for Windows users where service.log and jms.log growth continues. These instructions will change the 'jms.log' and 'service.log' files to rotate every hour and maintain 24 copies and subsequently their names will include the time.  Once the files with the new naming convention appear,  kindly remove the files without the timestamps in their names (service.log and jms.log).

As a precaution, please back up the original file <TRAVERSE_HOME>\etc\logback.xml before proceeding through these steps.

-For jms.log, find the following lines:

<!-- appender to record activity related to jms clients -->
<appender name="FILEjms" class="ch.qos.logback.core.rolling.RollingFileAppender">
  <File>${LOGDIR}/jms.log</File>
  <encoder>
    <pattern>%d{ISO8601} %c{2}[%t]: \(%p\) %m%n</pattern>
  </encoder>
  <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
    <level>${LOGLEVEL}</level>
  </filter>
  <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
    <maxIndex>2</maxIndex>
    <FileNamePattern>${LOGDIR}/jms.log.%i</FileNamePattern>
  </rollingPolicy>
  <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
    <MaxFileSize>10MB</MaxFileSize>
  </triggeringPolicy>
</appender>



-Replace those lines with the following:

<!-- appender to record activity related to jms clients -->
<appender name="FILEjms" class="ch.qos.logback.core.rolling.RollingFileAppender">
  <encoder>
    <pattern>%d{ISO8601} %c{2}[%t]: \(%p\) %m%n</pattern>
  </encoder>
  <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
    <level>${LOGLEVEL}</level>
  </filter>
  <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <FileNamePattern>${LOGDIR}/jms-%d{yyyy-MM-dd-HH}.log</FileNamePattern>
    <maxHistory>24</maxHistory> 
  </rollingPolicy>
</appender>

 

-For service.log, find the following lines

<!-- appender to record activity at backend web service/database layer -->
<appender name="FILEservice" class="ch.qos.logback.core.rolling.RollingFileAppender">
  <File>${LOGDIR}/service.log</File>
  <encoder>
    <pattern>${LOGPATTERN}</pattern>
  </encoder>
  <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
    <level>${LOGLEVEL}</level>
  </filter>
  <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
    <maxIndex>2</maxIndex>
    <FileNamePattern>${LOGDIR}/service.log.%i</FileNamePattern>
  </rollingPolicy>
  <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
    <MaxFileSize>10MB</MaxFileSize>
  </triggeringPolicy>
</appender>

 

-Replace those lines with the following:

<!-- appender to record activity at backend web service/database layer -->
<appender name="FILEservice" class="ch.qos.logback.core.rolling.RollingFileAppender">
  <encoder>
    <pattern>${LOGPATTERN}</pattern>
  </encoder>
  <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
    <level>${LOGLEVEL}</level>
  </filter>
  <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <FileNamePattern>${LOGDIR}/service-%d{yyyy-MM-dd-HH}.log</FileNamePattern>
    <maxHistory>24</maxHistory>
  </rollingPolicy>
</appender>

Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    Bill Leinauer

    Just removed 14GB+ with the copy command.

     

    Is there a reason why the settings are at 7 days to begin with in the xml?  Also an update to the file will be over written with upgrades.

     

    Can this be added to the next patch so that the service log only gets saved for 7 days like the other logs?

  • 0
    Avatar
    Ben Smeele

    Just an FYI the info above states it will make a new file every hour and then only keep maxHistory (7 copies) so its 7 hours of logs not days. If you want to change this you need to change the FileNamePattern and take the -HH off of it so that it will creat a file every day and then set macHistory to the number of days you want.

     

    Agree with last comment I just removed 55gb of service log from my system. Would be nice to see this a bit cleaner in the next patch or a way to have it so certain files like these are not overwritten.

Article is closed for comments.