Hi All
I am using a JMS appender to log messages. I encapsulate the log message
in my own object called "LogMessage" and log it using log4J. For the
JMS consumer, I have a MessageBean which has a onMessage(Message msg)
method. Inside this method I expect to retrieve the same object that was
logged in log4J i.e my own obbject " LogMessage"
But I am not sure, how log4j wraps the LogMessage and sends it to the
JMS server.
I am stuck at this point, in the onMessage method.
public void onMessage(Message msg) {
try {
ObjectMessage objMsg = (ObjectMessage) msg;
LoggingEvent eventObject =(LoggingEvent)objMsg.getObject();
}
It seems to me that Log4J calls toString() method on the LogMessage
object and sends it to the appender. Is that true ? Is there a way I can
retrieve the original "LogMessage" Object ?
Thanks for the help
--Viv