On 1/2/2014 12:42 AM, Tapajyoti Roybarman wrote:
Hi,

I need to record all debug statements (System.out.println("xyz")) from my
application in catalina.out log. When I start Tomcat it creates the log
file and only records statements till the server startup. But after that,
none of the System.out.println() statements present in my JSPs get
recorded in catalina.out file. Though I can see these statements in the
Tomcat console.

Tomcat Version : apache-tomcat-7.0.27

OS : Windows 7

I am attaching few files which might be of some help.

logging.properties --> present in tomcat/conf

catalina.2013-12-31.log --> example, so that you can see what gets
generated. Present in tomcat/logs

log4j.properties --> present in tomcat/webapps/myapp/WEB-INF/classes



I have seen the documentation present in
http://tomcat.apache.org/tomcat-7.0-doc/logging.html But, the problem is
that I can only use the default configuration (JULI). I cannot go for any
other option. So, I need to find out a way using my current configuration
only.

Thanks in advance.

Best Regards,
Tapajyoti

Tapajyoti,

The list strips attachments, so they didn't come through. If you need to send information to the list, it's best to either post it up on something like pastebin (if it's huge) or include it inline if it's not. Most people prefer inline.

That said, are you in control of the applications? Can you make source code changes? If so, don't use System.out.println() as your error mechanism.

Use something like log4j, with / without commons logging or slf4j. Write the appropriate configuration file, and direct all of your logging from the application to that file.

You can do this for all aspects of your application (JSP, servlets, listeners, filters, plain old java objects).

Opinion:

IMHO there's hardly ever any reason to set up logging in a JSP. Logging is usually required when you're doing model or controller work (which belongs in POJOs or servlets) in the view component (JSP). Don't do this. At the very least wrap this logic up in beans, and place the logging there. It's also easier to test that way.

. . . just my two cents
/mde/



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to