logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shuvalov, Andrew V" <Andrew.Shuva...@gs.com>
Subject Extending LoggingEvent
Date Fri, 07 May 2004 12:48:00 GMT

I'm trying to subclass the LoggingEvent to use it in my own macros, but
apparently I don't have that much control over it. In particular, I have to
supply the message in constructor, and after that it is read-only. Let me
explain why do I need access to write into the message.

I want to pass arbitrary parameters to my LoggingEvent in the log macros.
For example, I want to write:

MY_ERROR ("my.code", "Can't format the hard drive" << ErrorCode(5));

Here I can pass optional parameter ErrorCode in the stream. To do so, I need
to make my LoggingEvent to be ostream itself. But in order to do so, I need
to instantiate it with empty message first. So I'd like to see a protected
method "setMessage(const String &msg)".

Is it possible?


P.S. Please don't forget my recent Solaris socket patch.

View raw message