logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjay Gupta \(sanjaygu\)" <sanja...@cisco.com>
Subject Serialization of LoggingEvent message field
Date Thu, 24 Jul 2003 01:07:45 GMT
I am sending the LoggingEvent over wire (SocketAppender). The message
object in my case is a custom object I created called a LoggerMessage.
This is a simple container class which holds multiple fields
(all serializable) that we need to transfer over the wire.  Now
obviously we
are unable to transfer this due to the the fact that message object in a
LoggingEvent is not serialized. So, how do I send the LoggingEvent with
my Custom Message Object.
Here is what I tried - 
1. One solution I  came up with was to wrap the LoggingEvent object and
our LoggerMessage object in a serializable wrapper class that we
created, and transfer that over the wire.  Then on the other
end, we deserialize the wrapper from the stream, pull out the
and the LoggerEvent out, and assign the LoggerMessage to the
LoggingEvent as
its message field (overwriting the String value that it would have after
serialization process).  However, this is where we ran into our problem.
There is no setter method to set the message object in a LoggingEvent.
2. Another solution I came up with was to xml-ize the LoggingEvent
Object info and then create a LoggingEvent object on the other end. But
then how do I set Localization Info?
Anone has any thoughts how to achieve this? 
I was going to thru' mail-archive, it seems that people have encountered
this problem earlier too. There were suggestions of providing a way to
either serialize Message Object or provide a serializable hashtable
where people can put name-value pair for custom fields. Any thoughts?  

View raw message