3 Replies Latest reply on Jan 13, 2012 7:29 AM by Wolf-Dieter Fink

    Log4j and JBOSS 7.x

    Noa Drach Novice

      Hello,

       

      I have 2 questions:

       

      1. is the aproach described in this discussion http://community.jboss.org/thread/154993 is still valid in AS7 for application specific logging? --> jboss-logging.xml file in your deployment META-INF directory
      2. in case i take this aproach, is there a way to control my application logging from the admin console the same way i can control the jboss logging

       

      i would appereciate pointers to already exisitng discussions, i just didn't find them

       

      Thanks,

      Noa

        • 1. Re: Log4j and JBOSS 7.x
          Wolf-Dieter Fink Master

          No, AS7 is different.

           

          1)

          Have a look into the standalone.xml or domain.xml depend on what you use.

          See the subsystem 'logging' here you will find the settings.

           

          2)

          This is very simple

          try localhost:9990 in your browser

          Klick on Profile (right upper corner) and select 'core' loggers' from the tree on the left.

          Here you are able to change the logging configuration on-the-fly and the changes are persistent in AS7

          • 2. Re: Log4j and JBOSS 7.x
            Daniel Straub Newbie

            Where can I find more details about the used pattern layout etc ? I guess (and tried) is it similar to log4j pattern layout.

             

            But what is the layout to show a exception in the jboss-as code ?

            For e.g. I try to find some errors during a web app login. In the "SecurityContextAssociationValve" is a statement like this :

             

            log.debugf("Failed to determine servlet", e);

             

            (in my case it was a NullpointerException), but the exception stacktrace is not shown


            Here my logger configuration in standalone.xml

             

                        <console-handler name="DEBUG-CONSOLE">

                            <level name="TRACE"/>

                            <formatter>

                                <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%C.%M:%L] (%t)  %s%E%n"/>

                            </formatter>

                        </console-handler>

                        ...

             

                        <logger category="org.jboss.web" use-parent-handlers="false">

                            <level name="TRACE"/>

                            <handlers>

                                <handler name="DEBUG-CONSOLE"/>

                            </handlers>

                        </logger>

                        <logger category="org.jboss.as.web" use-parent-handlers="false">

                            <level name="TRACE"/>

                            <handlers>

                                <handler name="DEBUG-CONSOLE"/>

                            </handlers>

                        </logger>

             


            Any ideas how to configure the logger ?


            • 3. Re: Log4j and JBOSS 7.x
              Wolf-Dieter Fink Master

              Not nice

               

              For the pattern you might see the apache log4j documentation (API doc PatternLayout).

              But I suppose it will not help.

               

              You might add a category org.jboss.as.web with DEBUG to see more details.

              Otherwise it might only help to change the statement to log.debugf(e,"Failed to determine servlet"). In that case the Exception is logged with the complete stacktrace.