Add logging

This commit is contained in:
kssenii 2024-04-03 20:32:48 +02:00
parent 9d9ee6ce06
commit 925148f928
2 changed files with 9 additions and 2 deletions

View File

@ -1379,7 +1379,6 @@ void FileCache::applySettingsIfPossible(const FileCacheSettings & new_settings,
}
}
if (new_settings.max_size != actual_settings.max_size
|| new_settings.max_elements != actual_settings.max_elements)
{

View File

@ -142,8 +142,10 @@ void FileCacheFactory::updateSettingsFromConfig(const Poco::Util::AbstractConfig
caches_by_name_copy = caches_by_name;
}
auto * log = &Poco::Logger::get("FileCacheFactory");
std::unordered_set<std::string> checked_paths;
for (const auto & [_, cache_info] : caches_by_name_copy)
for (const auto & [cache_name, cache_info] : caches_by_name_copy)
{
if (cache_info->config_path.empty() || checked_paths.contains(cache_info->config_path))
continue;
@ -155,7 +157,12 @@ void FileCacheFactory::updateSettingsFromConfig(const Poco::Util::AbstractConfig
FileCacheSettings old_settings = cache_info->getSettings();
if (old_settings == new_settings)
{
LOG_TRACE(log, "No settings changes for cache: {}", cache_name);
continue;
}
LOG_TRACE(log, "Will apply settings changes for cache: {}", cache_name);
try
{
@ -166,6 +173,7 @@ void FileCacheFactory::updateSettingsFromConfig(const Poco::Util::AbstractConfig
/// Settings changes could be partially applied in case of exception,
/// make sure cache_info->settings show correct state of applied settings.
cache_info->setSettings(old_settings);
tryLogCurrentException(__PRETTY_FUNCTION__);
throw;
}