<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10536">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">logger.c: Fix default console logging when no logger.conf available.<br><br>Default logging was not setup correctly when there was no logger.conf.<br>This resulted in many expected log messages not actually getting out to<br>the console.<br><br>Change-Id: I542e61c03b2f630ff5327f9de5641d776c6fa70c<br>---<br>M main/logger.c<br>1 file changed, 7 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/36/10536/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/logger.c b/main/logger.c</span><br><span>index 57e5857..ff781b1 100644</span><br><span>--- a/main/logger.c</span><br><span>+++ b/main/logger.c</span><br><span>@@ -621,7 +621,8 @@</span><br><span> return chan;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/* \brief Read config, setup channels.</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Read config, setup channels.</span><br><span> * \param altconf Alternate configuration file to read.</span><br><span> *</span><br><span> * \pre logchannels list is write locked</span><br><span>@@ -663,14 +664,11 @@</span><br><span> </span><br><span> /* If no config file, we're fine, set default options. */</span><br><span> if (!cfg) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(chan = ast_calloc(1, sizeof(*chan) + 1))) {</span><br><span style="color: hsl(0, 100%, 40%);">- fprintf(stderr, "Failed to initialize default logging\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ chan = make_logchannel("console", "error,warning,notice,verbose", 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!chan) {</span><br><span style="color: hsl(120, 100%, 40%);">+ fprintf(stderr, "ERROR: Failed to initialize default logging\n");</span><br><span> return -1;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- chan->type = LOGTYPE_CONSOLE;</span><br><span style="color: hsl(0, 100%, 40%);">- chan->logmask = (1 << __LOG_WARNING) | (1 << __LOG_NOTICE) | (1 << __LOG_ERROR)</span><br><span style="color: hsl(0, 100%, 40%);">- | (1 << __LOG_VERBOSE);</span><br><span style="color: hsl(0, 100%, 40%);">- memcpy(&chan->formatter, &logformatter_default, sizeof(chan->formatter));</span><br><span> </span><br><span> AST_RWLIST_INSERT_HEAD(&logchannels, chan, list);</span><br><span> global_logmask |= chan->logmask;</span><br><span>@@ -738,7 +736,8 @@</span><br><span> </span><br><span> var = ast_variable_browse(cfg, "logfiles");</span><br><span> for (; var; var = var->next) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(chan = make_logchannel(var->name, var->value, var->lineno, 0))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ chan = make_logchannel(var->name, var->value, var->lineno, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!chan) {</span><br><span> /* Print error message directly to the consoles since the lock is held</span><br><span> * and we don't want to unlock with the list partially built */</span><br><span> ast_console_puts_mutable("ERROR: Unable to create log channel '", __LOG_ERROR);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10536">change 10536</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10536"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I542e61c03b2f630ff5327f9de5641d776c6fa70c </div>
<div style="display:none"> Gerrit-Change-Number: 10536 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>