How to change timestamp format in Catalina.out

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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.  

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:

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter


The log format in log4j.properties for Jira is:

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:

  1. Take a backup of <JIRA-INSTALL>/conf/logging.properties
  2. Stop Jira
  3. Update <JIRA-INSTALL>/conf/logging.properties as below

    java.util.logging.ConsoleHandler.level = FINE
    java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter

    TO

    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
  4. Start Jira

There is a feature request for the same JRASERVER-69119 - Standardize the Date Format in Catalina.out  


Last modified on Jan 22, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.