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 dispatchErrorLogEvents
andWarningLogEvents
to 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 theLogListeners
that receive the log event types specified by thelogEvents
properties. For example:
logDestinations=\
SysadminPager,\
SysadminEmailer
This specifies that
ErrorLogEvents
are to be sent to theSysadminPager
component, whileWarningLogEvents
are to be sent to theSysadminEmailer
component. TheLogEvent
is sent to the first destination matching the given class, as either an exact class match, or a subclass. So anyErrorLogEvent
or subclass ofErrorLogEvent
is 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
LogEvents
that are not errors or warnings are sent to theFileLogger
component. 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 thelogEvents
orlogDestinations
properties, then events are always be distributed to thedefaultDestinations
. This is a useful way for you to send a singleLogEvent
to multiple destinations - e.g., e-mail and a file.
However, unlike the
defaultDestinations
property, thelogDestinations
property cannot be used to send one type ofLogEvent
to two different destinations. If you set these properties:
logEvents=\
InfoLogEvent,\
InfoLogEvent
logDestinations=\
/logging/infoListener1,\
/logging/infoListener2
then no
InfoLogEvents
will reachinfoListener2
; all will be sent to infoListener1. You can send a singleLogEvent
to multiple destinations either by using thedefaultDestinations
property, or by using twoDispatchLoggers
in sequence. The firstDispatchLogger
might have these properties:
logEvents=\
InfoLogEvent,\
FooLogEvent
logDestinations=\
/logging/infoDispatchLogger2,\
/logging/fooListener
while the second, the
/logging/infoDispatchLogger2
named in the logDestinations property, would receive onlyInfoLogEvents
and could use thedefaultDestinations
property to route theInfoLogEvents
to both/logging/infoListener1
and/logging/infoListener2
:
defaultDestinations=\
/logging/infoListener1,\
/logging/infoListener2