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.8.4_orig/auto/make (+4 lines)
Lines 15-20 Link Here
15
ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
15
ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
16
ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`
16
ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`
17
17
18
#SYSLOG
19
if [[ "${USE_SYSLOG}" == "YES" ]]; then
20
    CFLAGS="$CFLAGS -DUSE_SYSLOG"
21
fi
18
22
19
cat << END                                                     > $NGX_MAKEFILE
23
cat << END                                                     > $NGX_MAKEFILE
20
24
(-)nginx-0.8.4_orig/auto/options (+7 lines)
Lines 110-115 Link Here
110
MD5_OPT=
110
MD5_OPT=
111
MD5_ASM=NO
111
MD5_ASM=NO
112
112
113
USE_SYSLOG=NO
114
113
USE_SHA1=NO
115
USE_SHA1=NO
114
SHA1=NONE
116
SHA1=NONE
115
SHA1_OPT=
117
SHA1_OPT=
Lines 252-257 Link Here
252
        --with-md5-opt=*)                MD5_OPT="$value"           ;;
254
        --with-md5-opt=*)                MD5_OPT="$value"           ;;
253
        --with-md5-asm)                  MD5_ASM=YES                ;;
255
        --with-md5-asm)                  MD5_ASM=YES                ;;
254
256
257
	--with-syslog)			 USE_SYSLOG=YES		    ;;
258
255
        --with-sha1=*)                   SHA1="$value"              ;;
259
        --with-sha1=*)                   SHA1="$value"              ;;
256
        --with-sha1-opt=*)               SHA1_OPT="$value"          ;;
260
        --with-sha1-opt=*)               SHA1_OPT="$value"          ;;
257
        --with-sha1-asm)                 SHA1_ASM=YES               ;;
261
        --with-sha1-asm)                 SHA1_ASM=YES               ;;
Lines 381-386 Link Here
381
  --with-md5-opt=OPTIONS             set additional options for md5 building
385
  --with-md5-opt=OPTIONS             set additional options for md5 building
382
  --with-md5-asm                     use md5 assembler sources
386
  --with-md5-asm                     use md5 assembler sources
383
387
388
  --with-syslog			     use syslog instead of files to log messages
389
384
  --with-sha1=DIR                    set path to sha1 library sources
390
  --with-sha1=DIR                    set path to sha1 library sources
385
  --with-sha1-opt=OPTIONS            set additional options for sha1 building
391
  --with-sha1-opt=OPTIONS            set additional options for sha1 building
386
  --with-sha1-asm                    use sha1 assembler sources
392
  --with-sha1-asm                    use sha1 assembler sources
Lines 395-400 Link Here
395
  --with-openssl-opt=OPTIONS         set additional options for OpenSSL building
401
  --with-openssl-opt=OPTIONS         set additional options for OpenSSL building
396
402
397
  --with-debug                       enable the debugging logging
403
  --with-debug                       enable the debugging logging
404
  
398
405
399
END
406
END
400
407
(-)nginx-0.8.4_orig/auto/summary (+5 lines)
Lines 71-76 Link Here
71
    *)     echo "  + using zlib library: $ZLIB" ;;
71
    *)     echo "  + using zlib library: $ZLIB" ;;
72
esac
72
esac
73
73
74
case $USE_SYSLOG in
75
    YES)   echo "  + using syslog" ;;
76
    *)     echo "  + syslog is not used" ;;
77
esac
78
74
echo
79
echo
75
80
76
81
(-)nginx-0.8.4_orig/src/core/nginx.c (+12 lines)
Lines 8-13 Link Here
8
#include <ngx_core.h>
8
#include <ngx_core.h>
9
#include <nginx.h>
9
#include <nginx.h>
10
10
11
#ifdef USE_SYSLOG
12
#include <syslog.h>
13
#endif
11
14
12
static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle);
15
static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle);
13
static ngx_int_t ngx_get_options(int argc, char *const *argv);
16
static ngx_int_t ngx_get_options(int argc, char *const *argv);
Lines 271-276 Link Here
271
    ngx_ssl_init(log);
274
    ngx_ssl_init(log);
272
#endif
275
#endif
273
276
277
    /* SYSLOG SUPPORT */
278
#ifdef USE_SYSLOG
279
    openlog("nginx", LOG_ODELAY, LOG_DAEMON);
