0 Replies Latest reply on Oct 31, 2005 2:59 AM by chaituu

    own log4j properties

    chaituu

      I deployed ear in default/deploy directory;

      in the ear i have war and jar ;

      in the WEB-INF directory of war i have my own log4j.properties file and also i placed log4j.jar in WEB-INF/lib directory;


      when the server is up using listener class i am reading log4j.properties file;

      below class to read log4j.properties file;its working perfectly;


      public class PropInit implements ServletContextListener
      {
      private ServletContext context = null;
      public void contextInitialized(ServletContextEvent event)
      {
      File logFile = null;
      }
      try
      {
      logFile = new File(context.getRealPath("/WEB-INF/log4j.properties"));


      }

      BLAH-- BLAH---
      }
      }


      i followed below URL.

      http://www.jboss.org/wiki/Wiki.jsp?page=Logging

      Using your own log4j.properties file - class loader scoping


      in default/conf directory i renamed log4j.xml to jboss-log4j.xml;and in jboss-service.xml i changed log4j.xml to jboss-log4j.xml;

      i made changes in jboss-web.xml.

      <jboss-web>
      <loader-repository>test:loader=test.war
      </loader-repository>
      </jboss-web>



      # Root category
      log4j.rootCategory=info, R
      log4j.appender.stdout=org.apache.log4j.ConsoleAppender
      log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
      # Pattern for standard output
      log4j.appender.stdout.layout.ConversionPattern=%d [%-5p] %c{2} %M.%L - %m%n

      og4j.category.app=info, SESSME
      log4j.appender.SESSME=org.apache.log4j.RollingFileAppender
      log4j.appender.SESSME.File=${jboss.server.home.dir}/log/std.log
      log4j.appender.SESSME.MaxFileSize=5120KB
      # Keep ten backup files
      log4j.appender.SESSME.MaxBackupIndex=10
      log4j.appender.SESSME.layout=org.apache.log4j.PatternLayout
      log4j.appender.SESSME.layout.ConversionPattern=%d , %m%n

      log files are created when the server is up but content is not going to respective log file;every time its going into server.log(i dont want that).

      i have one doubt should i write PropInit class to read log4j.properties that i placed in WEB-INF directory or else jboss will automatically read log4j.properties file ;