Commit Graph

82 Commits

Author SHA1 Message Date
Julian Brost 0503ca1379 Initialize namespaces without using `overrideFrozen`
This commit adds a new initialization priority `FreezeNamespaces` that is run
last and moves all calls to `Namespace::Freeze()` there. This allows all other
initialization functions to still update namespaces without the use of the
`overrideFrozen` flag.

It also moves the initialization of `System.Platform*` and `System.Build*` to
an initialize function so that these can also be set without setting
`overrideFrozen`.

This is preparation for a following commit that will make the frozen flag in
namespaces finial, no longer allowing it to be overriden (freezing the
namespace will disable locking, so performing further updates would be unsafe).
2023-01-19 09:53:36 +01:00
Alexander A. Klimov 0fbb0332a6 Logger: don't render log messages which will be disposed anyway
by caching the total minimum log severity of all loggers in a
"global variable" and whether a message's severity is large enough for any of
the loggers in a per-message no-op flag.
2022-10-11 13:28:08 +02:00
Julian Brost a927ba39b7 Windows: only include critical messages in early log messages
The point of logging to the Windows Event Log was to catch errors that happen
before the full logging configuration has been loaded and enabled. Messages
like the number of loaded objects per type just cause noise in the log and
provide little benefit. Therefore raise the required log level at this stage.

Note that this commit removes the (never documented) ability to use the -x flag
to change the level. But doing so would require patching the command line of
the service in the registry anyways.
2022-07-14 14:07:56 +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
Alexander A. Klimov c3388e9af6 Use std::mutex, not boost::mutex 2021-02-03 09:54:57 +01:00
Alexander A. Klimov 63a8c1b7ef Log: trim trailing newlines
refs #7828
2020-02-19 11:27:58 +01:00
Michael Friedrich 1f50a705f9 Adjust code comment for Logger->Flush() on Windows 2019-09-06 09:24:34 +02:00
Michael Friedrich d14a88235d Replace Copyright header with a short version, part I
CLion -> replace in path
2019-02-25 14:48:22 +01:00
Michael Friedrich dab53448bc icinga.com: Update *.{h,c}pp 2018-10-18 09:27:04 +02:00
Alan Jenkins a0fb0bbfe3 fix "Console" log to flush
It's called "Console", which would be line-buffered anyway.  But, it's
implemented as std::cout.  This might be piped to a logger, as in
daemontools or systemd.  In this case it will not be a TTY, and log lines
should be flushed without too much delay.  Let's just flush each message.

Let's not introduce a static instance of StreamLogger (flushed by interval
timer).  That's too stressful to read, because static instances are really
annoying to order.  Example citation: "Yay, our static destructors are
pretty much beyond repair at this point." -- application.cpp.

I don't know if there will be any need to optimize logging syscalls.  The
init script uses `--daemonize`.  I think the systemd service should also
avoid using the "Console" log after startup (see next commit).  The
documentation does not warn that the syslog feature is less efficient
in system calls than mainlog; deferred flusing does not seem to be a highly
prominent feature.  There's no cool comment in the code about how much the
syscalls were slowing down some use case (or qualifying that this
optimization can only eliminate syscalls on platforms with both mutexes and
clocks that can work without syscalls).
2018-08-25 09:54:55 +01:00
Gunnar Beutner 10d6f70a85 Move constants and functions into different namespaces 2018-08-13 13:44:31 +02:00
Michael Friedrich fd381ff5e0 Keep notes for immediately log flushing
Disabled, but kept for future debugging sessions.
Helps with things like #6455
2018-07-19 12:51:30 +02:00
Michael Friedrich e606a443b7 Add support for config validation log timestamps
This also adds implicit support for the startup.log
generated from API config package validation, e.g. used by
the Icinga Director.

