diff options
author | Martin Vobruba <vobruba.martin@gmail.com> | 2016-07-04 10:46:44 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-07-11 09:34:48 +0200 |
commit | 2809a676b55cebd4c6f8a8895ffe286db0704e87 (patch) | |
tree | 82234099f4941228c5c0539b06107e8cdddc05f8 /sapi/apache2handler/sapi_apache2.c | |
parent | 2e3903b2d62976087b3ce74275372052a9922a36 (diff) | |
download | php-git-2809a676b55cebd4c6f8a8895ffe286db0704e87.tar.gz |
Pass error severity to SAPI modules and raise corresponding error level in Apache
Diffstat (limited to 'sapi/apache2handler/sapi_apache2.c')
-rw-r--r-- | sapi/apache2handler/sapi_apache2.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 6f6de422ba..f61841d86c 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -314,16 +314,44 @@ php_apache_sapi_flush(void *server_context) } } -static void php_apache_sapi_log_message(char *msg) +static void php_apache_sapi_log_message(char *msg, int syslog_type_int) { php_struct *ctx; + int aplog_type = APLOG_ERR; ctx = SG(server_context); + switch (syslog_type_int) { + case LOG_EMERG: + aplog_type = APLOG_EMERG; + break; + case LOG_ALERT: + aplog_type = APLOG_ALERT; + break; + case LOG_CRIT: + aplog_type = APLOG_CRIT; + break; + case LOG_ERR: + aplog_type = APLOG_ERR; + break; + case LOG_WARNING: + aplog_type = APLOG_WARNING; + break; + case LOG_NOTICE: + aplog_type = APLOG_NOTICE; + break; + case LOG_INFO: + aplog_type = APLOG_INFO; + break; + case LOG_DEBUG: + aplog_type = APLOG_DEBUG; + break; + } + if (ctx == NULL) { /* we haven't initialized our ctx yet, oh well */ ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, 0, NULL, "%s", msg); } else { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, "%s", msg); + ap_log_rerror(APLOG_MARK, aplog_type, 0, ctx->r, "%s", msg); } } @@ -332,7 +360,7 @@ static void php_apache_sapi_log_message_ex(char *msg, request_rec *r) if (r) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, msg, r->filename); } else { - php_apache_sapi_log_message(msg); + php_apache_sapi_log_message(msg, -1); } } |