Adjust global logger default level to align with config.logging_level
when no context is created.
#5551
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the default logging level of
global_logger
based on theTILEDB_VERBOSE
flag. This ensures that the global logger's default logging level aligns withconfig.logging_level
, even before aContext
is created. Previously, the level was unconditionally set toLogger::Level::ERR
, regardless of the flag.If a
Context
was created before the global logger, the logging level was correctly set:TileDB/tiledb/sm/storage_manager/context.cc
Line 228 in 7296b27
However, if
global_logger
was used before anyContext
was created, the logging level was incorrectly set. This behavior was noticed in context-free C APIs that useapi_entry_error
. When these APIs were called before aContext
was created, log messages appeared after callingLOG_ERROR(const std::string& msg)
, even if theTILEDB_VERBOSE
flag was not set.Closes CORE-269
Reproduction
One such C API is
tiledb_config_load_from_file
. When thefilename
argument is set toNULL
, it throws aCAPIStatusException
. Below is a script demonstrating this behavior: when the line that allocated the context is included, nothing appears on the user's screen using the defaultconfig.logging_level
value. However, if that line is commented out, a log message appears like the following:[2025-06-20 20:04:08.442] [Process: 85057] [error] [1750439048442019000-Global] C API: Cannot load from file; null filename
TYPE: IMPROVEMENT
DESC: Adjust global logger default level to align with
config.logging_level
when no context is created.