[squid-dev] [RFC] Migrate explicit syslog calls to debugs

Alex Rousskov rousskov at measurement-factory.com
Thu Jul 27 04:06:51 UTC 2017


Hello,

    Squid master process uses many explicit syslog() calls like these:

> syslog(LOG_ALERT, "fork failed: %s", xstrerr(xerrno));
> syslog(LOG_ALERT, "Suspiciously high workers value: %d",
> syslog(LOG_NOTICE, "Squid Parent: will start %d kids", (int)TheKids.count());
> syslog(LOG_ALERT, "execvp failed: %s", xstrerr(xerrno));
> syslog(LOG_NOTICE, "Squid Parent: %s process %d started",
> syslog(LOG_NOTICE, "Squid Parent: %s process %d exited with status %d",
> syslog(LOG_NOTICE, "Squid Parent: %s process %d exited due to signal %d with status %d",
> syslog(LOG_NOTICE, "Squid Parent: %s process %d exited",
> syslog(LOG_NOTICE, "Squid Parent: %s process %d will not"
> syslog(LOG_NOTICE, "Squid Parent: unknown child process %d exited", pid);
> syslog(LOG_ALERT, "Exiting due to unexpected forced shutdown");
> syslog(LOG_ALERT, "Exiting due to repeated, frequent failures");


I propose to replace explicit syslog() calls with DBG_CRITICAL and
DBG_IMPORTANT debugs() calls _and_ automatically enable syslog-logging
of levels 0-1 debugs() calls made by the master process.

The proposed combination should preserve the current syslog info while
allowing us to use modern ostream-style formatting that is usually more
convenient, often more powerful, and sometimes safer to use than
printf-style formatting used by syslog().


The proposed approach would also make it easier to add master process
debugging messages (that should not go to syslog by default). As Squid
master process becomes smarter (e.g., an upcoming patch adds initial
master reconfiguration support among other things), these debugging
messages become desperately needed.


What do you think?


Thank you,

Alex.


More information about the squid-dev mailing list