4 Replies Latest reply on Jul 17, 2013 8:08 AM by Alexander Hoffmann

    Logging configuration, change level of a specific error

    Alexander Hoffmann Newbie

      Hey guys,

       

      I'm working with JBoss 6 and logging module 1.2 (<subsystem xmlns="urn:jboss:domain:logging:1.2">).

      I want to set the level of this specific log message from WARN to INFO because stackoverflow tells me that it's not really an error:

       

      17:22:39,078 WARN  [org.jboss.as.ee] (MSC service thread 1-7) JBAS011006: Not installing optional component org.springframework.web.context.request.async.StandardServletAsyncWebRequest due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.springframework.web.context.request.async.StandardServletAsyncWebRequest
      

       

      Ifound something about the "levelChange" here but I just can't make it work for me.

       

      Do you have any advise?

        • 1. Re: Logging configuration, change level of a specific error
          James Perkins Master

          Could you please clarify which version you're using? My guess would be JBoss EAP 6 from the subsystem namespace.

           

          If it's EAP 6 you could use a filter. I don't think you'll want the org.jboss.as.ee category level set to ERROR, but you could do that.

           

          To change the level you would do:

          If that category was not previously added

          /subsystem=logging/logger=org.jboss.as.ee:add(level=ERROR)
          

           

          If the category was previously added

          /subsystem=logging/logger=org.jboss.as.ee:write-attribute(name=level,value=ERROR)
          

           

          You could also use a filter. I would suggest adding filters to handlers rather than loggers as with loggers they're not inherited.

           

          To add a filter in EAP 6.1:

          /subsystem=logging/console-handler=CONSOLE:write-attribute(name=filter-spec,value=not(match("JBAS011006")))
          

           

          To add a filter to EAP 6.0:

          /subsystem=logging/console-handler=CONSOLE:write-attribute(name=filter,value={"not" => {"match" => "JBAS011006"}})
          

           

          You can do the same on the logger category org.jboss.as.ee too, but as I said handlers are generally better for filters. You can add the same filter to any handler as well.

           

          Note that all these CLI commands assume a standalone server, but the paths could be altered and would work on domain servers.

           

          --

          James R. Perkins

          2 of 2 people found this helpful
          • 2. Re: Logging configuration, change level of a specific error
            Alexander Hoffmann Newbie

            Hey James, thank you for your help.
            I use EAP 6.1.

             

            Can you tell me how to implement your solution in the standalone-full.xml? Or at least an example or link with more information about this topc.

            I just can't find a good documentation for configuring logging filters on the internet (I litterally spent a whole day on this yesterday).

             

            This is my situation right now (standalone-full.xml, JBoss EAP 6.1.0.GA):

             

             

            <subsystem xmlns="urn:jboss:domain:logging:1.2">
                        <console-handler name="CONSOLE">
                            <level name="INFO"/>
                            <!-- I added this filter to get rid of this log -->
                            <filter-spec value="not(any(match(&quot;JBAS015960.*&quot;), match(&quot;does not point to a valid jar for a Class-Path reference.*&quot;)))"/>
                            
                            <formatter>
                                <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                            </formatter>
                        </console-handler>
                        <periodic-rotating-file-handler name="FILE" autoflush="true">
                            <!-- same here. I don't want it to appear in the server.log, too -->
                            <filter-spec value="not(any(match(&quot;JBAS015960.*&quot;), match(&quot;does not point to a valid jar for a Class-Path reference.*&quot;))), levelChange(&quot;INFO&quot;)/>
                            
                            <formatter>
                                <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                            </formatter>
                            <file relative-to="jboss.server.log.dir" path="server.log"/>
                            <suffix value=".yyyy-MM-dd"/>
                            <append value="true"/>
                        </periodic-rotating-file-handler>
                        <logger category="com.arjuna">
                            <level name="WARN"/>
                        </logger>
                        <logger category="org.apache.tomcat.util.modeler">
                            <level name="WARN"/>
                        </logger>
                        <logger category="org.jboss.as.config">
                            <level name="DEBUG"/>
                        </logger>
                        <logger category="sun.rmi">
                            <level name="WARN"/>
                        </logger>
                        <logger category="jacorb">
                            <level name="WARN"/>
                        </logger>
                        <logger category="jacorb.config">
                            <level name="ERROR"/>
                        </logger>
                        <root-logger>
                            <level name="INFO"/>
                            <handlers>
                                <handler name="CONSOLE"/>
                                <handler name="FILE"/>
                            </handlers>
                        </root-logger>
            </subsystem>
            

             

            I added a filter-spec in line 5 and 13. But I need more filters like the one I mentioned in the first post which changes the level of JBAS011006 from WARN to INFO.

             

            I aprpeciate any help.

            • 3. Re: Logging configuration, change level of a specific error
              James Perkins Master

              There is some documentation here https://docs.jboss.org/author/display/AS72/Logging+Configuration#LoggingConfiguration-FilterExpressions. One thing I do notice in your filter expression is the spaces between the comma delimited filters might be an issue. I can't remember off the top of my head though.

               

              The trick for will be just getting the right expression together. There is a levelChange filter that would have to be used in conjunction with a match filter. Just not sure on the exact order with all the others.

               

              --

              James R. Perkins

              • 4. Re: Logging configuration, change level of a specific error
                Alexander Hoffmann Newbie

                The trick for will be just getting the right expression together. There is a levelChange filter that would have to be used in conjunction with a match filter. Just not sure on the exact order with all the others.

                Hi,

                the trick is to find out how to use those filters at all since the documentation is pretty bad right now (no examples).

                 

                I found out how to combine match and levelchange and here is my solution for this specific problem:

                 

                In added a new handler in the standalone-full.xml.

                The CONSOLE handler removes some logs which I don't need. The new CONSOLELEVELCHANGE handler however adds the JBAS011006 log to the console but it changes the level from WARN to INFO first. If I don't remove the JBAS011006 in the first handler, I will get two JBAS011006 logs. One with the level WARN from the frist handler and one with the level INFO from the second handler.

                I also did the same for the file handler (not shown here).

                 

                <console-handler name="CONSOLE">
                                <level name="INFO"/>
                                <filter-spec value="not(any(match(&quot;JBAS015960.*&quot;),match(&quot;JBAS011006.*&quot;)))"/>
                                <formatter>
                                    <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                                </formatter>
                            </console-handler>
                
                <!-- new Handler -->
                <console-handler name="CONSOLELEVELCHANGE">
                                <level name="WARN"/>
                                <filter-spec value="all(match(&quot;JBAS011006.*&quot;),levelChange(INFO))"/>
                                <formatter>
                                    <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                                 </formatter>
                </console-handler>
                
                ...
                
                <root-logger>
                                <level name="INFO"/>
                                <handlers>
                                    <handler name="CONSOLE"/>
                                    <handler name="CONSOLELEVELCHANGE"/>
                                </handlers>
                            </root-logger>
                

                 

                I am an intern, I have few experience with JBoss, so there might be a better way to do this.