3 Commits

Author SHA1 Message Date
Julian Brost
1e316b6663 Windows: log into separate "Icinga 2" log
Previously, Icinga 2 logged to the shared "Application" log provided by
default. Due to the comparatively high volume of log messages, this lead to
complaints and for the early logging (before the final logging configuration is
loaded and enabled), the behavior isn't configurable easily. By using our own
log file, this should be less annoying for users.

The log is named "Icinga 2" and the source "Icinga 2 General" because according
to the documentation, these names should not be the same: "You cannot use a
source name that has already been used as a log name." [1]

This naming allows for distributing messages across different sources in the
future (think "Icinga 2 ApiListener", "Icinga2 CheckerComponent", ...).
However, this requires registering all these names in the registry, so this is
just left as an option for now.

The existing "Icinga for Windows" log is not used on explicit request. [2]

[1] https://docs.microsoft.com/en-us/windows/win32/eventlog/event-sources
[2] https://github.com/Icinga/icinga2/issues/8996#issuecomment-1183013092
2022-07-14 14:04:00 +02:00
Julian Brost
05ca30a6a0 Write early log messages to the Windows Event Log
When Icinga 2 is started as a service, the early log messages generated
until the FileLogger object is activated are lost and make it really
hard to debug issues that (only) occur when Icinga 2 reloads.

With this commit, these early log messages are written to the Windows
Event Log.
2021-06-21 15:15:54 +02:00
Julian Brost
6de9f58810 Add WindowsEventLogLogger 2021-06-21 15:15:54 +02:00