Unable to write application logs using externalized Log4j2 XML configuration using Red Hat EAP 7.1.5












0















I have an application made of Spring Boot WAR packages that need to be migrated to Red Hat EAP 7.1.5.



In my current setup I do the following:




  1. Each WAR has a dedicated log4j2 XML per environment.

  2. This XML file name is defined in the web.xml

  3. The folder containing the log4j2_xxxx.xml is added to the classpath in the JVM startup script.

  4. The WARs are distributed across multiple run-time instances, with a possibility of one run-time hosting more than one WAR.


I would like to replicate the same using EAP. I do see the external log4j2 XML configuration being successfully loaded, however do not see any log statements being written at all.



I am using the following dependencies for packaging log4j2
org.springframework.boot.spring-boot-starter-log4j2 (version 1.5.7)
org.apache.logging.log4j.log4j-web (version 2.10.0)



I have tried the following:




  1. Define a custom module under $JBOSS_HOME/modules/

  2. Add the log4j2 XML in the same folder.

  3. Refer this as global-module in standalone.xml


When I deploy a WAR I can see that the expected log file is created, which means the log4j2 XML configuration is being read successfully. However no logs get written at all in the application log file.



I have tried to get past this by defining a jboss-deployment-structure XML as follows:



<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.log4j" />
<module name="org.jboss.log4j.logmanager" />
<module name="org.jboss.logging" />
<module name="org.jboss.logging.commons.logging" />
<module name="org.jboss.logging.jul-to-slf4j-stub" />
</exclusions>
<exclude-subsystems>
<subsystem name="logging"/>
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>


This results in the application logging being removed from the default JBOSS log (server.log) altogether but it does not write the logs to the designated log as well.



I would expect all the logging being done within the application to be written into the file defined by the external log4j2 XML configuration. Any idea what I am missing?










