1 Reply Latest reply on Sep 23, 2016 5:20 PM by James Perkins

    Jboss logging filter validation

    Roman K Newbie

      Hi, i have a question about logger Jboss.I use Jboss 6.4 EAP
      I want to write messages to file, only from some packages , like :

      17:56:41 ERROR [com.google.test] (http-/0.0.0.0:8080-5)

      Test message Google 

      17:56:41 ERROR [com.yaahoo.test] (http-/0.0.0.0:8080-5) Test message Yaahoo

       


      In my file i want to write only from package [com.google.test] , what I need to write to a standalone.xml . My version of filter doesn't work:

      <filter-spec value="not(match(&quot;[com.google.test]*&quot;))"/>

        • 1. Re: Jboss logging filter validation
          James Perkins Master

          If you only want to write one category to a specific file you just need to create a file-handler and a logger which you assign that file-handler to.

           

          Example:

          /subsystem=logging/file-handler=google-logs:add(append=true, autoflush=true, named-formatter=PATTERN, file={relative-to="jboss.server.log.dir", path="google.log"})

          /subsystem=logging/logger=com.google.test:add(level=INFO, handlers=[google-logs])

           

          If you don't want those logs to also go the console and the default server.log replace the last command with the following:

          /subsystem=logging/logger=com.google.test:add(level=INFO, handlers=[google-logs], use-parent-handlers=true)

           

          --

          James R. Perkins