ERROR log messages don't get sent to configured output file at startup
While having MySQL shut down on localhost, start kea-dhcp6 with:
{
"Dhcp6": {
"lease-database": {
"name": "keatest",
"password": "keatest",
"user": "keatest",
"type": "mysql"
},
"loggers": [
{
"debuglevel": 0,
"name": "kea-dhcp6",
"output_options": [
{
"output": "/var/log/kea-dhcp6.log"
}
],
"severity": "INFO"
}
]
}
}
You'll see the following messages in the log file:
INFO HOSTS_BACKENDS_REGISTERED
INFO DHCP6_CONFIG_COMPLETE
INFO DHCPSRV_MYSQL_DB opening
But the following messages are only sent to standard output and standard error:
INFO DHCP6_STARTING
WARN DHCP6_DEVELOPMENT_VERSION
ERROR DHCP6_CONFIG_LOAD_FAIL
ERROR DHCP6_INIT_FAIL
The INFO message logs predate the ERROR message logs so it's not like the logger isn't properly initialized when ERROR messages are logged.
Anyway, the suggestions are:
- initialize the logger as early as possible, maybe in a separate first pass of the configuration
- send as many logs as possible to the configured output
This is affecting customers who run Kea as a systemd service. Most packages install a systemd service. They can't see the reason of the failure unless they look in /var/log/messages or syslog instead of the configured /var/log/kea-dhcp6.log.