5 Replies Latest reply on Jun 8, 2006 9:16 AM by Phu Nguyen

    how to configure the logging level in JBOSS

    cari34 Newbie

      Hi guys,
      I would like to configure the logging in JBOSS.

      The server.log file in the %JBOSS_HOME%\server\default directory
      is too big.

      How could I control the size of this file.

      I would like to minimize the logging put in this file.

      Is there a mean that allows doing that.

      Any idea ?

      Thank you very much

        • 1. Re: how to configure the logging level in JBOSS
          Darran Lofthouse Master

          Logging for JBoss is provided using Log4J

          • 2. Re: how to configure the logging level in JBOSS
            cari34 Newbie

            Hi darranl,
            Thanks for the reply.
            Do you know what should I do to
            minimize the size of the loggings
            in the server.log file ?

            Carri

            • 3. Re: how to configure the logging level in JBOSS
              Scott Stark Master

              See the docs on the log4j site
              http://logging.apache.org/log4j/docs/
              and apply these to the conf/log4j.xml config.

              • 4. Re: how to configure the logging level in JBOSS
                Phu Nguyen Newbie

                i have a same problem. jboss' logging file 's really too large. it increases to 15GB ^_^! any body has soved this problem. pls, email to me ^_^
                my email's jojojoe_nguyen@yahoo.com
                thank you very much!

                • 5. Re: how to configure the logging level in JBOSS
                  Phu Nguyen Newbie

                  Log4j

                  Logging has a profound effect on performance. Changing the logging level to TRACE can bring the JBossAS to a crawl. Changing it to ERROR (or WARN) can speed things up dramatically. \

                  * By default, JBoss logs both to the console and server.log and by default it uses level "INFO".
                  * Consider not logging to System.out (you may still want to redirect it to catch JVM errors)
                  * Consider changing the log level to ERROR. Remember that JBoss watches its log4j config file for changes and you can always change configuration at runtime.
                  * Add a category filter for your Java class hierarchy.

                  To turn off console logging:

                  * Edit server/slim/conf/log4j.xml
                  * Change the following XML fragment:



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


                  make it read



                  <appender-ref ref="FILE"/>


                  * You can then remove this fragment:







                  <!-- The default pattern: Date Priority [Category] Message\n -->




                  To change the log level:

                  * Edit server/slim/conf/log4j.xml
                  * Remove/comment these XML fragments:






                  <!-- Limit org.jgroups category to INFO -->




                  * Change the root category by changing this XML fragment:



                  <appender-ref ref="CONSOLE"/> <!-- you may have removed this earlier -->
                  <appender-ref ref="FILE"/>


                  to look like this




                  <appender-ref ref="CONSOLE"/> <!-- you may have removed this earlier -->
                  <appender-ref ref="FILE"/>


                  And finally, probably the most important thing in log4j, make sure you limit the logging level on your own class hierarchy. This assumes that you are using log4j as it was intended and not writing everything to System.out. This will significantly reduce the overhead of log4j and allow you to fully enjoy the benefits of calls like if (log.isDebugEnabled()).... If you don't do this then all the logging in your code will get formatted and passed to the appender, and the threshold on the appender will weed out the log messages. This can generate a significant amount of garbage. Assuming your java package starts with "a.b", add something like this to log4j.xml:


                  <!-- Limit a.b category to INFO -->




                  This can be added in the same area where you find the category filters for org.apache and org.jboss (see above).