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,14 +91,14 @@ one. Here they are:
parameter is \ex{\#f}, no limit is imposed. Defaults to \ex{\#f}.
\end{desc}
\defun{with-logfile}{logfile [options]}{options}
\defun{with-log-file}{log-file [options]}{options}
\begin{desc}
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
which case the information is logged to that port, or \ex{\#f} for
no logging. Defaults to \ex{\#f}.
To allow rotation of logfiles, the server re-opens the logfile
To allow rotation of log files, the server re-opens the log file
whenever it receives a \texttt{USR1} signal.
\end{desc}

View File

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

View File

@ -17,7 +17,7 @@
request-handler
server-admin
simultaneous-requests
logfile
log-file
syslog?
resolve-ips?)
httpd-options?
@ -35,7 +35,7 @@
set-httpd-options-server-admin!)
(simultaneous-requests 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?!)
(resolve-ips? httpd-options-resolve-ips? set-httpd-options-resolve-ips?!))
@ -49,11 +49,11 @@
#f ; server-admin
#f ; simultaneous-requests
#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))
; #f: no logging
#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
@ -74,7 +74,7 @@
(set-httpd-options-simultaneous-requests!
new-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-resolve-ips?! new-options (httpd-options-resolve-ips? options))
new-options))
@ -106,8 +106,8 @@
(make-httpd-options-transformer set-httpd-options-server-admin!))
(define with-simultaneous-requests
(make-httpd-options-transformer set-httpd-options-simultaneous-requests!))
(define with-logfile
(make-httpd-options-transformer set-httpd-options-logfile!))
(define with-log-file
(make-httpd-options-transformer set-httpd-options-log-file!))
(define with-syslog?
(make-httpd-options-transformer set-httpd-options-syslog?!))
(define with-resolve-ips?

View File

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