Installations that are based on the RPM distribution (Red Hat, CentOS and derivatives) can be configured with a workaround as follows (note that upgrading to Openfire 4.6.5 remains the preferred solution).
These installs typically have a configuration file in /etc/sysconfig/openfire that can be used to apply additional configuration to Openfire. The default file looks something like this:
# Set this to the path where openfire lives.
# If this is not set the script will look for /usr/local/openfire, then
# /opt/openfire.
#OPENFIRE_HOME=""
# If there is a different user you would like to run openfire as,
# change the following line.
#OPENFIRE_USER="daemon"
# If you wish to change the location of the openfire pid file,
# change the following line.
#OPENFIRE_PIDFILE="/var/run/openfire.pid"
# If you wish to explictly specific the location of the log directory,
# you can set it here. Note that this applies to the logs generated outside
# openfire itself. If you want to change the location of openfire's own
# logs, see the system property 'log.directory'. If this is not set,
# it will default to $OPENFIRE_HOME/logs.
#OPENFIRE_LOGDIR="/some/where/logs"
# If you wish to set any specific options to pass to the JVM, you can
# set them with the following variable.
#OPENFIRE_OPTS="-Xmx1024m"
# If you wish to override the auto-detected JAVA_HOME variable, uncomment
# and change the following line.
#JAVA_HOME=/usr/java/default
Note that all these lines are commented out (start with a # symbol) and are thus not active.
Find the line that contains OPENFIRE_OPTS and activate it, by removing the # that’s in front of it (or duplicate the line, leaving the original line as future example). Then, modify the value of the property to include the -Dlog4j2.formatMsgNoLookups=true directive. If previously the line was commented out (the default), then you do not need to retain the example value from the example. If your instance was already using the OPENFIRE_OPTS line, then add the new option to the existing values, separating them with a whitespace character (ensure to include everything within the quote " characters).
The new file content could look something like this:
# Set this to the path where openfire lives.
# If this is not set the script will look for /usr/local/openfire, then
# /opt/openfire.
#OPENFIRE_HOME=""
# If there is a different user you would like to run openfire as,
# change the following line.
#OPENFIRE_USER="daemon"
# If you wish to change the location of the openfire pid file,
# change the following line.
#OPENFIRE_PIDFILE="/var/run/openfire.pid"
# If you wish to explictly specific the location of the log directory,
# you can set it here. Note that this applies to the logs generated outside
# openfire itself. If you want to change the location of openfire's own
# logs, see the system property 'log.directory'. If this is not set,
# it will default to $OPENFIRE_HOME/logs.
#OPENFIRE_LOGDIR="/some/where/logs"
# If you wish to set any specific options to pass to the JVM, you can
# set them with the following variable.
#OPENFIRE_OPTS="-Xmx1024m"
OPENFIRE_OPTS="-Dlog4j2.formatMsgNoLookups=true"
# If you wish to override the auto-detected JAVA_HOME variable, uncomment
# and change the following line.
#JAVA_HOME=/usr/java/default
After saving the file, restart Openfire (note this will briefly interrupt service).
# systemctl restart openfire
To check if your changes were successful issue the following command:
# ps ax | grep openfire
The output should include the formatMsgNoLookups option, like in the example below:
21214 ? Sl 0:02 /etc/alternatives/jre/bin/java -Dlog4j.configurationFile=/opt/openfire/lib/log4j2.xml -server -Dlog4j2.formatMsgNoLookups=true -DopenfireHome=/opt/openfire -Dopenfire.lib.dir=/opt/openfire/lib -classpath /opt/openfire/lib/startup.jar -jar /opt/openfire/lib/startup.jar
21254 pts/0 R+ 0:00 grep --color=auto openfire