1 Reply Latest reply on Apr 9, 2003 7:21 AM by paveu

    PLEAS HELP LOG4J

    brette esterbrookd Newbie

      I am stuck. How do I use log4j in my ejbs, or my struts files. I can not get it to work. What do i have wrong... =-(

      Logger logger = Logger.getRootLogger();
      logger.fatal("HELPME");

      I have this in an action class. I get no errors and no logs please help I am getting very frusterated... It should be so simple!

        • 1. Re: PLEAS HELP LOG4J
          paveu Newbie

          Hello!

          If you use JBoss version shipped with log4j, you should see logs printing on JBoss console. If your JBoss doesn't use log4j you have to configure properly the logger, in other words you have to add appenders to this logger.

          You may also try to get logger in this way:

          Logger logger = Logger.getLogger("MyLogger");

          or even better

          Logger logger = Logger.getLogger(YourClassName.getClass());

          where YourClassName is the name of the class where you instantiate logger, which is most recomended by folks that wrote log4j.

          Hope this helped
          Pawel