8 Replies Latest reply on Jan 17, 2007 12:14 AM by smokingapipe

    Stupid problem: no logging period for an EAR file

    smokingapipe

      I have a server that has two virtual hosts with two EAR files on it. I get absolutely NO logging information from them. I don't get notified when they deploy. I'm looking at the JBoss console, and even when these apps do "System.out.println()", nothing shows up. I use java.util.logging.Logger.severe() and nothing shows up. All the logging (and System.out itself) are just going into a black hole.

      Is there some solution to this? I'm going out of my mind because I can't even get the most basic logging information to trace which parts of my code are running and which are not. I'm totally in the dark and am reduced to using tcpflow to try to get clues about what's happening.

        • 1. Re: Stupid problem: no logging period for an EAR file
          smokingapipe

          Btw this is with JBoss 4.0.5.

          • 2. Re: Stupid problem: no logging period for an EAR file
            smokingapipe

            I tried putting this:

             <Logger className="org.jboss.web.tomcat.Log4jLogger"
             verbosityLevel="INFO"
             category="org.jboss.web.localhost.Engine" />
            

            in the web server.xml file for JBoss and that made the whole thing fail.

            Hmm, surely logging is possible for applications in JBoss? I just want to do the obvious things: if there is an uncaught exception, log it, and also be able to say logger.severe("somethign happened"). This shouldn't be brain surgery here...


            • 3. Re: Stupid problem: no logging period for an EAR file
              smokingapipe

              I looked at the jmx-console and looked at the log4j mbean, and set the CatchSystemErr and CatchSystemOut to false, and that didn't seem to change anything. The one thing that does work is (Java 6) System.console().printf(). That cannot be redirected at all from within Java. Unfortunately if I want to see exception traces using that I still need to use try / catch blocks, AND it won't do me any good for looking at exceptions that occur outside my code.

              The other alternative is to run a totally separate JBoss instance on another port and don't use virtual hosts at all.

              But this all seems absurd. JBoss is such an advanced product, there must be some way to log exceptions and use virtual hosts.

              • 4. Re: Stupid problem: no logging period for an EAR file
                smokingapipe

                And apparently I'm not the only one who is getting this "there are no logs" problem when using virtual hosts in JBoss:

                http://osdir.com/ml/log4j-user@logging.apache.org/msg07435.html//osdir.com/ml/log4j-user@logging.apache.org/msg07435.html

                • 5. Re: Stupid problem: no logging period for an EAR file
                  smokingapipe

                  And I set my log4j.xml file to:

                  <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
                  
                   <appender name="console" class="org.apache.log4j.ConsoleAppender">
                   <param name="Target" value="System.out"/>
                   <layout class="org.apache.log4j.PatternLayout">
                   <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
                   </layout>
                   </appender>
                  
                   <root>
                   <priority value ="info" />
                   <appender-ref ref="console" />
                   </root>
                  
                  </log4j:configuration>
                  


                  which should log everything above info level. All my log messages are at "severe" level. None of them show up.

                  I think this is a bug in JBoss.


                  • 6. Re: Stupid problem: no logging period for an EAR file
                    smokingapipe

                    On a whim, I was looking around, and saw the server/default/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml file. I edited that file and changed:

                    <attribute name="FilteredPackages">javax.servlet,org.apache.commons.logging</attribute>


                    to:

                    <attribute name="FilteredPackages">javax.servlet,org</attribute>


                    and restarted and it WORKED in the sense that I suddenly saw a ton of web app log messages. But what didn't work is that I now got class loader violations because it was trying to load commons logging twice. Not good.

                    But this is progress. It tells me that I might be able to succeed by purging my application of any classes in org.apache.commons.logging and then changing that attribute.


                    • 7. Re: Stupid problem: no logging period for an EAR file
                      smokingapipe

                      Any ideas? Surely I'm not the first person to notice this?

                      • 8. Re: Stupid problem: no logging period for an EAR file
                        smokingapipe

                        Problem solved: One of the webapps deployed on that JBoss installation was doing something insane to the logging system and stopped it from logging anything.

                        It would be ideal if there were some mechanism that would block webapps from misbehaving like that. Anyway, that was the problem. The offending app was the Claros email system.