0 Replies Latest reply on Dec 7, 2005 11:29 AM by Miguel Acevedo

    Separate application logging

    Miguel Acevedo Newbie

      Hello there, I was wondering if there's a way to log each application on Jboss, I mean, i dont want every line of log of each application to go to server.log, but instead to redirect them to one log file per application. For example com.server.app1 redirect output to app1.log, com.server.app2 redirects to app2.log.

      I've tried configuring log4j.xml to add a new appender for app1, and then the category for each package is redirected to app1 in this case, but when I deploy app1.war i get the following exception

      [STDOUT] log4j:ERROR A "org.jboss.logging.util.OnlyOnceErrorHandler" object is not assignable to a "org.apache.log4j.spi.ErrorHandler" variable.
      09:57:11,620 INFO [STDOUT] log4j:ERROR The class "org.apache.log4j.spi.ErrorHandler" was loaded by
      09:57:11,620 INFO [STDOUT] log4j:ERROR [WebappClassLoader
      delegate: false
      ----------> Parent Classloader:
      ] whereas object of type
      09:57:11,621 INFO [STDOUT] log4j:ERROR "org.jboss.logging.util.OnlyOnceErrorHandler" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@f72617].
      09:57:11,708 INFO [STDOUT] log4j:ERROR Could not create an Appender. Reported error follows.
      09:57:11,708 INFO [STDOUT] java.lang.ClassCastException
      09:57:11,711 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:165)
      09:57:11,712 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:140)
      09:57:11,712 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:153)
      09:57:11,712 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:415)
      09:57:11,712 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:384)
      09:57:11,713 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:783)
      09:57:11,713 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:666)
      09:57:11,713 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
      09:57:11,713 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:602)
      09:57:11,714 INFO [STDOUT] at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:460)
      09:57:11,714 INFO [STDOUT] at org.apache.log4j.LogManager.(LogManager.java:113)
      09:57:11,714 INFO [STDOUT] at org.apache.log4j.Logger.getLogger(Logger.java:94)
      09:57:11,714 INFO [STDOUT] at com.ti.tmx.daily.controllers.DailyWeekController.(DailyWeekController.java:32)
      and so on

      In this case, i get the app1.log file created, but ALL Jboss messages go there instead the ones I care about (com.server.app1).

      I really appreciate your help guys.
      Thanks in advance

      Miguel Acevedo