
Thank you for sharing this example which illustrates the point quite well. Ralph Goers wrote:
Yes and no. The API would be a call like logger.logEvent(EventData data); EventData is really just a Map with a few extra methods. Under the hood the event data gets serialized to XML as the "message" but the EventData map is still passed as a parameter. Then when the Appender gets the LoggingEvent it can first check for the map being present. If it is it can just use it and the serialized XML just gets ignored. Otherwise we have to go through the expense of reconstructing the map from the message. If one of the out-of-the box Appenders is used then the map will be ignored and only the serialized map is recorded, but if someone wants to write a custom appender it will save quite a bit of overhead in not having to reconstruct the EventData map on every audit event.
Ralph
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch