1 Reply Latest reply on Sep 20, 2019 5:24 AM by zhurlik

    Can you configure WAR logging without editing the standalone.xml?


      I am serving a WAR file in a Standalone instance of JBOSS eap 7.2.   The WAR file is set to log to two different log files; application.log and request.log.


      The WAR deploys as expected and appears to be working, but the log files are ignored.  They get created, but nothing gets written to them.

      I am seeing some INFO entries getting written to the JBOSS server.log, but nothing in my logs.


      I have discovered that I can edit standalone.xml and add loggers there, allowing me output the logs to a log file and change the logging level, though I haven't figured out how to get it to sort the two log entries to different logs.

      But in the Production deployment of the WAR, I'm not sure I'll have access to standalone.xml to make the necessary changes.


      Are there any changes I can make to the WARs log4j2.xml file to allow it to write to my log files, without making any changes to standalone.xml? 


      Here is a copy of the log4j2.xml file I am using.


      <?xml version="1.0" encoding="UTF-8"?>

      <Configuration monitorInterval="30">


              <Property name="baseDir">/opt/jboss-eap-7.2/standalone/log</Property>




              <Console name="STDOUT" target="SYSTEM_OUT">

                  <PatternLayout pattern="%d: [%-5p] %c{1} - %m%n"/>


              <Console name="STDERR" target="SYSTEM_ERR">

                  <PatternLayout pattern="%d: [%-5p] %c{1} - %m%n"/>


              <Async name="asyncManager" blocking="false" bufferSize="1024">

                  <AppenderRef ref="logFile"/>



              <RollingFile name="logFile"



                  <PatternLayout pattern="%d: [%-5p] %c{1} - %m%n"/>


                      <TimeBasedTriggeringPolicy interval="1" modulate="true"/>


                  <DefaultRolloverStrategy compressionLevel="9"/>



              <RollingFile name="RequestLogRollingFileAppender"



                  <PatternLayout pattern="%d{yyyy-MM-dd'T'HH:mm:ss.SSSZZ}: [%p] %t %c - %m%n"/>


                      <SizeBasedTriggeringPolicy size="1000 KB"/>


                  <DefaultRolloverStrategy max="10" compressionLevel="9"/>




              <Logger name="request.output" additivity="true" level="info">

                  <AppenderRef ref="RequestLogRollingFileAppender"/>



              <Root level="warn">

                  <AppenderRef ref="asyncManager"/>