fixes #3455
2018-05-03 11:35:29 +02:00
Gunnar Beutner 9d436605f0 Fix compatibility with CMake < 3.1 2018-01-18 15:12:46 +01:00
Gunnar Beutner 21254fb610 Avoid accessing attributes for validators where not necessary 2018-01-11 08:20:16 +01:00
Gunnar Beutner 621eed3f13 Apply clang-tidy fix 'modernize-pass-by-value' 2018-01-04 12:24:57 +01:00
Gunnar Beutner ac155d1dda Apply clang-tidy fix 'modernize-redundant-void-arg' 2018-01-04 12:24:57 +01:00
Gunnar Beutner fe8572d75b Remove inline methods and use explicit template instantiation to minimize the number of weak symbols 2018-01-03 11:04:58 +01:00
Michael Insel 158ae2188e Change copyright header for 2018 2018-01-02 12:08:55 +01:00
Jean Flach 2636e6a77a Whitespace fix
What does this change?
* Remove use of spaces for formatting
These could be found by using `grep -r -l -P '^\t+ +[^*]'
* Removal of training whitespaces
* A few lines longer than 120 chars
2017-12-20 14:53:52 +01:00
Gunnar Beutner 83f17b5bfa Replace boost::assign::list_of with initializer lists 2017-11-30 18:09:38 +01:00
Michael Friedrich b7caf0820d Ensure that *.icinga.com is used everywhere
fixes #13897
fixes #13277
2017-01-10 17:19:12 +01:00
Gunnar Beutner b5b09216c6 Use lambda functions for INITIALIZE_ONCE
fixes #12562
2016-08-27 09:48:36 +02:00
Gunnar Beutner 288413f046 Replace BOOST_FOREACH with range-based for loops
fixes #12538
2016-08-25 06:46:17 +02:00
Gunnar Beutner 2d55cf1341 Implement validation for the Logger#severity attribute
fixes #11646
2016-04-21 13:50:47 +02:00
Gunnar Beutner 599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Gunnar Beutner 050c520b2a Convert Comment/Downtime to config objects
fixes #9777
2015-10-28 17:56:29 +01:00
Gunnar Beutner f45f6ccd82 Implement support for tracking dependencies between config objects
refs #9096
2015-08-25 13:54:05 +02:00
Gunnar Beutner 071d2f18fb Rename DynamicObject/DynamicType to ConfigObject/ConfigType
fixes #9914
2015-08-15 20:40:41 +02:00
Gunnar Beutner 72a7b08480 Move implementation code from thpp files into separate files
fixes #8890
2015-03-28 11:08:12 +01:00
Gunnar Beutner 1e9e5edcff Fix incorrect assignment in Logger::EnableConsoleLog 2015-03-02 12:47:24 +01:00
Jean Flach 1a9c4ceef6 Restructure troubleshootcollect, more after the jump
Changed `--output-file` to `--output`
Default output file now has a timestamp in the name, no more overwriting
Added Section headers and file markers
Taken time is now measured and output
And some format changes were made

refs #3446
2015-02-19 17:12:32 +01:00
Michael Friedrich 78bfd0204c Update copyright year 2015-01-22 12:00:23 +01:00
Gunnar Beutner 1cb0231c05 Refactor how variable scopes work
refs #8074
2014-12-14 11:33:45 +01:00
Gunnar Beutner e692ca16cd Add missing Stop call in the Logger class
fixes #7652
2014-11-13 09:02:23 +01:00
Gunnar Beutner 478f03b49a Replace boost::shared_ptr with boost::intrusive_ptr
refs #7622
2014-11-09 16:54:41 +01:00
Michael Friedrich bc83c9a698 CLI Commands: Remove timestamp prefix when logging output
fixes #7376
2014-10-31 22:01:36 +01:00
Gunnar Beutner 9368ff0e03 Update some more log messages 2014-10-20 10:09:57 +02:00
Gunnar Beutner 2d5e9514a5 Refactor logging code 2014-10-19 17:52:17 +02:00
Gunnar Beutner 8cc6368954 Implement generic color support for terminals
fixes #7396
2014-10-17 20:44:17 +02:00
Gunnar Beutner f7f8bd9b00 Use const-ref specifier when catching exceptions
refs #6070
2014-08-25 08:36:30 +02:00
Michael Friedrich 17668af2c2 Error messages: Fix Logger exceptions.
Refs #6070
2014-06-05 15:35:30 +02:00
Gunnar Beutner 632026cd9f Rename C++ header files.
Fixes #6291
2014-05-25 16:27:14 +02:00
Gunnar Beutner 16a2d36bdc Rename --debug to --log-level.
Refs #6276
2014-05-23 18:11:21 +02:00
Michael Friedrich 5ec300f68e Add debug log severity for console logger.
Fixes #6276
2014-05-23 11:57:08 +02:00
Michael Friedrich 7462c8320a Add 'notice' severity to *Logger.
Refs #6070
2014-05-22 16:07:57 +02:00
Gunnar Beutner 9c3e399188 Remove unnecessary includes.
Fixes #6189
2014-05-11 18:11:32 +02:00
Gunnar Beutner 2c17305536 Implement additional arguments for log().
Fixes #5902
2014-04-01 09:33:54 +02:00
Michael Friedrich ce737ff2f3 Change copyright header (again).
Fixes #5424
2014-03-19 11:42:47 +01:00
Michael Friedrich 555d72150a Update copyright header.
Fixes #5424
2014-01-09 00:32:11 +01:00