Browse Source

Small bugfix in logs + add log in conf

Yann Weber 4 years ago
parent
commit
90100e6a88
3 changed files with 17 additions and 1 deletions
  1. 7
    0
      include/conf.h
  2. 3
    1
      src/conf.c
  3. 7
    0
      src/logger.c

+ 7
- 0
include/conf.h View File

@@ -19,6 +19,13 @@
19 19
 #ifndef __CONF_H___
20 20
 #define __CONF_H___
21 21
 
22
+#include <fcgiapp.h>
23
+#include <fcgi_stdio.h> /* fcgi library; put it first*/
24
+
25
+#define PY_SSIZE_T_CLEAN
26
+#include <Python.h>
27
+#include "structmember.h"
28
+
22 29
 #include <unistd.h>
23 30
 #include <getopt.h>
24 31
 #include <sys/types.h>

+ 3
- 1
src/conf.c View File

@@ -145,6 +145,7 @@ int check_entrypoint_import()
145 145
 	pid = fork();
146 146
 	if(!pid)
147 147
 	{
148
+		pyfcgi_log(LOG_DEBUG, "Checking entrypoint import");
148 149
 		pyinit();
149 150
 		ret = (void*)import_entrypoint();
150 151
 		if(!ret)
@@ -152,7 +153,8 @@ int check_entrypoint_import()
152 153
 			dprintf(2, "Unable to import entrypoint...\n");
153 154
 			exit(1);
154 155
 		}
155
-		exit(0);
156
+		pyfcgi_log(LOG_DEBUG, "Entrypoint import OK");
157
+		Py_Exit(0);
156 158
 	}
157 159
 	waitpid(pid, &status, 0);
158 160
 	return WEXITSTATUS(status);

+ 7
- 0
src/logger.c View File

@@ -553,6 +553,12 @@ int pyfcgi_logger_set_ident(const char* new_ident)
553 553
 			strerror(errno));
554 554
 		return PYFCGI_FATAL;
555 555
 	}
556
+
557
+	if(conf->flags & PYFCGI_LOG_FSYSLOG)
558
+	{
559
+		pyfcgi_logger_enable_syslog(new_ident);
560
+	}
561
+
556 562
 	len = strlen(new_ident);
557 563
 	for(i=0; i<conf->format_sz; i++)
558 564
 	{
@@ -627,6 +633,7 @@ dprintf(2, "ERROR ALLOC _msg : %s", strerror(errno));
627 633
 dprintf(2, "ERROR REALLOC _msg : %s", strerror(errno));
628 634
 			return NULL;
629 635
 		}
636
+		fmt->_msg = tmp;
630 637
 	}
631 638
 	memcpy(fmt->_msg + fmt->buflen[0], message, fmt_msg_len);
632 639
 	suff_off = fmt->buflen[0] + fmt_msg_len;

Loading…
Cancel
Save