![]() |
Kea 3.1.1
|
Configures log4cplus by translating Kea configuration structures. More...
#include <log_parser.h>
Public Member Functions | |
LogConfigParser (const ConfigPtr &storage) | |
Constructor. | |
void | parseConfiguration (const isc::data::ConstElementPtr &log_config, bool verbose=false) |
Parses specified configuration. | |
Static Public Member Functions | |
static std::string | getLogPath (bool reset=false, const std::string explicit_path="") |
Fetches the supported log file path. | |
static std::string | validatePath (const std::string logpath) |
Validates a library path against the supported path for log files. | |
Configures log4cplus by translating Kea configuration structures.
This parser iterates over provided data elements and translates them into values applicable to log4cplus.
The data structures converted to JSON format have the following syntax: { "name": "kea", "output-options": [ { "output": "/home/thomson/kea-inst/kea-warn.log", "maxver": 8, "maxsize": 204800, "flush": true } ], "severity": "WARN" }
This is only an example and actual values may be different.
The data structures don't have to originate from JSON. JSON is just a convenient presentation syntax.
This class uses ConfigBase
object to store logging configuration.
Definition at line 43 of file log_parser.h.
isc::process::LogConfigParser::LogConfigParser | ( | const ConfigPtr & | storage | ) |
Constructor.
storage | parsed logging configuration will be stored here |
Definition at line 30 of file log_parser.cc.
References isc_throw.
|
static |
Fetches the supported log file path.
The first call to this function with no arguments will set the default hooks path to either the value of LOGFILE_DIR or the environment variable KEA_LOG_FILE_DIR if it is defined. Subsequent calls with no arguments will simply return this value.
reset | recalculate when true, defaults to false. |
explicit_path | set default log path to this value. This is for testing purposes only. |
Definition at line 137 of file log_parser.cc.
Referenced by validatePath().
void isc::process::LogConfigParser::parseConfiguration | ( | const isc::data::ConstElementPtr & | log_config, |
bool | verbose = false ) |
Parses specified configuration.
Walks over specified logging configuration JSON structures and store parsed information in config_->logging_info_.
log_config | JSON structures to be parsed (loggers list) |
verbose | specifies verbose mode (true forces DEBUG, debuglevel = 99) |
Definition at line 38 of file log_parser.cc.
Referenced by isc::process::Daemon::configureLogger().
|
static |
Validates a library path against the supported path for log files.
logpath | path to validate. |
Definition at line 149 of file log_parser.cc.
References isc::process::DCTL_LOG_PATH_SECURITY_WARNING, isc::process::dctl_logger, getLogPath(), LOG_WARN, and isc::Exception::what().