summaryrefslogtreecommitdiff
path: root/main/php_syslog.c
diff options
context:
space:
mode:
authorPhilip Prindeville <philipp@redfish-solutions.com>2017-08-22 16:34:06 -0600
committerJakub Zelenka <bukka@php.net>2018-07-01 18:08:07 +0100
commit2475337bd8a0fad0dac03db3f5e7e9d331d53653 (patch)
treeb63e4fb01f947716d1d0f0b99e2ef7e1d679126c /main/php_syslog.c
parent0c4f4481f59489c9de62489a396964e221ef793c (diff)
downloadphp-git-2475337bd8a0fad0dac03db3f5e7e9d331d53653.tar.gz
Add syslog's ident and facility parameters to config
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Diffstat (limited to 'main/php_syslog.c')
-rw-r--r--main/php_syslog.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/main/php_syslog.c b/main/php_syslog.c
index 1718bb9ccb..7fcecef231 100644
--- a/main/php_syslog.c
+++ b/main/php_syslog.c
@@ -42,6 +42,15 @@ PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */
{
va_list args;
+ /*
+ * don't rely on openlog() being called by syslog() if it's
+ * not already been done; call it ourselves and pass the
+ * correct parameters!
+ */
+ if (!PG(have_called_openlog)) {
+ php_openlog(PG(syslog_ident), 0, PG(syslog_facility));
+ }
+
va_start(args, format);
vsyslog(priority, format, args);
va_end(args);
@@ -56,6 +65,15 @@ PHPAPI void php_syslog(int priority, const char *format, ...) /* {{{ */
smart_string sbuf = {0};
va_list args;
+ /*
+ * don't rely on openlog() being called by syslog() if it's
+ * not already been done; call it ourselves and pass the
+ * correct parameters!
+ */
+ if (!PG(have_called_openlog)) {
+ php_openlog(PG(syslog_ident), 0, PG(syslog_facility));
+ }
+
va_start(args, format);
zend_printf_to_smart_string(&fbuf, format, args);
smart_string_0(&fbuf);