!--a11y-->
Hierarchical Destination
Inheritance 
The naming hierarchy does not only enable inheritance severity, it also enables destination (log) assignment.

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.
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):

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.

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