Hi, Lev Lvovsky wrote: > My system has the "syslog.h" header for syslogd logging functionality, > and subsequently upon looking for the code, there're some tests for > this file: > > Using the latest 0.9.8 source the precompiler directive > "LOG4CXX_HAVE_SYSLOG" is initially defined in the "include/log4cxx/ > private/log4cxx_private.h" header file, however the header file cannot > be included in other source without "-DLOG4CXX_TEST" or "- DLOG4CXX" > being added to the compiler options, else the following message shows up:
See also http://issues.apache.org/jira/browse/LOGCXX-66 I ported the syslog appender to the APR some time ago, and also found this issue. I will add an appropriate autoconf check. Header files below "private" are not meant to be included in the application; as a work around, adding -DLOG4CXX_HAVE_SYSLOG should help. Note that this only affects the syslog() function on POSIX systems; remote logging (including "localhost" ;-)) through datagram packets should work in any case. You should probably use the package from http://www.littletux.net/log4cxx. Regards, Andreas > --- > #error "log4cxx/private/log4cxx_private.h should only be used within > log4cxx implementation or tests" > --- > > 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... > > --- > <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. -- Andreas Fester mailto:[EMAIL PROTECTED] WWW: http://www.littletux.net ICQ: 326674288
