You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard Sayre <ri...@gmail.com> on 2009/12/21 15:56:21 UTC

Tomcat 6 Log Tomcat output to file

I usually install Tomcat as a Service under windows which causes all
Tomcat output to go to stdout.log.  I am in a situation where I can
not do this.  I have to start Tomcat from the command line.  When I do
all of Tomcats output is logged to the console.  How do I manually
configure Tomcat so the output gets logged to a file?

I tried the instructions under the log4j section here
http://tomcat.apache.org/tomcat-6.0-doc/logging.html

When I restarted Tomcat no new log file was created.  The output
stilled logged to the console window.

I couldn't find any other documentation on how to do this in Tomcat 6.

Can some one point me to some documentation on how to set up this type
of logging?

Thank you

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


RE: Tomcat 6 Log Tomcat output to file

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com]
> Subject: Re: Tomcat 6 Log Tomcat output to file
> 
> catalina.bat run >outputfile.log 2>&1

Indeed; thanks for the correction.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: Tomcat 6 Log Tomcat output to file

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/1/4 Caldarale, Charles R <Ch...@unisys.com>:
>> From: n828cl [mailto:Chuck.Caldarale@unisys.com]
>> Subject: Re: Tomcat 6 Log Tomcat output to file
>>
>> awarnier wrote:
>> > startup.bat > outputfile
>>
>> Close, but it should be:
>>
>> catalina.bat > outputfile.log
>
> Scratch that - it's not complete; it should be:
>
> catalina.bat > outputfile.log 2>&1
>

catalina.bat run >outputfile.log 2>&1

;)

Best regards,
Konstantin Kolinko

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


RE: Tomcat 6 Log Tomcat output to file

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: n828cl [mailto:Chuck.Caldarale@unisys.com]
> Subject: Re: Tomcat 6 Log Tomcat output to file
> 
> awarnier wrote:
> > startup.bat > outputfile
> 
> Close, but it should be:
> 
> catalina.bat > outputfile.log

Scratch that - it's not complete; it should be:

catalina.bat > outputfile.log 2>&1

Most of the log messages are sent to stderr, not stdout, so the two redirections are needed.

You will need to run shutdown.bat from a separate command prompt, or use CTRL-C in the original one, along with answering y to the now-hidden terminate message.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: Tomcat 6 Log Tomcat output to file

Posted by n828cl <Ch...@unisys.com>.

awarnier wrote:
> 
> 
> startup.bat > outputfile
> 
> 

Close, but it should be:

catalina.bat > outputfile.log

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you received
this in error, please contact the sender and delete the e-mail and its
attachments from all computers.

-- 
View this message in context: http://old.nabble.com/Tomcat-6-Log-Tomcat-output-to-file-tp26875090p27007967.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Tomcat 6 Log Tomcat output to file

Posted by Richard Sayre <ri...@gmail.com>.
the > logfile still only logs the Using messages that I posted earlier.

I tried adding > outTest.txt at the bottom of Catalina.bat after each
of the commands that start tomcat.  The output is still logging to the
console window.  I tried removing the 'start' prefix from %_EXECJAVA%.
 In DOS start is what launches a new cmd window.  This caused an
error.

I'll keep trying different things.  If anyone has any more suggestions
they would greatly appreciated.

I might move back to the original documentation and see if I can just
get the loggers set up properly.

Thanks

On Mon, Dec 21, 2009 at 1:00 PM, André Warnier <aw...@ice-sa.com> wrote:
> Richard Sayre wrote:
>>
>> No this only writes the following:
>>
>> Using CATALINA_BASE:   D:\liferay\tomcat-6.0.18
>> Using CATALINA_HOME:   D:\liferay\tomcat-6.0.18
>> Using CATALINA_TMPDIR: D:\liferay\tomcat-6.0.18\temp
>> Using JRE_HOME:        D:\liferay\tomcat-6.0.18/jre1.5.0_17/win
>>
>> Then it spawns a new window for Tomcat output.
>
> It requires a bit of work examining the startup.bat and catalina.bat files,
> but maybe try this :
>
> startup.bat run > logfile
>
> If I interpret these bat files correctly, that should start Tomcat in the
> same window. (To stop it, just type CTRL-C).
> If not, then you are welcome to go look for yourself.
> ;-)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


Re: Tomcat 6 Log Tomcat output to file

Posted by André Warnier <aw...@ice-sa.com>.
Richard Sayre wrote:
> No this only writes the following:
> 
> Using CATALINA_BASE:   D:\liferay\tomcat-6.0.18
> Using CATALINA_HOME:   D:\liferay\tomcat-6.0.18
> Using CATALINA_TMPDIR: D:\liferay\tomcat-6.0.18\temp
> Using JRE_HOME:        D:\liferay\tomcat-6.0.18/jre1.5.0_17/win
> 
> Then it spawns a new window for Tomcat output.

