1 Reply Latest reply on Mar 7, 2006 12:04 AM by song hao

    JBoss Log4j problem

    song hao Newbie

      My EJB 3.0 Stateless Session Beans use log4j, but it not work fine.

      LoggerService.java

      public class LoggerService {
       public static Logger Errorlog;
       public static Logger Infolog;
      
       static {
       Properties prop = new Properties();
      
       prop.setProperty("log4j.logger.FidsError", "ERROR,ErrorFile");
       prop.setProperty("log4j.logger.FidsInfo", "INFO,InfoFile");
      
       prop.setProperty("log4j.appender.ErrorFile", "org.apache.log4j.DailyRollingFileAppender");
       prop.setProperty("log4j.appender.ErrorFile.layout", "org.apache.log4j.PatternLayout");
       prop.setProperty("log4j.appender.ErrorFile.layout.ConversionPattern", "%d %-5p [%C.%M] %m %L%n");
       prop.setProperty("log4j.appender.ErrorFile.Append", "true");
       prop.setProperty("log4j.appender.ErrorFile.DatePattern", "'.'yyyy-MM-dd'.log'");
       prop.setProperty("log4j.appender.ErrorFile.File", "${jboss.server.home.dir}/log/Error.log");
      
       prop.setProperty("log4j.appender.InfoFile", "org.apache.log4j.DailyRollingFileAppender");
       prop.setProperty("log4j.appender.InfoFile.layout", "org.apache.log4j.PatternLayout");
       prop.setProperty("log4j.appender.InfoFile.layout.ConversionPattern", "%d %-5p [%C.%M] %m %L%n");
       prop.setProperty("log4j.appender.InfoFile.Append", "true");
       prop.setProperty("log4j.appender.InfoFile.DatePattern", "'.'yyyy-MM-dd'.log'");
       prop.setProperty("log4j.appender.InfoFile.File", "${jboss.server.home.dir}/log/Info.log");
      
       PropertyConfigurator.configure(prop);
      
       Errorlog = Logger.getLogger("FidsError");
       Infolog = Logger.getLogger("FidsInfo");
       }
      
      }


      Stateless Session Beans TestEJB.java

      try {
       .........
      } catch(Exception e) {
       LoggerService.Errorlog.error(e.toString());
      }


      a Client program access TestEJB, but client shows:
      log4j:WARN No appenders could be found for logger (org.jboss.security.SecurityAssociation).
      log4j:WARN Please initialize the log4j system properly.


      what's wrong with LoggerService.java?