tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jäkel, Guido <G.Jae...@dnb.de>
Subject RE: Configuring log format for console output (catalina.out)
Date Wed, 22 May 2019 06:54:40 GMT
Dear Joan,

by use of the common scripts, the file  catalina.out  will contain the console output (stdout/tderr)
of the *JVM* process and -- if not configured in another way -- of the applications. Therefore,
you have to deal with the features of output formatting of current JVMs. Or -- as me -- you
might pipe this file descriptors through a tiny script that will prepend a timestamp in a
format of your choice. This will have the advantage that it also handle "console" output of
Java application; despite of the fact that using stdout/stderr instead of a java logging mechanism
is a very bad style.

If you don't need to process thousands of lines per second, a simple shell script may do the
job:

	while read line; do echo "`date -Ins` $line"; done

To avoid "double-stamping", you may add an heuristic check of the incoming line; please adjust
the RegExpr to your neeeds

	while read line; do [[ ! "$line" =~ ^\d\d\d\d ]] && echo -n "[`date -Ins`] "; echo
$line; done


Guido
Mime
View raw message