280
#endif
281
274
    /*
282
    /*
275
     * init_cycle->log is required for signal handlers and
283
     * init_cycle->log is required for signal handlers and
276
     * ngx_process_options()
284
     * ngx_process_options()
Lines 382-387 Link Here
382
        ngx_master_process_cycle(cycle);
390
        ngx_master_process_cycle(cycle);
383
    }
391
    }
384
392
393
#ifdef USE_SYSLOG
394
    closelog();
395
#endif
396
385
    return 0;
397
    return 0;
386
}
398
}
387
399
(-)nginx-0.8.4_orig/src/core/ngx_conf_file.c (+6 lines)
Lines 907-912 Link Here
907
    full.data = NULL;
907
    full.data = NULL;
908
#endif
908
#endif
909
909
910
#ifdef USE_SYSLOG
911
    if (name->len) {
912
      name->len = 0;
913
    }
914
#endif
915
910
    if (name->len) {
916
    if (name->len) {
911
        full = *name;
917
        full = *name;
912
918
(-)nginx-0.8.4_orig/src/core/ngx_log.c (-1 / +24 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_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
14
static char *ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
12
15
Lines 90-98 Link Here
90
    u_char  *p, *last, *msg;
93
    u_char  *p, *last, *msg;
91
    u_char   errstr[NGX_MAX_ERROR_STR];
94
    u_char   errstr[NGX_MAX_ERROR_STR];
92
95
96
#ifndef USE_SYSLOG
93
    if (log->file->fd == NGX_INVALID_FILE) {
97
    if (log->file->fd == NGX_INVALID_FILE) {
94
        return;
98
        return;
95
    }
99
    }
100
#endif
96
101
97
    last = errstr + NGX_MAX_ERROR_STR;
102
    last = errstr + NGX_MAX_ERROR_STR;
98
103
Lines 139-145 Link Here
139
144
140
    ngx_linefeed(p);
145
    ngx_linefeed(p);
141
146
147
#ifdef USE_SYSLOG
148
    /* allocate a string which can hold the error message */
149
    char *syslogstr;
150
151
    if ((syslogstr = calloc((p - errstr + 1), sizeof(char))) != NULL) {
152
      strncpy(syslogstr, errstr, p - errstr);
153
154
      /* write to syslog */
155
      syslog(LOG_CRIT, "%s", syslogstr);
156
157
      free(syslogstr);
158
    }
159
#else
142
    (void) ngx_write_fd(log->file->fd, errstr, p - errstr);
160
    (void) ngx_write_fd(log->file->fd, errstr, p - errstr);
161
#endif
143
162
144
    if (!ngx_use_stderr
163
    if (!ngx_use_stderr
145
        || level > NGX_LOG_WARN
164
        || level > NGX_LOG_WARN
Lines 428-436 Link Here
428
447
429
    value = cf->args->elts;
448
    value = cf->args->elts;
430
449
450
#ifdef USE_SYSLOG
451
    value[1].data = "stderr";
452
#endif
453
431
    if (ngx_strcmp(value[1].data, "stderr") == 0) {
454
    if (ngx_strcmp(value[1].data, "stderr") == 0) {
432
        name.len = 0;
455
        name.len = 0;
433
        name.data = NULL;
456
        name.data = "";
434
457
435
    } else {
458
    } else {
436
        name = value[1];
459
        name = value[1];
(-)nginx-0.8.4_orig/src/http/modules/ngx_http_log_module.c (+25 lines)
Lines 8-13 Link Here
8
#include <ngx_core.h>
8
#include <ngx_core.h>
9
#include <ngx_http.h>
9
#include <ngx_http.h>
10
10
11
#ifdef USE_SYSLOG
12
#include <syslog.h>
13
#endif
11
14
12
typedef struct ngx_http_log_op_s  ngx_http_log_op_t;
15
typedef struct ngx_http_log_op_s  ngx_http_log_op_t;
13
16
Lines 310-315 Link Here
310
ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
313
ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
311
    size_t len)
314
    size_t len)
312
{
315
{
316
#ifdef USE_SYSLOG
317
  /* allocate a string which can hold the error message */
318
  char *syslogstr;
319
320
  if ((syslogstr = calloc((len + 1), sizeof(char))) != NULL) {
321
    strncpy(syslogstr, buf, len);
322
323
    /* write to syslog */
324
    syslog(LOG_NOTICE, "%s", syslogstr);
325
326
    free(syslogstr);
327
  }
328
#else
313
    u_char     *name;
329
    u_char     *name;
314
    time_t      now;
330
    time_t      now;
315
    ssize_t     n;
331
    ssize_t     n;
Lines 354-359 Link Here
354
370
355
        log->error_log_time = now;
371
        log->error_log_time = now;
356
    }
372
    }
373
#endif
357
}
374
}
358
375
359
376
Lines 800-806 Link Here
800
        return NGX_CONF_ERROR;
817
        return NGX_CONF_ERROR;
801
    }
818
    }
802
819
820
#ifdef USE_SYSLOG
821
    ngx_http_access_log.data = "";
822
#endif
803
    log->file = ngx_conf_open_file(cf->cycle, &ngx_http_access_log);
823
    log->file = ngx_conf_open_file(cf->cycle, &ngx_http_access_log);
824
804
    if (log->file == NULL) {
825
    if (log->file == NULL) {
805
        return NGX_CONF_ERROR;
826
        return NGX_CONF_ERROR;
806
    }
827
    }
Lines 859-865 Link Here
859
    n = ngx_http_script_variables_count(&value[1]);
880
    n = ngx_http_script_variables_count(&value[1]);
860
881
861
    if (n == 0) {
882
    if (n == 0) {
883
#ifdef USE_SYSLOG
884
        value[1].data = "";
885
#endif
862
        log->file = ngx_conf_open_file(cf->cycle, &value[1]);
886
        log->file = ngx_conf_open_file(cf->cycle, &value[1]);
887
863
        if (log->file == NULL) {
888
        if (log->file == NULL) {
864
            return NGX_CONF_ERROR;
889
            return NGX_CONF_ERROR;
865
        }
890
        }

Return to bug 222373