Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ISC Open Source Projects
BIND
Commits
ed2ee2df
Commit
ed2ee2df
authored
Mar 18, 2020
by
Ondřej Surý
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'marka-memget-cannot-fail-logging' into 'master'
Cleanup logging API now that isc_mem_get cannot fail. See merge request
!3252
parents
e6deefd0
0b793166
Pipeline
#37391
canceled with stages
in 12 minutes and 10 seconds
Changes
35
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
215 additions
and
397 deletions
+215
-397
bin/check/check-tool.c
bin/check/check-tool.c
+4
-4
bin/delv/delv.c
bin/delv/delv.c
+14
-35
bin/dig/dighost.c
bin/dig/dighost.c
+1
-3
bin/dnssec/dnssectool.c
bin/dnssec/dnssectool.c
+5
-8
bin/named/include/named/log.h
bin/named/include/named/log.h
+2
-2
bin/named/log.c
bin/named/log.c
+24
-61
bin/named/logconf.c
bin/named/logconf.c
+6
-8
bin/named/server.c
bin/named/server.c
+3
-6
bin/nsupdate/nsupdate.c
bin/nsupdate/nsupdate.c
+1
-3
bin/rndc/rndc.c
bin/rndc/rndc.c
+5
-7
bin/tests/cfg_test.c
bin/tests/cfg_test.c
+4
-6
bin/tests/makejournal.c
bin/tests/makejournal.c
+4
-3
bin/tests/optional/adb_test.c
bin/tests/optional/adb_test.c
+4
-6
bin/tests/optional/byname_test.c
bin/tests/optional/byname_test.c
+4
-5
bin/tests/optional/db_test.c
bin/tests/optional/db_test.c
+1
-2
bin/tests/optional/gsstest.c
bin/tests/optional/gsstest.c
+4
-4
bin/tests/optional/log_test.c
bin/tests/optional/log_test.c
+8
-8
bin/tests/optional/sig0_test.c
bin/tests/optional/sig0_test.c
+1
-1
bin/tests/system/pipelined/pipequeries.c
bin/tests/system/pipelined/pipequeries.c
+1
-1
bin/tests/system/rsabigexponent/bigkey.c
bin/tests/system/rsabigexponent/bigkey.c
+7
-6
bin/tests/system/tkey/keycreate.c
bin/tests/system/tkey/keycreate.c
+1
-1
bin/tests/system/tkey/keydelete.c
bin/tests/system/tkey/keydelete.c
+1
-1
bin/tools/mdig.c
bin/tools/mdig.c
+1
-1
bin/tools/named-journalprint.c
bin/tools/named-journalprint.c
+4
-4
conftools/perllib/dnsconf/DNSConf.i
conftools/perllib/dnsconf/DNSConf.i
+1
-2
doc/design/logging
doc/design/logging
+2
-3
doc/dev/dev.md
doc/dev/dev.md
+7
-17
lib/dns/client.c
lib/dns/client.c
+1
-4
lib/dns/tests/dnstest.c
lib/dns/tests/dnstest.c
+3
-5
lib/isc/include/isc/log.h
lib/isc/include/isc/log.h
+5
-27
lib/isc/log.c
lib/isc/log.c
+74
-138
lib/isc/tests/isctest.c
lib/isc/tests/isctest.c
+3
-5
lib/isccfg/tests/duration_test.c
lib/isccfg/tests/duration_test.c
+3
-3
lib/isccfg/tests/parser_test.c
lib/isccfg/tests/parser_test.c
+3
-3
lib/ns/tests/nstest.c
lib/ns/tests/nstest.c
+3
-4
No files found.
bin/check/check-tool.c
View file @
ed2ee2df
...
...
@@ -553,7 +553,7 @@ setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
isc_logconfig_t
*
logconfig
=
NULL
;
isc_log_t
*
log
=
NULL
;
RUNTIME_CHECK
(
isc_log_create
(
mctx
,
&
log
,
&
logconfig
)
==
ISC_R_SUCCESS
)
;
isc_log_create
(
mctx
,
&
log
,
&
logconfig
);
isc_log_registercategories
(
log
,
categories
);
isc_log_setcontext
(
log
);
dns_log_init
(
log
);
...
...
@@ -565,9 +565,9 @@ setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
destination
.
file
.
name
=
NULL
;
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
RUNTIME_CHECK
(
isc_log_createchannel
(
logconfig
,
"stderr"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
0
)
==
ISC_R_SUCCESS
);
isc_log_createchannel
(
logconfig
,
"stderr"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
0
);
RUNTIME_CHECK
(
isc_log_usechannel
(
logconfig
,
"stderr"
,
NULL
,
NULL
)
==
ISC_R_SUCCESS
);
...
...
bin/delv/delv.c
View file @
ed2ee2df
...
...
@@ -271,11 +271,7 @@ setup_logging(FILE *errout) {
isc_logdestination_t
destination
;
isc_logconfig_t
*
logconfig
=
NULL
;
result
=
isc_log_create
(
mctx
,
&
lctx
,
&
logconfig
);
if
(
result
!=
ISC_R_SUCCESS
)
{
fatal
(
"Couldn't set up logging"
);
}
isc_log_create
(
mctx
,
&
lctx
,
&
logconfig
);
isc_log_registercategories
(
lctx
,
categories
);
isc_log_registermodules
(
lctx
,
modules
);
isc_log_setcontext
(
lctx
);
...
...
@@ -287,20 +283,12 @@ setup_logging(FILE *errout) {
destination
.
file
.
name
=
NULL
;
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
result
=
isc_log_createchannel
(
logconfig
,
"stderr"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTPREFIX
);
if
(
result
!=
ISC_R_SUCCESS
)
{
fatal
(
"Couldn't set up log channel 'stderr'"
);
}
isc_log_createchannel
(
logconfig
,
"stderr"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTPREFIX
);
isc_log_setdebuglevel
(
lctx
,
loglevel
);
result
=
isc_log_settag
(
logconfig
,
";; "
);
if
(
result
!=
ISC_R_SUCCESS
)
{
fatal
(
"Couldn't set log tag"
);
}
isc_log_settag
(
logconfig
,
";; "
);
result
=
isc_log_usechannel
(
logconfig
,
"stderr"
,
ISC_LOGCATEGORY_DEFAULT
,
NULL
);
...
...
@@ -309,12 +297,9 @@ setup_logging(FILE *errout) {
}
if
(
resolve_trace
&&
loglevel
<
1
)
{
result
=
isc_log_createchannel
(
logconfig
,
"resolver"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DEBUG
(
1
),
&
destination
,
ISC_LOG_PRINTPREFIX
);
if
(
result
!=
ISC_R_SUCCESS
)
{
fatal
(
"Couldn't set up log channel 'resolver'"
);
}
isc_log_createchannel
(
logconfig
,
"resolver"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DEBUG
(
1
),
&
destination
,
ISC_LOG_PRINTPREFIX
);
result
=
isc_log_usechannel
(
logconfig
,
"resolver"
,
DNS_LOGCATEGORY_RESOLVER
,
...
...
@@ -325,12 +310,9 @@ setup_logging(FILE *errout) {
}
if
(
validator_trace
&&
loglevel
<
3
)
{
result
=
isc_log_createchannel
(
logconfig
,
"validator"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DEBUG
(
3
),
&
destination
,
ISC_LOG_PRINTPREFIX
);
if
(
result
!=
ISC_R_SUCCESS
)
{
fatal
(
"Couldn't set up log channel 'validator'"
);
}
isc_log_createchannel
(
logconfig
,
"validator"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DEBUG
(
3
),
&
destination
,
ISC_LOG_PRINTPREFIX
);
result
=
isc_log_usechannel
(
logconfig
,
"validator"
,
DNS_LOGCATEGORY_DNSSEC
,
...
...
@@ -341,12 +323,9 @@ setup_logging(FILE *errout) {
}
if
(
message_trace
&&
loglevel
<
10
)
{
result
=
isc_log_createchannel
(
logconfig
,
"messages"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DEBUG
(
10
),
&
destination
,
ISC_LOG_PRINTPREFIX
);
if
(
result
!=
ISC_R_SUCCESS
)
{
fatal
(
"Couldn't set up log channel 'messages'"
);
}
isc_log_createchannel
(
logconfig
,
"messages"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DEBUG
(
10
),
&
destination
,
ISC_LOG_PRINTPREFIX
);
result
=
isc_log_usechannel
(
logconfig
,
"messages"
,
DNS_LOGCATEGORY_RESOLVER
,
...
...
bin/dig/dighost.c
View file @
ed2ee2df
...
...
@@ -1394,9 +1394,7 @@ setup_libs(void) {
isc_mem_create
(
&
mctx
);
isc_mem_setname
(
mctx
,
"dig"
,
NULL
);
result
=
isc_log_create
(
mctx
,
&
lctx
,
&
logconfig
);
check_result
(
result
,
"isc_log_create"
);
isc_log_create
(
mctx
,
&
lctx
,
&
logconfig
);
isc_log_setcontext
(
lctx
);
dns_log_init
(
lctx
);
dns_log_setcontext
(
lctx
);
...
...
bin/dnssec/dnssectool.c
View file @
ed2ee2df
...
...
@@ -128,7 +128,6 @@ sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size) {
void
setup_logging
(
isc_mem_t
*
mctx
,
isc_log_t
**
logp
)
{
isc_result_t
result
;
isc_logdestination_t
destination
;
isc_logconfig_t
*
logconfig
=
NULL
;
isc_log_t
*
log
=
NULL
;
...
...
@@ -153,12 +152,11 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
break
;
}
RUNTIME_CHECK
(
isc_log_create
(
mctx
,
&
log
,
&
logconfig
)
==
ISC_R_SUCCESS
)
;
isc_log_create
(
mctx
,
&
log
,
&
logconfig
);
isc_log_setcontext
(
log
);
dns_log_init
(
log
);
dns_log_setcontext
(
log
);
RUNTIME_CHECK
(
isc_log_settag
(
logconfig
,
program
)
==
ISC_R_SUCCESS
);
isc_log_settag
(
logconfig
,
program
);
/*
* Set up a channel similar to default_stderr except:
...
...
@@ -170,10 +168,9 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp) {
destination
.
file
.
name
=
NULL
;
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
result
=
isc_log_createchannel
(
logconfig
,
"stderr"
,
ISC_LOG_TOFILEDESC
,
level
,
&
destination
,
ISC_LOG_PRINTTAG
|
ISC_LOG_PRINTLEVEL
);
check_result
(
result
,
"isc_log_createchannel()"
);
isc_log_createchannel
(
logconfig
,
"stderr"
,
ISC_LOG_TOFILEDESC
,
level
,
&
destination
,
ISC_LOG_PRINTTAG
|
ISC_LOG_PRINTLEVEL
);
RUNTIME_CHECK
(
isc_log_usechannel
(
logconfig
,
"stderr"
,
NULL
,
NULL
)
==
ISC_R_SUCCESS
);
...
...
bin/named/include/named/log.h
View file @
ed2ee2df
...
...
@@ -45,7 +45,7 @@ named_log_init(bool safe);
* as root.
*/
isc_result_t
void
named_log_setdefaultchannels
(
isc_logconfig_t
*
lcfg
);
/*%
* Set up logging channels according to the named defaults, which
...
...
@@ -53,7 +53,7 @@ named_log_setdefaultchannels(isc_logconfig_t *lcfg);
* this just means setting up default_debug.
*/
isc_result_t
void
named_log_setsafechannels
(
isc_logconfig_t
*
lcfg
);
/*%
* Like named_log_setdefaultchannels(), but omits any logging to files.
...
...
bin/named/log.c
View file @
ed2ee2df
...
...
@@ -53,10 +53,7 @@ named_log_init(bool safe) {
/*
* Setup a logging context.
*/
result
=
isc_log_create
(
named_g_mctx
,
&
named_g_lctx
,
&
lcfg
);
if
(
result
!=
ISC_R_SUCCESS
)
{
return
(
result
);
}
isc_log_create
(
named_g_mctx
,
&
named_g_lctx
,
&
lcfg
);
/*
* named-checktool.c:setup_logging() needs to be kept in sync.
...
...
@@ -71,12 +68,9 @@ named_log_init(bool safe) {
ns_log_setcontext
(
named_g_lctx
);
if
(
safe
)
{
result
=
named_log_setsafechannels
(
lcfg
);
named_log_setsafechannels
(
lcfg
);
}
else
{
result
=
named_log_setdefaultchannels
(
lcfg
);
}
if
(
result
!=
ISC_R_SUCCESS
)
{
goto
cleanup
;
named_log_setdefaultchannels
(
lcfg
);
}
result
=
named_log_setdefaultcategory
(
lcfg
);
...
...
@@ -94,9 +88,8 @@ cleanup:
return
(
result
);
}
isc_result_t
void
named_log_setdefaultchannels
(
isc_logconfig_t
*
lcfg
)
{
isc_result_t
result
;
isc_logdestination_t
destination
;
/*
...
...
@@ -109,12 +102,9 @@ named_log_setdefaultchannels(isc_logconfig_t *lcfg) {
destination
.
file
.
name
=
"named.run"
;
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
result
=
isc_log_createchannel
(
lcfg
,
"default_debug"
,
ISC_LOG_TOFILE
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
|
ISC_LOG_DEBUGONLY
);
if
(
result
!=
ISC_R_SUCCESS
)
{
goto
cleanup
;
}
isc_log_createchannel
(
lcfg
,
"default_debug"
,
ISC_LOG_TOFILE
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
|
ISC_LOG_DEBUGONLY
);
}
if
(
named_g_logfile
!=
NULL
)
{
...
...
@@ -122,48 +112,32 @@ named_log_setdefaultchannels(isc_logconfig_t *lcfg) {
destination
.
file
.
name
=
named_g_logfile
;
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
result
=
isc_log_createchannel
(
lcfg
,
"default_logfile"
,
ISC_LOG_TOFILE
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
|
ISC_LOG_PRINTCATEGORY
|
ISC_LOG_PRINTLEVEL
);
if
(
result
!=
ISC_R_SUCCESS
)
{
goto
cleanup
;
}
isc_log_createchannel
(
lcfg
,
"default_logfile"
,
ISC_LOG_TOFILE
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
|
ISC_LOG_PRINTCATEGORY
|
ISC_LOG_PRINTLEVEL
);
}
#if ISC_FACILITY != LOG_DAEMON
destination
.
facility
=
ISC_FACILITY
;
result
=
isc_log_createchannel
(
lcfg
,
"default_syslog"
,
ISC_LOG_TOSYSLOG
,
ISC_LOG_INFO
,
&
destination
,
0
);
if
(
result
!=
ISC_R_SUCCESS
)
{
goto
cleanup
;
}
isc_log_createchannel
(
lcfg
,
"default_syslog"
,
ISC_LOG_TOSYSLOG
,
ISC_LOG_INFO
,
&
destination
,
0
);
#endif
/* if ISC_FACILITY != LOG_DAEMON */
/*
* Set the initial debug level.
*/
isc_log_setdebuglevel
(
named_g_lctx
,
named_g_debuglevel
);
result
=
ISC_R_SUCCESS
;
cleanup:
return
(
result
);
}
isc_result_t
void
named_log_setsafechannels
(
isc_logconfig_t
*
lcfg
)
{
isc_result_t
result
;
isc_logdestination_t
destination
;
if
(
!
named_g_logstderr
)
{
result
=
isc_log_createchannel
(
lcfg
,
"default_debug"
,
ISC_LOG_TONULL
,
ISC_LOG_DYNAMIC
,
NULL
,
0
);
if
(
result
!=
ISC_R_SUCCESS
)
{
goto
cleanup
;
}
isc_log_createchannel
(
lcfg
,
"default_debug"
,
ISC_LOG_TONULL
,
ISC_LOG_DYNAMIC
,
NULL
,
0
);
/*
* Setting the debug level to zero should get the output
...
...
@@ -179,29 +153,18 @@ named_log_setsafechannels(isc_logconfig_t *lcfg) {
destination
.
file
.
name
=
named_g_logfile
;
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
result
=
isc_log_createchannel
(
lcfg
,
"default_logfile"
,
ISC_LOG_TOFILE
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
|
ISC_LOG_PRINTCATEGORY
|
ISC_LOG_PRINTLEVEL
);
if
(
result
!=
ISC_R_SUCCESS
)
{
goto
cleanup
;
}
isc_log_createchannel
(
lcfg
,
"default_logfile"
,
ISC_LOG_TOFILE
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
|
ISC_LOG_PRINTCATEGORY
|
ISC_LOG_PRINTLEVEL
);
}
#if ISC_FACILITY != LOG_DAEMON
destination
.
facility
=
ISC_FACILITY
;
result
=
isc_log_createchannel
(
lcfg
,
"default_syslog"
,
ISC_LOG_TOSYSLOG
,
ISC_LOG_INFO
,
&
destination
,
0
);
if
(
result
!=
ISC_R_SUCCESS
)
{
goto
cleanup
;
}
isc_log_createchannel
(
lcfg
,
"default_syslog"
,
ISC_LOG_TOSYSLOG
,
ISC_LOG_INFO
,
&
destination
,
0
);
#endif
/* if ISC_FACILITY != LOG_DAEMON */
result
=
ISC_R_SUCCESS
;
cleanup:
return
(
result
);
}
isc_result_t
...
...
bin/named/logconf.c
View file @
ed2ee2df
...
...
@@ -92,7 +92,7 @@ category_fromconf(const cfg_obj_t *ccat, isc_logconfig_t *logconfig) {
*/
static
isc_result_t
channel_fromconf
(
const
cfg_obj_t
*
channel
,
isc_logconfig_t
*
logconfig
)
{
isc_result_t
result
;
isc_result_t
result
=
ISC_R_SUCCESS
;
isc_logdestination_t
dest
;
unsigned
int
type
;
unsigned
int
flags
=
0
;
...
...
@@ -271,14 +271,12 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
}
}
if
(
logconfig
==
NULL
)
{
result
=
ISC_R_SUCCESS
;
}
else
{
result
=
isc_log_createchannel
(
logconfig
,
channelname
,
type
,
level
,
&
dest
,
flags
);
if
(
logconfig
!=
NULL
)
{
isc_log_createchannel
(
logconfig
,
channelname
,
type
,
level
,
&
dest
,
flags
);
}
if
(
result
==
ISC_R_SUCCESS
&&
type
==
ISC_LOG_TOFILE
)
{
if
(
type
==
ISC_LOG_TOFILE
)
{
FILE
*
fp
;
/*
...
...
@@ -333,7 +331,7 @@ named_logconfig(isc_logconfig_t *logconfig, const cfg_obj_t *logstmt) {
const
cfg_obj_t
*
catname
;
if
(
logconfig
!=
NULL
)
{
CHECK
(
named_log_setdefaultchannels
(
logconfig
)
)
;
named_log_setdefaultchannels
(
logconfig
);
}
(
void
)
cfg_map_get
(
logstmt
,
"channel"
,
&
channels
);
...
...
bin/named/server.c
View file @
ed2ee2df
...
...
@@ -9110,8 +9110,7 @@ load_configuration(const char *filename, named_server_t *server,
} else {
const cfg_obj_t *logobj = NULL;
CHECKM(isc_logconfig_create(named_g_lctx, &logc),
"creating new logging configuration");
isc_logconfig_create(named_g_lctx, &logc);
logobj = NULL;
(void)cfg_map_get(config, "logging", &logobj);
...
...
@@ -9119,16 +9118,14 @@ load_configuration(const char *filename, named_server_t *server,
CHECKM(named_logconfig(logc, logobj), "configuring "
"logging");
} else {
CHECKM(named_log_setdefaultchannels(logc),
"setting up default logging channels");
named_log_setdefaultchannels(logc);
CHECKM(named_log_setunmatchedcategory(logc),
"setting up default 'category unmatched'");
CHECKM(named_log_setdefaultcategory(logc),
"setting up default 'category default'");
}
CHECKM(isc_logconfig_use(named_g_lctx, logc),
"installing logging configuration");
isc_logconfig_use(named_g_lctx, logc);
logc = NULL;
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
...
...
bin/nsupdate/nsupdate.c
View file @
ed2ee2df
...
...
@@ -812,9 +812,7 @@ setup_system(void) {
dns_result_register
();
result
=
isc_log_create
(
gmctx
,
&
glctx
,
&
logconfig
);
check_result
(
result
,
"isc_log_create"
);
isc_log_create
(
gmctx
,
&
glctx
,
&
logconfig
);
isc_log_setcontext
(
glctx
);
dns_log_init
(
glctx
);
dns_log_setcontext
(
glctx
);
...
...
bin/rndc/rndc.c
View file @
ed2ee2df
...
...
@@ -985,18 +985,16 @@ main(int argc, char **argv) {
isc_taskmgr_create
(
rndc_mctx
,
1
,
0
,
NULL
,
&
taskmgr
));
DO
(
"create task"
,
isc_task_create
(
taskmgr
,
0
,
&
task
));
DO
(
"create logging context"
,
isc_log_create
(
rndc_mctx
,
&
log
,
&
logconfig
));
isc_log_create
(
rndc_mctx
,
&
log
,
&
logconfig
);
isc_log_setcontext
(
log
);
DO
(
"setting log tag"
,
isc_log_settag
(
logconfig
,
progname
)
)
;
isc_log_settag
(
logconfig
,
progname
);
logdest
.
file
.
stream
=
stderr
;
logdest
.
file
.
name
=
NULL
;
logdest
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
logdest
.
file
.
maximum_size
=
0
;
DO
(
"creating log channel"
,
isc_log_createchannel
(
logconfig
,
"stderr"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_INFO
,
&
logdest
,
ISC_LOG_PRINTTAG
|
ISC_LOG_PRINTLEVEL
));
isc_log_createchannel
(
logconfig
,
"stderr"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_INFO
,
&
logdest
,
ISC_LOG_PRINTTAG
|
ISC_LOG_PRINTLEVEL
);
DO
(
"enabling log channel"
,
isc_log_usechannel
(
logconfig
,
"stderr"
,
NULL
,
NULL
));
...
...
bin/tests/cfg_test.c
View file @
ed2ee2df
...
...
@@ -72,8 +72,7 @@ main(int argc, char **argv) {
isc_mem_create
(
&
mctx
);
result
=
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
);
check_result
(
result
,
"isc_log_create()"
);
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
);
isc_log_setcontext
(
lctx
);
/*
...
...
@@ -83,10 +82,9 @@ main(int argc, char **argv) {
destination
.
file
.
name
=
NULL
;
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
result
=
isc_log_createchannel
(
lcfg
,
"_default"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
);
check_result
(
result
,
"isc_log_createchannel()"
);
isc_log_createchannel
(
lcfg
,
"_default"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
);
result
=
isc_log_usechannel
(
lcfg
,
"_default"
,
NULL
,
NULL
);
check_result
(
result
,
"isc_log_usechannel()"
);
...
...
bin/tests/makejournal.c
View file @
ed2ee2df
...
...
@@ -100,7 +100,7 @@ main(int argc, char **argv) {
CHECK
(
dst_lib_init
(
mctx
,
NULL
));
dst_active
=
true
;
CHECK
(
isc_log_create
(
mctx
,
&
lctx
,
&
logconfig
)
)
;
isc_log_create
(
mctx
,
&
lctx
,
&
logconfig
);
isc_log_registercategories
(
lctx
,
categories
);
isc_log_setcontext
(
lctx
);
dns_log_init
(
lctx
);
...
...
@@ -110,8 +110,9 @@ main(int argc, char **argv) {
destination
.
file
.
name
=
NULL
;
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
CHECK
(
isc_log_createchannel
(
logconfig
,
"stderr"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
0
));
isc_log_createchannel
(
logconfig
,
"stderr"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
0
);
CHECK
(
isc_log_usechannel
(
logconfig
,
"stderr"
,
NULL
,
NULL
));
dns_result_register
();
...
...
bin/tests/optional/adb_test.c
View file @
ed2ee2df
...
...
@@ -297,8 +297,7 @@ main(int argc, char **argv) {
isc_mempool_create
(
mctx
,
sizeof
(
client_t
),
&
cmp
);
isc_mempool_setname
(
cmp
,
"adb test clients"
);
result
=
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
);
check_result
(
result
,
"isc_log_create()"
);
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
);
isc_log_setcontext
(
lctx
);
dns_log_init
(
lctx
);
dns_log_setcontext
(
lctx
);
...
...
@@ -310,10 +309,9 @@ main(int argc, char **argv) {
destination
.
file
.
name
=
NULL
;
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
result
=
isc_log_createchannel
(
lcfg
,
"_default"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
);
check_result
(
result
,
"isc_log_createchannel()"
);
isc_log_createchannel
(
lcfg
,
"_default"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
);
result
=
isc_log_usechannel
(
lcfg
,
"_default"
,
NULL
,
NULL
);
check_result
(
result
,
"isc_log_usechannel()"
);
...
...
bin/tests/optional/byname_test.c
View file @
ed2ee2df
...
...
@@ -56,7 +56,7 @@ log_init(void) {
/*
* Setup a logging context.
*/
RUNTIME_CHECK
(
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
)
==
ISC_R_SUCCESS
)
;
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
);
isc_log_setcontext
(
lctx
);
dns_log_init
(
lctx
);
dns_log_setcontext
(
lctx
);
...
...
@@ -69,10 +69,9 @@ log_init(void) {
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
flags
=
ISC_LOG_PRINTTIME
;
RUNTIME_CHECK
(
isc_log_createchannel
(
lcfg
,
"_default"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
flags
)
==
ISC_R_SUCCESS
);
isc_log_createchannel
(
lcfg
,
"_default"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
flags
);
RUNTIME_CHECK
(
isc_log_usechannel
(
lcfg
,
"_default"
,
NULL
,
NULL
)
==
ISC_R_SUCCESS
);
isc_log_setdebuglevel
(
lctx
,
level
);
...
...
bin/tests/optional/db_test.c
View file @
ed2ee2df
...
...
@@ -402,8 +402,7 @@ main(int argc, char *argv[]) {
DNS_DBFIND_VALIDATEGLUE
);
break
;
case
'l'
:
RUNTIME_CHECK
(
isc_log_create
(
mctx
,
&
lctx
,
NULL
)
==
ISC_R_SUCCESS
);
isc_log_create
(
mctx
,
&
lctx
,
NULL
);
isc_log_setcontext
(
lctx
);
dns_log_init
(
lctx
);
dns_log_setcontext
(
lctx
);
...
...
bin/tests/optional/gsstest.c
View file @
ed2ee2df
...
...
@@ -458,7 +458,7 @@ main(int argc, char *argv[]) {
mctx
=
NULL
;
isc_mem_create
(
&
mctx
);
RUNCHECK
(
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
)
)
;
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
);
isc_log_setcontext
(
lctx
);
dns_log_init
(
lctx
);
dns_log_setcontext
(
lctx
);
...
...
@@ -470,9 +470,9 @@ main(int argc, char *argv[]) {
destination
.
file
.
name
=
NULL
;
destination
.
file
.
versions
=
ISC_LOG_ROLLNEVER
;
destination
.
file
.
maximum_size
=
0
;
RUNCHECK
(
isc_log_createchannel
(
lcfg
,
"_default"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
));
isc_log_createchannel
(
lcfg
,
"_default"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
);
RUNCHECK
(
isc_log_usechannel
(
lcfg
,
"_default"
,
NULL
,
NULL
));
isc_log_setdebuglevel
(
lctx
,
9
);
...
...
bin/tests/optional/log_test.c
View file @
ed2ee2df
...
...
@@ -112,9 +112,9 @@ main(int argc, char **argv) {
lcfg
=
NULL
;
isc_mem_create
(
&
mctx
);
CHECK
(
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
)
)
;
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
);
CHECK
(
isc_log_settag
(
lcfg
,
progname
)
)
;
isc_log_settag
(
lcfg
,
progname
);
isc_log_setcontext
(
lctx
);
dns_log_init
(
lctx
);
...
...
@@ -147,20 +147,20 @@ main(int argc, char **argv) {
destination
.
file
.
maximum_size
=
1
;
destination
.
file
.
versions
=
file_versions
;
CHECK
(
isc_log_createchannel
(
isc_log_createchannel
(
lcfg
,
"file_test"
,
ISC_LOG_TOFILE
,
ISC_LOG_INFO
,
&
destination
,
ISC_LOG_PRINTTIME
|
ISC_LOG_PRINTTAG
|
ISC_LOG_PRINTLEVEL
|
ISC_LOG_PRINTCATEGORY
|
ISC_LOG_PRINTMODULE
)
)
;
ISC_LOG_PRINTCATEGORY
|
ISC_LOG_PRINTMODULE
);
/*
* Create a dynamic debugging channel to a file descriptor.
*/
destination
.
file
.
stream
=
stderr
;
CHECK
(
isc_log_createchannel
(
lcfg
,
"debug_test"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
|
ISC_LOG_PRINTLEVEL
|
ISC_LOG_DEBUGONLY
)
)
;
isc_log_createchannel
(
lcfg
,
"debug_test"
,
ISC_LOG_TOFILEDESC
,
ISC_LOG_DYNAMIC
,
&
destination
,
ISC_LOG_PRINTTIME
|
ISC_LOG_PRINTLEVEL
|
ISC_LOG_DEBUGONLY
);
/*
* Test the usability of the four predefined logging channels.
...
...
bin/tests/optional/sig0_test.c
View file @
ed2ee2df
...
...
@@ -236,7 +236,7 @@ main(int argc, char *argv[]) {
socketmgr
=
NULL
;
RUNTIME_CHECK
(
isc_socketmgr_create
(
mctx
,
&
socketmgr
)
==
ISC_R_SUCCESS
);
RUNTIME_CHECK
(
isc_log_create
(
mctx
,
&
lctx
,
&
logconfig
)
==
ISC_R_SUCCESS
)
;
isc_log_create
(
mctx
,
&
lctx
,
&
logconfig
);
s
=
NULL
;
RUNTIME_CHECK
(
isc_socket_create
(
socketmgr
,
PF_INET
,
isc_sockettype_udp
,
...
...
bin/tests/system/pipelined/pipequeries.c
View file @
ed2ee2df
...
...
@@ -274,7 +274,7 @@ main(int argc, char *argv[]) {
lctx
=
NULL
;
lcfg
=
NULL
;
RUNCHECK
(
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
)
)
;
isc_log_create
(
mctx
,
&
lctx
,
&
lcfg
);
R