You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tapajyoti Roybarman <ta...@tcs.com> on 2014/01/02 09:42:55 UTC
System.out.println statements not captured in catalina.out
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
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
Re: System.out.println statements not captured in catalina.out
Posted by Mark Eggers <it...@yahoo.com>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: System.out.println statements not captured in catalina.out
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Tapajyoti,
On 1/2/14, 3:42 AM, Tapajyoti Roybarman wrote:
> 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.
What is the "Tomcat console"?
Have you set swallowOutput="true" in any of your <Context> elements
(check CATALINA_BASE/context.xml,
CATALINA_BASE/conf/[engine]/[host]/[webapp].xml, and your web app's
META-INF/context.xml files)?
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBCAAGBQJSxaR2AAoJEBzwKT+lPKRYiFsP/1FPnbt+M4GUKfxiWzKgjS2Y
emckQi9Oxf+TU90iAFuo8mVEWIMUvr1+x0dGlsbHRhfzTbVSnjWi+j+g43IYTnrx
zPFVz7rW0Ibe5CPc/+ah0YahHIMDvaGd1ivN4TERLuxVBNuJwZrEBMy2B9o6SvIn
uJN2OeHi5/LlHhCV68TfNfp+gRVxZUb2bYihH838i+XEVtFf+yfAbJ6LQ1gxdm72
zjVvYKU8h/f95W/vjOlcDzBivih1uBIzAKTMBY4Zi7XIqNx65vgkFwHFQOkMaNxH
nWixwTzZibmrxufMJbo82D0gECKJ7vxzorwcE4Z7HPXae5kKgDjK6GUCamcy52hp
nq8pxBPpW04iSXc8AB3UMTAeWp7znFzbx9Ryey8B4NkQsz2/+BAwhIf4G4rT4w7d
bp7488GigUrECo7mQu/mnaJn5PtpsQ9pKS1s8E/5nh9qztrjWPMVJf9zCPXxrAV9
4sGSWNRV0WLjjuKedJzmbUH3JKqbIcmLNVuUkmw5m5/ut+zOjpW49Jc5c0pNRlT3
V7sAFXSIWGLeki+O5ZhOxKy1eFMdiUrEHD5mgufnQjfZyjnRthAT2c0/32zODSYD
by9rlAHpxI5GEpNAWHSVe+kYTsknfmXFUKsbOT5PDtk2q0gpUHFd+vZ6Bxltujkp
d714JrexPZ5jpQI1Sgto
=/A98
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org