You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Anna Battenhouse <an...@cci-triad.com> on 2003/04/25 03:23:31 UTC

capturing StdOut in log4j file

I have an application that uses log4j for its application log, but I also
want to capture some information that is normally written to standard out
(e.g. output of verbose:gc).

I can of course redirect standard out to a file via nohup, tee or whatever,
but there are two problems with that approach:

1) The standard out output is not properly interlaced with application log
messages so I can't correlate GC events with something happening in my code,
and

2) The app runs on a very low end PC where disk space is tight, so allowing
the redirected-to file to grow without bound is not an option. So I want the
output to go to a set of log4j rollable log files.

Has anyone else run into this before? Have any suggestions?

Thanks,
------------------------------------------------------
Anna Battenhouse
Internet Applications Architect
CCITRIAD, Inc.
804 Las Cimas Parkway, Suite 200
Austin TX 78746
(512) 278-5524
anna.battenhouse@ccitriad.com


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


Re: capturing StdOut in log4j file

Posted by Fergus Gallagher <Fe...@OrbisUK.com>.
I typically send all output to STDOUT, for the reasons you mention.  But I
use logrotate (in copytruncate mode) to rotate the logs. (This can also
compress and/or delete old logs).  

logrotate can *theoretically* lead to a small dataloss at the time of
rotation.  If that was an issue, then there is a logfile rotation script
(written) for Apache that might be more suitable.

However, I believe Log4J v1.3 will allow for SAFE redirection of
stdout/stderr to a Log4J appender.


Fergus


On Thu, Apr 24, 2003 at 08:23:31PM -0500, Anna Battenhouse wrote:
> I have an application that uses log4j for its application log, but I also
> want to capture some information that is normally written to standard out
> (e.g. output of verbose:gc).
> 
> I can of course redirect standard out to a file via nohup, tee or whatever,
> but there are two problems with that approach:
> 
> 1) The standard out output is not properly interlaced with application log
> messages so I can't correlate GC events with something happening in my code,
> and
> 
> 2) The app runs on a very low end PC where disk space is tight, so allowing
> the redirected-to file to grow without bound is not an option. So I want the
> output to go to a set of log4j rollable log files.
> 
> Has anyone else run into this before? Have any suggestions?
> 
> Thanks,
> ------------------------------------------------------
> Anna Battenhouse
> Internet Applications Architect
> CCITRIAD, Inc.
> 804 Las Cimas Parkway, Suite 200
> Austin TX 78746
> (512) 278-5524
> anna.battenhouse@ccitriad.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org

-- 
Fergus Gallagher          Tel: +44 (20) 8742 1600
Orbis                     Fax: +44 (20) 8742 2649
414 Chiswick High Street  email: Fergus.Gallagher@orbisuk.com
London  W4 5TL            Web: http://www.orbisuk.com

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