Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 222373 | Differences between
and this patch

Collapse All | Expand All

(-)nginx-0.6.31_orig/auto/make (+4 lines)
Lines 13-18 Link Here
13
ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
13
ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
14
ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`
14
ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`
15
15
16
#SYSLOG
17
if [[ "${USE_SYSLOG}" == "YES" ]]; then
18
   CFLAGS="$CFLAGS -DUSE_SYSLOG"
19
fi
16
20
17
cat << END                                                     > $NGX_MAKEFILE
21
cat << END                                                     > $NGX_MAKEFILE
18
22
(-)nginx-0.6.31_orig/auto/options (+10 lines)
Lines 102-107 Link Here
102
MD5_OPT=
102
MD5_OPT=
103
MD5_ASM=NO
103
MD5_ASM=NO
104
104
105
USE_SYSLOG=NO
106
105
USE_SHA1=NO
107
USE_SHA1=NO
106
SHA1=NONE
108
SHA1=NONE
107
SHA1_OPT=
109
SHA1_OPT=
Lines 225-230 Link Here
225
        --with-md5-opt=*)                MD5_OPT="$value"           ;;
227
        --with-md5-opt=*)                MD5_OPT="$value"           ;;
226
        --with-md5-asm)                  MD5_ASM=YES                ;;
228
        --with-md5-asm)                  MD5_ASM=YES                ;;
227
229
230
	--with-syslog)			 USE_SYSLOG=YES		    ;;
231
228
        --with-sha1=*)                   SHA1="$value"              ;;
232
        --with-sha1=*)                   SHA1="$value"              ;;
229
        --with-sha1-opt=*)               SHA1_OPT="$value"          ;;
233
        --with-sha1-opt=*)               SHA1_OPT="$value"          ;;
230
        --with-sha1-asm)                 SHA1_ASM=YES               ;;
234
        --with-sha1-asm)                 SHA1_ASM=YES               ;;
Lines 233-238 Link Here
233
        --with-zlib-opt=*)               ZLIB_OPT="$value"          ;;
237
        --with-zlib-opt=*)               ZLIB_OPT="$value"          ;;
234
        --with-zlib-asm=*)               ZLIB_ASM="$value"          ;;
238
        --with-zlib-asm=*)               ZLIB_ASM="$value"          ;;
235
239
240
	--with-syslog)			 USE_SYSLOG="YES"	    ;;
241
236
        --test-build-devpoll)            NGX_TEST_BUILD_DEVPOLL=YES ;;
242
        --test-build-devpoll)            NGX_TEST_BUILD_DEVPOLL=YES ;;
237
        --test-build-eventport)          NGX_TEST_BUILD_EVENTPORT=YES ;;
243
        --test-build-eventport)          NGX_TEST_BUILD_EVENTPORT=YES ;;
238
        --test-build-epoll)              NGX_TEST_BUILD_EPOLL=YES   ;;
244
        --test-build-epoll)              NGX_TEST_BUILD_EPOLL=YES   ;;
Lines 341-346 Link Here
341
  --with-md5-opt=OPTIONS             set additional options for md5 building
347
  --with-md5-opt=OPTIONS             set additional options for md5 building
342
  --with-md5-asm                     use md5 assembler sources
348
  --with-md5-asm                     use md5 assembler sources
343
349
350
  --with-syslog			     use syslog instead of files to log messages
351
344
  --with-sha1=DIR                    set path to sha1 library sources
352
  --with-sha1=DIR                    set path to sha1 library sources
345
  --with-sha1-opt=OPTIONS            set additional options for sha1 building
353
  --with-sha1-opt=OPTIONS            set additional options for sha1 building
346
  --with-sha1-asm                    use sha1 assembler sources
354
  --with-sha1-asm                    use sha1 assembler sources
Lines 356-361 Link Here
356
364
357
  --with-debug                       enable the debugging logging
365
  --with-debug                       enable the debugging logging
358
366
367
  --with-syslog			     enable syslog support (disables writing to file)
368
359
END
369
END
360
370
361
    exit 1
371
    exit 1
(-)nginx-0.6.31_orig/auto/summary (+5 lines)
Lines 83-88 Link Here
83
    *)     echo "  + using zlib library: $ZLIB" ;;
83
    *)     echo "  + using zlib library: $ZLIB" ;;
