1 Reply Latest reply on Aug 19, 2011 9:42 AM by Narendra Choyal

    log4j don't work with EJB

    Marcos Simón Newbie

      Hi everybody,

       

      I´ve got a JBoss AS6 Final, where are running some web applications correctly, with theirs logs files created with log4j.

       

      But now I´ve created a EJB3, with Eclipse, and I put a log4j.properties file in the root source folder, but it don't work.  I try to change the location and other diferents changes, but It don't work anyway.

       

      In all documents finded in internet say that is esay (I thought the same before that), and I do the same steps theirs suggest, but nothing.

       

      My directories structure is:

       

      \myEJB

           \ejbModule

                \diz\ ... (and the rest of my java class and packages)

                \META-INF\

                     \ejb-jar.xml

                     \MAINFEST.MF

                \log4.properties

           \build

                \classes\

                     \diz\ ... (and the rest of class genertes by compiler)

                     \META-INF\

                          \ejb-jar.xml

                          \MAINFEST.MF

                     log4j.properties

       

      And my log4.properties

       

      log4j.rootCategory=DEBUG,file

      #log4j.rootCategory=ERROR,file

       

      ### Logs a fichero ###

      #log4j.appender.file=org.apache.log4j.FileAppender

      log4j.appender.file=org.apache.log4j.DailyRollingFileAppender

      log4j.appender.file.ImmediateFlush=true

      log4j.appender.file.file=${jboss.server.home.dir}/log/mylog.log

      log4j.appender.file.layout=org.apache.log4j.PatternLayout

      log4j.appender.file.layout.ConversionPattern=%d %-5p %C.%M(%L): %m%n

      log4j.appender.file.append=true

       

       

      I suppose that is a small detail that I´ve forgotten or similar, but I can't find it !!!

       

      Thanks in advance,

       

      Marcos

        • 1. Re: log4j don't work with EJB
          Narendra Choyal Newbie

          Hi to all of you who read this,

           

          for logging in JBoss that you are Using JBoss AS 6 final,

           

          You directly change file

          $JBOSS_HOME/server/YOUR_SERVER_PARTION_NAME/deploy/jboss-logging.xml

          Ex. /var/jboss/default/deploy/jboss-logging.xml

           

          In this file you can edit/add fileLocation, pattern as with your requirements,

           

          This starts your logging after server starts(i.e after bootstrap).

           

           

          for advance users:

          --------------------------

          • you can also make LOG server( as well as master & slave log server easily).

           

           

          Regards,

          Narendra Choyal