Sunday, 11 January 2015

JBoss WildFly 8 : log4j not logging


For a newly installed JBoss WildFly 8 if your application is using log4j , there would not be any log in the file or console.


1. WHAT happened ?
 There is no log printed in the console from deployed application in JBoss WildFly 8 which powered by log4j.


2. WHY it happened ?

Because JBoss WildFly 8 is using its own log configuration as below not your application ones.


 


3. HOW to resolve it 

Step 1 : let JBoss WildFly 8 to load log4j.xml or log4j.properties from deployed application not standalone.xml by adding : <use-deployment-logging-config value="false"/> as below :


Step 2 : use the logging function from deployed application not JBoss WildFly 8 by adding WEB-INF/classes/jboss-deployment-structure.xml








You may refer to below for details on JBoss WildFly 8 logging configuration :

https://docs.jboss.org/author/display/WFLY8/Logging+Configuration#LoggingConfiguration-PerdeploymentLogging

5 comments:

  1. Thanks for this. I was tearing my hair out because I desperately needed to see the log and no amount of messing with my wildfly config was helping. Well done!

    ReplyDelete
    Replies
    1. Thank you for the comment , glad it helps.

      Delete
  2. I'm new in wildfly... wich files are been modify in this example?

    ReplyDelete
    Replies
    1. 1. ${JBOSS_HOME}\standalone\configuration\standalone.xml (if you are launching the server with standalone mode)
      2. ${project_location}\src\main\resources\jboss-deployment-structure.xml (if your project is maven powered)

      Delete
  3. Awersome !!

    worked like a charm.

    Kindly change your snippet as '/' is missing there (for above line only) and that might lead some naive user to some trouble.

    Thanks :)

    ReplyDelete

Flag Counter