I have multiple wars running on a standalone jboss server. I have logging subsystem configured in the standalone.xml. I referred this redhat link on Add Per-deployment Logging to an Application to create a log handler specific for one of the apps.
I created logging.properties file in the app war under META-INF folder with following content
loggers=com.company
logger.com.company.level=TRACE
logger.com.company.useParentHandlers=true
logger.com.company.handlers=TESTFILE
# A handler configuration
handler.TESTFILE=org.jboss.logmanager.handlers.FileHandler
handler.TESTFILE.level=TRACE
handler.TESTFILE.formatter=PATTERN1
handler.TESTFILE.properties=append,autoFlush,enabled,suffix,fileName
handler.TESTFILE.constructorProperties=fileName,append
handler.TESTFILE.append=true
handler.TESTFILE.autoFlush=true
handler.TESTFILE.enabled=true
handler.TESTFILE.fileName=${jboss.server.log.dir}/app.log
# The formatter to use
formatter.PATTERN1=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN1.properties=pattern
formatter.PATTERN1.constructorProperties=pattern
formatter.PATTERN1.pattern=%d %-5p %c: %m%n
I deployed the app but it didn't do anything apart from what is configured in standalone.xml logging sub system. Is this setup supposed to work on EAP 6.4 ?
Yes this should work in JBoss EAP 6.4. You may want to try moving the logging.properties file to the
WAR/WEB-INF/classes
. There may have been a bug where it fails to look in theWAR/WEB-INF
directory.If that doesn't work you could also turn on trace logging for
org.jboss.as.logging
which should show the logging.properties file being found in your deployment.The following CLI command will enable trace logging to see the details of what the logging subsystem is doing.
If you want to see these log messages on the console you'll need to enable trace logging for the console tool.