Show TOC Start of Content Area

Function documentation Formatter Locate the document in its SAP Library structure

Use

Each log destination type can print messages in different formats: TraceFormatter, XMLFormatter, and ListFormatter.

Features

TraceFormatter

·        A human readable format.

·        This is the most commonly used formatter when you want to understand quickly what is going on with the application.

·        Normally this formatter is not used with a log viewer. Therefore, you can customize the pattern of the TraceFormatter indicated by various placeholders.

By default, the pattern is: %24d %-40l [%t] %s: %m.

The corresponding output is:

Jan 01, 2001 10:10:00 PM      com.sapmarkets.FooClass.fooMethod [main] Fatal: A sample fatal message.

 

For example, if the pattern becomes %24d %l [%s] %m, the corresponding output is:

Jan 01, 2001 10:10:00 PM      com.sapmarkets.FooClass.fooMethod [Fatal] A sample fatal message.

 

·        The number in the pattern denotes the width of a field. In the first example: “%-40l” indicates a 40 char limit for the location name (com.sapmarkets.FooClass.fooMethod) that will be right-aligned (with a minus sign). If the length of a string exceeds the defined width, the string will be truncated. In the second example: “%l” simply displays the full string that will be left-aligned.

The table below describes the meaning of the placeholders. For more information, see the Javadoc.

Place Holders

Place Holder

Description

%d

Timestamp in readable form.

%l

The location of origin (for example, com.sapmarkets.FooClass.fooMethod).

%c

The log controller through which the message was issued (for example, com.sapmarkets.FooClass).

%t

The thread that emitted the message.

%s

The message severity.

%m

The formatted message text.

%I

The message ID.

%p

The time stamp in milliseconds since January 1, 1970 00:00:00 GMT

%g

The group identification.

 

XMLFormatter

Suitable for file transfer to be further processed in other applications.

This graphic is explained in the accompanying text

  <record>

    <id>10.48.27.165:4A5AB2:E99D2EDAFF:-8000</id>

    <time>Mon Jan 01 22:00:00 PDT 2001</time>

    <source>com.sapmarkets.FooClass</source>

    <location>com.sapmarkets.FooClass.fooMethod</location>

    <thread>main</thread>

    <severity>Fatal</severity>

    <msg-type>Plain</msg-type>

    <msg-clear>A sample fatal message</msg-clear>

  </record>

 

The DTD of the result is:

This graphic is explained in the accompanying text

<!ELEMENT table (id, time, source, location, thread, group?, severity, relatives?, msg-type, msg-code?, bundle?, msg-clear?, args?)>

             <!ELEMENT id (#PCDATA)>

             <!ELEMENT time (#PCDATA)>

             <!ELEMENT source (#PCDATA)>

             <!ELEMENT location (#PCDATA)>

             <!ELEMENT thread (#PCDATA)>

             <!ELEMENT group (id, level, indent)>

             <!ELEMENT level (#PCDATA)>

             <!ELEMENT indent (#PCDATA)>

             <!ELEMENT severity (#PCDATA)>

             <!ELEMENT relatives (relative+)>

             <!ELEMENT relative (#PCDATA)>

             <!ELEMENT msg-type (#PCDATA)>

             <!ELEMENT msg-code (#PCDATA)>

             <!ELEMENT bundle (#PCDATA)>

             <!ELEMENT msg-clear (#PCDATA)>

             <!ELEMENT args (arg+)>

             <!ELEMENT arg (#PCDATA)>

 

ListFormatter

·        The output of this format serves like a router to send the data for further processing by another application, instead of being read directly by an end user.

·        Simple hash-separated fields to be processed mainly with a log viewer. For more information, see Structure linkLog Viewer used in the J2EE Engine.

·        Sample output of the same result is:

#1.3#10.48.27.165:4A5AB2:E99D42D4F4:-8000#Mon Jan 01 22:00:00 PDT 2001#com.sapmarkets.FooClass#com.sapmarkets.FooClass.fooMethod#main##0#0#Fatal##Plain###A sample fatal message#

·        The order of the fields, delimited by the hash sign is:

¡        Version (of the ListFormatter)

¡        Message ID

¡        Timestamp

¡        Source name (log controller)

¡        Location name (the actual code location that generates the message)

¡        Thread ID

¡        (Group ID)

¡        Group level

¡        Group indentation

¡        Message severity

¡        (Relatives names: can be multiple)

¡        Message Type (PLAIN or JAVA)

¡        (Message Code)

¡        (ResourceBundle name)

¡        Message

¡        (Number of arguments)

¡        (Arguments)

 


End of Content Area