!--a11y-->
Settings for Logging an Application 
Settings in init-config.xml
|
type |
Selects the logging API to be used. The type of the SAP API is "sapmarkets". Setting to off will totally disable any logging activity. |
|
version |
Not used when SAP logging API is used. (was only relevant when using log4j) |
|
config-file |
The name of the config-file, to be used. The configuration file for the SAP Logging API is log-config.properties |
|
path |
Path where to store the log files. If the path attribute is not set, the default {application}/WEB-INF/logs/ will be used as logging directory.If you use / the path will be constructed relative to /WEB-INF/, e.g. /tmp/logs/ will log to {application}/WEB-INF/tmp/logs/.Finally you may also use absolute paths to a directory, e.g. c:/temp/ as log path. |
A typical segment for the configuration within the init-config.xml looks like the following:
<initialization className="com.sapmarkets.isa.core.logging.LogConfigurator">
<param name="type" value="sapmarkets"/>
<param name="config-file" value="/WEB-INF/cfg/log-config.properties"/>
</initialization>
This initialization block should be the first within init-config.xml. This guarantees that logging is initialized before other initializations are started.
Settings in the SAP Logging API configuration file
Important facts are the separation between:

You will usually only change the log level when you make changes in Locations.
Locations will deliver the statements only if the priority is higher than defined in the configuration file. Thus, if the information should be increased, simply set the priority of the category to something more detailed (for example:
DEBUG to see every message).|
Priority |
Use |
|
ERROR |
Serious errors should generally be used for events that are extremely important, and that can stop the application. The messages must be comprehensible for both end users and system administrators. |
|
WARNING |
This level should usually be used for messages that inform end users or system administrators of events that represent potential problems. |
|
INFO |
The "information" priority should only be used for messages that make sense for both end users and system administrators. |
|
DEBUG |
The debug priority can be used for tracing. Tracing is a special form of logging, whereby only specific messages are logged. The logging interface can also be used to record tracing messages. |
com.sapmarkets.isa.core.taglib will log to the categories:
1. com.sapmarkets.isa.core.taglib
2. com.sapmarkets.isa.core
3. com.sapmarkets.isa (the root node)
[location name].attribute = value
[location name].logs = +log[name of Log]
Example of Location configuration
#Set parent location of ISA
com.sapmarkets.isa.severity = DEBUG
com.sapmarkets.isa.logs = +log[isa]
#Set location of core functions.
com.sapmarkets.isa.core.severity = DEBUG
com.sapmarkets.isa.core.logs = +log[core]
#Set location of isacore functions
com.sapmarkets.isa.isacore.severity = DEBUG
com.sapmarkets.isa.isacore.logs = +log[isacore]
The
com.sapmarkets.isa location is currently set to log level DEBUG. The associated Log is named isa. All log entries coming from packages beginning with com.sapmarkets.isa will be logged into the isa log.The
com.sapmarkets.isa.core location is also set to log level DEBUG. The associated Log is named core. All log entries created by classes located in packages beginning with com.sapmarkets.isa.core will be logged into this log as well as in the isa log, because com.sapmarkets.isa is parent of com.sapmarkets.isa.core.
Logs
Logs are responsible for writing log entries into different destinations. The currently used Log type is a FileLog which writes log entries into files. A different Log type is the ConsoleLog which outputs log entries into the standard Error output stream.
There can be different Logs distinguished by their name. A Log is configured using the following syntax:
log[name].attribute = value
FileLog Properties
|
log |
Attribute |
Value |
Description |
|
log[name] |
FileLog |
||
|
log[name] |
severity |
Log level |
The effective Log level for this Log. Used to refine the log level defined in the Location. |
|
log[name] |
formatter |
formatter[name of formatter] |
The formatter which should be used by this Log. |
|
log[name] |
pattern |
name and destination of log files |
The name of the file can be given using a pattern with a number of place holders: Please note that the above placeholders are not used in the default logging configuration. There is a special placeholder only valid for the Internet Sales Application: %[isa:path]. This placeholder specifies the log path, relative to the web application. For further information please refer to the description of the path attribute in the init-config.xml file. |
|
log[name] |
limit |
Limit of file size in bytes |
This parameter has to coexist with the parameter with the attribute "cnt". Either they both have values assigned or both values equal to zero. These settings are used to turn on the output file rotation. |
|
log[name] |
cnt |
Maximum number of files |
This parameter has to coexist with the parameter with the attribute "limit". Either they both have values assigned or both values equal to zero. These settings are used to turn on the output file rotation. |
You can set this parameter as in the following example:
log[isa] = FileLog
log[isa].pattern = %[isa:path]/isa.log
log[isa].limit = 10000000
log[isa].cnt = 10
log[isa].formatter = formatter[isa]
The configuration above defines a File Log named isa. The files will be written in the folder (when the path attribute in the init-config.xml is omitted) <application-root>\web-inf\logs. The maximum number of log files is 10 with a maximum file size of 10MB. The formatter used to format the messages is named isa.
Formatter

It is usually not necessary to change the print format of the log messages
formatter[name] = TraceFormatter
formatter[name].pattern = custom formatting pattern
The pattern allows you to specify the message data fields, with place holders of the form
"%[[-]<width>[-]]<type>", interspersed with arbitrary text that you want to have included in formatted messages.If you put a dash in front of the <width> of the field to be printed, which is a positive integral number, the field is aligned on the right, in case of a trailing dash it is aligned on the left. If you flank <width> with dashes on both sides, you get a centered field. If you omit the alignment, the field is left-aligned. The <type> that specifies the field can be one of:
In Internet Sales the message also contains the session id and the resource key used to print the message
Description of the Internet Sales Locations
Location Description
|
Name of the Category |
Description of the Logging |
Log file used |
|
com.sapmarkets.isa |
All logging entries from the Internet Sales application will be collected here |
isa.log |
|
com.sapmarkets.isa.auction |
Logging entries from the Web Auction component |
auction.log |
|
com.sapmarkets.isa.backend |
Messages regarding backend (e.g. CRM) communication |
backend.log |
|
com.sapmarkets.isa.businessobject |
Messages regarding the business objects that implement the business logic (e.g. also via backend communication) |
businessobject.log |
|
com.sapmarkets.isa.catalog |
Logging entries from the Internet Sales catalog |
catalog.log |
|
com.sapmarkets.isa.cic |
Logging statements from the Live Web Collaboration component |
cic.log |
|
com.sapmarkets.isa.core |
Framework, initialization, BLS-Layer and system management infrastructure |
core.log |
|
com.sapmarkets.isa.core.eai.init.InitEaiISA.xml |
Writes eai-config.xml.log, which contains the combined configuration file that is being used (web.xml plus eai-config.xml) |
eai-config.xml.log |
|
com.sapmarkets.isa.isacore |
Logging entries from the Internet Sales application (specific package com.sapmarkets.isa.isacore) |
isacore.log |
|
monitoring |
Root node for Monitoring |
monitoring.log |
|
monitoring.jco.performance |
Monitoring of the throughput of the Java Connector (JCO) |
monitoring.log |
|
monitoring.jco.pools |
Java Connector (JCO) Pools statistics |
core.log |
|
monitoring.performance |
Monitoring of the performance |
monitoring.log |