Changes between Version 5 and Version 6 of Logging


Ignore:
Timestamp:
2012-10-05T09:00:20Z (12 years ago)
Author:
Vojtech Horky
Comment:

Write section about changing log level at run-time

Legend:

Unmodified
Added
Removed
Modified
  • Logging

    v5 v6  
    7878== Changing reported level at run-time ==
    7979
    80 TODO - logset
     80It is also possible to change reported log level at run-time. For that the user shall use the `logset` utility. The utility is controlled purely via its command-line arguments - one of them is always the name of the level that is supposed to be set.
     81
     82To change the default reporting level, simply run `logset` with the level name - following would make the system very quiet.
     83{{{
     84logset fatal
     85}}}
     86
     87To change the reporting level of a certain log, run `logset` with the log name followed by the level name. For example, to make devman more verbose, run the following:
     88{{{
     89logset devman debug2
     90}}}
     91
     92It is also possibly to target a nested log - simply separate individual names with a slash (like in a file name).
     93
     94'''Example (tester logger2)''': To demonstrate how setting log levels at run-time works, you shall open at least three terminals. In one, start the `tester` with `logger2` test. This test only prints messages at different levels to different logs.
     95
     96In the second, you shall monitor the tester log - either by `cat`ting `/log/tester` or you can switch to kernel console (if you configure HelenOS without GUI, seventh console shall display that output).
     97
     98And in the third console you can issue the `logset` to see what happens.
     99
     100By default, you would see that `tester` continuously prints errors, warnings and notes into three logs: the default one (i. e. `tester`), `alpha` and `bravo` (`tester/alpha` and `tester/alpha/bravo`).
     101
     102Running
     103{{{
     104logset tester/alpha fatal
     105}}}
     106would mute all the output to `alpha` and `alpha/bravo` logs. The reason why `bravo` was muted as well is because it is a child of `alpha` and has to respect its settings (unless explicitly overridden).
     107
     108But it is possible to explicitly enable `bravo` output. If we ran
     109{{{
     110logset tester/alpha/bravo warn
     111}}}
     112the `alpha` is still muted but together with the original `tester` messages, `bravo` warnings are interleaved.
     113
    81114
    82115== Using the C API ==