1 Reply Latest reply on Sep 21, 2009 9:10 AM by Nikos Paraskevopoulos

    how to configure log4j

    Sathish kumar Govindarajan Newbie
      i want to handle my errors in a specified folder by using log4j
      i tried but it does create a log file

      <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">

      <appender name="App1Log" class="org.apache.log4j.FileAppender">
            <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"></errorHandler>
            <param name="Append" value="false"/>
            <param name="File" value="d:/jboss5/server/default/log/app1.txt"/>
            <layout class="org.apache.log4j.PatternLayout">
               <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
            </layout>
            <filter class="org.jboss.logging.filter.TCLFilter">
               <param name="AcceptOnMatch" value="true"/>
               <param name="DeployURL" value="HRMSAPP.ear"/>
            </filter>   
       
            <!-- end the filter chain here -->
            <filter class="org.apache.log4j.varia.DenyAllFilter"></filter>

         </appender>



          <!--<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
              <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
              <param name="Target" value="System.out"/>
              <layout class="org.apache.log4j.PatternLayout">
                   The default pattern: Date Priority [Category] Message\n
                  <param name="ConversionPattern" value="%-5p [%c{6}] %m%n"/>
              </layout>
          </appender>

          --><!-- ############### Embedded JBoss AS #################  -->
          <category name="org.jboss">
              <priority value="ERROR"/>
          </category>
          <category name="com.arjuna">
              <priority value="ERROR"/>
          </category>
         
          <!-- EMB-6, JMS activation throws an error due to deployment ordering, but as there is a timeout
          and retry the tests pass. Hide the error message -->
          <category name="jboss.resource.adapter.jms.inflow.JmsActivation">
              <priority value="ERROR"/>
          </category>

          <!-- ############### Hibernate logging ################# -->

          <category name="org.hibernate">
              <priority value="ERROR"/>
          </category>

          <!--
          <category name="org.hibernate.SQL">
              <priority value="TRACE"/>
          </category>
          <category name="org.hibernate.type">
              <priority value="TRACE"/>
          </category>
          <category name="org.hibernate.loader">
              <priority value="TRACE"/>
          </category>
          <category name="org.hibernate.cache">
              <priority value="TRACE"/>
          </category>
          -->

          <!-- Ajax4jsf is too noisy -->
          <category name="org.ajax4jsf.cache">
              <priority value="WARN"/>
          </category>


          <!-- ############### Seam logging ################### -->
          <category name="org.jboss.seam">
              <priority value="WARN"/>
          </category>



          <!-- These things are too noisy
          <category name="org.jboss.seam.jsf.SeamVariableResolver">
              <priority value="INFO"/>
          </category>
          <category name="org.jboss.seam.contexts.Contexts">
              <priority value="INFO"/>
          </category>
          <category name="org.jboss.seam.Component">
              <priority value="INFO"/>
          </category>
          <category name="org.jboss.seam.deployment.Scanner">
              <priority value="INFO"/>
          </category>
          <category name="org.jboss.seam.util.Naming">
              <priority value="INFO"/>
          </category>
          <category name="org.jboss.seam.debug.hot">
              <priority value="INFO"/>
          </category>
          <category name="org.jboss.seam.core.Events">
              <priority value="INFO"/>
          </category>
          -->

          <!-- Debugging conversations and persistence contexts
          <category name="org.jboss.seam.core.Manager">
              <priority value="DEBUG"/>
          </category>
          <category name="org.jboss.seam.core.ManagedPersistenceContext">
              <priority value="DEBUG"/>
          </category>
          <category name="org.jboss.seam.jsf.AbstractSeamPhaseListener">
              <priority value="DEBUG"/>
          </category>
          <category name="org.jboss.seam.interceptors.ConversationInterceptor">
              <priority value="DEBUG"/>
          </category>
          <category name="org.jboss.seam.contexts.Lifecycle">
              <priority value="DEBUG"/>
          </category>
          <category name="org.hibernate.impl.SessionImpl">
              <priority value="DEBUG"/>
          </category>
          <category name="org.hibernate.event.def.AbstractFlushingEventListener">
              <priority value="DEBUG"/>
          </category>
          -->

          <root>
              <priority value="INFO"/>
              <appender-ref ref="CONSOLE"/>
          </root>

      </log4j:configuration>