tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r700777 - in /tomcat/connectors/trunk/jk/native/common: jk_global.h jk_util.c jk_util.h
Date Wed, 01 Oct 2008 14:10:56 GMT
Author: mturk
Date: Wed Oct  1 07:10:56 2008
New Revision: 700777

URL: http://svn.apache.org/viewvc?rev=700777&view=rev
Log:
Add util function for fdopen the log file. Used by OS provided loggers

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_global.h
    tomcat/connectors/trunk/jk/native/common/jk_util.c
    tomcat/connectors/trunk/jk/native/common/jk_util.h

Modified: tomcat/connectors/trunk/jk/native/common/jk_global.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_global.h?rev=700777&r1=700776&r2=700777&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_global.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_global.h Wed Oct  1 07:10:56 2008
@@ -120,6 +120,7 @@
 #endif /* _WINDOWS_ */
 #include <sys/timeb.h>
 #include <process.h>
+#include <io.h>
 #else /* WIN32 */
 #include <unistd.h>
 #if defined(NETWARE) && defined(__NOVELL_LIBC__)

Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?rev=700777&r1=700776&r2=700777&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Wed Oct  1 07:10:56 2008
@@ -600,6 +600,39 @@
     return JK_FALSE;
 }
 
+int jk_attach_file_logger(jk_logger_t **l, int fd, int level)
+{
+    if (l && file) {
+
+        jk_logger_t *rc = (jk_logger_t *)malloc(sizeof(jk_logger_t));
+        jk_file_logger_t *p = (jk_file_logger_t *) malloc(sizeof(jk_file_logger_t));
+        if (rc && p) {
+            rc->log = log_to_file;
+            rc->level = level;
+            rc->logger_private = p;
+#if defined(AS400) && !defined(AS400_UTF8)
+            p->logfile = fdopen(fd, "a+, o_ccsid=0");
+#else
+            p->logfile = fdopen(fd, "a+");
+#endif
+            if (p->logfile) {
+                *l = rc;
+                jk_set_time_fmt(rc, NULL);
+                return JK_TRUE;
+            }
+        }
+        if (rc) {
+            free(rc);
+        }
+        if (p) {
+            free(p);
+        }
+
+        *l = NULL;
+    }
+    return JK_FALSE;
+}
+
 int jk_close_file_logger(jk_logger_t **l)
 {
     if (l && *l) {

Modified: tomcat/connectors/trunk/jk/native/common/jk_util.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.h?rev=700777&r1=700776&r2=700777&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.h Wed Oct  1 07:10:56 2008
@@ -45,6 +45,8 @@
 
 int jk_open_file_logger(jk_logger_t **l, const char *file, int level);
 
+int jk_attach_file_logger(jk_logger_t **l, int fd, int level);
+
 int jk_close_file_logger(jk_logger_t **l);
 
 int jk_log(jk_logger_t *l,



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message