It's mainly in tests.
'todname',
'tojson',
'user',
- 'verbose',
'worker',
'kluautil_list_dir',
-- Sandbox declarations
local _, up_bs = net.bufsize()
net.bufsize(4096, up_bs)
-verbose(true)
+set_log_level('debug')
policy.add(policy.suffix(policy.PASS, {todname('test.')}))
cache.size = 2*MB
--- verbose(true)
+-- set_log_level('debug')
-- Self-checks on globals
assert(help() ~= nil)
end
_hint_root_file('hints')
-verbose(true)
+set_log_level('debug')
{% endraw %}
net = { '{{SELF_ADDR}}' }
"hostname()\n hostname\n"
"package_version()\n return package version\n"
"user(name[, group])\n change process user (and group)\n"
- "verbose(true|false)\n toggle verbose mode\n"
"set_log_level\n logging level (crit, err, warning, notice, info or debug)\n"
"option(opt[, new_val])\n get/set server option\n"
"mode(strict|normal|permissive)\n set resolver strictness level\n"
" -c, --config=[path] Config file path (relative to [rundir]) (default: config).\n"
" -n, --noninteractive Don't start the read-eval-print loop for stdin+stdout.\n"
" -q, --quiet No command prompt in interactive mode.\n"
- " -v, --verbose Run in verbose mode.\n"
+ " -v, --verbose Increase logging to debug level.\n"
" -V, --version Print version of the server.\n"
" -h, --help Print help and usage.\n"
"Options:\n"
Logging level ``notice`` is set after start by default,
so logs from Knot Resolver should contain only couple lines a day.
-For debugging purposes it is possible to enable very verbose logging using
-:func:`verbose` function.
+For debugging purposes it is possible to use the very verbose ``debug`` level.
In addition to levels, logging is also divided into the
:ref:`groups <config_log_groups>`. All groups
.. py:function:: verbose([true | false])
+ .. deprecated:: 5.4.0
+ Use :func:`set_log_level` instead.
+
:param: ``true`` enable ``debug`` level, ``false`` switch to default level (``notice``).
:return: boolean ``true`` when ``debug`` level is enabled.
> -- this is a comment entered into interactive prompt
> -- comments have no effect here
> -- the next line shows a command entered interactivelly and its output
- > verbose()
- false
- > -- the previous line without > character is output from verbose() command
+ > get_log_level()
+ 'notice'
+ > -- the previous line without > character is output from get_log_level() command
Following example demontrates how to interactivelly list all currently loaded modules, and includes multi-line output:
.. code-block:: lua
> modules.list()
- [1] => iterate
- [2] => validate
- [3] => cache
+ {
+ 'iterate',
+ 'validate',
+ 'cache',
+ 'ta_update',
+ 'ta_signal_query',
+ 'policy',
+ 'priming',
+ 'detect_time_skew',
+ 'detect_time_jump',
+ 'ta_sentinel',
+ 'edns_keepalive',
+ 'refuse_nord',
+ 'watchdog',
+ }
+
Before we dive into configuring features, let us explain modularization basics.
Daemon will refrain from printing the command prompt.
.TP
.B \-v\fR, \fB\-\-verbose
-Increase verbosity. If given multiple times, more information is logged.
-This is in addition to the verbosity (if any) from the config file.
+Increase logging to debug level.
.TP
.B \-h
Show short commandline option help.
.. '8453 -> web interface\n'
.. '\n'
.. 'For verbose logging enter following command to prompt below:\n'
- .. 'verbose(true)\n')
+ .. 'set_log_level("debug")\n')
end
print_help()
end
-- execute query right after start up and exit when the query is finished
event.after(0, function()
-- ultra verbose log
- verbose(true)
+ set_log_level('debug')
policy.add(policy.all(policy.DEBUG_ALWAYS))
log_debug(ffi.C.LOG_GRP_RESOLVER, 'starting DNS query for %s %s', qname, kres.tostring.type[qtype])
local starttime = cqueues.monotime()
modules.unload('detect_time_skew')
end
-verbose(true)
+set_log_level('debug')
policy.add(policy.all(policy.DEBUG_ALWAYS))
cache.open(1*MB)
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
policy.add(policy.all(policy.DEBUG_ALWAYS))
{% endraw %}
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
policy.add(policy.all(policy.DEBUG_ALWAYS))
{% endraw %}
end
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
policy.add(policy.all(policy.DEBUG_ALWAYS))
policy.add(policy.all(policy.FORWARD('8.8.8.8')))
{% endraw %}
bool BADCOOKIE_AGAIN : 1;/**< Query again because bad cookie returned. */
bool CNAME : 1; /**< Query response contains CNAME in answer section. */
bool REORDER_RR : 1; /**< Reorder cached RRs. */
- bool TRACE : 1; /**< Also log answers if --verbose. */
+ bool TRACE : 1; /**< Also log answers on debug level. */
bool NO_0X20 : 1; /**< Disable query case randomization . */
bool DNSSEC_NODS : 1; /**< DS non-existance is proven */
bool DNSSEC_OPTOUT : 1; /**< Closest encloser proof has optout */
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
net = { '{{SELF_ADDR}}' }
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
net = { '{{SELF_ADDR}}' }
"``/stats``", "Statistics/metrics", "Exported :ref:`metrics <mod-stats-list>` from :ref:`mod-stats` in JSON format."
"``/metrics``", "Prometheus metrics", "Exported metrics for Prometheus_."
- "``/trace/:name/:type``", "Tracking", ":ref:`Trace resolution <mod-http-trace>` of a DNS query and return the verbose logs."
+ "``/trace/:name/:type``", "Tracking", ":ref:`Trace resolution <mod-http-trace>` of a DNS query and return its debug-level logs."
"``/doh``", "Legacy DNS-over-HTTPS", ":rfc:`8484` endpoint, see :ref:`mod-http-doh`."
"``/dns-query``", "Legacy DNS-over-HTTPS", ":rfc:`8484` endpoint, see :ref:`mod-http-doh`."
--------------------
Query policies :any:`policy.DEBUG_ALWAYS`, :any:`policy.DEBUG_CACHE_MISS` or
-:any:`policy.DEBUG_IF` can be used to enable verbose logging for selected
+:any:`policy.DEBUG_IF` can be used to enable debug-level logging for selected
subdomains or queries matching specific conditions. Please refer to their
documentation for usage.
The :ref:`http module <mod-http>` provides ``/trace`` endpoint which allows to trace various
aspects of the request execution. The basic mode allows you to resolve a query
-and trace verbose logs for it (and messages received):
+and trace debug-level logs for it (and messages received):
.. code-block:: bash
.. py:attribute:: QTRACE
- Pretty-print DNS response packets from authoritative servers into the verbose log for the query and its sub-queries. It's useful for debugging weird DNS servers. Verbose logging must be enabled using :func:`verbose` for this policy to be effective.
+ Pretty-print DNS response packets from authoritative servers into debug logs for the query and its sub-queries. It's useful for debugging weird DNS servers.
+ Note that debug-level logs are off by default; see :func:`set_log_level`.
.. code-block:: lua
.. py:attribute:: REQTRACE
- Pretty-print DNS requests from clients into the log.
- It's useful for debugging weird DNS clients.
+ Pretty-print DNS requests from clients into the verbose log. It's useful for debugging weird DNS clients.
+ Debug-level logging must be enabled for this policy to be effective; see :func:`set_log_level`.
It makes most sense together with :ref:`mod-view` (enabling per-client)
and probably with verbose logging those request (e.g. ``DEBUG_ALWAYS``).
.. py:function:: DEBUG_IF(test_function)
- :param test_function: Function with single argument of type :c:type:`kr_request` which returns ``true`` if verbose logs for a given request should be printed and ``false`` otherwise.
+ :param test_function: Function with single argument of type :c:type:`kr_request` which returns ``true`` if debug logs for a given request should be generated and ``false`` otherwise.
Enable extra verbose logging but print logs only for requests which match condition specified by ``test_function``. This allows to fine-tune which requests should be printed.
- .. warning:: Verbose logging has significant performance impact on resolver and might also overload you logging system because one request can easily generate tens of kilobytes of logs. Always use appropriate `Filters`_ to limit number of requests triggering this action to a minimum!
+ .. warning:: Logging on debug level has significant performance impact on resolver and might also overload you logging system because one request can easily generate tens of kilobytes of logs. Always use appropriate `Filters`_ to limit number of requests triggering this action to a minimum!
- .. note:: ``test_function`` is evaluated only when request is finished. As a result verbose logs for all requests must be collected until request is finished because it is not possible to know beforehand how ``test_function`` at the end evaluates given request. When a request is finalized logs are either printed or thrown away.
+ .. note:: ``test_function`` is evaluated only when request is finished. As a result debug logs for all requests must be collected until request is finished because it is not possible to know beforehand how ``test_function`` at the end evaluates given request. When a request is finalized logs are either printed or thrown away.
- Example usage which gathers verbose logs for all requests in subtree ``dnssec-failed.org.`` and prints verbose logs for all requests finished with states different than ``kres.DONE`` (most importantly ``kres.FAIL``, see :c:type:`kr_layer_state`).
+ Example usage which gathers verbose logs for all requests in subtree ``dnssec-failed.org.`` and prints debug logs for all requests finished with states different than ``kres.DONE`` (most importantly ``kres.FAIL``, see :c:type:`kr_layer_state`).
.. code-block:: lua
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
net = { '{{SELF_ADDR}}' }
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
net = { '{{SELF_ADDR}}' }
end)
ffi.gc(debug_stashlog_cb, free_cb)
--- buffer verbose logs and print then only if test() returns a truthy value
+-- buffer debug logs and print then only if test() returns a truthy value
function policy.DEBUG_IF(test)
local debug_finish_cb = ffi.cast('trace_callback_f', function (cbreq)
jit.off(true, true) -- JIT for (C -> lua)^2 nesting isn't allowed
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
net = { '{{SELF_ADDR}}' }
policy.add(policy.suffix(policy.PASS, {todname('test.')}))
cache.size = 2*MB
--- verbose(true)
+-- set_log_level('debug')
-- Self-checks on globals
assert(help() ~= nil)
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
net.ipv6 = false
{% endraw %}
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
net = { '{{SELF_ADDR}}' }
policy.add(policy.suffix(policy.PASS, {todname('test.')}))
prepare_cache()
-verbose(true)
+set_log_level('debug')
modules.load('renumber < cache')
renumber.config({
-- Source subnet, destination subnet
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
{% if DO_IP6 == "true" %}
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
net = { '{{SELF_ADDR}}' }
policy.add(policy.suffix(policy.PASS, {todname('test.')}))
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
modules.load('hints')
policy.add(policy.suffix(policy.PASS, {todname('test.')}))
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
modules.load('hints')
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
net = { '{{SELF_ADDR}}' }
_hint_root_file('hints')
cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
{% endraw %}
net = { '{{SELF_ADDR}}' }
private.ok_callback()
return
end
- log_info(ffi.C.LOG_GRP_WATCHDOG, 'watchdog query returned unexpected answer! query verbose log:')
+ log_info(ffi.C.LOG_GRP_WATCHDOG, 'watchdog query returned unexpected answer! query log:')
log_info(ffi.C.LOG_GRP_WATCHDOG, table.concat(logbuf, ''))
if pkt ~= nil then
log_info(ffi.C.LOG_GRP_WATCHDOG, 'problematic answer:\n%s', pkt)
verbose = true
elseif v == '-d' then
verbose = true
- table.insert(config, 'verbose(true)')
+ table.insert(config, 'set_log_level("debug")')
elseif v == '-4' then
table.insert(config, 'net.ipv6 = false')
elseif v == '-6' then
'policy > iterate',
}
-verbose({{ 'true' if kresd.verbose else 'false' }})
+{% if kresd.verbose %}
+set_log_level('debug')
+{% endif %}
{% if kresd.ip %}
net.listen('{{ kresd.ip }}', {{ kresd.port }})