Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
595 views
in Technique[技术] by (71.8m points)

logging - Where does system.out.println print from a JSP?

Where does tomcat put the System.out.println output ?

I'm not interested in out.println. I'm using a system that uses system.out to log issues, like login success/fail, and I need to look to that generated "log".

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It usually prints to catalina.out.

It is highly unrecommended to log using system.out.println() from several reasons:

  • you cannot control which messages are logged and which aren't unless you change the code
  • catalina.out just grow all the time, and you cannot move it so that tomcat will create another one.

A better solution is to use one of the popular (and mature) logging frameworks:

A good solution which is backed by log4j, is to use Jakarta's log tag library, where you can have your logging messages in any of this forms

<log:info message="this is a message"/>

<log:info category="foo.bar" message="this is a message"/>

<log:info category="foo.bar">
  this is a message
</log:info>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...