logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michaël CATANZARITI <mca...@free.fr>
Subject Re: Extending LoggingEvent
Date Sat, 08 May 2004 13:43:29 GMT
Hello Andrew,

I'm not sure to understand what you want to do.

If you want to pass parameters to a logger, you can use logging macros, See:

If you want to override the class LoggingEvent, you have to override the 
class Logger in order to instanciate your LoggingEvent class in 
Logger::forcedLog. But it's not advised for you won't be able to use the 
SocketAppender anymore.


Shuvalov, Andrew V wrote:

> Hi,
> 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?
> Thanks
> Andrew
> P.S. Please don't forget my recent Solaris socket patch.

View raw message