1 Reply Latest reply on Jul 27, 2003 11:29 AM by harlequinn

    Servlet Logging

    tom.purvis

      I'm transitioning from working with tomcat (doing plain servlet/jsp work) to jboss. I'm pretty familiar with tomcat, and I chose to start working with the integrated tomcat/jboss setup (jboss-3.2.1_tomcat-4.1.24).

      Today, I'm making some progress toward my first servet that's a client to an EJB, but of course I've hit some coding stumbles. I tried to log some debug information, then realized that my servlet isn't logging anywhere.

      So I need to put a Logger into the webapp context in server.xml. Oh, but wait, there is no server.xml. The integrated tomcat that came with JBoss doesn't have a server.xml.

      Hmm. So how do I wire up a logger for my servlet? I don't know--I've searched google, searched my jboss docs, and I'm not getting anywhere. There's lots of information about how log4j is really great, and I should use it.

      Fine. I'll use it. But I don't want to write any custom logging code, I just want the standard log() methods in the servlet api to actually output to somewhere. How do I do this? Edit web.xml or jboss-web.xml? How? Dunno, it doesn't seem to be discussed anywhere.

      Perhaps I'm just impatient, because I was making progress on figuring out how to utilize J2EE better, but now I've got to wallow around trying to figure out how to log from my danged servlet. Easy with tomcat. Should just be a detail. But I've been dicking around with it now for a couple hours. HELP!

        • 1. Re: Servlet Logging
          harlequinn

          *bump* Has this been answered? I have a working servlet app but seems my System.out.println commands as well as my getServletContext().log() commands are not output anywhere and I don't see how to make them visible.

          I am running JBOSS 3.2.1 with default log4j.xml. I have checked console, system out log, server log, and they are simply not shown. I tried setting console and file loggers to INFO, DEBUG, and TRACE, but they didn't help.

          Am I missing something obvious? I need an easy way to output debug values from the servlet so I know what's happening. Anyone have a clue on how to make this happen?

          It works on standalone Tomcat with no effort.