| b05e07c8 | 04-Nov-2025 |
Patrick Williams <patrick@stwcx.xyz> |
use sdbusplus unpack syntax
Rather than defining a variable and then reading it from a message, sdbusplus also supports directly unpack-ing from the message. Use this syntax instead as it is more e
use sdbusplus unpack syntax
Rather than defining a variable and then reading it from a message, sdbusplus also supports directly unpack-ing from the message. Use this syntax instead as it is more efficient and succinct.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I2516cfa21eaf0fc51902f2b23d4a54241e9d4978
show more ...
|
| 40fb5493 | 28-Oct-2025 |
Alexander Hansen <alexander.hansen@9elements.com> |
Copyright: Move to SPDX-License-Identifier
Original copyright holders have been preserved, this patch moves the copyright notice to the compact SPDX notation.
Change-Id: I197e79ed3f9b09e293e02bda82
Copyright: Move to SPDX-License-Identifier
Original copyright holders have been preserved, this patch moves the copyright notice to the compact SPDX notation.
Change-Id: I197e79ed3f9b09e293e02bda820fa4c52d9a88e8 Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
show more ...
|
| 9fd25af5 | 23-Sep-2025 |
Piotr Sulewski <piotrx.sulewski@intel.com> |
Add configurable log level for cerr output
When directly running an executable which utilizes lg2, all logs are shown by default. Currently, we can only disable them entirely without any filtering o
Add configurable log level for cerr output
When directly running an executable which utilizes lg2, all logs are shown by default. Currently, we can only disable them entirely without any filtering options.
This commit adds the LG2_LOG_LEVEL environment variable for log filtering. It allows runtime control of log verbosity by setting LG2_LOG_LEVEL to desired maximum log level (0-7). Messages above this level are filtered out. Defaults to 7 (all levels) if not set.
Tested: Logs are properly filtered when the env variable is set
Change-Id: Ibe44d9971550d3b74ef818a00f7d6b364eb0212c Signed-off-by: Piotr Sulewski <piotrx.sulewski@intel.com>
show more ...
|
| 0ceb37da | 29-Jul-2025 |
Brad Bishop <bradbish@qti.qualcomm.com> |
meson: subproject as system dependency
When phosphor-logging is a subproject, use -isystem for phosphor-logging headers. This is a signal to, for example static analysis tools, that the phosphor-log
meson: subproject as system dependency
When phosphor-logging is a subproject, use -isystem for phosphor-logging headers. This is a signal to, for example static analysis tools, that the phosphor-logging headers are to be treated as if they were installed in the compilers default search path (e.g. /usr/include).
Change-Id: I428d507cbf303816b27eae63d1d90d3ff02c2e7d Signed-off-by: Brad Bishop <bradbish@qti.qualcomm.com>
show more ...
|
| 76fe0d1f | 14-May-2025 |
Patrick Williams <patrick@stwcx.xyz> |
tools: add gen-eventfilter.py
Generate event filtering code for lg2::commit from an input json file, so that system integrators can create default filtering rules to omit undesired events and errors
tools: add gen-eventfilter.py
Generate event filtering code for lg2::commit from an input json file, so that system integrators can create default filtering rules to omit undesired events and errors from their systems.
Tested:
Used `log-create` to create an event and observed it. Modified the default event filter as follows and saw log was not created.
``` @@ -3,6 +3,9 @@ "default": "allowed" }, "errors": { - "default": "allowed" + "default": "allowed", + "ids": [ + "xyz.openbmc_project.State.SMC.SMCFailed" + ] } } ```
``` $ ./builddir/log-create xyz.openbmc_project.State.SMC.SMCFailed --json '{ "IDENTIFIER": "/xyz/openbmc_project/inventory/SomeSMC", "FAILURE_TYPE": "Timeout for the SMC" }' ```
Change-Id: Ib6041481075758b994bb27a816dbf5e9f26c2841 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
| 3857579e | 03-Dec-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: use DEBUG_INVOCATION to reduce debug journal
The systemd-v257 release introduced a new convention that can be used by daemons to reduce the amount of calls to journald for debug-level messages:
lg2: use DEBUG_INVOCATION to reduce debug journal
The systemd-v257 release introduced a new convention that can be used by daemons to reduce the amount of calls to journald for debug-level messages: DEBUG_INVOCATION[1]. Daemons will typically start with DEBUG_INVOCATION not set, but in the event of a crash, the daemon will be restarted with it set. Daemons are expected to emit higher debug messages when ran in that mode.
Adjusting the logger code to avoid sending debug messages to journald unless DEBUG_INVOCATION is set. This reduces the overhead of logging by skipping the journald calls entirely.
[1]: https://github.com/systemd/systemd/commit/7d8bbfbe0852ec89590d1dc5e28afc95d6d44fa1
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I5896c4714b92786c8f859f2e5ab389753e4b5c26
show more ...
|
| 5383d760 | 01-Feb-2025 |
Patrick Williams <patrick@stwcx.xyz> |
meson: reformat with meson formatter
Apply the `meson format` results.
Change-Id: I874e2c57075988db53dad8e365c0bf1ac204f81b Signed-off-by: Patrick Williams <patrick@stwcx.xyz> |
| 4e8c0343 | 22-Jan-2025 |
Amithash Prasasd <amithash@meta.com> |
Add helper method to resolve a log object path
Add a helper method to resolve a previously generated log entry which can be used by other services in conjunction with the `lg2::commit` API.
Change-
Add helper method to resolve a log object path
Add a helper method to resolve a previously generated log entry which can be used by other services in conjunction with the `lg2::commit` API.
Change-Id: Ia1582177b51ca2f0bfecae98f999b5b8f2f61c93 Signed-off-by: Amithash Prasasd <amithash@meta.com>
show more ...
|
| ea21d995 | 22-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
entry: use map for metadata in ctor
Transition the entry constructor to use the `map<string,string>` rather than the `vector<string>`.
Tested: UTs pass and daemon still creates logs.
Signed-off-by
entry: use map for metadata in ctor
Transition the entry constructor to use the `map<string,string>` rather than the `vector<string>`.
Tested: UTs pass and daemon still creates logs.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Icf3ead163cc99a1498734d33335fb6da52e6c98c
show more ...
|
| dd9694ae | 21-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: avoid double quoting strings
The JSON `.dump()` function will quote a string, if that is what the JSON type was. This results in AdditionalData fields which appear double-quoted. Fix
lg2: commit: avoid double quoting strings
The JSON `.dump()` function will quote a string, if that is what the JSON type was. This results in AdditionalData fields which appear double-quoted. Fix this by checking the type and using the raw value for strings.
Before: ``` .AdditionalData property as 8 "READING_VALUE=98.6" "SENSOR_NAME=\"Inlet Temperature\"" "THRESHOLD_VALUE=40.0" "UNITS=\"xyz.openbmc_project.Sensor.Value.Unit.DegreesC\"" "_CODE_FILE=../log_create_main.cpp" "_CODE_FUNC=int generate_event(const std::string&, const nlohmann::json_abi_v3_11_2::json&)" "_CODE_LINE=34" "_PID=1931265" emits-change writable ```
After: ``` .AdditionalData property as 8 "READING_VALUE=98.6" "SENSOR_NAME=Inlet Temperature" "THRESHOLD_VALUE=40.0" "UNITS=xyz.openbmc_project.Sensor.Value.Unit.DegreesC" "_CODE_FILE=../log_create_main.cpp" "_CODE_FUNC=int generate_event(const std::string&, const nlohmann::json_abi_v3_11_2::json&)" "_CODE_LINE=34" "_PID=2219391" emits-change writable ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ie29ab523f7517d5484a833d91c58c2058b710069
show more ...
|
| 236d864b | 18-Nov-2024 |
Amithash Prasasd <amithash@meta.com> |
Install commit.hpp into target include directory
This ensures that users can include commit.hpp which is needed to generate event logs
Change-Id: Ie04479d9a9ef41a3e3533db7bc20d33ff22b38be Signed-of
Install commit.hpp into target include directory
This ensures that users can include commit.hpp which is needed to generate event logs
Change-Id: Ie04479d9a9ef41a3e3533db7bc20d33ff22b38be Signed-off-by: Amithash Prasasd <amithash@meta.com>
show more ...
|
| fc14867b | 06-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: simplify commit functions
Eliminate the template indirection for the commit function in favor of a base-class overload. There was previously a public template specialization of `lg2::c
lg2: commit: simplify commit functions
Eliminate the template indirection for the commit function in favor of a base-class overload. There was previously a public template specialization of `lg2::commit` and a private base-class implementation (in the `details` namespace). The template implementations provided no stronger type-checking, since it was already a concept requiring inheritance from the base-class. The template precluded simple code such as:
```cpp try { //... } catch (const sdbusplus::exception::generated_event_base& e) { lg2::commit(e); } ```
By making the base-class types public, rather than hidden in the details namespace, and removing the templates, the code is simpler and more usable.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: If0a3e1331eff36aec4b9f7e4950636360d59306e
show more ...
|
| 6eb96bf7 | 05-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: add support for journal-only method
The design document for the new event system references an option to log events to the journal rather than to dbus[1] using the 'OPENBMC_MESSAGE_ID'
lg2: commit: add support for journal-only method
The design document for the new event system references an option to log events to the journal rather than to dbus[1] using the 'OPENBMC_MESSAGE_ID' identifier. Add support and test cases for this as a meson option.
[1]: https://github.com/openbmc/docs/blob/master/designs/event-logging.md#phosphor-logging
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6cb94453c6cc95a9ccbbbc11859b70ef12d375fd
show more ...
|
| 9ca4d137 | 31-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
manager: use new Logging.Cleared event
Modify the internal manager support for creating internal events to be able to support the sdbusplus generated events. Transition from the local Logging.Error
manager: use new Logging.Cleared event
Modify the internal manager support for creating internal events to be able to support the sdbusplus generated events. Transition from the local Logging.Error.LogsCleared to the global Logging.Cleared event. Clean up references to the old event.
Tested: ``` $ busctl --user call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Collection.DeleteAll DeleteAll $ busctl --user introspect xyz.openbmc_project.Logging /xyz/openbmc_project/logging/entry/1 -l | cat NAME TYPE SIGNATURE RESULT/VALUE FLAGS xyz.openbmc_project.Logging.Entry interface - - - .GetEntry method - h - .AdditionalData property as 5 "NUMBER_OF_LOGS=210" "_CODE_FILE=../log_manager.hpp" "_CODE_FUNC=virtual void phosphor::logging::Manager::deleteAll()" "_CODE_LINE=361" "_PID=3318436" emits-change writable .EventId property s "" emits-change writable .Id property u 1 emits-change writable .Message property s "xyz.openbmc_project.Logging.Cleared" emits-change writable .Resolution property s "" emits-change writable .Resolved property b false emits-change writable .ServiceProviderNotify property s "xyz.openbmc_project.Logging.Entry.Notify.NotSupported" emits-change writable .Severity property s "xyz.openbmc_project.Logging.Entry.Level.Informational" emits-change writable .Timestamp property t 1730408674348 emits-change writable .UpdateTimestamp property t 1730408674348 emits-change writable ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I470f33ae2f5bfae6bf6d6a80ac2c5f028e41da95
show more ...
|
| 247fed60 | 31-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: extract source location information and add to event
sdbusplus will add PID and std::source_location information, from the event origination point, to the event. Extract this and add i
lg2: commit: extract source location information and add to event
sdbusplus will add PID and std::source_location information, from the event origination point, to the event. Extract this and add it to the event.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6364ba0f74231fca2815c770bc3e56c2780d199e
show more ...
|
| f0af358f | 10-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: add methods for new sdbusplus events
Add implementations and test cases for the `lg2::commit` functions.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I25a87fd65738e4d
lg2: commit: add methods for new sdbusplus events
Add implementations and test cases for the `lg2::commit` functions.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I25a87fd65738e4debbe98f3473709f77d51777e9
show more ...
|
| e001cd79 | 07-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: add stubs to support new sdbusplus events
Create empty stubs for the commit functions from the new event log design[1].
[1]: https://github.com/openbmc/docs/blob/master/designs/event-l
lg2: commit: add stubs to support new sdbusplus events
Create empty stubs for the commit functions from the new event log design[1].
[1]: https://github.com/openbmc/docs/blob/master/designs/event-logging.md
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I8c0232858f41b875e78d5e41f17c065ca727429d
show more ...
|
| 4e1456e4 | 03-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
elog: ensure new sdbusplus events cannot be committed directly
sdbusplus events should not be committed in the old way, because they have their metadata directly in the class rather than using the s
elog: ensure new sdbusplus events cannot be committed directly
sdbusplus events should not be committed in the old way, because they have their metadata directly in the class rather than using the side-band metadata YAML (from phosphor-logging). Add compile-time asserts to ensure they cannot be used with the older interfaces.
Tested:
Create a simple test: ``` phosphor::logging::report< sdbusplus::event::xyz::openbmc_project::Logging::Cleared>(); ```
Which fails to compile as follows: ``` In file included from ../test/basic_event_commit.cpp:3: ../lib/include/phosphor-logging/elog.hpp: In instantiation of ‘uint32_t phosphor::logging::report(Args ...) [with T = sdbusplus::event::xyz::openbmc_project::Logging::Cleared; Args = {}; uint32_t = unsigned int]’: ../test/basic_event_commit.cpp:13:66: required from here ../lib/include/phosphor-logging/elog.hpp:205:15: error: static assertion failed: T must NOT be an sdbusplus::generated_event 205 | !std::is_base_of_v<sdbusplus::exception::generated_event<T>, T>, ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I9cfc6915d125545067082a4fff717443aedd1531
show more ...
|
| 7576224a | 03-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
meson: switch code dependency to libsystemd
For a while now systemd has packaged a separate `libsystemd`. For meson dependency, `systemd` should be used when looking for systemd service file paths
meson: switch code dependency to libsystemd
For a while now systemd has packaged a separate `libsystemd`. For meson dependency, `systemd` should be used when looking for systemd service file paths and `libsystemd` should be used for `sd_*` functions.
Update the dependency accordingly.
Change-Id: I2de6ab74c3384339a9f393d3149eabaccf1a5ba4 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
| 075c7923 | 16-Aug-2024 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda forma
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda formatting also changed, so we have made changes to the organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style. See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I21d2ca8065f24fd73509229c517f5caf48934b60 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
| da063a9c | 13-Jul-2024 |
Patrick Williams <patrick@stwcx.xyz> |
Remove lg2 template deduction guides
Deduction guides for the base 'log' class are unnecessary and unused, and deduction guides for the level-types already exist. Remove the unused ones.
Signed-of
Remove lg2 template deduction guides
Deduction guides for the base 'log' class are unnecessary and unused, and deduction guides for the level-types already exist. Remove the unused ones.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I795ea3a6d453e7a101d9b1d257e1334c894e340b
show more ...
|
| 5bc26533 | 10-Apr-2024 |
Arya K Padman <aryakpadman@gmail.com> |
PEL: Changing the remaining traces to lg2 style
Some of the logging traces of PEL files still uses old style of logging.
Changing the remaining traces in PEL files to lg2 style of logging.Some of t
PEL: Changing the remaining traces to lg2 style
Some of the logging traces of PEL files still uses old style of logging.
Changing the remaining traces in PEL files to lg2 style of logging.Some of the traces in phosphor logging code which use the old style is also considered.
Change-Id: I0daf9589af443881cb61730047c23db17fdec2c3 Signed-off-by: Arya K Padman <aryakpadman@gmail.com>
show more ...
|
| b6ed39fa | 26-Feb-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: allow enumeration formatting
A good amount of code is using something like `std::to_underlying` to convert enums to a value for output with lg2. Add support directly in the library.
Tested: M
lg2: allow enumeration formatting
A good amount of code is using something like `std::to_underlying` to convert enums to a value for output with lg2. Add support directly in the library.
Tested: Modified phosphor-health-monitor with one enum with a `to_string` conversion and one without: ``` <7> TYPE=CPU, NAME=CPU SUBTYPE=Enum(1) PATH=, FREQ=1, WSIZE=120 <7> TYPE=CPU, NAME=CPU_Kernel SUBTYPE=Enum(0) PATH=, FREQ=1, WSIZE=120 ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0644ff00fb7ff9b20daaf4ea5f9564b9b9e83237
show more ...
|
| c2c32a2a | 26-Feb-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: allow type output customizations
Allow lg2 output for custom types where the type has a `to_string` function defined per ADL lookup rules.
Tested: Modified phosphor-health-monitor to have a `t
lg2: allow type output customizations
Allow lg2 output for custom types where the type has a `to_string` function defined per ADL lookup rules.
Tested: Modified phosphor-health-monitor to have a `to_string` for local enumerations. ``` <7> TYPE=CPU, NAME=CPU SUBTYPE=CPU PATH=, FREQ=1, WSIZE=120 <7> TYPE=CPU, NAME=CPU_Kernel SUBTYPE=CPU_Kernel PATH=, FREQ=1, WSIZE=120 ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6850b0bb142f0ef5219a5fc07c2cb4e2c90d5779
show more ...
|
| 6ddbf69e | 05-Sep-2023 |
Willy Tu <wltu@google.com> |
Remove SDBUSPP_REMOVE_DEPRECATED_NAMESPACE
Fix the code to support new sdbusplus error without SDBUSPP_REMOVE_DEPRECATED_NAMESPACE.
Change-Id: I12713ec1757d3835e1acf07c7abf409ff97615e1 Signed-off-b
Remove SDBUSPP_REMOVE_DEPRECATED_NAMESPACE
Fix the code to support new sdbusplus error without SDBUSPP_REMOVE_DEPRECATED_NAMESPACE.
Change-Id: I12713ec1757d3835e1acf07c7abf409ff97615e1 Signed-off-by: Willy Tu <wltu@google.com>
show more ...
|