A DispatchLogger is a LogListener that routesLogEvents to other LogListeners based on the types of those LogEvents. For example, you may wish to send ErrorLogEvents to an EmailLogger, while all other log event types are sent to a file.
A DispatchLogger is configured with the following properties:
logEvents
The class names of the different types of log events to be dispatched to various listeners. For example, if you want to dispatchErrorLogEventsandWarningLogEventsto different listeners, you would specify:
logEvents=\
atg.nucleus.logging.ErrorLogEvent,\
atg.nucleus.logging.WarningLogEvent
The next property,
logDestinations, specifies where those two types of events are to be sent.
logDestinations
The names of theLogListenersthat receive the log event types specified by thelogEventsproperties. For example:
logDestinations=\
SysadminPager,\
SysadminEmailer
This specifies that
ErrorLogEventsare to be sent to theSysadminPagercomponent, whileWarningLogEventsare to be sent to theSysadminEmailercomponent. TheLogEventis sent to the first destination matching the given class, as either an exact class match, or a subclass. So anyErrorLogEventor subclass ofErrorLogEventis sent toSysadminPager.
defaultDestinations
The destinations of any log events that do not match any of the types inlogEvents. For example:
defaultDestinations=\
FileLogger
This specifies that any
LogEventsthat are not errors or warnings are sent to theFileLoggercomponent. You may specify multiple destinations, in which case the event is sent to all of the specified destinations in order. If you do not specify thelogEventsorlogDestinationsproperties, then events are always be distributed to thedefaultDestinations. This is a useful way for you to send a singleLogEventto multiple destinations - e.g., e-mail and a file.
However, unlike the
defaultDestinationsproperty, thelogDestinationsproperty cannot be used to send one type ofLogEventto two different destinations. If you set these properties:
logEvents=\
InfoLogEvent,\
InfoLogEvent
logDestinations=\
/logging/infoListener1,\
/logging/infoListener2
then no
InfoLogEventswill reachinfoListener2; all will be sent to infoListener1. You can send a singleLogEventto multiple destinations either by using thedefaultDestinationsproperty, or by using twoDispatchLoggersin sequence. The firstDispatchLoggermight have these properties:
logEvents=\
InfoLogEvent,\
FooLogEvent
logDestinations=\
/logging/infoDispatchLogger2,\
/logging/fooListener
while the second, the
/logging/infoDispatchLogger2named in the logDestinations property, would receive onlyInfoLogEventsand could use thedefaultDestinationsproperty to route theInfoLogEventsto both/logging/infoListener1and/logging/infoListener2:
defaultDestinations=\
/logging/infoListener1,\
/logging/infoListener2

