]> git.ipfire.org Git - thirdparty/asterisk.git/commit
logger: Added logger_queue_limit to the configuration options.
authorGeorge Joseph <gjoseph@digium.com>
Mon, 8 May 2017 21:11:19 +0000 (15:11 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Mon, 8 May 2017 21:27:04 +0000 (15:27 -0600)
commit7d4a22bf2e98c1477d0e81306eb11844ed056c67
tree3fbac99c395335380a4a6b36213b9c594c88ac92
parent4d0bc3e5fc9a5b3349d742225a558361582a1bfb
logger:  Added logger_queue_limit to the configuration options.

All log messages go to a queue serviced by a single thread
which does all the IO.  This setting controls how big that
queue can get (and therefore how much memory is allocated)
before new messages are discarded. The default is 1000.
Should something go bezerk and log tons of messages in a tight
loop, this will prevent memory escalation.

When the limit is reached, a WARNING is logged to that effect
and messages are discarded until the queue is empty again.  At
that time another WARNING will be logged with the count of
discarded messages.  There's no "low water mark" for this queue
because the logger thread empties the entire queue and processes it
in 1 batch before going back and waiting on the queue again.
Implementing a low water mark would mean additional locking as
the thread processes each message and it's not worth it.

A "test" was added to test_logger.c but since the outcome is
non-deterministic, it's really just a cli command, not a unit
test.

Change-Id: Ib4520c95e1ca5325dbf584c7989ce391649836d1
CHANGES
configs/samples/logger.conf.sample
include/asterisk/logger.h
main/logger.c
tests/test_logger.c