6 Replies Latest reply on Feb 3, 2012 11:08 AM by dinocsc

    JBOSS 5.1 and jboss-log4j.xml

    dinocsc

      I am new to JBOSS and am trying to configure the jboss-log4j.xml file so that anything that goes to the console also goes to the server.log file.

       

      We have developers who cannot see the console in our QA environment and wish to see what some custom classes in their application is generating in terms of System.out.

       

      Yes I know the solution is to have no System.out statements and use only proper log4j statements in the code but we inherited a large legacy set of applications that contained alot of System.out statements and we are slowing updating all of them.

       

      We did this with our Tomcat 5.5.25 server with no issue but are migrating to JBOSS 5.1 and cannot get it to work.

       

      I thought that by default, out of the box install, anything sent to the console would also go to the server.log. This is not happening.

       

      Can someone provide me some clarification/direction?

       

      Thanks in advance.

        • 1. Re: JBOSS 5.1 and jboss-log4j.xml
          wdfink

          Simple test is to change the appender CONSOLE from target to file (as FILE is) and write to a separate file. If this will work and you 'normal' configuration not you should check the appender configuration.

          • 2. Re: JBOSS 5.1 and jboss-log4j.xml
            dinocsc

            We tried your suggestion but we got message that "File" is not valid for console appender. What is interesting is that one time without making any changes to the xml file, we saw messages going to console and to the server.log. We did a restart of JBOSS and then nothing was shown on the console display and therefore nothing went to server.log

             

            It seems we have an issue with the console appender not sending messages to console.

             

            Any idea?

            • 3. Re: JBOSS 5.1 and jboss-log4j.xml
              peterj

              Sorry for the edits on this post, but after rereading everything, I think that you need to post your jboss-logj4.xml file because we need to see what you did so that we can tell you how to correct it.

              • 4. Re: JBOSS 5.1 and jboss-log4j.xml
                wdfink

                Sorry, a bit unclear. What I meant is that you remove the appender CONSOLE and replace it by a copy of the FILE appender and rename the filename (i.e. console.log) and the appender name = CONSOLE.

                 

                The CONSOLE appender set a threshold INFO (no messages with more detail as INFO are logged to console)

                 

                In general, the CONSOLE and FILE appender are independent, if you never specify an appender except in the root-logger all will go to the declared appenders and filtered by the different appender.

                See the apache log4j documentation http://logging.apache.org/log4j/

                • 5. Re: JBOSS 5.1 and jboss-log4j.xml
                  dinocsc

                  No Problem Peter. Here is the xml file. We did not touch it. It is the default copy after install of JBOSS.

                  • 6. Re: JBOSS 5.1 and jboss-log4j.xml
                    dinocsc

                    Thanks for the clarification. I thought it was strange to add a "File" param to the Console appender config :-)

                     

                    I will give this a try.