6 Replies Latest reply on Apr 23, 2012 5:11 AM by Hauke Gulich

    Logging in different files for specified packages with AS 7

    Hauke Gulich Newbie

      Hello everyone,

       

      I know that it is possible to write some logging information comming from a specified package to a file but I don't know how to enter that in the standalone.xml.

       

      I didn't change anything up to now to the standalone.xml.

       

      What I want is:

       

      log/server.log should have all log informations without the package de.hauke.server.jms.*

      log/jms.log should have all log information from the package above (and only those).

       

      The console should also show all information without the package.

       

       

       

      Thanks a lot,

      Hauke

        • 1. Re: Logging in different files for specified packages with AS 7
          Wolf-Dieter Fink Master

          Edit standalone.xml subsystem ==   <subsystem xmlns="urn:jboss:domain:logging:1.1">

           

          Search the "<periodic-rotating-file-handler name="FILE"> and copy the whole element, rename the handler-name and the file's path.

          Add a new <logger category="de.hauke.server.jms" use-parent-handlers="false"> and add only the handler section with your handler (name that you give ...).

          You must add use-parent-handlers because the default is that all handlers of root-logger are added.

           

          This should work.

          1 of 1 people found this helpful
          • 2. Re: Logging in different files for specified packages with AS 7
            Hauke Gulich Newbie

            Thank you very much. That helped. Now I have the jms.log with the jms logging.

             

            What I now need is to exclude this category from the console appender.

             

            But first step works!

             

            Thanks again :-)

            • 3. Re: Logging in different files for specified packages with AS 7
              Wolf-Dieter Fink Master

              If you set use-parent-handlers="false" and add only the new FILE handler, as described above, it should not log to console (if you still not change other elements of the logging configuration.

              • 4. Re: Logging in different files for specified packages with AS 7
                Hauke Gulich Newbie

                Here is my complete standalone xml part containing the logging

                {code:xml}

                <subsystem xmlns="urn:jboss:domain:logging:1.1">

                <console-handler name="CONSOLE" autoflush="true">

                <level name="INFO"/>

                <formatter>

                <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-8p [%-35.35c] | %s%E%n"/>

                </formatter>

                </console-handler>

                <periodic-rotating-file-handler name="FILE" autoflush="true">

                <level name="INFO"/>

                <formatter>

                <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-8p [%-35.35c] | %s%E%n"/>

                </formatter>

                <file relative-to="jboss.server.log.dir" path="server.log"/>

                <suffix value=".yyyy-MM-dd"/>

                <append value="true"/>

                </periodic-rotating-file-handler>

                <periodic-rotating-file-handler name="JMSLogging" autoflush="true">

                <level name="INFO"/>

                <formatter>

                <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-8p [%-35.35c] | %s%E%n"/>

                </formatter>

                <file relative-to="jboss.server.log.dir" path="jms.log"/>

                <suffix value=".yyyy-MM-dd"/>

                <append value="true"/>

                </periodic-rotating-file-handler>

                <logger category="com.arjuna">

                <level name="WARN"/>

                </logger>

                <logger category="org.apache.tomcat.util.modeler">

                <level name="WARN"/>

                </logger>

                <logger category="sun.rmi">

                <level name="WARN"/>

                </logger>

                <logger category="de.hauke.server.jms" use-parent-handlers="false">

                <level name="DEBUG"/>

                <handlers>

                <handler name="JMSLogging"/>

                </handlers>

                </logger>

                <root-logger>

                <level name="INFO"/>

                <handlers>

                <handler name="CONSOLE"/>

                <handler name="FILE"/>

                </handlers>

                </root-logger>

                </subsystem>{code}


                Sorry that the file isn't formatted, but the formatting is always lost in this forum.

                 

                The stange thing is, if I put

                 

                use-parent-handlers="false"

                 

                behind <logger category="de.hauke...." use-parent-handlers="false">, after starting JBoss, this attribute is gone. Seems to be at the wrong position?

                 

                Thanks,

                Hauke

                • 5. Re: Logging in different files for specified packages with AS 7
                  Wolf-Dieter Fink Master

                  For me it works with "logging:1.1".

                  I've tested with AS7.1.1.Final.

                  What version do you use, maybe it is a resolved bug ....

                  • 6. Re: Logging in different files for specified packages with AS 7
                    Hauke Gulich Newbie

                    I am working with AS 7.0.2

                     

                    I will try tonight with 7.1.1.Final.

                     

                     

                    Hopefully my application sill works with 7.1.1 :-)