Date Posted:
Product: TIBCO Spotfire®
Product: TIBCO Spotfire®
Problem:
"log4j2.xml" RollingFileAppender settings to customize sql.log in TIBCO Spotfire server
Solution:
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. The below article describes about customizing "sql.log" to create a new log everyday. By default the logging policy is size based.
Default setting:
--------------------
<RollingFile name="sqllog" fileName="${basedir}/server.log"
filePattern="${basedir}/sql.log.%i">
<Policies>
<SizeBasedTriggeringPolicy size="${sqlLogSizePolicy}"/>
</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) The settings need to be re-done in case of a Spotfire Server upgrade
https://logging.apache.org/log4j/2.x/manual/configuration.htmlhttps://howtodoinjava.com/log4j2/log4j2-rollingfileappender-example/
Comments
0 comments
Article is closed for comments.