In web server, rename LOGFILE -> LOG-FILE.

This commit is contained in:
sperber 2003-01-30 16:09:20 +00:00
parent 6e5f9ed278
commit fe25e5a307
4 changed files with 30 additions and 30 deletions

View File

@ -91,7 +91,7 @@ one. Here they are:
parameter is \ex{\#f}, no limit is imposed. Defaults to \ex{\#f}. parameter is \ex{\#f}, no limit is imposed. Defaults to \ex{\#f}.
\end{desc} \end{desc}
\defun{with-logfile}{logfile [options]}{options} \defun{with-log-file}{log-file [options]}{options}
\begin{desc} \begin{desc}
This specifies the name of a log file for the server where it writes This specifies the name of a log file for the server where it writes
Common Log Format logging information. It can also be a port in Common Log Format logging information. It can also be a port in

View File

@ -69,7 +69,7 @@
;; syslog has to be initialized before CLF-logging ;; syslog has to be initialized before CLF-logging
;; because the latter may generate syslog-messages ;; because the latter may generate syslog-messages
(init-http-syslog! (httpd-options-syslog? options)) (init-http-syslog! (httpd-options-syslog? options))
(init-http-port-log! (httpd-options-logfile options)) (init-http-port-log! (httpd-options-log-file options))
(if (httpd-options-resolve-ips? options) (if (httpd-options-resolve-ips? options)
(set-logging-dns-lookup? #t) (set-logging-dns-lookup? #t)
(set-logging-dns-lookup? #f))) (set-logging-dns-lookup? #f)))
@ -88,28 +88,28 @@
(set-logging-http-syslog? #f) (set-logging-http-syslog? #f)
(set-logging-http-syslog-proc do-nothing-proc)))) (set-logging-http-syslog-proc do-nothing-proc))))
(define (init-http-port-log! logfile) (define (init-http-port-log! log-file)
(let ((logport (let ((logport
(cond (cond
((string? logfile) ; try to open logfile for appending (output) ((string? log-file) ; try to open log-file for appending (output)
(open-logfile logfile)) (open-log-file log-file))
((output-port? logfile) ; we were given an output port, so let's use it ((output-port? log-file) ; we were given an output port, so let's use it
logfile) log-file)
((eq? logfile #f) ; no logging demanded ((eq? log-file #f) ; no logging demanded
#f) #f)
; unexpected value of logfile; ; unexpected value of log-file;
(else (else
(http-syslog (http-syslog
(syslog-level warning) (syslog-level warning)
"[httpd] Warning: Logfile was not specified correctly (given: ~S).~% No CLF logging." "[httpd] Warning: Log-File was not specified correctly (given: ~S).~% No CLF logging."
logfile) log-file)
(make-null-output-port))))) (make-null-output-port)))))
(if logfile ; if logging was specified, set up the logger (if log-file ; if logging was specified, set up the logger
(let ((http-log-lock (make-lock))) (let ((http-log-lock (make-lock)))
(set-logging-http-log-port logport) (set-logging-http-log-port logport)
(if (string? logfile) (if (string? log-file)
(spawn (make-logfile-rotator logfile http-log-lock))) (spawn (make-log-file-rotator log-file http-log-lock)))
(set-logging-http-log-proc (make-http-log-proc http-log-lock)))))) (set-logging-http-log-proc (make-http-log-proc http-log-lock))))))
(define (make-http-log-proc http-log-lock) (define (make-http-log-proc http-log-lock)
@ -138,8 +138,8 @@
((assq tag headers) => cdr) ((assq tag headers) => cdr)
(else "unknown"))) (else "unknown")))
;; does the logfile rotation on signal USR1 ;; does the log-file rotation on signal USR1
(define (make-logfile-rotator logfile http-log-lock) (define (make-log-file-rotator log-file http-log-lock)
(set-interrupt-handler interrupt/usr1 #f) (set-interrupt-handler interrupt/usr1 #f)
(lambda () (lambda ()
(on-interrupt (on-interrupt
@ -148,18 +148,18 @@
(with-lock http-log-lock (with-lock http-log-lock
(lambda () (lambda ()
(close-output-port (logging-http-log-port)) (close-output-port (logging-http-log-port))
(set-logging-http-log-port (open-logfile logfile)))))))) (set-logging-http-log-port (open-log-file log-file))))))))
(define (open-logfile logfile) (define (open-log-file log-file)
(with-errno-handler* (with-errno-handler*
(lambda (errno packet) (lambda (errno packet)
(http-syslog (syslog-level warning) (http-syslog (syslog-level warning)
"[httpd] Warning: An error occured while opening ~S for writing (~A).~%Send signal USR1 when the problem is fixed.~%" "[httpd] Warning: An error occured while opening ~S for writing (~A).~%Send signal USR1 when the problem is fixed.~%"
logfile log-file
(car packet)) (car packet))
(make-null-output-port)) (make-null-output-port))
(lambda () (lambda ()
(open-output-file logfile (open-output-file log-file
(bitwise-ior open/create open/append))))) (bitwise-ior open/create open/append)))))
; returns a string for a CLF entry (Common Log Format) ; returns a string for a CLF entry (Common Log Format)

