summaryrefslogtreecommitdiffstats
path: root/utility
diff options
context:
space:
mode:
Diffstat (limited to 'utility')
-rw-r--r--utility/util.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/utility/util.c b/utility/util.c
index 45b95ba..d8502fc 100644
--- a/utility/util.c
+++ b/utility/util.c
@@ -2,6 +2,7 @@
2#include "apr_strings.h" 2#include "apr_strings.h"
3#include "apr_lib.h" 3#include "apr_lib.h"
4#include "apr_file_io.h" 4#include "apr_file_io.h"
5#include "apr_time.h"
5 6
6#include "config.h" 7#include "config.h"
7 8
@@ -158,7 +159,8 @@ const char *logging_strerror(apr_status_t rv)
158void logging_log(config_t *cfg, loglevel_e level, const char *fmt, ...) 159void logging_log(config_t *cfg, loglevel_e level, const char *fmt, ...)
159{ 160{
160 va_list ap; 161 va_list ap;
161 struct iovec vec[2]; 162 char date[APR_RFC822_DATE_LEN];
163 struct iovec vec[4];
162 apr_size_t blen; 164 apr_size_t blen;
163 165
164 if (cfg->loglevel < level) return; 166 if (cfg->loglevel < level) return;
@@ -166,16 +168,21 @@ void logging_log(config_t *cfg, loglevel_e level, const char *fmt, ...)
166 va_start(ap, fmt); 168 va_start(ap, fmt);
167 apr_pool_clear(cfg->errorlog_p); 169 apr_pool_clear(cfg->errorlog_p);
168 170
169 vec[0].iov_base = apr_pvsprintf(cfg->errorlog_p, fmt, ap); 171 apr_rfc822_date(date, apr_time_now());
170 vec[0].iov_len = strlen(vec[0].iov_base); 172 vec[0].iov_base = date;
171 vec[1].iov_base = "\n"; 173 vec[0].iov_len = APR_RFC822_DATE_LEN-1;
172 vec[1].iov_len = 1; 174 vec[1].iov_base = " ";
175 vec[1].iov_len = 2;
176 vec[2].iov_base = apr_pvsprintf(cfg->errorlog_p, fmt, ap);
177 vec[2].iov_len = strlen(vec[2].iov_base);
178 vec[3].iov_base = "\n";
179 vec[3].iov_len = 1;
173 180
174 if (level == LOGLEVEL_NOISE) { 181 if (level == LOGLEVEL_NOISE) {
175 apr_file_writev(cfg->errorlog_fperr,vec,2,&blen); 182 apr_file_writev(cfg->errorlog_fperr,vec,4,&blen);
176 } 183 }
177 if (cfg->loglevel > LOGLEVEL_NONE && cfg->errorlog_fp) { 184 if (cfg->loglevel > LOGLEVEL_NONE && cfg->errorlog_fp) {
178 apr_file_writev(cfg->errorlog_fp,vec,2,&blen); 185 apr_file_writev(cfg->errorlog_fp,vec,4,&blen);
179 } 186 }
180 187
181 va_end(ap); 188 va_end(ap);