"log4j2.xml" RollingFileAppender settings to customize TIBCO Spotfire Server logs

"log4j2.xml" RollingFileAppender settings to customize TIBCO Spotfire Server logs

book

Article ID: KB0075309

calendar_today

Updated On:

Products Versions
Spotfire Server 7.9 and higher

Description

Starting Spotfire 7.9 the logging framework was upgraded from Log4j to Log4j2. There are ways to customize the "log4j2" logging as per your requirement.

Here we will discuss about customizing the "server.log" to create a new log everyday. By default the logging is size based.

Issue/Introduction

"log4j2.xml" RollingFileAppender settings to customize TIBCO Spotfire Server logs

Environment

All supported operating systems

Resolution

To set the logging to create new logs everyday perform the settings below:
- Edit "log4j2.xml" located in "<installation folder>tibco\tss\10.3.0\tomcat\spotfire-config"

Default setting:
--------------------
      <RollingFile name="serverlog" fileName="${basedir}/server.log"
                 filePattern="${basedir}/server.log.%i">
      <Policies>
                <SizeBasedTriggeringPolicy size="${serverLogSizePolicy}"/>
      </Policies>
      <DefaultRolloverStrategy max="${serverLogDefaultRollover}" fileIndex="min"/>
                <PatternLayout pattern="${standardLogPattern}"/>
    </RollingFile>
--------------------

Change the "filePattern" and the policies as below and save the file.
----------------------
       <RollingFile name="serverlog" fileName="${basedir}/server.log"
                 filePattern="${basedir}/server.%d{yyyy-MM-dd}.log">
      <Policies>
               <TimeBasedTriggeringPolicy interval="1" modulate="true" />
      </Policies>
      <DefaultRolloverStrategy max="${serverLogDefaultRollover}" fileIndex="min"/>
              <PatternLayout pattern="${standardLogPattern}"/>
    </RollingFile>
----------------------

- Restart the Spotfire server service for the changes to take effect.


NOTE:
1) Backup the log4j2.xml before editing it.
2) Similar settings can be done with other logs as well.
3) The settings need to be re-done in case of a Spotfire Server upgrade
       

Additional Information

https://logging.apache.org/log4j/2.x/manual/configuration.html
https://howtodoinjava.com/log4j2/log4j2-rollingfileappender-example/