Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected filter behavior when referencing %Process% #18

Open
barsnick opened this issue Mar 22, 2024 · 0 comments
Open

Unexpected filter behavior when referencing %Process% #18

barsnick opened this issue Mar 22, 2024 · 0 comments
Assignees

Comments

@barsnick
Copy link

liblog uses boost's filter capabilities for e.g. allowing to configure log levels. It accesses fields such as Severity and Process, I suppose by use of "global attributes".

It is documented in everest-core's logging config file here:
https://github.com/EVerest/everest-core/blob/a5e4173d1726327cb22429bfbe0c65d3ed213b13/cmake/assets/logging.ini#L7-L12

# To get debug logs of only one module, add the "%Process% contains" filter, e.g.:
#
#     "(%Process% contains OCPP201 and %Severity% >= DEBG)"
#
# whereas "OCPP201" is the value of the field `active_modules.NAME.module` in the respective /config/config-*.yaml.
Filter="%Severity% >= INFO"

The documentation section

whereas "OCPP201" is the value of the field active_modules.NAME.module in the respective /config/config-*.yaml

is not correct, it does not work like this currently.

Somewhere along the way, both the actual OS process name and the process prefix of the logged line are changed. (I guess the OS process name is modified here in everest-framework, while the process name to log is modified in lib/logging.cpp in liblog.) Note also how the logged process name changes from active_modules.NAME to the truncated process name during the framework initialization. This logged process name is what is actually filtered on with %Process%, AFAICT.

So, one could say the documentation is incorrect, and change that to state active_modules.NAME, and fix the example. But this also doesn't work if that name is longer than 15 characters, due to liblog's truncation. (We have a serialcommhub_x7 instance name in our configs, and cannot filter on that.)

The ideal fix would be to separate the %Process% filter attribute from what is being logged. Or to introduce a new %ProcessFull% or %ProcessLong%, and handing it a concatenation of both the active_modules.NAME and active_modules.NAME.module, untruncated. (Perhaps concatenated with a :. Fun fact: boost apparently cannot have such a : in the Filter definition.) I hacked something like this locally which works great for the C++ modules, but doesn't pick up the node module's names.

@hikinggrass hikinggrass self-assigned this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants