5 Replies Latest reply on Apr 26, 2012 10:24 AM by jamezp

    Logging output manipulation after the logline creation

    kristjan273

      Hi,

       

      how would I achieve manipulation of loglines output in as7(7.1.1.Final) after the log is produced. Eg. I would like to manipulate output of AsyncHandler by defining/configuring the subhandler properly.

       

      At most I would like to limit (or filter) the stacktrace(s). I see the docs https://docs.jboss.org/author/display/AS71/Subsystem+configuration for the filter posibility but have some trouble understanding the proper usage.

      Or should I write some custom handler. Also I used to live some time in the past by using log4j's formatter pattern for %throwable{n}.

       

       

      Any suggestions or hint(s)?

       

      Thank you in advance,

      A

        • 1. Re: Logging output manipulation after the logline creation
          jamezp

          Do you just want to remove the stacktrace from being printed? If so, just remove the %E in the pattern.

          • 2. Re: Logging output manipulation after the logline creation
            kristjan273

            No, exactly as said, limit or filter out the stack trace. Something like http://nurkiewicz.blogspot.com/2012/03/filtering-irrelevant-stack-trace-lines.html .

            I used to live with log4j %throwable{n}, but now I want move towards jboss logging framework.

            • 3. Re: Logging output manipulation after the logline creation
              jamezp

              It seems like %throwable{n} just prints n lines from the stack trace. It sounds more like you want a filter though. You could probably use the match filter along with a not filter.

               

              This example will not print any message that contains JBAS or JNDI to the console:

                          <console-handler name="CONSOLE">
                              <level name="INFO"/>
                              <formatter>
                                  <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
                              </formatter>
                              <filter>
                                  <not>
                                      <match pattern=".*JBAS"/>
                                      <match pattern=".*JNDI"/>
                                  </not>
                              </filter>
                          </console-handler>
              
              

               

              Is that more what you're looking for?

              1 of 1 people found this helpful
              • 4. Re: Logging output manipulation after the logline creation
                kristjan273

                Yes, very close to what I want. Do you know an option to also limit the filtered stack to eq. 3 lines only?

                 

                And maybe, are you able to explain what other filter instructions do - like "all","any","accept","change-level","deny","level","level-range","match","not","replace". ?

                 

                Otherwise, tnx on the helpful answer!

                • 5. Re: Logging output manipulation after the logline creation
                  jamezp

                  There is no way to cut-down the stack trace. You can either print it or not.

                   

                  There isn't much information on what the levels do. Well, there is some if you execute /subsystem=logging/logger=*:read-resource-description from CLI. Actually if you have AS 7 running you could run $JBOSS_HOME/bin/jboss-cli.sh --connect "/subsystem=logging/logger=*:read-resource-description" >> /home/user/somefile.txt to write it out to a file. It's probably not the greatest documentation, but it could be useful. The documentation will be updated soon hopefully.