share|improve this question



























    0















    I have an application made of Spring Boot WAR packages that need to be migrated to Red Hat EAP 7.1.5.



    In my current setup I do the following:




    1. Each WAR has a dedicated log4j2 XML per environment.

    2. This XML file name is defined in the web.xml

    3. The folder containing the log4j2_xxxx.xml is added to the classpath in the JVM startup script.

    4. The WARs are distributed across multiple run-time instances, with a possibility of one run-time hosting more than one WAR.


    I would like to replicate the same using EAP. I do see the external log4j2 XML configuration being successfully loaded, however do not see any log statements being written at all.



    I am using the following dependencies for packaging log4j2
    org.springframework.boot.spring-boot-starter-log4j2 (version 1.5.7)
    org.apache.logging.log4j.log4j-web (version 2.10.0)



    I have tried the following:




    1. Define a custom module under $JBOSS_HOME/modules/

    2. Add the log4j2 XML in the same folder.

    3. Refer this as global-module in standalone.xml


    When I deploy a WAR I can see that the expected log file is created, which means the log4j2 XML configuration is being read successfully. However no logs get written at all in the application log file.



    I have tried to get past this by defining a jboss-deployment-structure XML as follows:



    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-deployment-structure>
    <deployment>
    <exclusions>
    <module name="org.apache.log4j" />
    <module name="org.jboss.log4j.logmanager" />
    <module name="org.jboss.logging" />
    <module name="org.jboss.logging.commons.logging" />
    <module name="org.jboss.logging.jul-to-slf4j-stub" />
    </exclusions>
    <exclude-subsystems>
    <subsystem name="logging"/>
    </exclude-subsystems>
    </deployment>
    </jboss-deployment-structure>


    This results in the application logging being removed from the default JBOSS log (server.log) altogether but it does not write the logs to the designated log as well.



    I would expect all the logging being done within the application to be written into the file defined by the external log4j2 XML configuration. Any idea what I am missing?










    share|improve this question

























      0












      0








      0








      I have an application made of Spring Boot WAR packages that need to be migrated to Red Hat EAP 7.1.5.



      In my current setup I do the following:




      1. Each WAR has a dedicated log4j2 XML per environment.

      2. This XML file name is defined in the web.xml

      3. The folder containing the log4j2_xxxx.xml is added to the classpath in the JVM startup script.

      4. The WARs are distributed across multiple run-time instances, with a possibility of one run-time hosting more than one WAR.


      I would like to replicate the same using EAP. I do see the external log4j2 XML configuration being successfully loaded, however do not see any log statements being written at all.



      I am using the following dependencies for packaging log4j2
      org.springframework.boot.spring-boot-starter-log4j2 (version 1.5.7)
      org.apache.logging.log4j.log4j-web (version 2.10.0)



      I have tried the following:




      1. Define a custom module under $JBOSS_HOME/modules/

      2. Add the log4j2 XML in the same folder.

      3. Refer this as global-module in standalone.xml


      When I deploy a WAR I can see that the expected log file is created, which means the log4j2 XML configuration is being read successfully. However no logs get written at all in the application log file.



      I have tried to get past this by defining a jboss-deployment-structure XML as follows:



      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-deployment-structure>
      <deployment>
      <exclusions>
      <module name="org.apache.log4j" />
      <module name="org.jboss.log4j.logmanager" />
      <module name="org.jboss.logging" />
      <module name="org.jboss.logging.commons.logging" />
      <module name="org.jboss.logging.jul-to-slf4j-stub" />
      </exclusions>
      <exclude-subsystems>
      <subsystem name="logging"/>
      </exclude-subsystems>
      </deployment>
      </jboss-deployment-structure>


      This results in the application logging being removed from the default JBOSS log (server.log) altogether but it does not write the logs to the designated log as well.



      I would expect all the logging being done within the application to be written into the file defined by the external log4j2 XML configuration. Any idea what I am missing?










      share|improve this question














      I have an application made of Spring Boot WAR packages that need to be migrated to Red Hat EAP 7.1.5.



      In my current setup I do the following:




      1. Each WAR has a dedicated log4j2 XML per environment.

      2. This XML file name is defined in the web.xml

      3. The folder containing the log4j2_xxxx.xml is added to the classpath in the JVM startup script.

      4. The WARs are distributed across multiple run-time instances, with a possibility of one run-time hosting more than one WAR.


      I would like to replicate the same using EAP. I do see the external log4j2 XML configuration being successfully loaded, however do not see any log statements being written at all.



      I am using the following dependencies for packaging log4j2
      org.springframework.boot.spring-boot-starter-log4j2 (version 1.5.7)
      org.apache.logging.log4j.log4j-web (version 2.10.0)



      I have tried the following:




      1. Define a custom module under $JBOSS_HOME/modules/

      2. Add the log4j2 XML in the same folder.

      3. Refer this as global-module in standalone.xml


      When I deploy a WAR I can see that the expected log file is created, which means the log4j2 XML configuration is being read successfully. However no logs get written at all in the application log file.



      I have tried to get past this by defining a jboss-deployment-structure XML as follows:



      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-deployment-structure>
      <deployment>
      <exclusions>
      <module name="org.apache.log4j" />
      <module name="org.jboss.log4j.logmanager" />
      <module name="org.jboss.logging" />
      <module name="org.jboss.logging.commons.logging" />
      <module name="org.jboss.logging.jul-to-slf4j-stub" />
      </exclusions>
      <exclude-subsystems>
      <subsystem name="logging"/>
      </exclude-subsystems>
      </deployment>
      </jboss-deployment-structure>


      This results in the application logging being removed from the default JBOSS log (server.log) altogether but it does not write the logs to the designated log as well.



      I would expect all the logging being done within the application to be written into the file defined by the external log4j2 XML configuration. Any idea what I am missing?







      spring-boot wildfly jboss7.x log4j2






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 1 at 6:55









      Prabal RakshitPrabal Rakshit

      103




      103
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993588%2funable-to-write-application-logs-using-externalized-log4j2-xml-configuration-usi%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993588%2funable-to-write-application-logs-using-externalized-log4j2-xml-configuration-usi%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas