Skip to content

Commit

Permalink
[logger] enable format no NoLookups for log4j
Browse files Browse the repository at this point in the history
  • Loading branch information
truthbk committed Dec 10, 2021
1 parent 9316603 commit ffb04cf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/datadog/jmxfetch/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public class App {
private static final String COLLECTION_POOL_NAME = "jmxfetch-collectionPool";
private static final String RECOVERY_POOL_NAME = "jmxfetch-recoveryPool";

private static final String LOG4J2_FMT_MSG_NOLOOKUPS = "log4j2.formatMsgNoLookups";

private static final ByteArraySearcher CONFIG_TERM_SEARCHER
= new ByteArraySearcher(App.AD_CONFIG_TERM.getBytes());
private static final ByteArraySearcher LEGACY_CONFIG_TERM_SEARCHER
Expand Down Expand Up @@ -143,6 +145,9 @@ public static void main(String[] args) {
// Running these commands here because they are logging specific,
// not needed in dd-java-agent, which calls run directly.

// Nasty but no easy programmatic way to enable behavior otherwise
System.setProperty(LOG4J2_FMT_MSG_NOLOOKUPS, "True");

// Set up the logger to add file handler
CustomLogger.setup(Level.toLevel(config.getLogLevel()),
config.getLogLocation(),
Expand Down

0 comments on commit ffb04cf

Please sign in to comment.