summaryrefslogtreecommitdiff
path: root/include/asterisk/logger.h
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2017-05-08 15:11:19 -0600
committerGeorge Joseph <gjoseph@digium.com>2017-05-08 16:49:13 -0500
commit201346fb7dff373d73a0663d1b05d968685013c7 (patch)
tree002cae51072ab320208696a92857bd515270eecb /include/asterisk/logger.h
parentd96f755682c16141962d0fc7914cd46263f8a961 (diff)
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
Diffstat (limited to 'include/asterisk/logger.h')
-rw-r--r--include/asterisk/logger.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 2f629dfbe..849f986b3 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -507,6 +507,22 @@ void ast_verb_console_set(int verb_level);
*/
int ast_is_logger_initialized(void);
+/*!
+ * \brief Set the maximum number of messages allowed in the processing queue
+ *
+ * \param queue_limit
+ *
+ * \return Nothing
+ */
+void ast_logger_set_queue_limit(int queue_limit);
+
+/*!
+ * \brief Get the maximum number of messages allowed in the processing queue
+ *
+ * \return Queue limit
+ */
+int ast_logger_get_queue_limit(void);
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif