logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aghanian, Rostom" <rostom.aghan...@ingrammicro.com>
Subject LoggingEvent serialization of message Object
Date Thu, 22 Aug 2002 21:17:15 GMT
Hello,
I have an issue, which looking through Log4J dev archives, seems like a few
others have ran into.  The problem was actually recently brought up by
Torben Brunn in a post titled 'JMS and MDB' on Jul 23, 2002.  The issue was
replied to by Ceki however there were more questions raised then answered.
So here is the issue again and hopefully we can clear things up and maybe
get a solution for my issue.

Actually, before I dive into the details of the issue, let me briefly state
what my main purpose of this post is:  I would like to suggest that a
setMessage(Object message) method be added to the LoggingEvent class.  There
is already a getMessage() object, but no setter. 

Now on with the details.  The issue is the fact that the message object in a
LoggingEvent is not serialized.  Ceki's reply to this was that this is to
avoid the serialization of very large message objects.  And also, he
inquires about the need for serializing this object.  And here is a reason:
the message object in our case is a custom object we 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 LoggingEvent serialization limitation
mentioned above.  So, the solution that we 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 LoggerMessage
and the LoggerEvent out, and assign the LoggerMessage to the LoggingEvent as
its message field (overwriting the String value that it would have after the
serialization process).  However, this is where we ran into another problem.
There is not setter method to set the message object in a LoggingEvent.
And, looking at the source code of log4j it does not seem possible to easily
reconstruct a new LoggingEvent object from scratch using the fields of
another LoggingEvent object.

Any feedback would be greatly appreciated.
Rostom Aghanian

--
To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>


Mime
View raw message