It requires a bit of work examining the startup.bat and catalina.bat 
files, but maybe try this :

startup.bat run > logfile

If I interpret these bat files correctly, that should start Tomcat in 
the same window. (To stop it, just type CTRL-C).
If not, then you are welcome to go look for yourself.
;-)


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


Re: Tomcat 6 Log Tomcat output to file

Posted by Richard Sayre <ri...@gmail.com>.
No this only writes the following:

Using CATALINA_BASE:   D:\liferay\tomcat-6.0.18
Using CATALINA_HOME:   D:\liferay\tomcat-6.0.18
Using CATALINA_TMPDIR: D:\liferay\tomcat-6.0.18\temp
Using JRE_HOME:        D:\liferay\tomcat-6.0.18/jre1.5.0_17/win

Then it spawns a new window for Tomcat output.


On Mon, Dec 21, 2009 at 11:32 AM, André Warnier <aw...@ice-sa.com> wrote:
> Richard Sayre wrote:
>>
>> I usually install Tomcat as a Service under windows which causes all
>> Tomcat output to go to stdout.log.  I am in a situation where I can
>> not do this.  I have to start Tomcat from the command line.  When I do
>> all of Tomcats output is logged to the console.  How do I manually
>> configure Tomcat so the output gets logged to a file?
>>
>> I tried the instructions under the log4j section here
>> http://tomcat.apache.org/tomcat-6.0-doc/logging.html
>>
>> When I restarted Tomcat no new log file was created.  The output
>> stilled logged to the console window.
>>
>> I couldn't find any other documentation on how to do this in Tomcat 6.
>>
>> Can some one point me to some documentation on how to set up this type
>> of logging?
>>
> startup.bat > outputfile
>
> ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


Re: Tomcat 6 Log Tomcat output to file

Posted by André Warnier <aw...@ice-sa.com>.
Richard Sayre wrote:
> I usually install Tomcat as a Service under windows which causes all
> Tomcat output to go to stdout.log.  I am in a situation where I can
> not do this.  I have to start Tomcat from the command line.  When I do
> all of Tomcats output is logged to the console.  How do I manually
> configure Tomcat so the output gets logged to a file?
> 
> I tried the instructions under the log4j section here
> http://tomcat.apache.org/tomcat-6.0-doc/logging.html
> 
> When I restarted Tomcat no new log file was created.  The output
> stilled logged to the console window.
> 
> I couldn't find any other documentation on how to do this in Tomcat 6.
> 
> Can some one point me to some documentation on how to set up this type
> of logging?
> 
startup.bat > outputfile

?

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


Re: Tomcat 6 Log Tomcat output to file

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard,

On 12/21/2009 9:56 AM, Richard Sayre wrote:
> I usually install Tomcat as a Service under windows which causes all
> Tomcat output to go to stdout.log.  I am in a situation where I can
> not do this.  I have to start Tomcat from the command line.  When I do
> all of Tomcats output is logged to the console.  How do I manually
> configure Tomcat so the output gets logged to a file?
> 
> I tried the instructions under the log4j section here
> http://tomcat.apache.org/tomcat-6.0-doc/logging.html
> 
> When I restarted Tomcat no new log file was created.  The output
> stilled logged to the console window.

Could you specify what you did do? Posting your logging.properties file
would also be helpful.

I believe there are a few messages that Tomcat simply logs to
System.out/System.err and there's nothing you can do about that.

STARTUP.BAT calls CATALINA.BAT which, as you have seen, runs "START
java.exe ...". If you read through that mess, you'll see that no output
redirection is done. I think Windows doesn't do stdout/stderr
inheritance when one process calls another (or, at least, running
"start" escapes that). Finally, the "start" command doesn't appear to
have a "redirect stdout to a file" option.

It looks like you already tried redirecting the output of "start" to no
avail.... looks like Windows is fighting you, here.

Is Tomcat itself generating a lot of output? If you have your logging
configuration correct, very little should end up on stdout. If it's your
webapp that's spewing to stdout, check out the "swallowOutput" attribute
of the <Context> configuration element in context.xml. You'll still have
to have a sane logging configuration for this to work properly.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksv1BcACgkQ9CaO5/Lv0PC7TQCZAcgnZ4cDaEDHkdj+VlTYJE+v
xc4AoKbYIhLVGb8EiFDj2Jkz9sW91ABV
=axVp
-----END PGP SIGNATURE-----

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