You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jay Wright <jw...@once.com> on 2002/03/01 18:48:37 UTC

Logging

Using Tomcat 4, I am trying to accomplish writing logs (preferrably via
System.out and System.err) that have a timestamp on each and every write.
Iplanet and JavaWebServer did this automatically.  It is important to write
to these logs and have them timestamped, WITHOUT writing code that is in any
way web-server specific.

What I have learned about Tomcat 4 logging is this:  All System.out and
System.err print statements go by default to the catalina.out file.  Each
<context> within tomcat can be written to a specific file via the <logger>
component.  

There are a couple of "questions" that I'm trying to understand.

First - can the catalina.out file be configured through tomcat components
such that all System.out and System.err entries are timestamped.  

Two - What are the api calls to write to the <logger> file and can I
specifiy the verbosity (the level of the entry 0-4) with each entry?

I'm hesitant to use the <logger> since I'm unfamiliar with whether or not
that code would be portable to other web servers?

Thanks,
Jay

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Logging

Posted by Markus Spath <ms...@arcor.de>.

Jay Wright wrote:

...
> 
> I'm hesitant to use the <logger> since I'm unfamiliar with whether or not
> that code would be portable to other web servers?
> 



have a look at log4j !

anyway, configurations in tomcat wouldn't break your code either.

markus






--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Logging

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 1 Mar 2002, Jay Wright wrote:

>
> First - can the catalina.out file be configured through tomcat components
> such that all System.out and System.err entries are timestamped.
>

You can configure a <Logger> that uses the SystemOutLogger or
SystemErrLogger with timestamp="true", and anything logged there by Tomcat
(or your application calling the getServletContext().log() method) will be
timestamped.  However, this won't affect any output that is directly
written with things like System.out.println().

> Two - What are the api calls to write to the <logger> file and can I
> specifiy the verbosity (the level of the entry 0-4) with each entry?
>

>From within your application, anything you write via the
HttpServlet.log() or ServletContext.log() methods is written directly to
the <Logger> associated with your web application (with optional
timestamps if you have asked for it).  There is no provision through the
servlet API to set verbosity levels, however.

> I'm hesitant to use the <logger> since I'm unfamiliar with whether or not
> that code would be portable to other web servers?
>

Basic rule - *nothing* in server.xml is portable, but *everything* in your
own web.xml is portable.

> Thanks,
> Jay
>

Craig


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>