84
esac
84
esac
85
85
86
case $USE_SYSLOG in
87
    YES)   echo "  + using syslog" ;;
88
    *)     echo "  + syslog is not used" ;;
89
esac
90
86
echo
91
echo
87
92
88
93
(-)nginx-0.6.31_orig/src/core/nginx.c (+12 lines)
Lines 9-14 Link Here
9
#include <ngx_event.h>
9
#include <ngx_event.h>
10
#include <nginx.h>
10
#include <nginx.h>
11
11
12
#ifdef USE_SYSLOG
13
#include <syslog.h>
14
#endif
12
15
13
static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle);
16
static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle);
14
static ngx_int_t ngx_getopt(ngx_cycle_t *cycle, int argc, char *const *argv);
17
static ngx_int_t ngx_getopt(ngx_cycle_t *cycle, int argc, char *const *argv);
Lines 221-226 Link Here
221
    ngx_ssl_init(log);
224
    ngx_ssl_init(log);
222
#endif
225
#endif
223
226
227
    /* SYSLOG SUPPORT */
228
#ifdef USE_SYSLOG
229
    openlog("nginx", LOG_ODELAY, LOG_DAEMON);
230
#endif
231
224
    /* init_cycle->log is required for signal handlers and ngx_getopt() */
232
    /* init_cycle->log is required for signal handlers and ngx_getopt() */
225
233
226
    ngx_memzero(&init_cycle, sizeof(ngx_cycle_t));
234
    ngx_memzero(&init_cycle, sizeof(ngx_cycle_t));
Lines 358-363 Link Here
358
        ngx_single_process_cycle(cycle);
366
        ngx_single_process_cycle(cycle);
359
    }
367
    }
360
368
369
#ifdef USE_SYSLOG
370
    closelog();
371
#endif
372
361
    return 0;
373
    return 0;
362
}
374
}
363
375
(-)nginx-0.6.31_orig/src/core/ngx_conf_file.c (+5 lines)
Lines 751-756 Link Here
751
    full.data = NULL;
751
    full.data = NULL;
752
#endif
752
#endif
753
753
754
#ifdef USE_SYSLOG
755
if (name) {
756
		name = NULL;
757
}
758
#endif
754
    if (name) {
759
    if (name) {
755
        full = *name;
760
        full = *name;
756
761
(-)nginx-0.6.31_orig/src/core/ngx_log.c (-1 / +29 lines)
Lines 7-12 Link Here
7
#include <ngx_config.h>
7
#include <ngx_config.h>
8
#include <ngx_core.h>
8
#include <ngx_core.h>
9
9
10
#ifdef USE_SYSLOG
11
#include <syslog.h>
12
#endif
10
13
11
static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
14
static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
12
15
Lines 81-89 Link Here
81
#endif
84
#endif
82
    u_char   errstr[NGX_MAX_ERROR_STR], *p, *last;
85
    u_char   errstr[NGX_MAX_ERROR_STR], *p, *last;
83
86
87
    #ifndef USE_SYSLOG
84
    if (log->file->fd == NGX_INVALID_FILE) {
88
    if (log->file->fd == NGX_INVALID_FILE) {
85
        return;
89
        return;
86
    }
90
    }
91
    #endif
87
92
88
    last = errstr + NGX_MAX_ERROR_STR;
93
    last = errstr + NGX_MAX_ERROR_STR;
89
94
Lines 158-164 Link Here
158
163
159
    ngx_linefeed(p);
164
    ngx_linefeed(p);
160
165
161
    ngx_write_fd(log->file->fd, errstr, p - errstr);
166
#ifdef USE_SYSLOG
167
    /* allocate a string which can hold the error message */
168
    char *syslogstr;
169
170
    if ((syslogstr = calloc((p - errstr + 1), sizeof(char))) != NULL)
171
    {
172
        strncpy(syslogstr, errstr, p - errstr);
173
174
	/* write to syslog */
175
        syslog(LOG_CRIT, "%s", syslogstr);
176
177
        free(syslogstr);
178
    }
179
#else
180
        ngx_write_fd(log->file->fd, errstr, p - errstr);
181
#endif
162
}
182
}
163
183
164
184
Lines 242-254 Link Here
242
    ngx_log_t  *log;
262
    ngx_log_t  *log;
