httpd(8) still creates/opens log files with `no log' in httpd.conf(5): 

     [no] log [option]
             Set the specified logging options.  Logging is enabled by default
             using the standard access and error log files, but can be changed
             per server or location.  Use the no log directive to disable
             logging of any requests.  Multiple options may be specified
             within curly braces.  Valid options are:

I want to quickly serve files with nothing but a config file:

        # cat /etc/httpd.conf
        chroot "/foo"
        server "default" {
                listen on "*" port www
                no log
                root "/"
        }
        # httpd -d
        doas ([email protected]) password:
        startup
        failed to open /foo/logs/access.log: No such file or directory
        parent: failed to open log file
        logger exiting, pid 1150
        server exiting, pid 42968
        server exiting, pid 51707

Diff below fixes this.

Feedback? OK?

Index: usr.sbin/httpd/logger.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/logger.c,v
retrieving revision 1.21
diff -u -p -r1.21 logger.c
--- usr.sbin/httpd/logger.c     7 Feb 2018 03:28:05 -0000       1.21
+++ usr.sbin/httpd/logger.c     2 May 2019 20:13:04 -0000
@@ -197,7 +197,7 @@ logger_open(struct server *srv, struct s
 {
        struct log_file *log, *logfile = NULL, *errfile = NULL;
 
-       if (srv_conf->flags & SRVFLAG_SYSLOG)
+       if (srv_conf->flags & (SRVFLAG_SYSLOG | SRVFLAG_NO_LOG))
                return (0);
 
        /* disassociate */

Reply via email to