Author: afester
Date: Tue May  2 11:58:16 2006
New Revision: 399014

URL: http://svn.apache.org/viewcvs?rev=399014&view=rev
Log:
LOGCXX-66: re-added syslogappender

Modified:
    logging/log4cxx/trunk/build.xml
    logging/log4cxx/trunk/configure.in
    logging/log4cxx/trunk/include/log4cxx/private/log4cxx_private.h.in
    logging/log4cxx/trunk/src/syslogappender.cpp
    logging/log4cxx/trunk/src/syslogwriter.cpp

Modified: logging/log4cxx/trunk/build.xml
URL: 
http://svn.apache.org/viewcvs/logging/log4cxx/trunk/build.xml?rev=399014&r1=399013&r2=399014&view=diff
==============================================================================
--- logging/log4cxx/trunk/build.xml (original)
+++ logging/log4cxx/trunk/build.xml Tue May  2 11:58:16 2006
@@ -420,8 +420,15 @@
        replace="${logchar_is_wchar}"/>
 
     <replaceregexp file="${include.dir}/log4cxx/log4cxx.h"
-       match="#define LOG4CXX_HAS_WCHAR_T.*"
-       replace="#define LOG4CXX_HAS_WCHAR_T ${has.wchar_t}"/>
+       match="@HAS_WCHAR_T@"
+       replace="${has.wchar_t}"/>
+
+    <!-- The MS Windows template for log4cxx_private.h contains a hard coded
+         "0" for LOG4CXX_HAVE_SYSLOG. Therefore the following replacement
+         only applies to the UNIX template. -->
+    <replaceregexp file="${include.dir}/log4cxx/private/log4cxx_private.h"
+       match="@HAS_SYSLOG@"
+       replace="1"/>
 </target>
 
 <target name="get-apr-module">

Modified: logging/log4cxx/trunk/configure.in
URL: 
http://svn.apache.org/viewcvs/logging/log4cxx/trunk/configure.in?rev=399014&r1=399013&r2=399014&view=diff
==============================================================================
--- logging/log4cxx/trunk/configure.in (original)
+++ logging/log4cxx/trunk/configure.in Tue May  2 11:58:16 2006
@@ -154,9 +154,15 @@
 
 AC_CHECK_FUNCS(swprintf)
 
-# for SysLogAppender
-
-AC_CHECK_FUNCS(syslog)
+# for local syslog() function for SyslogAppender
+AC_CHECK_FUNCS(syslog, [have_syslog=yes], [have_syslog=no])
+if test "$have_syslog" = "yes"
+then
+ AC_SUBST(HAS_SYSLOG, 1)
+else
+ AC_SUBST(HAS_SYSLOG, 0)
+fi
+                                          
 
 # Checks for libraries
 # ----------------------------------------------------------------------------

Modified: logging/log4cxx/trunk/include/log4cxx/private/log4cxx_private.h.in
URL: 
http://svn.apache.org/viewcvs/logging/log4cxx/trunk/include/log4cxx/private/log4cxx_private.h.in?rev=399014&r1=399013&r2=399014&view=diff
==============================================================================
--- logging/log4cxx/trunk/include/log4cxx/private/log4cxx_private.h.in 
(original)
+++ logging/log4cxx/trunk/include/log4cxx/private/log4cxx_private.h.in Tue May  
2 11:58:16 2006
@@ -54,6 +54,6 @@
 //       attempting creation of the corresponding appender.
 //
 #define LOG4CXX_HAVE_SMTP 0
-#define LOG4CXX_HAVE_SYSLOG 1
+#define LOG4CXX_HAVE_SYSLOG @HAS_SYSLOG@
 
 #endif

Modified: logging/log4cxx/trunk/src/syslogappender.cpp
URL: 
http://svn.apache.org/viewcvs/logging/log4cxx/trunk/src/syslogappender.cpp?rev=399014&r1=399013&r2=399014&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/syslogappender.cpp (original)
+++ logging/log4cxx/trunk/src/syslogappender.cpp Tue May  2 11:58:16 2006
@@ -21,6 +21,7 @@
 #include <log4cxx/spi/loggingevent.h>
 #include <log4cxx/level.h>
 #include <log4cxx/helpers/transcoder.h>
+#include <log4cxx/private/log4cxx_private.h>
 
 #ifdef LOG4CXX_HAVE_SYSLOG
 #include <syslog.h>

Modified: logging/log4cxx/trunk/src/syslogwriter.cpp
URL: 
http://svn.apache.org/viewcvs/logging/log4cxx/trunk/src/syslogwriter.cpp?rev=399014&r1=399013&r2=399014&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/syslogwriter.cpp (original)
+++ logging/log4cxx/trunk/src/syslogwriter.cpp Tue May  2 11:58:16 2006
@@ -20,6 +20,7 @@
 #include <log4cxx/helpers/datagramsocket.h>
 #include <log4cxx/helpers/datagrampacket.h>
 #include <log4cxx/helpers/socketimpl.h>
+#include <log4cxx/helpers/transcoder.h>
 
 #define SYSLOG_PORT 514
 
@@ -50,18 +51,14 @@
    }
 }
 
-void SyslogWriter::write(const LogString&)
-{
-#if 0
-//  TODO
-   USES_CONVERSION;
-   const char * bytes = T2A(string.c_str());
-   DatagramPacketPtr packet = new DatagramPacket((void *)bytes, 
string.length() + 1,
-                  address, SYSLOG_PORT);
+void SyslogWriter::write(const LogString& source) {
+   LOG4CXX_ENCODE_CHAR(data, source);
 
-   if(this->ds != 0)
-   {
+   DatagramPacketPtr packet = 
+          new DatagramPacket((void*) data.c_str(), data.length() + 1,
+                             address, SYSLOG_PORT);
+
+   if(this->ds != 0) {
       ds->send(packet);
    }
-#endif
 }


Reply via email to