243
    ngx_str_t  *value, *name;
263
    ngx_str_t  *value, *name;
244
264
265
#ifndef USE_SYSLOG
245
    if (args) {
266
    if (args) {
246
        value = args->elts;
267
        value = args->elts;
247
        name = &value[1];
268
        name = &value[1];
248
269
249
    } else {
270
    } else {
271
#endif
250
        name = NULL;
272
        name = NULL;
273
#ifndef USE_SYSLOG
251
    }
274
    }
275
#endif
252
276
253
    log = ngx_pcalloc(cycle->pool, sizeof(ngx_log_t));
277
    log = ngx_pcalloc(cycle->pool, sizeof(ngx_log_t));
254
    if (log == NULL) {
278
    if (log == NULL) {
Lines 325-330 Link Here
325
349
326
    value = cf->args->elts;
350
    value = cf->args->elts;
327
351
352
#ifdef USE_SYSLOG
353
    value[1].data = "stderr";
354
#endif
355
328
    if (value[1].len == 6 && ngx_strcmp(value[1].data, "stderr") == 0) {
356
    if (value[1].len == 6 && ngx_strcmp(value[1].data, "stderr") == 0) {
329
        cf->cycle->new_log->file->fd = ngx_stderr.fd;
357
        cf->cycle->new_log->file->fd = ngx_stderr.fd;
330
        cf->cycle->new_log->file->name.len = 0;
358
        cf->cycle->new_log->file->name.len = 0;
(-)nginx-0.6.31_orig/src/http/modules/ngx_http_log_module.c (+26 lines)
Lines 9-14 Link Here
9
#include <ngx_http.h>
9
#include <ngx_http.h>
10
#include <nginx.h>
10
#include <nginx.h>
11
11
12
#ifdef USE_SYSLOG
13
#include <syslog.h>
14
#endif
12
15
13
typedef struct ngx_http_log_op_s  ngx_http_log_op_t;
16
typedef struct ngx_http_log_op_s  ngx_http_log_op_t;
14
17
Lines 284-289 Link Here
284
ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
287
ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
285
    size_t len)
288
    size_t len)
286
{
289
{
290
#ifdef USE_SYSLOG
291
    /* allocate a string which can hold the error message */
292
    char *syslogstr;
293
294
    if ((syslogstr = calloc((len + 1), sizeof(char))) != NULL)
295
    {
296
        strncpy(syslogstr, buf, len);
297
298
        /* write to syslog */
299
        syslog(LOG_NOTICE, "%s", syslogstr);
300
301
        free(syslogstr);
302
    }
303
#else
287
    time_t     now;
304
    time_t     now;
288
    ssize_t    n;
305
    ssize_t    n;
289
    ngx_err_t  err;
306
    ngx_err_t  err;
Lines 321-326 Link Here
321
338
322
        log->error_log_time = now;
339
        log->error_log_time = now;
323
    }
340
    }
341
#endif
324
}
342
}
325
343
326
344
Lines 585-591 Link Here
585
        return NGX_CONF_ERROR;
603
        return NGX_CONF_ERROR;
586
    }
604
    }
587
605
606
#ifdef USE_SYLOG
607
    log->file = ngx_conf_open_file(cf->cycle, NULL);
608
#else
588
    log->file = ngx_conf_open_file(cf->cycle, &ngx_http_access_log);
609
    log->file = ngx_conf_open_file(cf->cycle, &ngx_http_access_log);
610
#endif
589
    if (log->file == NULL) {
611
    if (log->file == NULL) {
590
        return NGX_CONF_ERROR;
612
        return NGX_CONF_ERROR;
591
    }
613
    }
Lines 637-643 Link Here
637
        return NGX_CONF_ERROR;
659
        return NGX_CONF_ERROR;
638
    }
660
    }
639
661
662
#ifdef USE_SYSLOG
663
    log->file = ngx_conf_open_file(cf->cycle, NULL);
664
#else
640
    log->file = ngx_conf_open_file(cf->cycle, &value[1]);
665
    log->file = ngx_conf_open_file(cf->cycle, &value[1]);
666
#endif
641
    if (log->file == NULL) {
667
    if (log->file == NULL) {
642
        return NGX_CONF_ERROR;
668
        return NGX_CONF_ERROR;
643
    }
669
    }

Return to bug 222373