diff --git a/src/cfgparse.c b/src/cfgparse.c index 8df5386d6..bd720c624 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -4029,6 +4029,13 @@ int check_config_validity() if (curproxy->options & PR_O_LOGASAP) curproxy->to_log &= ~LW_BYTES; + if ((curproxy->mode == PR_MODE_TCP || curproxy->mode == PR_MODE_HTTP) && + (curproxy->cap & PR_CAP_FE) && curproxy->to_log && curproxy->logfac1 < 0) { + Warning("config : log format ignored for %s '%s' since it has no log address.\n", + proxy_type_str(curproxy), curproxy->id); + err_code |= ERR_WARN; + } + /* * ensure that we're not cross-dressing a TCP server into HTTP. */ diff --git a/src/log.c b/src/log.c index 093accb28..8d71eae3f 100644 --- a/src/log.c +++ b/src/log.c @@ -345,20 +345,10 @@ void tcp_sess_log(struct session *s) get_localtime(s->logs.tv_accept.tv_sec, &tm); - if (fe->logfac1 >= 0) - prx_log = fe; - /* - * FIXME: should we fall back to the backend if the frontend did not - * define any log ? It seems like we should not permit such complex - * setups because they would induce a debugging nightmare for the - * admin. - */ - // else if (be->logfac1 >= 0) - // prx_log = be; - else - prx_log = NULL; /* global */ + if (fe->logfac1 < 0 && fe->logfac2 < 0) + return; - /* FIXME: let's limit ourselves to frontend logging for now. */ + prx_log = fe; tolog = fe->to_log; svid = (tolog & LW_SVID) ? (s->srv != NULL) ? s->srv->id : "" : "-";