How to change timestamp format in Catalina.out
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
As per the current logging configuration, Catalina.out file will be having two different formats of timestamps like 10-Mar-2021 20:57:39.365 and 2021-03-10 20:57:39,495.
1
2
3
4
5
6
10-Mar-2021 20:57:39.365 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
10-Mar-2021 20:57:39.373 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
10-Mar-2021 20:57:39.387 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 5059 ms
2021-03-10 20:57:39,449+0100 JIRA-Bootstrap INFO [c.a.j.config.database.SystemDatabaseConfigurationLoader] Reading database configuration from /var/atlassian/application-data/jira/dbconfig.xml
2021-03-10 20:57:39,493+0100 JIRA-Bootstrap INFO [c.a.j.config.database.DatabaseConfigHandler] Trying to get encrypted password from xml and decrypt it
2021-03-10 20:57:39,495+0100 JIRA-Bootstrap INFO [c.a.j.config.database.DatabaseConfigHandler] Database password decryption not performed.
The reason is that, there are two sources writing events to catalina.out, Tomcat, and Jira. Tomcat uses the Java Utility Libraries for logging, and Jira uses Log4J. In Tomcat, logging is handled by $jira-insta/conf/logging.properties. The default looks like this:
1
2
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
The log format in log4j.properties for Jira is:
1
2
3
4
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=DEBUG
log4j.appender.console.layout=com.atlassian.logging.log4j.NewLineIndentingFilteringPatternLayout
log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSSZ} %t %p %X{jira.username} %X{jira.request.id} %X{jira.request.assession.id} %X{jira.request.ipaddr} %X{jira.request.url} [%q{2}] %m%n
Solution
The solution is to change the Tomcat default logging to have a similar pattern as Jira:
Take a backup of<JIRA-INSTALL>/conf/logging.properties
Stop Jira
Update<JIRA-INSTALL>/conf/logging.propertiesas below
1 2
java.util.logging.ConsoleHandler.level = FINE java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
TO
1 2 3
java.util.logging.ConsoleHandler.level = FINE java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter org.apache.juli.OneLineFormatter.timeFormat = yyyy-MM-dd HH:mm:ss,SSSZ
Start Jira
There is a feature request for the same JRASERVER-69119 - Standardize the Date Format in Catalina.out
Was this helpful?