View File

@ -17,7 +17,7 @@
request-handler request-handler
server-admin server-admin
simultaneous-requests simultaneous-requests
logfile log-file
syslog? syslog?
resolve-ips?) resolve-ips?)
httpd-options? httpd-options?
@ -35,7 +35,7 @@
set-httpd-options-server-admin!) set-httpd-options-server-admin!)
(simultaneous-requests httpd-options-simultaneous-requests (simultaneous-requests httpd-options-simultaneous-requests
set-httpd-options-simultaneous-requests!) set-httpd-options-simultaneous-requests!)
(logfile httpd-options-logfile set-httpd-options-logfile!) (log-file httpd-options-log-file set-httpd-options-log-file!)
(syslog? httpd-options-syslog? set-httpd-options-syslog?!) (syslog? httpd-options-syslog? set-httpd-options-syslog?!)
(resolve-ips? httpd-options-resolve-ips? set-httpd-options-resolve-ips?!)) (resolve-ips? httpd-options-resolve-ips? set-httpd-options-resolve-ips?!))
@ -49,11 +49,11 @@
#f ; server-admin #f ; server-admin
#f ; simultaneous-requests #f ; simultaneous-requests
#f #f
; string: filename of logfile (directory must exist) ; string: filename of log-file (directory must exist)
; output-port: log to this port (e.g. (current-error-port)) ; output-port: log to this port (e.g. (current-error-port))
; #f: no logging ; #f: no logging
#t ; Do syslogging? #t ; Do syslogging?
#t)) ; Write host names instead of IPs in logfiles? #t)) ; Write host names instead of IPs in log-files?
; creates a copy of a given httpd-option ; creates a copy of a given httpd-option
@ -74,7 +74,7 @@
(set-httpd-options-simultaneous-requests! (set-httpd-options-simultaneous-requests!
new-options new-options
(httpd-options-simultaneous-requests options)) (httpd-options-simultaneous-requests options))
(set-httpd-options-logfile! new-options (httpd-options-logfile options)) (set-httpd-options-log-file! new-options (httpd-options-log-file options))
(set-httpd-options-syslog?! new-options (httpd-options-syslog? options)) (set-httpd-options-syslog?! new-options (httpd-options-syslog? options))
(set-httpd-options-resolve-ips?! new-options (httpd-options-resolve-ips? options)) (set-httpd-options-resolve-ips?! new-options (httpd-options-resolve-ips? options))
new-options)) new-options))
@ -106,8 +106,8 @@
(make-httpd-options-transformer set-httpd-options-server-admin!)) (make-httpd-options-transformer set-httpd-options-server-admin!))
(define with-simultaneous-requests (define with-simultaneous-requests
(make-httpd-options-transformer set-httpd-options-simultaneous-requests!)) (make-httpd-options-transformer set-httpd-options-simultaneous-requests!))
(define with-logfile (define with-log-file
(make-httpd-options-transformer set-httpd-options-logfile!)) (make-httpd-options-transformer set-httpd-options-log-file!))
(define with-syslog? (define with-syslog?
(make-httpd-options-transformer set-httpd-options-syslog?!)) (make-httpd-options-transformer set-httpd-options-syslog?!))
(define with-resolve-ips? (define with-resolve-ips?

View File

@ -222,7 +222,7 @@
with-request-handler with-request-handler
with-server-admin with-server-admin
with-simultaneous-requests with-simultaneous-requests
with-logfile with-log-file
with-syslog? with-syslog?
with-resolve-ips?)) with-resolve-ips?))
@ -234,7 +234,7 @@
httpd-options-request-handler httpd-options-request-handler
httpd-options-server-admin httpd-options-server-admin
httpd-options-simultaneous-requests httpd-options-simultaneous-requests
httpd-options-logfile httpd-options-log-file
httpd-options-syslog? httpd-options-syslog?
httpd-options-resolve-ips?)) httpd-options-resolve-ips?))