4 Replies Latest reply on Sep 10, 2007 3:00 AM by LeQuoc Thai

    Warning when use log4j

    LeQuoc Thai Novice

      Hi all!
      I begginer with Log4j, and I have a problem that I need help:
      I use:

      jboss-4.0.5.GA, EJB3.0

      I have a bean (called RecordBean):
      ...
      private static final Logger myLogger = Logger.getLogger(RecordBean.class);

      public void add(int num1, int num2) {
      myLogger.info("Perform the adding two numbers...");
      ...
      }

      And inside
      \server\default\conf
      , I edit file log4j.xml (add my definition):
      <appender name="XXX" class="org.apache.log4j.FileAppender">
       <param name="File" value="${jboss.server.log.dir}/mylog.log"/>
       <param name="Threshold" value="INFO"/>
       <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
       </layout>
       </appender>
      .....
       <logger name="bean.log">
       <appender-ref ref="QT"/>
       </logger>
      
       <root>
       <appender-ref ref="CONSOLE"/>
       <appender-ref ref="FILE"/>
       </root>

      But when I deploy RecordBean, and my client call add method, logging ok, but I receive some Warning:
      log4j:WARN No appenders could be found for logger (org.jboss.security.SecurityAssociation).
      log4j:WARN Please initialize the log4j system properly.

      I imported log4j.jar.
      Please help me to solve this problem.