In this demonstration we will see how to configure use the log filtering feature of JBoss AS7.1.2 in order to prevent some of the log messages (containing a specific words) to not to appear in the logs. Many times it is desired to avoid displaying some WARN Messages or some INFO messages which appears in log but we dont want to see them in the logs.

02:22:28,652 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 32) JBAS016200: Activating ConfigAdmin Subsystem
02:22:28,660 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 37) JBAS010280: Activating Infinispan subsystem.
02:22:28,669 INFO  [org.jboss.as.jacorb] (ServerService Thread Pool -- 38) JBAS016300: Activating JacORB Subsystem
02:22:28,733 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 49) JBAS011906: Activating OSGi Subsystem
02:22:28,736 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 54) JBAS013101: Activating Security Subsystem
02:22:28,761 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 58) JBAS015537: Activating WebServices Extension
02:22:28,765 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 48) JBAS011800: Activating Naming Subsystem
02:22:28,773 INFO  [org.jboss.as.security] (MSC service thread 1-7) JBAS013100: Current PicketBox version=4.0.9.Final
02:22:28,782 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.11.Final)
02:22:28,844 INFO  [org.jboss.as.naming] (MSC service thread 1-8) JBAS011802: Starting Naming Service

Now suppose if we want to filterout all the messages in the log which has following JBoss message codes like “JBAS016200”, “JBAS010280”, “JBAS016300”, “JBAS011906”, “JBAS013101”, “JBAS015537” then we can achieve it by simply adding a “not” filter inside our JBoss configuration file like “standalone-full.xml” inside the logging subsystem as following:

            <periodic-rotating-file-handler name="FILE">

                        <match pattern="JBAS016200|JBAS010280|JBAS016300|JBAS011906|JBAS013101|JBAS015537"/>

                    <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                <file relative-to="jboss.server.log.dir" path="server.log"/>
                <suffix value=".yyyy-MM-dd"/>
                <append value="true"/>

Now after restarting the JBossAS 7.1.1 or AS 7.1.2 try to search any of the mentioned keywrd in the logs “JBAS016200”, “JBAS010280”, “JBAS016300”, “JBAS011906”, “JBAS013101”, “JBAS015537” , If you wont find it there it means your log filter is working fine. for example now the first few lines of your server.log may be as following without any of the above messages:

02:33:40,438 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-8) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.11.Final)
02:33:40,448 INFO  [org.jboss.as.security] (MSC service thread 1-2) JBAS013100: Current PicketBox version=4.0.9.Final
02:33:40,452 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 48) JBAS011800: Activating Naming Subsystem
02:33:40,500 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
02:33:40,527 INFO  [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service
02:33:40,540 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-5) JBAS015400: Bound mail session [java:jboss/mail/Default]
02:33:40,572 INFO  [org.jboss.jaxr] (MSC service thread 1-8) JBAS014000: Started JAXR subsystem, binding JAXR connection factory into JNDI as: java:jboss/jaxr/ConnectionFactory

Thanks 🙂
MiddlewareMagic Team

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.