tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joan <aseq...@gmail.com>
Subject Re: Configuring log format for console output (catalina.out)
Date Thu, 23 May 2019 08:14:04 GMT
Thanks Guido,

I hope that with the rsyslog magic (see
startmsg.regex="^[[:digit:]]{2}-[[:alpha:]]{3}-[[:digit:]]{4}
[[:digit:]]{1,2}:[[:digit:]]{1,2}:[[:digit:]]{1,2}\\.[[:digit:]]{3}"  for
the reference), I will be able to group this messages, otherwise I'll jump
into your solution.

Joan

Missatge de Jäkel, Guido <G.Jaekel@dnb.de> del dia dc., 22 de maig 2019 a
les 8:55:

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message