2 Replies Latest reply on Nov 2, 2007 2:05 AM by Kumar Jaya

    Custom Logger in JBoss

    Kumar Jaya Newbie

      I am using JBoss 4.0.X, I am having three ears deployed in JBoss. I am using a custom Logger say ABCLogger which extends Log4j, and I have bundled all these classes within xjz.jar file. I am having a copy of this xyz.jar file in all the three ears and logging the events by getting the logger from ABCLogger class. I have a seperate log4j.xml file for each of this ears. Like within the conf folder in the default directory of JBoss I have created three folders such as ear1, ear2 and ear2. All these folders have a log4j.xml file that is specific to the ear file. I have a single file appender and a custom exception appender for each ear file. But I am not able to see three seperate log files. When ever I call the the ABCLogger.getLogger() I am initializing the Logger to the corresponding log4j.xml file of the ear?? Can any one tell me why I am not able to get the log files??

        • 1. Re: Custom Logger in JBoss
          A N Newbie

          Have you tried defining your loggers inside the log4j.xml that you place in your server's conf directory?

          It would look something like this:

          Inside your class:

          private Logger dataLog = Logger.getLogger("YOUR_LOGGER");


          Inside your log4j:
          <appender name="YOUR_LOGGER_FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
           <param name="File" value="${jboss.server.home.dir}/log/yourFile.log"/>
           <param name="Append" value="true"/>
          THE REST OF YOUR CONFIGURATION
          </appender>
          
          <category name="YOUR_LOGGER">
           <appender-ref ref="YOUR_LOGGER_FILE"/>
          </category>

          This might help you out.

          • 2. Re: Custom Logger in JBoss
            Kumar Jaya Newbie

            I have a three different log4j.xml files for three different ears that I have deployed.

            Say I am deploying A.ear, B.ear and C.ear to JBoss, I will have three folder by the name A, B and C under the conf directory of the Server. Each of these folders will have the log4j.xml file for that particular ear.

            I am using my custom Logger say MyLogger which extends Logger for logging events. I have included this MyLogger.jar file in all the ear files.

            I also have the JBoss log4j.xml file in the conf directory undisturbed.