0 Replies Latest reply on Dec 3, 2005 1:02 AM by Yuhong Qian

    how to use my own log4j.properties

    Yuhong Qian Newbie

      Hi,

      I have a J2EE project which includes EJB and Servlets, I deploy it by copying bookmark.ear to the C:\jboss-4.0.1\server\default\deploy folder.

      I'd like to separate my appliaction logs by using my own log4j.properties.
      My own log4j.properties is packaged in the bookmark.war.

      In order to do that, I rename the C:\jboss-4.0.1\server\default\conf\log4j.xml to jboss-log4j.xml and update the conf\jboss-service.xml as follows:

      Change resource:log4j.xml to resource:jboss-log4j.xml



      Then I change jboss-web.xml for class-loading, as shown below:


      <jboss-web>

      <class-loading java2ClassLoadingCompliance="false">
      <loader-repository>
      bookmark:loader=bookmark.war
      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
      </loader-repository>
      </class-loading>

      </jboss-web>

      My log4j.properties is as follows:

      #define servletlog
      log4j.logger.servletlog=debug,file3
      log4j.appender.file3=org.apache.log4j.RollingFileAppender
      log4j.appender.file3.MaxFileSize=8192KB
      log4j.appender.file3.MaxBackupIndex=0
      log4j.appender.file3.File=${jboss.server.home.dir}/log/servlet.log
      log4j.appender.file3.layout=org.apache.log4j.PatternLayout
      log4j.appender.file3.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %c{1}:%L - %m%n

      In my servlet, I call the logger with the syntax:

      private Logger logger = Logger.getLogger(servletlog);

      logger.debug("###A debug message from bookmark app###");

      The expected result would be at the C:\jboss-4.0.1\server\default\log folder a servlet.log created.

      But unfortunately nothing happen. Neither no servlet.log under the
      C:\jboss-4.0.1\server\default\log folder nor other places.

      What's wrong? Any help are highly appreciated.