4 Replies Latest reply on Apr 17, 2008 11:22 AM by Peter Johnson

    Logging

    Jim Willeke Newbie

      I have spent the day trying to configure the ability to log to a file for ONE application with no success.

      Any help is appreciated.
      -jim

        • 1. Re: Logging
          Peter Johnson Master

          I will assume that you added a new file appender to jboss-log4j.xml. Let's assume that this appender is named MYFILE. Assuming your app uses the package name com.xxx.myapp, add this category:

          <category name="com.xxx.myapp">
           <priority value="INFO"/>
           <appender-ref ref="MYFILE" />
           </category>


          • 2. Re: Logging
            Jim Willeke Newbie

            yes, I added my appender to .../jboss/conf/log4j.xml

            My Appender looks like:














            <appender-ref ref="APASS"/>



            <appender-ref ref="CONSOLE"/>
            <appender-ref ref="FILE"/>
            <appender-ref ref="APASS"/>


            So I get all the entries for everything EXCEPT the ones I want.
            (Items sent to APASSfileLogger)

            Thanks
            -jim

            • 3. Re: Logging
              Jim Willeke Newbie

              Try this again.

              Yes, I added my appender to .../jboss/conf/log4j.xml



              My Appender looks as below.
              Thanks
              -jim

              
               <appender name="APASS" class="org.jboss.logging.appender.RollingFileAppender">
               <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
               <param name="File" value="${jboss.server.home.dir}/log/apass.log"/>
               <param name="Append" value="false"/>
               <param name="MaxFileSize" value="5000KB"/>
               <param name="MaxBackupIndex" value="10"/>
               <param name="Threshold" value="DEBUG"/>
               <layout class="org.apache.log4j.PatternLayout">
               <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %p %c %C{1} %M(%L) %m%n"/>
               </layout>
              </appender>
              
              
              <category name="APASSfileLogger" additivity="false">
               <priority value="DEBUG" />
               <appender-ref ref="APASS"/>
              </category>
              
               <root>
               <appender-ref ref="CONSOLE"/>
               <appender-ref ref="FILE"/>
               <appender-ref ref="APASS"/>
               </root>


              • 4. Re: Logging
                Peter Johnson Master

                By adding appender-ref to root, you will end up getting all logging showing up in apass.log. Remove that:

                <root>
                 <appender-ref ref="CONSOLE"/>
                 <appender-ref ref="FILE"/>
                 </root>