javaspringjvmwas

log4j2 Web Lookup not working for IBM WAS9 JVM Custom Property


We have Spring java-based web applications which use log4j2.xml for logging messages to files, etc.

We now need to update our log4j2.xml configs in order to be able to do a ${a.b.c} web lookup inside them so that we can use a JVM custom property value as part of the log file's name which the loggers log messages to. "a.b.c" is a JVM custom property name in IBM WAS9.0. However, when we deploy the apps, the log4j2 configurations fail to recognize any web lookup related stuff. The file created to log messages to is simply created with the name ${a.b.c} and no messages are actually logged in them. I have log4j-api, log4j-core, log4j-web in pom.xml.

I have read various docs online related to log4j2 web lookups when running in 3.0 servlets but I still can't see what the problem might be in our configurations. And I don't know what to look for in the log4j's trace logs in order to see what it is that we are missing.

Our Stack:

Spring 4.3.x Solaris Java 8 IBM WAS9.0 log4j-2.17.0 (log4j-api, log4j-core, log4j-web all in classpath)


Solution

  • I get this issue resolved by referencing the IBM WAS JVM custom property by ${sys:condir} in the log4j2.xml file.