1 2 Previous Next 19 Replies Latest reply on Apr 14, 2012 2:38 PM by James Perkins

    Log4j configuration in JBoss AS7

    Haroon Foad Newbie

      Dear All,

      I was using log4j in JBoss 4.2.2.GA without any hardships or obstacles,

      but now with JBoss AS7 I dont know how to configure it.

       

      In JBoss AS4 , I did like this:

      1. in jboss-log4j.xml I added:

       

      <category name="com.lit.wessal">
              <priority value="INFO"/>
              <appender-ref ref="WESSAL_WEB_APP_LOG"/>
      </category>
      
      <appender name="WESSAL_WEB_APP_LOG" class="org.jboss.logging.appender.DailyRollingFileAppender">
              <param name="Append" value="true"/>
              <param name="File" value="${jboss.server.home.dir}/log/wessal-web.log"/>
              <!-- Rollover at midnight each day -->
              <param name="DatePattern" value="'.'yyyy-MM-dd"/>
              <layout class="org.apache.log4j.PatternLayout">
                      <param name="ConversionPattern" value="%d %-5p [%c{1}] %l - %m%n"/>
              </layout>
      </appender>
      
      

       

       

      2. in Log.java

       

      package com.lit.wessald.mavenproject6.hibernateutil;
      
      
      import org.apache.log4j.Logger;
      
      
      /**
       * Defines the logger for Log4J logging.
       * 
       * 
       */
      public class Log {
                private static String LIS_LOGS = "com.lit.wessal";
        
                private static Logger _logger = Logger.getLogger(LIS_LOGS);
        
                /**
                 * DOCUMENT ME!
                 * 
                 * @return DOCUMENT ME!
                 */
                public static Logger getLogger() {
                          return _logger;
                }
        
                /**
                 * DOCUMENT ME!
                 * 
                 * @param classObject
                 *            DOCUMENT ME!
                 * 
                 * @return DOCUMENT ME!
                 */
                public static Logger getLogger(Class<?> classObject) {
                          return _logger = Logger.getLogger(classObject);
                }
      
      
                /**
                 * DOCUMENT ME!
                 * 
                 * @param className
                 *            DOCUMENT ME!
                 * 
                 * @return DOCUMENT ME!
                 */
                public static Logger getLogger(String logTitle) {
                          return _logger = Logger.getLogger(logTitle);
                }
      
      
      }
      
      

       

       

      How can I do the same thing in JBoss AS7.

      Please help.

        1 2 Previous Next