Show TOC Start of Content Area

Function documentation Log Assignment  Locate the document in its SAP Library structure

Use

Normally, customers take advantage of the inheritance property to simplify the configuration task, for example, for both severity and log assignment. The assignment of log is additive, and sometimes more control over the log assignment is needed to tune the specific assignment for definite source objects at certain levels.

Three kinds of logs can be assigned to a source object:

      ‘common’ log

      local log

      private log

These are mutually exclusive for each source object. The assignment of one type automatically disables the assignment of the other (if such is available).

‘Common’ Log

Allows regular inheritance. This log will become available to all descendants of the parent object.

The corresponding API is:

This graphic is explained in the accompanying text

static final Location parent = Location.getLocation("com.sapmarkets"),

   Location child = Location.getLocation("com.sapmarkets.foo");

parent.addLog(new ConsoleLog());

parent.setEffectiveSeverity(Severity.NONE);

child.setEffectiveSeverity(Severity.INFO);

child.fatalT("A fatal message from children");

This is an unconditional inheritance. As long as the message passes the evaluation of severity and filter of the child object, it is printed out via the inherited log (in this case, ConsoleLog).

Local Log

Inheritance is allowed, but with additional condition that the final discretion of message printing lies with the original parent object. The log is local, that is, it is not available for the descendants if the child message does not pass the severity and filter test of the parent object.

This graphic is explained in the accompanying text

static final Location parent = Location.getLocation("com.sapmarkets"),

   Location child = Location.getLocation("com.sapmarkets.foo");

parent.addLocalLog(new ConsoleLog());

parent.setEffectiveSeverity(Severity.NONE);

child.setEffectiveSeverity(Severity.INFO);

child.fatalT("A fatal message from children");

The child message is not printed because it does not pass the severity test of the parent.

Private Log

Completely disables inheritance. Log assignment is private, that is, only effective for the parent source object.

This graphic is explained in the accompanying text

static final Location parent = Location.getLocation("com.sapmarkets"),

   Location child = Location.getLocation("com.sapmarkets.foo");

parent.addPrivateLog(new ConsoleLog());

child.setEffectiveSeverity(Severity.INFO);

child.fatalT("A fatal message from children");

The child object does not inherit any destination log. Nothing is printed even the message passes all severity and filter tests.

 

 

End of Content Area