You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Shapira, Yoav" <Yo...@mpi.com> on 2003/08/01 18:57:30 UTC

RE: Servlets & JSPs log to different files

Howdy,

>What is standard/recomended approach to getting my servlets and JSPs to
log
>to
>the same file.
>
>I am currently using the context logger in server.xml as follows:
>
><!-- ActionItems Context -->
><Context path="/ai" docBase="ai" debug="0" reloadable="true"
>crossContext="true">
><Logger className="org.apache.catalina.logger.FileLogger"
prefix="ai_log."
>suffix=".txt" timestamp="true"/>
></Context>
>
>My JSP logs into /var/log/tomcat/ai_log.2003-08-01.txt
>But my servlets log into /var/log/tomcat/catalina.out

How are you logging in your servlets?  Are you using
System.out/System.err?  If so, don't use them, and instead use the
ServletContext#log(..) methods.  Output from the servlet context log
methods will end up in your context logger, ai_log... above.

Alternatively, use a logging kit like log4j and have both your JSPs and
servlets use it.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged.  This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender.  Thank you.


Re: Servlets & JSPs log to different files

Posted by Rick Roberts <te...@ait-web.com>.
> 
> 
> How are you logging in your servlets?  Are you using
> System.out/System.err?  If so, don't use them, and instead use the
> ServletContext#log(..) methods.

Actually, they are mostly beans with no ServletContext :(

-- 
*******************************************
* Rick Roberts                            *
* Advanced Information Technologies, Inc. *
*******************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Servlets & JSPs log to different files

Posted by Rick Roberts <te...@ait-web.com>.
> 
> 
> How are you logging in your servlets?  Are you using
> System.out/System.err?  If so, don't use them, and instead use the
> ServletContext#log(..) methods.

Actually, they are mostly beans with no ServletContext :(

-- 
*******************************************
* Rick Roberts                            *
* Advanced Information Technologies, Inc. *
*******************************************