vsomeip icon indicating copy to clipboard operation
vsomeip copied to clipboard

Implement slog2 logging capability

Open kheaactua opened this issue 1 year ago • 0 comments

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

  • [x] Tested on Linux
  • [x] Tested on QNX
  • [x] Tested on AOSP-Vendor

kheaactua avatar May 28 '24 19:05 kheaactua