3991. [func] Add the ability to buffer logging output by specifying
"buffered yes;" when defining a channel. [RT #26561]
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
3991. [func] Add the ability to buffer logging output by specifying
|
||||
"buffered yes;" when defining a channel. [RT #26561]
|
||||
|
||||
3990. [testing] Add tests for unknown DNSSEC algorithm handling.
|
||||
[RT #37541]
|
||||
|
||||
|
||||
@@ -185,10 +185,12 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig)
|
||||
const cfg_obj_t *printcat = NULL;
|
||||
const cfg_obj_t *printsev = NULL;
|
||||
const cfg_obj_t *printtime = NULL;
|
||||
const cfg_obj_t *buffered = NULL;
|
||||
|
||||
(void)cfg_map_get(channel, "print-category", &printcat);
|
||||
(void)cfg_map_get(channel, "print-severity", &printsev);
|
||||
(void)cfg_map_get(channel, "print-time", &printtime);
|
||||
(void)cfg_map_get(channel, "buffered", &buffered);
|
||||
|
||||
if (printcat != NULL && cfg_obj_asboolean(printcat))
|
||||
flags |= ISC_LOG_PRINTCATEGORY;
|
||||
@@ -196,6 +198,8 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig)
|
||||
flags |= ISC_LOG_PRINTTIME;
|
||||
if (printsev != NULL && cfg_obj_asboolean(printsev))
|
||||
flags |= ISC_LOG_PRINTLEVEL;
|
||||
if (buffered != NULL && cfg_obj_asboolean(buffered))
|
||||
flags |= ISC_LOG_BUFFERED;
|
||||
}
|
||||
|
||||
level = ISC_LOG_INFO;
|
||||
|
||||
@@ -37,6 +37,13 @@ logging {
|
||||
};
|
||||
category default { default_log; default_debug; };
|
||||
category lame-servers { null; };
|
||||
|
||||
channel query_log {
|
||||
file "query_log";
|
||||
print-time yes;
|
||||
buffered yes;
|
||||
};
|
||||
category queries { query_log; };
|
||||
};
|
||||
|
||||
controls {
|
||||
|
||||
@@ -3673,6 +3673,7 @@ $ORIGIN 0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
|
||||
[ <command>print-category</command> <option>yes</option> or <option>no</option>; ]
|
||||
[ <command>print-severity</command> <option>yes</option> or <option>no</option>; ]
|
||||
[ <command>print-time</command> <option>yes</option> or <option>no</option>; ]
|
||||
[ <command>buffered</command> <option>yes</option> or <option>no</option>; ]
|
||||
}; ]
|
||||
[ <command>category</command> <replaceable>category_name</replaceable> {
|
||||
<replaceable>channel_name</replaceable> ; [ <replaceable>channel_name</replaceable> ; ... ]
|
||||
@@ -3916,6 +3917,12 @@ notrace</command>. All debugging messages in the server have a debug
|
||||
<computeroutput>28-Feb-2000 15:05:32.863 general: notice: running</computeroutput>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If <command>buffered</command> has been turned on the output
|
||||
to files will not be flushed after each log entry. By default
|
||||
all log messages are flushed.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
There are four predefined channels that are used for
|
||||
<command>named</command>'s default logging as follows.
|
||||
|
||||
@@ -181,6 +181,12 @@
|
||||
<filename>named.conf</filename>. [RT #35857]
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Log output to files can now be buffered by specifying
|
||||
<command>buffered yes;</command> when creating a channel.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
<sect2 id="relnotes_changes">
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
#define ISC_LOG_PRINTTAG 0x0010 /* tag and ":" */
|
||||
#define ISC_LOG_PRINTPREFIX 0x0020 /* tag only, no colon */
|
||||
#define ISC_LOG_PRINTALL 0x003F
|
||||
#define ISC_LOG_BUFFERED 0x0040
|
||||
#define ISC_LOG_DEBUGONLY 0x1000
|
||||
#define ISC_LOG_OPENERR 0x8000 /* internal */
|
||||
/*@}*/
|
||||
@@ -427,8 +428,8 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
|
||||
* call by defining a new channel and then calling isc_log_usechannel()
|
||||
* for #ISC_LOGCATEGORY_DEFAULT.)
|
||||
*
|
||||
*\li Specifying #ISC_LOG_PRINTTIME or #ISC_LOG_PRINTTAG for syslog is allowed,
|
||||
* but probably not what you wanted to do.
|
||||
*\li Specifying #ISC_LOG_PRINTTIME or #ISC_LOG_PRINTTAG for syslog is
|
||||
* allowed, but probably not what you wanted to do.
|
||||
*
|
||||
* #ISC_LOG_DEBUGONLY will mark the channel as usable only when the
|
||||
* debug level of the logging context (see isc_log_setdebuglevel)
|
||||
@@ -446,8 +447,8 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
|
||||
*
|
||||
*\li level is >= #ISC_LOG_CRITICAL (the most negative logging level).
|
||||
*
|
||||
*\li flags does not include any bits aside from the ISC_LOG_PRINT* bits
|
||||
* or #ISC_LOG_DEBUGONLY.
|
||||
*\li flags does not include any bits aside from the ISC_LOG_PRINT* bits,
|
||||
* #ISC_LOG_DEBUGONLY or #ISC_LOG_BUFFERED.
|
||||
*
|
||||
* Ensures:
|
||||
*\li #ISC_R_SUCCESS
|
||||
|
||||
+8
-4
@@ -708,6 +708,8 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
|
||||
{
|
||||
isc_logchannel_t *channel;
|
||||
isc_mem_t *mctx;
|
||||
unsigned int permitted = ISC_LOG_PRINTALL | ISC_LOG_DEBUGONLY |
|
||||
ISC_LOG_BUFFERED;
|
||||
|
||||
REQUIRE(VALID_CONFIG(lcfg));
|
||||
REQUIRE(name != NULL);
|
||||
@@ -715,8 +717,7 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
|
||||
type == ISC_LOG_TOFILEDESC || type == ISC_LOG_TONULL);
|
||||
REQUIRE(destination != NULL || type == ISC_LOG_TONULL);
|
||||
REQUIRE(level >= ISC_LOG_CRITICAL);
|
||||
REQUIRE((flags &
|
||||
(unsigned int)~(ISC_LOG_PRINTALL | ISC_LOG_DEBUGONLY)) == 0);
|
||||
REQUIRE((flags & ~permitted) == 0);
|
||||
|
||||
/* XXXDCL find duplicate names? */
|
||||
|
||||
@@ -1415,7 +1416,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
||||
struct stat statbuf;
|
||||
isc_boolean_t matched = ISC_FALSE;
|
||||
isc_boolean_t printtime, printtag, printcolon;
|
||||
isc_boolean_t printcategory, printmodule, printlevel;
|
||||
isc_boolean_t printcategory, printmodule, printlevel, buffered;
|
||||
isc_logconfig_t *lcfg;
|
||||
isc_logchannel_t *channel;
|
||||
isc_logchannellist_t *category_channels;
|
||||
@@ -1654,6 +1655,8 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
||||
!= 0);
|
||||
printlevel = ISC_TF((channel->flags & ISC_LOG_PRINTLEVEL)
|
||||
!= 0);
|
||||
buffered = ISC_TF((channel->flags & ISC_LOG_BUFFERED)
|
||||
!= 0);
|
||||
|
||||
switch (channel->type) {
|
||||
case ISC_LOG_TOFILE:
|
||||
@@ -1715,7 +1718,8 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
|
||||
printlevel ? level_string : "",
|
||||
lctx->buffer);
|
||||
|
||||
fflush(FILE_STREAM(channel));
|
||||
if (!buffered)
|
||||
fflush(FILE_STREAM(channel));
|
||||
|
||||
/*
|
||||
* If the file now exceeds its maximum size
|
||||
|
||||
@@ -1882,6 +1882,7 @@ channel_clauses[] = {
|
||||
{ "print-time", &cfg_type_boolean, 0 },
|
||||
{ "print-severity", &cfg_type_boolean, 0 },
|
||||
{ "print-category", &cfg_type_boolean, 0 },
|
||||
{ "buffered", &cfg_type_boolean, 0 },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
static cfg_clausedef_t *
|
||||
|
||||
Reference in New Issue
Block a user