[logback-dev] LoggingEventVO and serialization
Ralph Goers
rgoers at apache.org
Thu Oct 22 02:45:21 CEST 2009
I am going to be creating a logging service. The architecture in our
POC is the client uses the JMSTopicAppender writing to ActiveMQ and
then the service will listen on the topic and write to the
destination. To avoid having the messages be logback specific so that
our legacy system can also interact with this I will be serializing
the messages according the the IETFSyslogLayout in my fork of Logback
(i.e. all the messages will comply with RFC 5424). I got this working
today with the output temporarily going to syslog-ng (which supports
IETF syslog messages). Of Course, JMSTopicAppender and
JMSQueueAppender had to be modified to allow a different form of
serialization. This was easily done by just seeing if a layout was
configured. If so, then LayoutPreSerializationTransformer is used
instead of LoggingEventPreSerializationTransformer.
However, just for fun I tried serializing to LoggingEventVO using the
default mechanisms in place and sending that through the JMS Appender
to the JMSTopicSink. It didn't quite work correctly. In looking at why
I discovered the LoggingEventVO serializes arguments by calling
toString(). So when the JMSAppender transforms the objects their
object type is lost. This means on the remote side it is impossible to
convert them back to the original object. I would think that some form
of the Serialized object should be in the argument array instead of
just a String. Otherwise it is impossible to get the remote side to
behave like the original client.
Ralph
More information about the logback-dev
mailing list