app.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:jupyterhub-nginx-chp 作者: yuvipanda 项目源码 文件源码
def access_log_dest(self):
        """
        Return the destination for access logs

        If we're running this as a systemd service, systemd
        makes /dev/stdout and friends be sockets that lead
        into journald, rather than files. This confuses
        nginx, which expects to `open()` them like normal
        files. nginx supports 'stderr' as a directive for
        error_log, but *not* access log. Since we still
        want to get them out into stderr, we hack this in.

        If /dev/stdout is a socket, we then write to syslog.
        JournalD also picks up syslog, so the end result is
        the same from an admin's pov. Just uglier and hackier

        I guess the 'right' thing here is for nginx to
        support `stderr` as a target in access_log just like
        for `error_log`
        """
        path = '/dev/stdout'
        if stat.S_ISSOCK(os.stat(path).st_mode):
            return 'syslog:server=unix:/dev/log,nohostname'
        return path

    # performance tuning!
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号