4 Replies Latest reply on Jan 13, 2004 9:42 AM by jae

    how to toggle logging

    jae Master

      i'm confused as to what the appropriate settings are to get log4j to output only debug information for my code and info messages for the rest of nukes.

      i see package/class names that look like this for debug messages: class org.jboss.nukes.common.template.TemplateBuilder.0

      and package/class names like this: org.jboss.nukes.common.template.TemplateLoader for info

      what would a proper log4j configuration look like? is there anyway to just have all logging levels function the same? (i imagine this would take some refactoring of how the logger is obtained, but backwards compatibility could be maintained).

      i'm trying to get a better understanding of the code base and why things are the way they are, as i'd like to hopefully become a regular contributer to the project.


        • 1. Re: how to toggle logging

          mine is to enabled DEBUG on org.jboss.nukes and on the CMP layer to see the JDBC statements emitted by the CMP EJBs :

          1/ look for the appender CONSOLE and move its Threshold param to DEBUG

          2/ add org.jboss category with priority INFO

          3/ add org.jboss.nukes with priority DEBUG

          4/ add org.jboss.ejb.plugins.cmp with priority DEBUG

          • 2. Re: how to toggle logging
            jae Master

            i've done that, but i end up getting some nasty debug output for what looks to be some kind of template.

            the class name for these debug statements looks like this:

            class org.jboss.nukes.common.template.TemplateBuilder.6

            and turning the priority to INFO for org.jboss.nukes does not seem
            to remove the output statements.

            also, i notice for my debug statements, the category being used is the
            mbean name, and not the class name. tracking back thru the code, i see that the mbean name (or the name i specify for a hot create) is what is passed to the AbstractMBean constructor.

            i may be missing something, but doesn't' that create a whole seperate category that is completely seperate from the class name, thus forcing me to have to have a category in my log4j conf file that is specific for that insteance?

            • 3. Re: how to toggle logging


              "cooper" wrote:
              you should maybe set the category org.jboss.nukes.common
              to priority INFO in that case.

              yes these are the templates compiled by the template engine.

              they are in debug logs so it should not be a pain

              • 4. Re: how to toggle logging
                jae Master

                ok - i was a little confused by the console vs server.log output - and just noticed that the console output chops off most of the package name, so i'm now straight on that issue.

                as for the template debug, the standard categories do not seem to work when it comes to turning off the output. i just tried this category, and it seems to have corrected the problem.

                it seems as if the pattern won't be matched unless the "class" is prefixed to the package/class name string. after doing some hunting through the code, it seems that the method Object::getClass() prefixes the the actual class name w/ the string "class". (the getClass() method is invoked by the TemplateRepository class when requesting the logger).