logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lev Lvovsky <lis...@sonous.com>
Subject Re: unused precompiler directive for syslog functionality
Date Fri, 11 Nov 2005 18:21:45 GMT
On Nov 11, 2005, at 4:42 AM, Curt Arnold wrote:

>> By implementation, does that mean 'whenever I'd like to use
>> log4cxx'?  Otherwise, the following block in syslogappender.cpp,
>> which actually invokes the syslog() function doesn't get entered...
>>
>>
>
> Implementation means log4cxx itself.  Client code (your code)
> should not include log4cxx_private.h or define LOG4CXX.
>

right, this is what  I figured...

>
>
>> ---
>> <syslogappender.cpp>
>>     261 #ifdef LOG4CXX_HAVE_SYSLOG
>>     262         if (sw == 0)
>>     263         {
>>     264                 std::string sbuf;
>>     265                 Transcoder::encode(msg, sbuf);
>>     266
>>     267                 // use of "%s" to avoid a security hole
>>     268                  ::syslog(syslogFacility | event->getLevel
>> ()->getSyslogEquivalent(),
>>     269                         "%s", sbuf.c_str());
>>     270
>>     271                 return;
>>     272         }
>>     273 #endif
>> ---
>>
>> As a stopgap, I "#define LOG4CXX 1", and "#include <log4cxx/
>> private/log4cxx_private.h>" in the "syslogappender.h" header file
>> before the "LOG4CXX_HAVE_SYSLOG" precompiler variable gets
>> checked.  I'm assuming there's either something wrong in the way
>> I'm doing things, or there's something wrong in the header files.
>>
>> Thanks!
>> -lev
>>
>
> Both of the actions that you did are directly undoing intentional
> checks that check that private implementation details are not
> exposed in the public API.  There is a judgement call what is
> publicly exposed and what is private, so we could consider moving
> some of the feature presence macros into a public header file.
>

yep... this is what I'd figured.  This precompiler macro is necessary
for me to use syslog (outside of me defining something at compile
time), so a public header file would be good methinks :)

thanks!
-lev


Mime
View raw message