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

Implement slog2 logging capability #713

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kheaactua
Copy link
Contributor

@kheaactua kheaactua commented May 28, 2024

Overview

Implement logging to slog2 when run on QNX.

Description

Implemented an slog2 logging capability into the logger which is enabled by default on QNX systems. The implementation in general is guarded with build defines, i.e. #ifdef __QNX__.

The configuration object was modified such that the slog2 logging can be controlled with /etc/vsomeip/logging.json, i.e.:

"logging": {
  "slog2": true
}

This code allocates 4 pages (16kB) by default, but the caller can provide an environment variable VSOMEIP_SLOG2_NUM_PAGES to control the allocation

The logger must be initialized prior to calling config through the implementation. Because non-CommonAPI apps (e.g. routingmanagerd) can use the VSOMEIP logging macros which would trigger a logging seg fault, the message object will now output the message in the erroneous case rather than raising a seg fault.

Other changes

  • Small CMake modernizations around the OS detection and how flags are applied.
    • The version-script is applied as a private linker option to libvsomeip, this removes the need to remove it from the CXX_FLAGS in the test's CMake setup.
  • Added a call to runtime->setProperty("LogApplication"); in the routingmanagerd example such that it had a log tag to filter on in logcat (Android only)
  • Simplified the logging code by moving the functions that translate log levels to logger specific levels into sub-functions (did not do this for DLT as I am not properly setup to test this right now.)

Testing

  • Tested on Linux
  • Tested on QNX
  • Tested on AOSP-Vendor

@kheaactua kheaactua force-pushed the logging_updates branch 7 times, most recently from 9f2b8c5 to 944902b Compare May 30, 2024 15:51
slog2 is enabled by default, but guarded with #ifdef __QNX__. It can be
controlled with /etc/vsomeip/logging.json, i.e.:

```json
"logging": {
  "slog2": true
}
```

This code allocates 4 pages (16kB) by default, but the caller can provide
an environment variable VSOMEIP_SLOG2_NUM_PAGES to control the allocation

Minimal CMake changes were made to link against the slog2 library on QNX

This commit also modifies the routingmanager example to set the
LogApplication property which is used as the log tag for AOSP logcat
logging.
@kheaactua kheaactua marked this pull request as ready for review May 30, 2024 20:18
@@ -14,9 +14,6 @@ find_package(benchmark)
##############################################################################
# google test

# remove export symbols from the cxx flags
string(REPLACE "${EXPORTSYMBOLS}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

# check for set environment variable
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I found a problem with this in another PR, I also have a solution there though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebased this to 3.5.1 locally, will push it soon.

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

Successfully merging this pull request may close these issues.

1 participant