Hello,

During code review I bump into a configuration (snippet below) for a
routing appender that seems wrong in various aspects.

appender.query-routing.type = Routing
appender.query-routing.name = query-routing
appender.query-routing.routes.type = Routes
appender.query-routing.routes.pattern = $${ctx:queryId}
# purge policy
...
# default route
appender.query-routing.routes.route-default.type = Route
appender.query-routing.routes.route-default.key = $${ctx:queryId}
appender.query-routing.routes.route-default.ref = RFA
# queryId based route
appender.query-routing.routes.route-mdc.type = Route
appender.query-routing.routes.route-mdc.file-mdc.type = RandomAccessFile
appender.query-routing.routes.route-mdc.file-mdc.name = query-file-appender
...

I've never used the routing appender before so I would be grateful if
somebody could verify the findings below.

First, the naming pattern (and comment) indicating that the first route
(route-default) is the default one seems to be wrong.
Based on the documentation [1], if there is no key definition for a route
then that one is the default; so in this case the second route seems to be
the default and not the first one.

The lookup based key definition in the first route seems to be useless.
Although not explicitly stated in the doc [1] from the code it seems that
only static literals (not lookups) are supported in route keys.

All in all, at the current state the route-default seems to be useless and
I suppose can be removed.

Best,
Stamatis

[1]
https://logging.apache.org/log4j/2.x/manual/appenders.html#RoutingAppender

Reply via email to