Hi
Is there a reason why the AsyncAppender properties constructor
[AsyncAppender::AsyncAppender (helpers::Properties const & props)] does not
call the base class properties constructor? I see that there is some tuff
in the Appender base class properties constructor (e.g. the "layout"
property) that is unnecessary for the AsyncAppender, but other stuff (e.g.
"filters." and "Threshold") would also make sense for the AsyncAppender.
I'm asking because this is why AsyncAppender does not support the Threshold
configuration attribute. I think supporting thresholds (and also filters)
would be very useful for the AsyncAppender because it could greatly reduce
the number of log messages that are passed through the QueueThread if the
AsyncAppender could discard most messages directly.
If this is not intentional, I'd like to ask for a patch/bugfix to enable
Threshold configuration for the AsyncAppender.
Btw: I patched AsyncAppender myself to add Threshold support. Because I
don't know why AsyncAppender properties constructor does not call the base
class properties constructor, I added my code at the end of the
AsyncAppender properties constructor, just before the call to
[init_queue_thread (queue_len);]. I basically copy-pasted code from the
Appender base class. Work's fine. Here's my code in case you find it useful:
if (props.exists(LOG4CPLUS_TEXT("Threshold"))) {
tstring tmp = props.getProperty(LOG4CPLUS_TEXT("Threshold"));
tmp = log4cplus::helpers::toUpper(tmp);
threshold = log4cplus::getLogLevelManager().fromString(tmp);
}
Thanks, Markus
|