How to rotate the process-controller and host-controller log in EAP 6 ?

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Issue

  • How to rotate the proccess-controller.log, host-controller.log log files in EAP 6?
  • Every time the host controller starts is overwritten the logs: console.log, host-controller.log, process-controller.log.What could be the cause of the issue.

Resolution

Define the PeriodicRotatingFileHandler in $JBOSS_HOME/domain/configuration/logging.properties as following:

# File handler configuration
handler.BOOT_FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
handler.BOOT_FILE.level=DEBUG
handler.BOOT_FILE.properties=autoFlush,append,fileName,suffix
handler.BOOT_FILE.autoFlush=true
handler.BOOT_FILE.append=true
handler.BOOT_FILE.suffix=.yyyy-MM-dd
handler.BOOT_FILE.fileName=${org.jboss.boot.log.file:boot.log}
handler.BOOT_FILE.formatter=PATTERN

The suffix property is responsible for rotating the log files based on a time interval that is determined by the content of the string which is passed in to this property:

handler.BOOT_FILE.suffix=.yyyy-MM-dd

Also note that you need to add append and suffix to handler.BOOT_FILE.properties. (handler.BOOT_FILE.properties=autoFlush,fileName by default.)

To test this configuration, you can try to change the system date of Operating System and see if the log files (host-controller.log, process-controller.log) are rotating. At the time of rotation of the log files, the first created log files are renamed to *.log.yyyy-MM-dd and, then again JBoss creates the (host-controller.log, process-controller.log) log files and writes in them.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments