3 Replies Latest reply on May 6, 2013 1:39 PM by jamezp

    Logging configurations with custom handlers & custom formatting

    newway

      Hello,

       

      I am looking for a place where there is some documentation of the logging capabilities in AS 7.1 - I didn't find it so far

       

      basically I was working with log4j.xml that was located in an external folder - from what I managed to read around it looks like I will need to incorporate my logging configurations into standalone.xml and I have the following questions:

       

      1. How do I incorporate log4j appender there? can someone refer me to some example snippet?
      2. I need to write message to the log with their UTC value - I created a UTCPatternLayout that extends org.apache.log4j.Layout - is it possible to use it with jboss logging?
      3. I have a custom appender that uses a datasource to log messages into the DB - is there something equivalent in jboss logging?

       

      I know there is a mixture of areas here but I am just trying to understand all my options

       

      thanks,

      Noa

        • 1. Re: Logging configurations with custom handlers & custom formatting
          jamezp

          Noa,

          It's still a work in progress, but you can find the logging documentation at https://docs.jboss.org/author/display/AS71/Logging+Configuration.

          1. How do I incorporate log4j appender there? can someone refer me to some example snippet?

          We do not use log4j in JBoss AS7 therefore currently appenders are not supported. We are working on a solution to be able to use a log4j configuration on a per deployment basis.

           

           

          2. I need to write message to the log with their UTC value - I created a UTCPatternLayout that extends org.apache.log4j.Layout - is it possible to use it with jboss logging?

          In JBoss AS7 we are using the PatternFormatter from JBoss Log Manager which will parse log4j patterns. You would want to use the %z{utc} option. See below for an example.

          %z{utc}%d{yyyy-dd-MM HH:mm:ss,SSS} %-5p [%c] %s%E%n
          

           

           

          3. I have a custom appender that uses a datasource to log messages into the DB - is there something equivalent in jboss logging?

          There is no handler that does that be default, though one could be written. JBoss Log Manager uses java.util.logging.Handler's. That is where you would use a custom handler on the standalone.xml.

           

          HTH,

          --

          James R. Perkins

          1 of 1 people found this helpful
          • 2. Re: Logging configurations with custom handlers & custom formatting
            bhushanraja

            James,

             

            Does the custom logging handler (email) in JBOSS has a email throttle feature where we can limit the email alerts?

             

             

            Thanks,

            JK

            • 3. Re: Logging configurations with custom handlers & custom formatting
              jamezp

              A custom logger will set properties on the handler so it's not up to the custom handler what is allowed to be set. If the email handler you're using allows you to limit the alerts, then sure.

               

              --

              James R. Perkins