[Asterisk-Users] asterisk logger - urgent!!!

Kevin P. Fleming kpfleming at digium.com
Sat Feb 11 18:04:19 MST 2006


Michael Collins wrote:

> I am curious to know if putting the output into a char array with
> sprintf() (to preserve the output formatting) and then writing it with
> write().  How much additional overhead would this take?  Hard to know
> without trying it.

Please... if you don't have the skills to test things, don't make
suggestions like this.

This is _exactly_ what I was referring to earlier. How do you know what
size array is going to be large enough? Do you just allocate an enormous
one on the stack for every call to ast_log, or do you malloc() one
instead (which has serious performance issues)? You can't just 'guess'
what will be big enough, which then leads to running through the
argument list twice... There will be a non-zero cost for doing this.

Can you honestly say that _any_ of this performance penalty, no matter
how small, for every user of Asterisk on every system everywhere, is
worth the cost when the entire problem that caused this thread can be
avoided by just paying attention to your server? No log files, CDR files
or anything else in the discussion here can grow to 2GB in anything less
than a few days under normal circumstances, if not far, far longer than
that. If you can't be bothered to run logrotate or some sort of watching
process on your server, I don't think we should be force everyone else
to have lower performance just so you won't be inconvenienced :-)

(and by 'you' I don't mean you specifically, Michael, I am referring to
those in this thread who think we should change the code used to write
to every file we write to in Asterisk)



More information about the asterisk-users mailing list