[squid-users] Compiling Squid without log messages

Alan lameventanas at gmail.com
Mon Jan 19 09:05:25 UTC 2015


On Thu, Jan 15, 2015 at 7:59 PM, Amos Jeffries <squid3 at treenet.co.nz> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 15/01/2015 11:00 p.m., Alan wrote:
>> Hello,
>>
>> I want to have a minimal Squid installation. So I compiled
>> disabling everything I don't need. The resulting /usr/sbin/squid is
>> 3.4 Mb.
>>
>> Since I don't need logging, I decided to remove that as well, but
>> its not easy to do with sed since sometimes log messages span
>> multiple lines.
>>
>> So I changed the definition for debugs() in Debug.h like this:
>>
>>
>> /* Debug stream */ +#ifdef NODEBUG +#define debugs(SECTION, LEVEL,
>> CONTENT) ((void)0) +#else #define debugs(SECTION, LEVEL, CONTENT)
>> \ do { \ if ((Debug::level = (LEVEL)) <= Debug::Levels[SECTION]) {
>> \ @@ -116,6 +119,7 @@ Debug::finishDebug(); \ } \ } while
>> (/*CONSTCOND*/ 0) +#endif
>>
>>
>> And compiled with -DNODEBUG. The resulting binary is 2.1 Mb, a 60%
>> size reduction!
>>
>> But it doesn't work properly, and since there is no log, its hard
>> to debug.
>>
>> A trace shows it accepts requests, makes them to the HTTP server,
>> but after that it closes the connection to the HTTP client.
>>
>> Any ideas?
>
> Well ... take a guess where to look :-P
>
> If you are disabling anything via manual alteration of the code
> instead of the ./configure --disable options (you mention using sed)
> then one of the things you *do* need is the debugs() logging.
>
> cache.log / debugs() is not just for debugging either. It is also for
> recording major/critical events that you as administrator really,
> really need to be made aware of.
>
>
>
> Though, on the diagnosis I suggest at least trying with a macro name
> other than "NODEBUG". For some reason that macro is used to disable
> the assertion handling.

Hi Amos,

It seems that there is an assert() that is setting something, instead
of just checking something.
I can reproduce the problem *without* redefining debugs(), just by
compiling with NODEBUG.
So now I can provide you a cache.log in case you think it would help.

And on the other hand, I get a fully functional Squid by using a
different macro name, like you suggested.

Regards,

Alan


More information about the squid-users mailing list