logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob L. Anawalt" <janaw...@geckosoftware.com>
Subject Re: Use of operator<<
Date Tue, 18 Mar 2008 17:01:16 GMT
Stephen Bartnikowski wrote:
>> -----Original Message-----
>> From: Josh Kelley [mailto:joshkel@gmail.com] 
>>     LOG4CXX_DEBUG(logger, "Read " << path << " and got " << out);

Nice. I hadn't tried that since 'message' was documented to expect a string and 
I didn't know if it would break in future versions, so I had written out the 
long form of what the macro wrapped. I will be correcting that shortly.

> this:
> #define LOGGING_DEBUG(message) { \
>    if ((*pLogger)->isDebugEnabled()) {\
>       log4cxx::logstream oss(*pLogger, log4cxx::Level::getDebug());\
>       oss.setLocation(LOG4CXX_LOCATION);\
>       oss << message;\
>       oss.end_message();}}
> This assumes you have the following declared and initialized:
> log4cxx::LoggerPtr* pLogger;

I see that the current online API documentation doesn't use the logstream, and 
have read Curt's response saying it is supported once again. If it hadn't been, 
I was thinking that the current online API docs looked a little more efficient 
for simple strings (which is where I currently use the logging macros), and that 
I would re-implement the older style macros as LS_LOG4CXX_*(logger,streamInput).

I hope the auto-detecting methods work well. If they didn't or again if the 
"stream in the macro" version hadn't returned and I needed wchar_t support I 
probably would have taken the "add a W to the macro name" easy way out 

Jacob Anawalt
Gecko Software, Inc.

View raw message