I'm curious if there is such a thing as a StatusAppender in log4j2 which, as
you would guess, is the appender the StatusLogger would use?
Here's what I'm trying to solve, I think.
I've been telling other developers I work with that a piece of code should only
write to a single logger. The reason for this, in my mind, is that if a piece
of code writes to more than one logger then it essentially has routing logic in
it and I would rather have the routing in the configuration. For example:
try
{
logger1.info(...);
.
.
.
logger2.debug(...);
}
catch(Exception e)
{
logger1.error(...);
}
The above code is sending debug events to a different logger than the rest of
the events it raises. I would rather have the code send all events to a single
logger and control where those events are routed via the configuration. Feel
free to let me know whether this is in line with logging principles.
So here's the problem. We've got some code which writes events to its logger.
We want to capture these events centrally so we're sending them to a central
location via an HTTP appender. We want to do this only for FATAL - INFO
events, so we're not expecting a huge load. DEBUG events however, we'd like to
send to the same location as the status logger. We can, of course, just add a
console appender for DEBUG events but that would have to be controlled
separately from the status logger and ideally it would be nice to just piggy
back on the status logger. We could have this code write to its private logger
and the status logger for DEBUG events, but then we get into the routing issue
I mentioned above. So I'm wondering, is there such a thing as a StatusAppender?
Thanks,
Nick