You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Craig R. McClanahan" <Cr...@eng.sun.com> on 2000/09/26 01:04:07 UTC

Re: What is the best way to redirect System.out in my servlets running under Tomcat?

Amandeep Jawa wrote:

>
> 1) redirecting stdout from my tomcat launch script:
> $TOMCAT_HOME/bin/startup.sh >tomcat.log 2>tomcat.err
>

What's your problem with this one?  That's what I do all the time to redirect
standard output, and the ">tomcat.log" part works on Windows platforms as well.
The Tomcat 4.0 milestone 1 startup scripts, for example, do this by default.

Craig McClanahan


====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Re: What is the best way to redirect System.out in my servlets running under Tomcat?

Posted by Pierre Neihouser <pi...@lionet.ie>.
Amandeep Jawa wrote:

> Craig (& everyone)
>
> I have no real problem with having to re-direct - it just seems like it
> should be in a configuration rather than require a change to a shell
> script - shell scripts aren't truly portable and that is what configuration
> files are for....

There is something I son't really understand:

You said that you redirect the standard error stream to the standard output
one in your code.
When you use this command:

tomcat.sh >tomcat.log 2>tomcat.err (or something like this)

you basically redirect the standard output and error to tomcat.log AND you
redirect the standard error to tomcat.err.  So if I understand what's going
on, you should have the standard errors in tomcat.err AND tomcat.log.  Is this
what you want to do ? (BTW standard output redirection is "1>").  Now, what
happens if you take your code
doing the redirection of err to out out of your servlets?  I suspect nothing
because you are already doing this with ">tomcat.log".

What do you think?

--
Pierre


Re: What is the best way to redirect System.out in my servlets running under Tomcat?

Posted by Amandeep Jawa <de...@imagelock.com>.
Craig (& everyone)

I have no real problem with having to re-direct - it just seems like it
should be in a configuration rather than require a change to a shell
script - shell scripts aren't truly portable and that is what configuration
files are for....

Even with doing the redirect in the shell command, I STILL have to add the
System.setOut(System.err);
to my code which is what I really don't like because a) I have to change
code, b) it
seems that now I've reconfigured the JVM & thus other java apps will have
stderr = stdout & c) there is no really good place in my code to call
System.setOut(System.err);


Hence my quest for a better solution - any ideas?

'deep


----- Original Message -----
From: "Craig R. McClanahan" <Cr...@eng.sun.com>
To: <to...@jakarta.apache.org>
Sent: Monday, September 25, 2000 4:04 PM
Subject: Re: What is the best way to redirect System.out in my servlets
running under Tomcat?


> Amandeep Jawa wrote:
>
> >
> > 1) redirecting stdout from my tomcat launch script:
> > $TOMCAT_HOME/bin/startup.sh >tomcat.log 2>tomcat.err
> >
>
> What's your problem with this one?  That's what I do all the time to
redirect
> standard output, and the ">tomcat.log" part works on Windows platforms as
well.
> The Tomcat 4.0 milestone 1 startup scripts, for example, do this by
default.
>
> Craig McClanahan
>
>
> ====================
> See you at ApacheCon Europe <http://www.apachecon.com>!
> Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
> Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
>                                     Applications to Tomcat
>
>
>