Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleEvent formats

Tomcat uses Apache Common Logging to generate the log events. The log messages that arrive through ServletContex log methods are also routed to this log library and associated to the following category:

org.apache.catalina.core.ContainerBase.[engine].[host].[context]

Usually, the engine is Catalina and the host is localhost. The context name it is used as [context], but there are some exceptions. For example, an application whose context path is /cava would have the following category associated org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/cava].

In Tomcat default distribution, Apache Common Logging is associated to the JUL framework (java.util.logging). Hence, all events, including the ones generated by ServletContext are managed by JUL.

Tomcat configures JUL with the file specified in the LOGGING_CONFIG environment variable. In case it is missing, the installation file CATALINA_BASE/conf/logging.properties is used.

  • Access log (localhost_access_log.yyyy-MM-dd.log):
    This file contains an access log similar to web server logs. In the log, there is an event for each petition processed by the server. You can control the event content (format and fields) in detail.
    The access log is configured as a Tomcat Valve. The definition is found in CATALINA_BASE/conf/server.xml. 

    Code Block
    <Valve className="org.apache.catalina.valves.AccessLogValve"
        directory="logs"
        prefix="localhost_access_log." suffix=".txt"
        pattern="%h %l %u %t &quot;%r&quot; %s %b" />

    Devo supports three formats for access logs; two of them are based upon standard formats and the other is defined by Devo to offer a format that contains more details. Each of these formats corresponds with the third level of an access log tag.

    • The log format that corresponds to the web.tomcat.access-clf tag is based on the Common Log Format (CLF). The specification of this format is:

      Code Block
      pattern="%h %l %u %t &quot;%r&quot; %s %b"
      pattern="common"
    • The log format that corresponds to the web.tomcat.access-combined tag is based on the NCSA Combined log format. The specification of this format is:

      Code Block
      pattern="%h %l %u %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot;"
      pattern="combined"
    • The log format that corresponds to the web.tomcat.access-lt tag is a custom format defined by Devo to offer more detailed logging. The specification of this format that includes cookie names is:

      Code Block
      pattern="%t %a %l %u %S %v:%p %m &quot;%U%q&quot; %H &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot; &quot;%{cookieName1}c:%{cookieName2}c&quot; %s %D %B %I"

      However, if you prefer not to include cookie names in your events, use this specification instead. 

      Code Block
      pattern="%t %a %l %u %S %v:%p %m &quot;%U%q&quot; %H &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot; &quot;&quot; %s %D %B %I"
  • localhost.yyyy-MM-dd.log:
    This log contains the messages written by the applications with JUL (java.util.logging). Tags starting with web.tomcat.app should be associated with events from this log file.
    The definition is found in CATALINA_BASE/conf/logging.properties. The logs coming from the applications are configured to be stored in this file. This is done with the help of a handler built to write in localhost.yyy-MM-dd.log and associated with ServletContext log.

    Code Block
    2localhost.org.apache.juli.FileHandler.level = FINE
    2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
    2localhost.org.apache.juli.FileHandler.prefix = localhost.
    org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler
  • catalina.yyyy-MM-dd.log:
    This log contains the messages generated by Tomcat, usually associated with the server and applications life cycle. Tags starting with web.tomcat.catalina should be associated with events from this log file.
    The definition is found in CATALINA_BASE/conf/logging.properties. The logs coming from the container are configured to be stored in this file. This is done with the help of a handler built to write in catalina.yyy-MM-dd.log and associated with the root logger.

    Code Block
    1catalina.org.apache.juli.FileHandler.level = FINE
    1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
    1catalina.org.apache.juli.FileHandler.prefix = catalina.  
    .handlers = 1catalina.org.apache.juli.FileHandler
  • catalina.out:
    This log contains the information sent by the applications to stdout and stderr. It is generated by redirecting to this files standard and error output at operating system level. Since Tomcat is not directly responsible of its creation, it doesn't rotate. Tags starting with web.tomcat.out should be associated with events from this log file.

...

Rw ui tabs macro
Rw tab
title1-3

web.tomcat.accessClf

Field

Type

Source field name

Extra fields

eventdate

timestamp

 

environment

str

venv

application

str

vapp

clon

str

vclon

serverdate

timestamp

 

srcIp

ip4

 

user

str

 

method

str

 

url

str

 

protocol

str

 

statusCode

int4

 

responseLength

int4

 

srcIdentd

str

 

userAgent

str

 

hostchain

str

 

tag

str

 

rawMessage

str

 

web.tomcat.accessCombined

Field

Type

Source field name

Extra fields

eventdate

timestamp

 

environment

str

venv

application

str

vapp

clon

str

vclon

serverdate

timestamp

 

srcIp

ip4

 

user

str

 

method

str

 

url

str

 

protocol

str

 

statusCode

int4

 

responseLength

int4

 

referer

str

 

userAgent

str

 

srcIdentd

str

 

hostchain

str

 

tag

str

 

rawMessage

str

 

web.tomcat.accessLt

Field

Type

Source field name

Extra Label

eventdate

timestamp

 

environment

str

venv

application

str

vapp

clon

str

vclon

serverdate

timestamp

 

srcIp

ip4

 

serverName

str

 

serverPort

int4

 

user

str

 

sessionId

str

 

method

str

 

url

str

 

protocol

str

 

statusCode

int4

 

referer

str

 

userAgent

str

 

cookies

str

 

responseTime

int4

 

requestLength

int4

 

threadName

str

 

srcIdentd

str

 

hostchain

str

 

tag

str

 

rawMessage

str

 

Rw tab
title4-6

web.tomcat.app

Field

Type

Source field name

Extra fields

eventdate

timestamp

 

environment

str

venv

application

str

vapp

clon

str

vclon

message

str

 

rawMessage

str

message

hostchain

str

 

tag

str

 

web.tomcat.appLt

Field

Type

Source field name

Extra Label

eventdate

timestamp

 

environment

str

venv

application

str

vapp

clon

str

vclon

serverdate

timestamp

 

sequence

int4

 

level

str

 

thread

int4

 

class

str

 

method

str

 

message

str

 

exceptionClass

str

 

exceptionMessage

str

 

stackTtrace

str

 

hostchain

str

 

tag

str

 

rawMessage

str

 

web.tomcat.catalina

Field

Type

Source field name

Extra fields

eventdate

timestamp

 

environment

str

venv

application

str

vapp

clon

str

vclon

message

str

 

rawMessage

str

message

hostchain

str

 

tag

str

 

Rw tab
title7-9

web.tomcat.catalinaLt

Field

Type

Source field name

Extra fields

eventdate

timestamp

 

environment

str

venv

application

str

vapp

clon

str

vclon

serverdate

timestamp

 

logger

str

 

sequence

int4

 

level

str

 

thread

int4

 

class

str

 

method

str

 

message

str

 

exceptionClass

str

 

exceptionMessage

str

 

stackTtrace

str

 

hostchain

str

 

tag

str

 

web.tomcat.tomcat_gc

Field

Type

Source field name

Extra fields

eventdate

timestamp

 

environment

str

venv

application

str

vapp

clon

str

vclon

rawMessage

str

rawSource

message

str

 

hostchain

str

 

tag

str

 

web.tomcat.out

Field

Type

Source field name

Extra fields

eventdate

timestamp

 

environment

str

venv

application

str

vapp

clon

str

vclon

message

str

 

hostchain

str

 

tag

str

 

...