Solutions
ForgeRock Identity Platform
Does not apply to Identity Cloud

Customizing Java Log Format to use SimpleFormatter fails in IDM (All versions)

Last updated Apr 8, 2021

The purpose of this article is to provide assistance when customizing the Java® Log Format to use the SimpleFormatter format fails in IDM.


Symptoms

The SimpleFormatter log format does not work in IDM. For example, the following format string in startup.sh does not work:

-Djava.util.logging.SimpleFormatter.format="%4$s: %5$s [%1$tc]%n"

The JVM fails to pick up the new format and continues to write the logs using the default format.

Recent Changes

N/A

Causes

This issue occurs if the format string is specified in the startup.sh file instead of the logging.properties file and the $ symbol is not escaped.

Solution

This issue can be resolved by specifying the format string in the logging.properties file, which applies the SimpleFormatter formatting correctly.

Alternatively, if you want to make changes to the startup.sh file, you must escape the $ symbol using \. For example, you would add the following system property to the java exec line in the startup.sh file:

-Djava.util.logging.SimpleFormatter.format="%4\$s: %5\$s [%1\$tc]%n"

See Also

Monitoring Guide › Configure Server Logs

Java Logging Overview

Class Formatter

Class SimpleFormatter

Related Issue Tracker IDs

N/A


Copyright and Trademarks Copyright © 2021 ForgeRock, all rights reserved.