Skip to content

Constraints and exceptions

cihub edited this page Dec 13, 2011 · 18 revisions

Constraints

Constraints are restricting rules for allowing log levels. If no constraints are specified, then all log levels are allowed.

  • Minmax constraints allow levels between min and max values inclusive (for example, between [info] and [error]). Both min and max don't have to be present. So, you can allow all log levels above min level OR below max level. Use keywords 'minlevel' and 'maxlevel' to set these constraints.

  • List constraints allow levels that are specified in a list. For example, you can allow levels "debug', info, critical" only. Use keyword 'levels' to set these constraints.

There are two types of constraints: global constraints and exception constraints

Global constraints

Global constraints are meant to be used in the most parts application. They are like general rules (as opposed to 'exceptions'). These constraints are set in the root 'sealog' element attributes.

For example, to allow only log levels 'info' and above, start your config with:

<sealog minlevel="info">

To allow levels between info and error (i.e. info, warn, error), use:

<sealog minlevel="info" maxlevel="error">

To allow only a specific set of levels (say, trace, info and critical), start your config with:

<sealog levels="trace,info,critical">
Clone this wiki locally