Search code examples
log4jwebsphere

Websphere AS Servername WAS_SERVER_NAME in Logfile Name (Log4j)


In the server console of WAS 7 there are variables like WAS_SERVER_NAME, but whenever I reference them via ${WAS_SERVER_NAME} (either in the logfile name or as a line in the logfile) they return null. Although they contain a value. what am I missing?

Using RollingFileAppender.

Thanks for your help!


Solution

  • As mentioned by dbreaux, WebSphere variables are not available as a System Property. The standard trick is to create a custom property for the JVM say WAS_SERVER_NAME which is assigned the value ${WAS_SERVER_NAME}.

    WAS run time would assign the value to the JVM property and then it would be available to log4j.

    HTH

    Manglu