Show TOC Start of Content Area

Function documentation Hierarchical Destination Inheritance Locate the document in its SAP Library structure

Use

The naming hierarchy does not only enable inheritance severity, it also enables destination (log) assignment.

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.fatalT("A fatal message from parent");

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

 

Both messages will be output to the console, even ConsoleLog is assigned only to the parent node.

Additivity

Multiple destination logs are permitted. Unlike the severity inheritance logic, the assignment of logs to a source object is additive. There is no race condition. For example, adding to the previous code example (the new code is in bold):

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.fatalT("A fatal message from parent");

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

child.addLog(new FileLog(<a file>));

 

There will still be two messages printed in the console (each from parent and child), while in the output file <a file>, messages from child (here, only one message) are also printed in addition to the console destination.

This graphic is explained in the accompanying text

You may suppress this inheritance feature in certain circumstances to tune the output behavior. For more information, see Output File.

 

See also:

Hierarchical Severity Inheritance

 

End of Content Area