Loggers
A logger is usually configured in the config file. The logging
section is inside controller
, e.g.
netplex {
...
controller {
...
logging { ... };
...
}
...
}
The possible types of logging
sections are explained below.
If there are several logging
sections, the messages are sent to
all configured loggers.
Instead of configuring loggers in the config file, one can also
create loggers from config objects like generic_config
.
See also [root:Netplex_intro].logging for more documentation.
Outputs messages to the channel
Reads a logging section like
logging {
type = "stderr";
format = "<format string>";
component = "<name_of_component>";
subchannel = "<name_of_subchannel>";
max_level = "<max_level>";
}
format
: Optional format string. See below.component
: Optional component selector. See below.subchannel
: Optional subchannel selector. See below.max_level
: Optional maximum log level. See below.Writes messages to this file
Reads a logging section like
logging {
type = "file";
file = "/path/to/logfile";
format = "<format string>";
component = "<name_of_component>";
subchannel = "<name_of_subchannel>";
max_level = "<max_level>";
}
file
: Log messages are appended to this file.format
: Optional format string. See below.component
: Optional component selector. See below.subchannel
: Optional subchannel selector. See below.max_level
: Optional maximum log level. See below.Triples (component, subchannel, max_level, file, format)
. Use *
as
wildcard in component
and subchannel
.
Currently, `All
is a synonym for the `Debug
level.
Reads a logging section like
logging {
type = "multi_file";
directory = "/path/to/logdir";
format = "<format string>";
file {
component = "<name_of_component>";
subchannel = "<name_of_subchannel>";
max_level = "<max_level>";
file = "<logfile>";
format = "<format string>";
};
file { ... }; ...
}
format
: Optional format string. See below.component
: Optional component selector. See below.subchannel
: Optional subchannel selector. See below.max_level
: Optional maximum log level. See below.Reads a logging section like
logging {
type = "syslog";
format = "<format string>";
identifier = "<identifier>";
facility = "<facility name>";
component = "<name_of_component>";
subchannel = "<name_of_subchannel>";
max_level = "<max_level>";
}
All parameters except type
are optional:
facility
: The faciltiy like LOCAL0
, USER
, ...identifier
: An identifier prefixing every messageformat
: Optional format string. See below.component
: Optional component selector. See below.subchannel
: Optional subchannel selector. See below.max_level
: Optional maximum log level. See below.Logging parameters that can occur in all logging configurations:
The format string may include variable
parts in the syntax $name
or ${name}
. The following variable
specifications are defined:
timestamp
: the time in standard format (as set in
Netlog.current_formatter)timestamp:<format>
the time in custom format where <format>
is a
[root:Netdate] format stringtimestamp:unix
: the time in seconds since the epochcomponent
: the name of the component emitting the log messagesubchannel
: the name of the subchannellevel
: the log levelmessage
: the log messageThe component
name restricts logging to the given Netplex component.
One can use the wildcard "*".
The subchannel
name restricts logging to this subchannel.
One can use the wildcard "*".
The max_level
specifier restricts logging to messages with at most
this level. Levels are "emerg", "alert", "crit", "err", "warning",
"notice", "info", "debug" (in order of increasing level).