Show TOC Start of Content Area

Background documentation Tips and Tricks  Locate the document in its SAP Library structure

      What if the content of the properties file is invalid?

Normally, if the syntax or semantics is incorrect, or if there is simply a typo, the configuration fails on that definition and prompts an error message. The tool continues to evaluate the subsequent configuration and outputs messages accordingly, based on whatever successful configuration that has been made.

The behavior results from the SAP Logging API error handling mechanism.

More information: Administrative Issues.

      Automatic lookup of default properties file?

There is no system property to define this, nor there is a default physical file location specified for this. It is necessary to make one call in the program to load the properties.

      Is there a possibility to define a Location and/or Category object in the file?

It is not necessary to create and maintain a category or a location object. These objects are always accessible by making calls, such as Category.getCategory() and Location.getLocation(), and the rest is done by the logging framework. It is a good practice to use a static variable to store the handle for better performance, in case the source objects to be accessed frequently.

Thus, it is not necessary to define/create these source objects explicitly in the configuration file in advance; just use it directly in your program.

      Does the order of configuration matter?

In general, no. Not for class variable definition. Consider the following:

Syntax

com.sapmarkets.foo.logs = + log[Console], log[File]

log[Console] = ConsoleLog

log[Console].formatter = ListFormatter

log[File] = FileLog

log[File].pattern = %t/trace.log

log[File].formatter = formatter[Trace]

formatter[Trace] = TraceFormatter

formatter[Trace].pattern = %s: %24d: %m

 

      What will be the format of the output shown in the Console?

The use of a ‘+’ sign does not apply to log assignments specified in the current file configuration content. Therefore, the sequence is important and the FileLog wins (assuming no previous configuration has been done).

More information: Syntax and Semantics of the Properties File.

Syntax

com.sapmarkets.foo.logs = + ConsoleLog

com.sapmarkets.foo.logs = + FileLog

 

If you want to assign multiple logs, use a comma as a delimiter:

Syntax

com.sapmarkets.foo.logs = + ConsoleLog, FileLog

 

End of Content Area