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

Amos Jeffries squid3 at treenet.co.nz
Thu Jul 27 05:04:19 UTC 2017


On 27/07/17 16:06, Alex Rousskov wrote:
> 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().

It can easily result in log lines too long for syslog to record easily 
(IIRC some do brain-dead line wrapping at inconvenient lengths). So that 
will need to be accounted for in the design.

> 
> 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?


I wonder if the use of clog you suggested years ago to resolve the early 
startup messages problems should be fixed first.

+1 on having this happen though, whenever it happens.


Amos


More information about the squid-dev mailing list