Skip to content

Commit

Permalink
log-level-config: add option to configure log levels
Browse files Browse the repository at this point in the history
The default log level can now be overwritten with
a different level stored in a configuration file.
Levels can be set for all ctid's of an apid
or only selected ctids

Signed-off-by: Alexander Mohr <[email protected]>
  • Loading branch information
alexmohr committed May 17, 2023
1 parent 0c1c75e commit 5bc73b7
Show file tree
Hide file tree
Showing 9 changed files with 556 additions and 36 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ option(WITH_TESTSCRIPTS "Set to ON to run CMakeLists.txt in testscripts"
option(WITH_GPROF "Set -pg to compile flags" OFF)
option(WITH_DLTTEST "Set to ON to build with modifications to test User-Daemon communication with corrupt messages" OFF)
option(WITH_DLT_SHM_ENABLE "EXPERIMENTAL! Set to ON to use shared memory as IPC. EXPERIMENTAL!" OFF)
option(WITH_DLT_ADAPTOR "Set to ON to build src/adaptor binaries" OFF)
option(WITH_DLT_ADAPTOR "Set to ON to build src/adaptor binaries" OFF)
option(WITH_DLT_ADAPTOR_STDIN "Set to ON to build src/adaptor/stdin binaries" OFF)
option(WITH_DLT_ADAPTOR_UDP "Set to ON to build src/adaptor/udp binaries" OFF)
option(WITH_DLT_CONSOLE "Set to ON to build src/console binaries" ON)
Expand All @@ -76,6 +76,7 @@ option(WITH_DLT_UNIT_TESTS "Set to ON to build gtest framework and tests/bina
option(WITH_DLT_QNX_SYSTEM "Set to ON to build QNX system binary dlt-qnx-system" OFF)
option(WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK "Set to ON to enable fallback to syslog if dlt logging to file fails" OFF)
option(WITH_DLT_NETWORK_TRACE "Set to ON to enable network trace (if message queue is supported)" ON)
option(WITH_DLT_LOG_LEVEL_APP_CONFIG "Set to ON to enable default log levels based on application ids" OFF)

set(DLT_IPC "FIFO" CACHE STRING "UNIX_SOCKET,FIFO")
set(DLT_USER "genivi" CACHE STRING "Set user for process not run as root")
Expand Down Expand Up @@ -295,6 +296,10 @@ else()
set(DLT_JSON_LIBRARY "")
endif()

if (WITH_DLT_LOG_LEVEL_APP_CONFIG)
add_definitions(-DDLT_LOG_LEVEL_APP_CONFIG)
endif()

add_subdirectory(doc)
add_subdirectory(src)
add_subdirectory(include)
Expand Down Expand Up @@ -365,6 +370,7 @@ message(STATUS "WITH_LEGACY_INCLUDE_PATH = ${WITH_LEGACY_INCLUDE_PATH}")
message(STATUS "WITH_EXTENDED_FILTERING = ${WITH_EXTENDED_FILTERING}")
message(STATUS "WITH_DLT_DISABLE_MACRO = ${WITH_DLT_DISABLE_MACRO}")
message(STATUS "WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK = ${WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK}" )
message(STATUS "WITH_DLT_LOG_LEVEL_APP_CONFIG = ${WITH_DLT_LOG_LEVEL_APP_CONFIG}" )
message(STATUS "Change a value with: cmake -D<Variable>=<Value>")
message(STATUS "-------------------------------------------------------------------------------")
message(STATUS)
8 changes: 7 additions & 1 deletion doc/dlt-daemon.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# SYNOPSIS

**dlt-daemon** \[**-h**\] \[**-d**\] \[**-c** filename\] \[**-t** directory\] \[**-p** port\]
**dlt-daemon** \[**-h**\] \[**-d**\] \[**-c** filename\] \[**-t** directory\] \[**-p** port\] \[**-a** filename\]

# DESCRIPTION

Expand Down Expand Up @@ -41,6 +41,12 @@ GENIVI system or more likely on a external tester device.
port need to be started with the environment variable
DLT_DAEMON_TCP_PORT set appropriately.

-a

: Load an alternative configuration for app id log level defaults.
By default, the configuration file /etc/dlt-log-levels.conf is loaded.


# EXAMPLES

Start DLT daemon in background mode:
Expand Down
5 changes: 5 additions & 0 deletions src/daemon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,8 @@ INSTALL(FILES dlt.conf
DESTINATION ${CONFIGURATION_FILES_DIR}
COMPONENT base)

if (WITH_DLT_LOG_LEVEL_APP_CONFIG)
INSTALL(FILES dlt-log-levels.conf
DESTINATION ${CONFIGURATION_FILES_DIR}
COMPONENT base)
endif()
Loading

0 comments on commit 5bc73b7

Please sign in to comment.