4 Replies Latest reply on Jul 18, 2002 1:23 PM by gpatwa

    log4j and Jboss

    gpatwa

      Hi,

      My appication uses logger subclass of category from log4j
      for logging any message and when i deployed my application i can't see my log message, i tried configuring in log4j.xml file in jboss but i saw it uses only category class. how can i set-up for with logger class for logging mesaage and my application work fine with "orion server", as know category is not going to support in future from new log4j version.

      thanks
      Gopal Patwa| Software Engg| Digital Media Solutions Group

      http://www.bbctechnology.com

        • 1. Re: log4j and Jboss
          jwkaltz

          Replace the log4j.jar that comes with JBoss by the new log4j.jar from jakarta.apache.org, which has the Logger class.

          • 2. Re: log4j and Jboss
            gpatwa

            Thanks for your reply i have replaced log4j.jar (218kb) from jboss from our log4j.jar (219kb) which comes from Apache log4j.

            I have given my example how we have done in our
            application to log messages.

            package com.bbc.baladie.web.action.login;

            import org.apache.log4j.Logger;

            public final class LoginAction extends ActionBase {

            /**
            * Logger object for logging messages
            */
            private static final Logger logger = Logger.getLogger(LoginAction.class);

            // don't see this log messge
            logger.info("Starting...");

            // this method called from some other class
            public void XYZ() {

            // don't see this log messge
            logger.debug("XYZ: Executing...");

            }
            }


            Jboss log4j XML file



            <appender-ref ref="CONSOLE" />


            when i put logger tag in config file i get this message so i have changed to category tag but either
            way i don't see my log message

            16:34:48,195 INFO [Log4jService] Starting
            16:34:48,205 INFO [AbstractDeploymentScanner$ScannerThread] Running
            16:34:48,215 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml
            log4j:ERROR Parsing error on line 153 and column -1
            log4j:ERROR Element "logger" does not allow "priority" here.
            16:34:49,507 INFO [Log4jService] Started


            let me know if i need to make some changes

            Thanks
            Gopal

            Our Application log4j properties file

            # Properties for configuring Log4j
            # $Id: log4j.properties,v 1.2 2002/06/03 20:28:40 hsaul Exp $

            log4j.rootLogger=DEBUG, baladie
            log4j.appender.baladie=org.apache.log4j.ConsoleAppender
            log4j.appender.baladie.layout=org.apache.log4j.PatternLayout

            # Print the date in ISO 8601 format
            log4j.appender.baladie.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

            # Print only messages of level WARN or above in the package com.foo.
            log4j.logger.com.foo=WARN






            • 3. Re: log4j and Jboss
              jwkaltz

              I'm using JBoss 2.4.x, so there may be a difference with JBoss 3.0.
              In my case, I don't have a log4j.xml, I just have the log4j.properties
              On server startup, I get this message
              2002-07-17 17:40:35,626 [root] Started Log4jService, config=file:/opt/JBoss-2.4.4/conf/se/log4j.properties

              and everything works fine.

              In any case, in your example the log4j.xml looks redundant with the log4j.properties - I'm not sure what the log4j.xml is for, but I would assume that you either write a log4j.xml or a log4j.properties, but not both.

              • 4. Re: log4j and Jboss
                gpatwa


                I have used only one log4j file, when i deploy on oc4j i used log4j properties file which works fine b'cos it does not used any log4j internally like jboss, and when i deploy to jboss 3.0 it read log4j.xml file from it's conf directory.

                Thanks
                Gopal