diff options
author | VladSemenyuk <VSemenyuk@luxoft.com> | 2020-09-01 20:35:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 13:35:06 -0400 |
commit | 062d3b0f2a6eb2185d14dc80a885cdfe4860ce23 (patch) | |
tree | 766c4725b8b129cec2d420ff65ae7e9731e91194 /src/components/policy | |
parent | 79fb6408810d776278bf3499c5273eb04159b076 (diff) | |
download | sdl_core-062d3b0f2a6eb2185d14dc80a885cdfe4860ce23.tar.gz |
[SDL 0046] Implement logger abstraction (#3472)
* Implement logger abstraction. Integrate it to SDL.
Create one logger instance for shared libraries
* Rename all logger macros.
* Update src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
Co-authored-by: Shobhit Adlakha <ShobhitAd@users.noreply.github.com>
* Fix review comments(errors in log messages)
* Fix review coments
* Fix code style
* Add logger variable creation to new commads
* Fix review comment
* Fixe review comment(class imblemtation moved to .cc file)
Co-authored-by: Shobhit Adlakha <ShobhitAd@users.noreply.github.com>
Diffstat (limited to 'src/components/policy')
17 files changed, 1576 insertions, 1814 deletions
diff --git a/src/components/policy/policy_external/src/access_remote_impl.cc b/src/components/policy/policy_external/src/access_remote_impl.cc index 26c8c5e38e..037f4551f1 100644 --- a/src/components/policy/policy_external/src/access_remote_impl.cc +++ b/src/components/policy/policy_external/src/access_remote_impl.cc @@ -36,7 +36,7 @@ #include "policy/cache_manager.h" #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl") +SDL_CREATE_LOG_VARIABLE("PolicyManagerImpl") using policy_table::DeviceData; using policy_table::FunctionalGroupings; @@ -48,11 +48,10 @@ struct ToHMIType { policy_table::AppHMITypes::value_type operator()(int item) const { policy_table::AppHMIType type = static_cast<policy_table::AppHMIType>(item); if (!IsValidEnum(type)) { - LOG4CXX_WARN(logger_, "HMI type isn't known " << item); + SDL_LOG_WARN("HMI type isn't known " << item); type = policy_table::AHT_DEFAULT; } - LOG4CXX_DEBUG(logger_, - "HMI type: " << item << " - " << EnumToJsonString(type)); + SDL_LOG_DEBUG("HMI type: " << item << " - " << EnumToJsonString(type)); return policy_table::AppHMITypes::value_type(type); } }; @@ -94,7 +93,7 @@ AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache) bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, policy_table::ModuleType module) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!cache_->IsApplicationRepresented(app_id)) { return false; } @@ -117,10 +116,10 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules, const std::string& module_name, const std::string& rpc_name, RemoteControlParams* input) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::AccessModules::const_iterator i = modules.find(module_name); if (i == modules.end()) { - LOG4CXX_DEBUG(logger_, "Module " << module_name << " wasn't found"); + SDL_LOG_DEBUG("Module " << module_name << " wasn't found"); return false; } @@ -133,19 +132,19 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules, const policy_table::Strings& parameters = j->second; return CompareParameters(parameters, input); } - LOG4CXX_DEBUG(logger_, "RPC " << rpc_name << " wasn't found"); + SDL_LOG_DEBUG("RPC " << rpc_name << " wasn't found"); return false; } bool AccessRemoteImpl::CompareParameters( const policy_table::Strings& parameters, RemoteControlParams* input) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (parameters.empty()) { return true; } if (input->empty()) { - LOG4CXX_DEBUG(logger_, "Input is empty"); + SDL_LOG_DEBUG("Input is empty"); return false; } @@ -157,7 +156,7 @@ bool AccessRemoteImpl::CompareParameters( void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, const std::vector<int>& hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); HMIList::mapped_type types; std::transform(hmi_types.begin(), hmi_types.end(), @@ -168,7 +167,7 @@ void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( const ApplicationOnDevice& who) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cache_->IsDefaultPolicy(who.app_id)) { return hmi_types_[who]; } else { @@ -179,7 +178,7 @@ const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( const policy_table::Strings& AccessRemoteImpl::GetGroups( const ApplicationOnDevice& who) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetGroups(who.app_id); } @@ -193,7 +192,7 @@ bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) { bool AccessRemoteImpl::GetPermissionsForApp(const std::string& device_id, const std::string& app_id, FunctionalIdType& group_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GetGroupsIds(device_id, app_id, group_types[kTypeGeneral]); GetGroupsIds(device_id, kDefaultId, group_types[kTypeDefault]); GetGroupsIds( @@ -229,13 +228,13 @@ void AccessRemoteImpl::GetGroupsIds(const std::string& device_id, FunctionalGroupIDs& groups_ids) { ApplicationOnDevice who = {device_id, app_id}; const policy_table::Strings& groups = GetGroups(who); - LOG4CXX_DEBUG(logger_, "Groups Names: " << groups); + SDL_LOG_DEBUG("Groups Names: " << groups); groups_ids.resize(groups.size()); std::transform(groups.begin(), groups.end(), groups_ids.begin(), &CacheManager::GenerateHash); - LOG4CXX_DEBUG(logger_, "Groups Ids: " << groups_ids); + SDL_LOG_DEBUG("Groups Ids: " << groups_ids); } bool AccessRemoteImpl::GetModuleTypes(const std::string& application_id, diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 164aa6bdf7..67d8bdb2d1 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -226,22 +226,22 @@ struct DefaultPolicyUpdater { namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") -#define CACHE_MANAGER_CHECK(return_value) \ - { \ - if (!pt_) { \ - LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \ - return return_value; \ - } \ +#define CACHE_MANAGER_CHECK(return_value) \ + { \ + if (!pt_) { \ + SDL_LOG_WARN("The cache manager is not initialized"); \ + return return_value; \ + } \ } -#define CACHE_MANAGER_CHECK_VOID() \ - { \ - if (!pt_) { \ - LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \ - return; \ - } \ +#define CACHE_MANAGER_CHECK_VOID() \ + { \ + if (!pt_) { \ + SDL_LOG_WARN("The cache manager is not initialized"); \ + return; \ + } \ } struct LanguageFinder { @@ -282,7 +282,7 @@ CacheManager::CacheManager(bool in_memory) } CacheManager::~CacheManager() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(backuper_locker_); backup_thread_->Stop(threads::Thread::kThreadSoftStop); delete backup_thread_->GetDelegate(); @@ -291,7 +291,7 @@ CacheManager::~CacheManager() { ConsentPriorityType CacheManager::GetConsentsPriority( const std::string& device_id, const std::string& application_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ConsentPriorityType prio_type = ConsentPriorityType::kExternalConsentPrio; CACHE_MANAGER_CHECK(prio_type); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -299,7 +299,7 @@ ConsentPriorityType CacheManager::GetConsentsPriority( pt_->policy_table.device_data->find(device_id); if (pt_->policy_table.device_data->end() == dev_params_iter) { - LOG4CXX_DEBUG(logger_, "Device id " << device_id << " not found."); + SDL_LOG_DEBUG("Device id " << device_id << " not found."); return prio_type; } @@ -309,8 +309,7 @@ ConsentPriorityType CacheManager::GetConsentsPriority( dev_par.user_consent_records->find(application_id); if (dev_par.user_consent_records->end() == app_consent_record) { - LOG4CXX_DEBUG(logger_, - "Application id " << application_id << " not found."); + SDL_LOG_DEBUG("Application id " << application_id << " not found."); return prio_type; } @@ -327,7 +326,7 @@ const policy_table::Strings& CacheManager::GetGroups(const PTString& app_id) { } const policy_table::Strings CacheManager::GetPolicyAppIDs() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto apps = pt_->policy_table.app_policies_section.apps; @@ -448,13 +447,12 @@ bool CacheManager::GetUserPermissionsForDevice( const std::string& device_id, StringArray& consented_groups, StringArray& disallowed_groups) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::DeviceData& device_data = *pt_->policy_table.device_data; if (device_data.end() == device_data.find(device_id)) { - LOG4CXX_ERROR(logger_, - "Device with " << device_id << "was not found in PT"); + SDL_LOG_ERROR("Device with " << device_id << "was not found in PT"); return false; } const policy_table::DeviceParams& params = device_data[device_id]; @@ -481,7 +479,7 @@ bool CacheManager::GetUserPermissionsForDevice( void CacheManager::GetAllAppGroups(const std::string& app_id, FunctionalGroupIDs& all_group_ids) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -520,7 +518,7 @@ void CacheManager::GetAllAppGroups(const std::string& app_id, void CacheManager::GetPreConsentedGroups( const std::string& app_id, FunctionalGroupIDs& preconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); if (kDeviceId == app_id) { @@ -560,7 +558,7 @@ void CacheManager::GetConsentedGroups(const std::string& device_id, const std::string& app_id, FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::DeviceData::iterator dev_params_iter = @@ -596,12 +594,11 @@ void CacheManager::GetUnconsentedGroups( const std::string& device_id, const std::string& policy_app_id, FunctionalGroupIDs& unconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); if (!IsApplicationRepresented(policy_app_id)) { - LOG4CXX_WARN(logger_, - "The application with app_id: " << policy_app_id + SDL_LOG_WARN("The application with app_id: " << policy_app_id << " is not represented"); return; } @@ -680,21 +677,18 @@ void CacheManager::ProcessUpdate( if (app_id == kDefaultId || app_id == kPreDataConsentId) { if (new_request_types.is_omitted()) { - LOG4CXX_INFO(logger_, - "Application " << app_id + SDL_LOG_INFO("Application " << app_id << " has omitted RequestTypes." " Previous values will be kept."); update_request_types = false; } else if (new_request_types.empty()) { if (new_request_types.is_cleaned_up()) { - LOG4CXX_INFO(logger_, - "Application " << app_id + SDL_LOG_INFO("Application " << app_id << " has cleaned up all values." " Previous values will be kept."); update_request_types = false; } else { - LOG4CXX_INFO(logger_, - "Application " << app_id + SDL_LOG_INFO("Application " << app_id << " has empty RequestTypes." " Any parameter will be allowed."); } @@ -721,7 +715,7 @@ void CacheManager::ProcessUpdate( } bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); pt_->policy_table.functional_groupings = @@ -812,7 +806,7 @@ policy_table::VehicleDataItems CacheManager::CollectCustomVDItems( void CacheManager::GetHMIAppTypeAfterUpdate( std::map<std::string, StringArray>& app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator policy_iter_begin = @@ -876,7 +870,7 @@ std::string CacheManager::currentDateTime() { bool CacheManager::GetPermissionsForApp(const std::string& device_id, const std::string& app_id, FunctionalIdType& group_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GetAllAppGroups(app_id, group_types[kTypeGeneral]); GetAllAppGroups(kDefaultId, group_types[kTypeDefault]); GetAllAppGroups(kPreDataConsentId, group_types[kTypePreDataConsented]); @@ -896,7 +890,7 @@ bool CacheManager::GetPermissionsForApp(const std::string& device_id, bool CacheManager::GetDeviceGroupsFromPolicies( policy_table::Strings& groups, policy_table::Strings& preconsented_groups) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); groups = pt_->policy_table.app_policies_section.device.groups; @@ -906,7 +900,7 @@ bool CacheManager::GetDeviceGroupsFromPolicies( } bool CacheManager::IsDeviceConsentCached(const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock lock(cached_device_permissions_lock_); CachedDevicePermissions::const_iterator cached_dev_consent_iter; @@ -916,7 +910,7 @@ bool CacheManager::IsDeviceConsentCached(const std::string& device_id) const { DeviceConsent CacheManager::GetCachedDeviceConsent( const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(cached_device_permissions_lock_); DeviceConsent result = kDeviceHasNoConsent; CACHE_MANAGER_CHECK(result); @@ -930,7 +924,7 @@ DeviceConsent CacheManager::GetCachedDeviceConsent( void CacheManager::SaveDeviceConsentToCache(const std::string& device_id, const bool is_allowed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock lock(cached_device_permissions_lock_); DeviceConsent result = is_allowed ? kDeviceAllowed : kDeviceDisallowed; @@ -943,7 +937,7 @@ bool CacheManager::GetPermissionsList(StringArray& perm_list) const { policy_table::Strings groups; policy_table::Strings preconsented_groups; if (!GetDeviceGroupsFromPolicies(groups, preconsented_groups)) { - LOG4CXX_WARN(logger_, "Can't get device groups from policies."); + SDL_LOG_WARN("Can't get device groups from policies."); return false; } @@ -955,8 +949,8 @@ bool CacheManager::GetPermissionsList(StringArray& perm_list) const { bool CacheManager::HasDeviceSpecifiedConsent(const std::string& device_id, const bool is_allowed) const { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device :" << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device :" << device_id); const DeviceConsent current_consent = GetDeviceConsent(device_id); const bool is_current_device_allowed = DeviceConsent::kDeviceAllowed == current_consent ? true : false; @@ -966,15 +960,14 @@ bool CacheManager::HasDeviceSpecifiedConsent(const std::string& device_id, return false; } const std::string consent = is_allowed ? "allowed" : "disallowed"; - LOG4CXX_INFO( - logger_, - "DeviceGetDeviceGroupsFromPolicies is already " << consent << "."); + SDL_LOG_INFO("DeviceGetDeviceGroupsFromPolicies is already " << consent + << "."); return true; } void CacheManager::SetDeviceConsent(const std::string& device_id, const bool is_allowed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); if (HasDeviceSpecifiedConsent(device_id, is_allowed)) { return; @@ -987,7 +980,7 @@ void CacheManager::SetDeviceConsent(const std::string& device_id, StringArray list_of_permissions; if (!GetPermissionsList(list_of_permissions) || list_of_permissions.empty()) { - LOG4CXX_WARN(logger_, "List of permissions can't be received or empty"); + SDL_LOG_WARN("List of permissions can't be received or empty"); return; } @@ -1003,7 +996,7 @@ void CacheManager::SetDeviceConsent(const std::string& device_id, if (!SetUserPermissionsForDevice( device_id, consented_groups, disallowed_groups)) { - LOG4CXX_WARN(logger_, "Can't set user consent for device"); + SDL_LOG_WARN("Can't set user consent for device"); return; } SaveDeviceConsentToCache(device_id, is_allowed); @@ -1011,7 +1004,7 @@ void CacheManager::SetDeviceConsent(const std::string& device_id, DeviceConsent CacheManager::GetDeviceConsent( const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(kDeviceHasNoConsent); if (IsDeviceConsentCached(device_id)) { return GetCachedDeviceConsent(device_id); @@ -1054,7 +1047,7 @@ DeviceConsent CacheManager::GetDeviceConsent( bool CacheManager::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); @@ -1078,14 +1071,14 @@ bool CacheManager::SetDeviceData(const std::string& device_id, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); if (pt_->policy_table.device_data->end() == pt_->policy_table.device_data->find(device_id)) { - LOG4CXX_ERROR(logger_, "Unable to find mobile device: " << device_id); + SDL_LOG_ERROR("Unable to find mobile device: " << device_id); return false; } @@ -1107,7 +1100,7 @@ bool CacheManager::SetUserPermissionsForDevice( const std::string& device_id, const StringArray& consented_groups, const StringArray& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); policy_table::DeviceParams& params = @@ -1140,7 +1133,7 @@ bool CacheManager::SetUserPermissionsForDevice( bool CacheManager::ReactOnUserDevConsentForApp(const std::string& app_id, bool is_device_allowed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); bool result = true; if (is_device_allowed) { @@ -1174,7 +1167,7 @@ void CacheManager::GetGroupNameByHashID(const int32_t group_id, bool CacheManager::SetUserPermissionsForApp( const PermissionConsent& permissions, bool* out_app_permissions_changed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); std::vector<FunctionalGroupPermission>::const_iterator iter = @@ -1204,7 +1197,7 @@ bool CacheManager::SetUserPermissionsForApp( const date_time::TimeDuration tm = date_time::getCurrentTime(); int64_t current_time_msec = date_time::getmSecs(tm); ucr.consent_last_updated = current_time_msec; - LOG4CXX_DEBUG(logger_, "Updating consents time " << current_time_msec); + SDL_LOG_DEBUG("Updating consents time " << current_time_msec); } (*ucr.consent_groups)[group_name] = is_allowed; @@ -1240,13 +1233,13 @@ void CacheManager::CheckPermissions(const PTString& app_id, const PTString& hmi_level, const PTString& rpc, CheckPermissionResult& result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); if (!IsApplicationRepresented(app_id)) { - LOG4CXX_ERROR( - logger_, "Application id " << app_id << " was not found in policy DB."); + SDL_LOG_ERROR("Application id " << app_id + << " was not found in policy DB."); return; } @@ -1301,16 +1294,15 @@ int CacheManager::IgnitionCyclesBeforeExchange() { static_cast<int>( pt_->policy_table.module_config.exchange_after_x_ignition_cycles), 0); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "IgnitionCyclesBeforeExchange limit:" << static_cast<int>(limit)); uint8_t current = 0; const int last_exch = static_cast<int>( *pt_->policy_table.module_meta->ignition_cycles_since_last_exchange); current = std::max(last_exch, 0); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "IgnitionCyclesBeforeExchange current:" << static_cast<int>(current)); return std::max(limit - current, 0); @@ -1323,16 +1315,16 @@ int CacheManager::KilometersBeforeExchange(int current) { std::max(static_cast<int>( pt_->policy_table.module_config.exchange_after_x_kilometers), 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange limit:" << limit); + SDL_LOG_DEBUG("KilometersBeforeExchange limit:" << limit); int last = 0; const int odo_val = static_cast<int>( *pt_->policy_table.module_meta->pt_exchanged_at_odometer_x); last = std::max(odo_val, 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange last:" << last); + SDL_LOG_DEBUG("KilometersBeforeExchange last:" << last); const int actual = std::max((current - last), 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange actual:" << actual); + SDL_LOG_DEBUG("KilometersBeforeExchange actual:" << actual); return std::max(limit - actual, 0); } @@ -1343,18 +1335,16 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate( switch (counter) { case KILOMETERS: *pt_->policy_table.module_meta->pt_exchanged_at_odometer_x = value; - LOG4CXX_DEBUG(logger_, - "SetCountersPassedForSuccessfulUpdate km:" << value); + SDL_LOG_DEBUG("SetCountersPassedForSuccessfulUpdate km:" << value); break; case DAYS_AFTER_EPOCH: *pt_->policy_table.module_meta->pt_exchanged_x_days_after_epoch = value; - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "SetCountersPassedForSuccessfulUpdate days after epoch:" << value); break; default: - LOG4CXX_ERROR(logger_, - "Unknown counter was requested to set: " << counter); + SDL_LOG_ERROR("Unknown counter was requested to set: " << counter); return false; } @@ -1363,7 +1353,7 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate( } int CacheManager::DaysBeforeExchange(uint16_t current) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(0); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -1375,14 +1365,13 @@ int CacheManager::DaysBeforeExchange(uint16_t current) { } const uint8_t limit = pt_->policy_table.module_config.exchange_after_x_days; - LOG4CXX_DEBUG(logger_, - "Exchange after: " << static_cast<int>(limit) << " days"); + SDL_LOG_DEBUG("Exchange after: " << static_cast<int>(limit) << " days"); - LOG4CXX_DEBUG(logger_, "Epoch since last update: " << *days_after_epoch); + SDL_LOG_DEBUG("Epoch since last update: " << *days_after_epoch); const uint16_t actual = std::max(static_cast<uint16_t>(current - *days_after_epoch), uint16_t(0)); - LOG4CXX_DEBUG(logger_, "The days since last update: " << actual); + SDL_LOG_DEBUG("The days since last update: " << actual); return std::max(limit - actual, 0); } @@ -1394,7 +1383,7 @@ void CacheManager::IncrementIgnitionCycles() { *pt_->policy_table.module_meta->ignition_cycles_since_last_exchange); (*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange) = ign_val + 1; - LOG4CXX_DEBUG(logger_, "IncrementIgnitionCycles ignitions:" << ign_val); + SDL_LOG_DEBUG("IncrementIgnitionCycles ignitions:" << ign_val); Backup(); } @@ -1616,7 +1605,7 @@ void CacheManager::SetHybridAppPreference( void CacheManager::GetAppServiceParameters( const std::string& policy_app_id, policy_table::AppServiceParameters* app_service_parameters) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -1659,7 +1648,7 @@ const boost::optional<bool> CacheManager::LockScreenDismissalEnabledState() const boost::optional<std::string> CacheManager::LockScreenDismissalWarningMessage( const std::string& language) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); boost::optional<std::string> empty; CACHE_MANAGER_CHECK(empty); @@ -1682,7 +1671,7 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( const std::vector<std::string>& msg_codes, const std::string& language, const std::string& active_hmi_language) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<UserFriendlyMessage> result; CACHE_MANAGER_CHECK(result); @@ -1699,23 +1688,20 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( FindLanguage(msg_languages, language); if (!message_string.is_valid()) { - LOG4CXX_WARN(logger_, - "Language " - << language - << " haven't been found for message code: " << *it); + SDL_LOG_WARN("Language " + << language + << " haven't been found for message code: " << *it); policy_table::MessageString active_hmi_language_message_string = FindLanguage(msg_languages, active_hmi_language); if (!active_hmi_language_message_string.is_valid()) { - LOG4CXX_WARN(logger_, - "Active hmi language " - << active_hmi_language - << " haven't been found for message code: " << *it); + SDL_LOG_WARN("Active hmi language " + << active_hmi_language + << " haven't been found for message code: " << *it); policy_table::MessageString fallback_message_string = FindLanguage(msg_languages, "en-us"); if (!fallback_message_string.is_valid()) { - LOG4CXX_ERROR(logger_, - "No fallback language found for message code: " << *it); + SDL_LOG_ERROR("No fallback language found for message code: " << *it); continue; } message_string = fallback_message_string; @@ -1755,10 +1741,10 @@ void CacheManager::GetUpdateUrls(const uint32_t service_type, void CacheManager::GetUpdateUrls(const std::string& service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); - LOG4CXX_DEBUG(logger_, "Search service value is: " << service_type); + SDL_LOG_DEBUG("Search service value is: " << service_type); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ServiceEndpoints::const_iterator iter = @@ -1842,7 +1828,7 @@ bool CacheManager::GetPriority(const std::string& policy_app_id, void CacheManager::CheckSnapshotInitialization() { CACHE_MANAGER_CHECK_VOID(); if (!snapshot_) { - LOG4CXX_ERROR(logger_, "Snapshot pointer is not initialized"); + SDL_LOG_ERROR("Snapshot pointer is not initialized"); return; } @@ -1960,15 +1946,14 @@ void CacheManager::CheckSnapshotInitialization() { policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff( const policy_table::VehicleDataItems& items_before, const policy_table::VehicleDataItems& items_after) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (items_before.empty()) { - LOG4CXX_DEBUG(logger_, "No custom VD items found in policy"); + SDL_LOG_DEBUG("No custom VD items found in policy"); return policy_table::VehicleDataItems(); } if (items_after.empty()) { - LOG4CXX_DEBUG(logger_, - "All custom VD items were removed after policy update"); + SDL_LOG_DEBUG("All custom VD items were removed after policy update"); return items_before; } @@ -1986,19 +1971,18 @@ policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff( } } - LOG4CXX_DEBUG(logger_, - "Found " << removed_items.size() << " removed VD items"); + SDL_LOG_DEBUG("Found " << removed_items.size() << " removed VD items"); return removed_items; } void CacheManager::SetRemovedCustomVdItems( const policy_table::VehicleDataItems& removed_items) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); removed_custom_vd_items_ = removed_items; } void CacheManager::PersistData() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (backup_.use_count() != 0) { if (pt_.use_count() != 0) { // Comma expression is used to hold the lock only during the constructor @@ -2058,7 +2042,7 @@ void CacheManager::PersistData() { #ifdef ENABLE_LOG policy_table::DeviceData& device_data = *copy_pt.policy_table.device_data; - LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size()); + SDL_LOG_DEBUG("Device_data size is: " << device_data.size()); #endif // ENABLE_LOG for (; it_device != it_end_device; ++it_device) { if (is_unpaired_.end() != is_unpaired_.find(it_device->first)) { @@ -2067,7 +2051,7 @@ void CacheManager::PersistData() { ex_backup_->SetUnpairedDevice(it_device->first, false); } } - LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size()); + SDL_LOG_DEBUG("Device_data size is: " << device_data.size()); } backup_->WriteDb(); } @@ -2075,14 +2059,14 @@ void CacheManager::PersistData() { } void CacheManager::ResetCalculatedPermissions() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_.clear(); } void CacheManager::ResetCalculatedPermissionsForDevice( const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_.erase(device_id); } @@ -2090,9 +2074,8 @@ void CacheManager::ResetCalculatedPermissionsForDevice( void CacheManager::AddCalculatedPermissions(const std::string& device_id, const std::string& policy_app_id, const Permissions& permissions) { - LOG4CXX_DEBUG(logger_, - "AddCalculatedPermissions for device: " - << device_id << " and app: " << policy_app_id); + SDL_LOG_DEBUG("AddCalculatedPermissions for device: " + << device_id << " and app: " << policy_app_id); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_[device_id][policy_app_id] = permissions; } @@ -2100,9 +2083,8 @@ void CacheManager::AddCalculatedPermissions(const std::string& device_id, bool CacheManager::IsPermissionsCalculated(const std::string& device_id, const std::string& policy_app_id, Permissions& permission) { - LOG4CXX_DEBUG(logger_, - "IsPermissionsCalculated for device: " - << device_id << " and app: " << policy_app_id); + SDL_LOG_DEBUG("IsPermissionsCalculated for device: " + << device_id << " and app: " << policy_app_id); sync_primitives::AutoLock lock(calculated_permissions_lock_); CalculatedPermissions::const_iterator it = calculated_permissions_.find(device_id); @@ -2145,7 +2127,7 @@ std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { bool CacheManager::GetInitialAppData(const std::string& app_id, StringArray& nicknames, StringArray& app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -2168,7 +2150,7 @@ bool CacheManager::GetInitialAppData(const std::string& app_id, bool CacheManager::GetFunctionalGroupings( policy_table::FunctionalGroupings& groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); const policy_table::FunctionalGroupings& f_groupings = @@ -2180,9 +2162,9 @@ bool CacheManager::GetFunctionalGroupings( int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); - LOG4CXX_DEBUG(logger_, "Application id: " << policy_app_id); + SDL_LOG_DEBUG("Application id: " << policy_app_id); int result = 0; if (kDeviceId != policy_app_id && !IsApplicationRepresented(policy_app_id)) { return 0; @@ -2280,7 +2262,7 @@ int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id, } void CacheManager::SetPreloadedPtFlag(const bool is_preloaded) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); *pt_->policy_table.module_config.preloaded_pt = is_preloaded; Backup(); } @@ -2304,7 +2286,7 @@ bool CacheManager::SetMetaInfo(const std::string& ccpu_version, } std::string CacheManager::GetCCPUVersionFromPT() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc::Optional<policy_table::ModuleMeta>& module_meta = pt_->policy_table.module_meta; return *(module_meta->ccpu_version); @@ -2329,7 +2311,7 @@ bool CacheManager::SetSystemLanguage(const std::string& language) { } bool CacheManager::GetFunctionalGroupNames(FunctionalGroupNames& names) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); rpc::policy_table_interface_base::FunctionalGroupings::iterator iter = @@ -2354,28 +2336,27 @@ bool CacheManager::CleanupUnpairedDevices() { sync_primitives::AutoLock lock_unpaired(unpaired_lock_); UnpairedDevices::iterator iter = is_unpaired_.begin(); UnpairedDevices::const_iterator iter_end = is_unpaired_.end(); - LOG4CXX_DEBUG(logger_, "Is_unpaired size is: " << is_unpaired_.size()); + SDL_LOG_DEBUG("Is_unpaired size is: " << is_unpaired_.size()); for (; iter != iter_end; ++iter) { // Delete device if (!pt_->policy_table.device_data.is_initialized()) { - LOG4CXX_ERROR(logger_, "Device_data section is not initialized."); + SDL_LOG_ERROR("Device_data section is not initialized."); return false; } policy_table::DeviceData& device_data = *pt_->policy_table.device_data; policy_table::DeviceData::iterator it_device = device_data.find(*iter); if (device_data.end() == it_device) { - LOG4CXX_INFO(logger_, - "No device id " - << *iter << " had been found in device_data section."); + SDL_LOG_INFO("No device id " + << *iter << " had been found in device_data section."); return false; } - LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size()); + SDL_LOG_DEBUG("Device_data size is: " << device_data.size()); device_data.erase(it_device); - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "Device id " << *iter << " had been deleted from device_data section."); - LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size()); + SDL_LOG_DEBUG("Device_data size is: " << device_data.size()); } is_unpaired_.clear(); Backup(); @@ -2396,7 +2377,7 @@ void CacheManager::Increment(usage_statistics::GlobalCounterId type) { ++(*pt_->policy_table.usage_and_error_counts->count_of_sync_reboots); break; default: - LOG4CXX_WARN(logger_, "Type global counter is unknown"); + SDL_LOG_WARN("Type global counter is unknown"); return; } Backup(); @@ -2444,7 +2425,7 @@ void CacheManager::Increment(const std::string& app_id, .count_of_tls_errors; break; default: - LOG4CXX_WARN(logger_, "Type app counter is unknown"); + SDL_LOG_WARN("Type app counter is unknown"); return; } Backup(); @@ -2465,7 +2446,7 @@ void CacheManager::Set(const std::string& app_id, .app_registration_language_vui = value; break; default: - LOG4CXX_WARN(logger_, "Type app info is unknown"); + SDL_LOG_WARN("Type app info is unknown"); return; } Backup(); @@ -2495,7 +2476,7 @@ void CacheManager::Add(const std::string& app_id, .minutes_in_hmi_none += minutes; break; default: - LOG4CXX_WARN(logger_, "Type app stopwatch is unknown"); + SDL_LOG_WARN("Type app stopwatch is unknown"); return; } Backup(); @@ -2558,8 +2539,7 @@ bool CacheManager::SetPredataPolicy(const std::string& app_id) { pt_->policy_table.app_policies_section.apps.find(kPreDataConsentId); if (pt_->policy_table.app_policies_section.apps.end() == iter) { - LOG4CXX_ERROR(logger_, - "Could not set " << kPreDataConsentId + SDL_LOG_ERROR("Could not set " << kPreDataConsentId << " permissions for app " << app_id); return false; } @@ -2589,20 +2569,18 @@ bool CacheManager::SetUnpairedDevice(const std::string& device_id, const bool result = pt_->policy_table.device_data->end() != pt_->policy_table.device_data->find(device_id); if (!result) { - LOG4CXX_DEBUG(logger_, - "Couldn't set unpaired flag for device id " - << device_id << " , since it wasn't found."); + SDL_LOG_DEBUG("Couldn't set unpaired flag for device id " + << device_id << " , since it wasn't found."); return false; } sync_primitives::AutoLock lock(unpaired_lock_); if (unpaired) { is_unpaired_.insert(device_id); - LOG4CXX_DEBUG(logger_, "Unpaired flag was set for device id " << device_id); + SDL_LOG_DEBUG("Unpaired flag was set for device id " << device_id); } else { is_unpaired_.erase(device_id); - LOG4CXX_DEBUG(logger_, - "Unpaired flag was removed for device id " << device_id); + SDL_LOG_DEBUG("Unpaired flag was removed for device id " << device_id); } return result; } @@ -2627,7 +2605,7 @@ bool CacheManager::IsApplicationRepresented(const std::string& app_id) const { bool CacheManager::Init(const std::string& file_name, const PolicySettings* settings) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); settings_ = settings; InitResult init_result = backup_->Init(settings); ex_backup_ = std::dynamic_pointer_cast<PTExtRepresentation>(backup_); @@ -2635,7 +2613,7 @@ bool CacheManager::Init(const std::string& file_name, bool result = true; switch (init_result) { case InitResult::EXISTS: { - LOG4CXX_INFO(logger_, "Policy Table exists, was loaded correctly."); + SDL_LOG_INFO("Policy Table exists, was loaded correctly."); result = LoadFromBackup(); if (result) { if (!backup_->IsDBVersionActual()) { @@ -2651,16 +2629,15 @@ bool CacheManager::Init(const std::string& file_name, } } break; case InitResult::SUCCESS: { - LOG4CXX_INFO(logger_, "Policy Table was inited successfully"); + SDL_LOG_INFO("Policy Table was inited successfully"); result = LoadFromFile(file_name, *pt_); std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); - LOG4CXX_DEBUG(logger_, - "Check if snapshot valid: " << std::boolalpha << result); + SDL_LOG_DEBUG("Check if snapshot valid: " << std::boolalpha << result); if (!UnwrapAppPolicies(pt_->policy_table.app_policies_section.apps)) { - LOG4CXX_ERROR(logger_, "Cannot unwrap application policies"); + SDL_LOG_ERROR("Cannot unwrap application policies"); } if (result) { @@ -2670,14 +2647,13 @@ bool CacheManager::Init(const std::string& file_name, } else { rpc::ValidationReport report("policy_table"); snapshot->ReportErrors(&report); - LOG4CXX_DEBUG(logger_, - "Validation report: " << rpc::PrettyFormat(report)); + SDL_LOG_DEBUG("Validation report: " << rpc::PrettyFormat(report)); ex_backup_->RemoveDB(); } } break; default: { result = false; - LOG4CXX_ERROR(logger_, "Failed to init policy table."); + SDL_LOG_ERROR("Failed to init policy table."); } break; } @@ -2729,11 +2705,11 @@ bool CacheManager::LoadFromBackup() { bool CacheManager::LoadFromFile(const std::string& file_name, policy_table::Table& table) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Loading policy table from file " << file_name); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Loading policy table from file " << file_name); BinaryMessage json_string; if (!file_system::ReadBinaryFile(file_name, json_string)) { - LOG4CXX_FATAL(logger_, "Failed to read policy table source file."); + SDL_LOG_FATAL("Failed to read policy table source file."); return false; } @@ -2742,20 +2718,18 @@ bool CacheManager::LoadFromFile(const std::string& file_name, std::string json(json_string.begin(), json_string.end()); if (!reader.parse(json, &value)) { - LOG4CXX_FATAL(logger_, "Preloaded PT is corrupted."); + SDL_LOG_FATAL("Preloaded PT is corrupted."); return false; } - LOG4CXX_DEBUG(logger_, - "Start verification of policy table loaded from file."); + SDL_LOG_DEBUG("Start verification of policy table loaded from file."); sync_primitives::AutoLock locker(cache_lock_); table = policy_table::Table(&value); #ifdef ENABLE_LOG Json::StreamWriterBuilder writer_builder; - LOG4CXX_DEBUG(logger_, - "Policy table content loaded:" << Json::writeString( + SDL_LOG_DEBUG("Policy table content loaded:" << Json::writeString( writer_builder, table.ToJsonValue())); #endif // ENABLE_LOG @@ -2764,21 +2738,20 @@ bool CacheManager::LoadFromFile(const std::string& file_name, if (!table.is_valid()) { rpc::ValidationReport report("policy_table"); table.ReportErrors(&report); - LOG4CXX_FATAL(logger_, - "Parsed table is not valid " << rpc::PrettyFormat(report)); + SDL_LOG_FATAL("Parsed table is not valid " << rpc::PrettyFormat(report)); return false; } return true; } bool CacheManager::ResetPT(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_unpaired_.clear(); backuper_->WaitForBackupIsDone(); if (!backup_->RefreshDB()) { - LOG4CXX_ERROR(logger_, "Can't re-create policy database. Reset failed."); + SDL_LOG_ERROR("Can't re-create policy database. Reset failed."); return false; } @@ -2794,25 +2767,22 @@ bool CacheManager::ResetPT(const std::string& file_name) { policy::RequestType::State CacheManager::GetAppRequestTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator app_policies_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request types for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id); return policy::RequestType::State::UNAVAILABLE; } const policy_table::RequestTypes& request_types = *app_policies_iter->second.RequestType; if (!request_types.is_initialized()) { - LOG4CXX_TRACE(logger_, - "Request types for " << policy_app_id << " are OMITTED"); + SDL_LOG_TRACE("Request types for " << policy_app_id << " are OMITTED"); return RequestType::State::OMITTED; } if (request_types.empty()) { - LOG4CXX_TRACE(logger_, - "Request types for " << policy_app_id << " are EMPTY"); + SDL_LOG_TRACE("Request types for " << policy_app_id << " are EMPTY"); return policy::RequestType::State::EMPTY; } return policy::RequestType::State::AVAILABLE; @@ -2821,19 +2791,17 @@ policy::RequestType::State CacheManager::GetAppRequestTypesState( void CacheManager::GetAppRequestTypes( const std::string& policy_app_id, std::vector<std::string>& request_types) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); if (kDeviceId == policy_app_id) { - LOG4CXX_DEBUG(logger_, - "Request types not applicable for app_id " << kDeviceId); + SDL_LOG_DEBUG("Request types not applicable for app_id " << kDeviceId); return; } policy_table::ApplicationPolicies::iterator policy_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request types for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id); return; } if (policy_iter->second.RequestType.is_initialized()) { @@ -2846,25 +2814,22 @@ void CacheManager::GetAppRequestTypes( RequestSubType::State CacheManager::GetAppRequestSubTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator app_policies_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request subtypes for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id); return RequestSubType::State::UNAVAILABLE; } const policy_table::RequestSubTypes& request_subtypes = *app_policies_iter->second.RequestSubType; if (!request_subtypes.is_initialized()) { - LOG4CXX_TRACE(logger_, - "Request subtypes for " << policy_app_id << " are OMITTED"); + SDL_LOG_TRACE("Request subtypes for " << policy_app_id << " are OMITTED"); return RequestSubType::State::OMITTED; } if (request_subtypes.empty()) { - LOG4CXX_TRACE(logger_, - "Request subtypes for " << policy_app_id << " are EMPTY"); + SDL_LOG_TRACE("Request subtypes for " << policy_app_id << " are EMPTY"); return RequestSubType::State::EMPTY; } return RequestSubType::State::AVAILABLE; @@ -2873,19 +2838,17 @@ RequestSubType::State CacheManager::GetAppRequestSubTypesState( void CacheManager::GetAppRequestSubTypes( const std::string& policy_app_id, std::vector<std::string>& request_subtypes) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); if (kDeviceId == policy_app_id) { - LOG4CXX_DEBUG(logger_, - "Request subtypes not applicable for app_id " << kDeviceId); + SDL_LOG_DEBUG("Request subtypes not applicable for app_id " << kDeviceId); return; } sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::iterator policy_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request subtypes for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id); return; } @@ -2896,7 +2859,7 @@ void CacheManager::GetAppRequestSubTypes( } const MetaInfo CacheManager::GetMetaInfo() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); MetaInfo meta_info; meta_info.ccpu_version = *pt_->policy_table.module_meta->ccpu_version; @@ -2916,7 +2879,7 @@ std::string CacheManager::GetCertificate() const { } void CacheManager::SetDecryptedCertificate(const std::string& certificate) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); *pt_->policy_table.module_config.certificate = certificate; @@ -2925,10 +2888,10 @@ void CacheManager::SetDecryptedCertificate(const std::string& certificate) { bool CacheManager::SetExternalConsentStatus( const ExternalConsentStatus& status) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); if (status.empty()) { - LOG4CXX_INFO(logger_, "No ExternalConsent status update."); + SDL_LOG_INFO("No ExternalConsent status update."); return false; } @@ -2936,13 +2899,13 @@ bool CacheManager::SetExternalConsentStatus( } ExternalConsentStatus CacheManager::GetExternalConsentStatus() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); return ex_backup_->GetExternalConsentStatus(); } ExternalConsentStatus CacheManager::GetExternalConsentEntities() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); ExternalConsentStatus items; for (policy_table::FunctionalGroupings::const_iterator it = @@ -2971,7 +2934,7 @@ ExternalConsentStatus CacheManager::GetExternalConsentEntities() { GroupsByExternalConsentStatus CacheManager::GetGroupsWithSameEntities( const ExternalConsentStatus& status) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(policy::GroupsByExternalConsentStatus()); sync_primitives::AutoLock auto_lock(cache_lock_); GroupsByExternalConsentStatus groups_by_external_consent; @@ -2985,7 +2948,7 @@ GroupsByExternalConsentStatus CacheManager::GetGroupsWithSameEntities( } std::map<std::string, std::string> CacheManager::GetKnownLinksFromPT() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK((std::map<std::string, std::string>())); std::map<std::string, std::string> links; sync_primitives::AutoLock auto_lock(cache_lock_); @@ -3026,7 +2989,7 @@ bool CacheManager::ConsentsSame( void CacheManager::SetExternalConsentForApp( const PermissionConsent& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ConsentGroups& external_consent_groups = @@ -3035,7 +2998,7 @@ void CacheManager::SetExternalConsentForApp( .external_consent_status_groups; if (ConsentsSame(external_consent_groups, permissions)) { - LOG4CXX_DEBUG(logger_, "External consents already have same values."); + SDL_LOG_DEBUG("External consents already have same values."); return; } @@ -3055,16 +3018,16 @@ void CacheManager::SetExternalConsentForApp( const date_time::TimeDuration tm = date_time::getCurrentTime(); int64_t current_time_msec = date_time::getmSecs(tm); app_consent_records.ext_consent_last_updated = current_time_msec; - LOG4CXX_DEBUG(logger_, "Updating consents time " << current_time_msec); + SDL_LOG_DEBUG("Updating consents time " << current_time_msec); Backup(); } bool CacheManager::MergePreloadPT(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::Table table; if (!LoadFromFile(file_name, table)) { - LOG4CXX_DEBUG(logger_, "Unable to load preloaded PT."); + SDL_LOG_DEBUG("Unable to load preloaded PT."); return false; } @@ -3086,7 +3049,7 @@ bool CacheManager::MergePreloadPT(const std::string& file_name) { void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::ModuleConfig copy(pt.module_config); pt.module_config = new_pt.module_config; @@ -3097,19 +3060,19 @@ void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt, void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::FunctionalGroupings::const_iterator it = new_pt.functional_groupings.begin(); for (; it != new_pt.functional_groupings.end(); ++it) { - LOG4CXX_DEBUG(logger_, "Merge functional group: " << it->first); + SDL_LOG_DEBUG("Merge functional group: " << it->first); pt.functional_groupings[it->first] = it->second; } } void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); pt.app_policies_section.device = const_cast<policy_table::PolicyTable&>(new_pt) .app_policies_section.device; @@ -3125,7 +3088,7 @@ void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (new_pt.consumer_friendly_messages.is_initialized()) { if (!pt.consumer_friendly_messages.is_initialized()) { pt.consumer_friendly_messages = new_pt.consumer_friendly_messages; @@ -3136,9 +3099,9 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, pt.consumer_friendly_messages->version = new_pt.consumer_friendly_messages->version; for (; it != new_pt.consumer_friendly_messages->messages->end(); ++it) { - LOG4CXX_DEBUG(logger_, "Merge CFM: " << it->first); + SDL_LOG_DEBUG("Merge CFM: " << it->first); if (!(pt.consumer_friendly_messages->messages.is_initialized())) { - LOG4CXX_DEBUG(logger_, "CFM not initialized."); + SDL_LOG_DEBUG("CFM not initialized."); } (*pt.consumer_friendly_messages->messages)[it->first] = it->second; } @@ -3148,12 +3111,12 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, void CacheManager::MergeVD(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); pt.vehicle_data.assign_if_valid(new_pt.vehicle_data); } void CacheManager::InitBackupThread() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); backuper_ = new BackgroundBackuper(this); backup_thread_ = threads::CreateThread("Backup thread", backuper_); backup_thread_->Start(); @@ -3167,7 +3130,7 @@ const PolicySettings& CacheManager::get_settings() const { void CacheManager::OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); auto device_data = *(pt_->policy_table.device_data); @@ -3180,12 +3143,11 @@ void CacheManager::OnDeviceSwitching(const std::string& device_id_from, auto& consents_from = *(from->second.user_consent_records); auto& consents_to = *(to->second.user_consent_records); - LOG4CXX_DEBUG(logger_, - "Merging user consents from device: " - << device_id_from << " to device: " << device_id_to); + SDL_LOG_DEBUG("Merging user consents from device: " + << device_id_from << " to device: " << device_id_to); for (auto f = consents_from.begin(); f != consents_from.end(); ++f) { const auto app_id = f->first; - LOG4CXX_DEBUG(logger_, "Updating permissions for key: " << app_id); + SDL_LOG_DEBUG("Updating permissions for key: " << app_id); consents_to[app_id] = f->second; } } @@ -3196,26 +3158,26 @@ CacheManager::BackgroundBackuper::BackgroundBackuper( , backup_is_in_progress_(false) , stop_flag_(false) , new_data_available_(false) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } CacheManager::BackgroundBackuper::~BackgroundBackuper() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void CacheManager::BackgroundBackuper::InternalBackup() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(cache_manager_); while (new_data_available_) { new_data_available_ = false; - LOG4CXX_DEBUG(logger_, "DoBackup"); + SDL_LOG_DEBUG("DoBackup"); cache_manager_->PersistData(); } } void CacheManager::BackgroundBackuper::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(need_backup_lock_); while (!stop_flag_) { backup_is_in_progress_.exchange(true); @@ -3225,7 +3187,7 @@ void CacheManager::BackgroundBackuper::threadMain() { } { - LOG4CXX_DEBUG(logger_, "Backup is done"); + SDL_LOG_DEBUG("Backup is done"); sync_primitives::AutoLock auto_lock(backup_done_lock_); backup_is_in_progress_.exchange(false); backup_done_.Broadcast(); @@ -3235,27 +3197,27 @@ void CacheManager::BackgroundBackuper::threadMain() { continue; } - LOG4CXX_DEBUG(logger_, "Wait for a next backup"); + SDL_LOG_DEBUG("Wait for a next backup"); backup_notifier_.Wait(need_backup_lock_); } } void CacheManager::BackgroundBackuper::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(need_backup_lock_); stop_flag_ = true; backup_notifier_.NotifyOne(); } void CacheManager::BackgroundBackuper::DoBackup() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(need_backup_lock_); new_data_available_ = true; backup_notifier_.NotifyOne(); } void CacheManager::BackgroundBackuper::WaitForBackupIsDone() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(backup_done_lock_); if (backup_is_in_progress_) { backup_done_.Wait(auto_lock); @@ -3264,7 +3226,7 @@ void CacheManager::BackgroundBackuper::WaitForBackupIsDone() { EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag( const std::string& application) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); return pt_->policy_table.app_policies_section.apps[application] @@ -3273,14 +3235,14 @@ EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag( EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag( const std::string& functional_group) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto& functional_groupings = pt_->policy_table.functional_groupings; const auto& grouping_itr = functional_groupings.find(functional_group); if (grouping_itr == functional_groupings.end()) { - LOG4CXX_WARN(logger_, "Group " << functional_group << " not found"); + SDL_LOG_WARN("Group " << functional_group << " not found"); return rpc::Optional<rpc::Boolean>(rpc::Boolean(false)); } @@ -3290,14 +3252,13 @@ EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag( void CacheManager::GetApplicationParams( const std::string& application_name, policy_table::ApplicationParams& application_params) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto apps = pt_->policy_table.app_policies_section.apps; const auto it = apps.find(application_name); if (apps.end() == it) { - LOG4CXX_WARN(logger_, - "Application " << application_name << " was not found"); + SDL_LOG_WARN("Application " << application_name << " was not found"); return; } diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc index b8bbb1682c..4607c3ca5f 100644 --- a/src/components/policy/policy_external/src/policy_helper.cc +++ b/src/components/policy/policy_external/src/policy_helper.cc @@ -44,7 +44,7 @@ namespace custom_str = utils::custom_string; namespace { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") bool CompareStrings(const StringsValueType& first, const StringsValueType& second) { @@ -356,7 +356,7 @@ std::vector<FunctionalGroupPermission> policy::CheckAppPolicy::GetRevokedGroups( FunctionalGroupNames groups_attributes; if (!pm_->cache_->GetFunctionalGroupNames(groups_attributes)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return std::vector<FunctionalGroupPermission>(); } @@ -390,7 +390,7 @@ bool CheckAppPolicy::IsKnownAppication( bool CheckAppPolicy::IsAppRevoked( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Application params are not initialized = application revoked // i.e. "123":null return app_policy.second.is_null(); @@ -427,7 +427,7 @@ void CheckAppPolicy::InsertPermission(const std::string& app_id, auto result = pm_->app_permissions_diff_.insert( std::make_pair(app_id, permissions_diff)); if (!result.second) { - LOG4CXX_ERROR(logger_, "App ID: " << app_id << " already exists in map."); + SDL_LOG_ERROR("App ID: " << app_id << " already exists in map."); } pm_->app_permissions_diff_lock_.Release(); } @@ -443,8 +443,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { AppPermissions permissions_diff(app_id); if (!IsKnownAppication(app_id)) { - LOG4CXX_WARN(logger_, - "Application:" << app_id << " is not present in snapshot."); + SDL_LOG_WARN("Application:" << app_id << " is not present in snapshot."); return true; } @@ -469,8 +468,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { const bool is_request_type_changed = IsRequestTypeChanged(app_policy); const bool is_request_subtype_changed = IsRequestSubTypeChanged(app_policy); if (is_request_type_changed) { - LOG4CXX_TRACE(logger_, - "Request types were changed for application: " << app_id); + SDL_LOG_TRACE("Request types were changed for application: " << app_id); SetPendingPermissions( app_policy, RESULT_REQUEST_TYPE_CHANGED, permissions_diff); AddResult(app_id, RESULT_REQUEST_TYPE_CHANGED); @@ -478,8 +476,8 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { (RESULT_NO_CHANGES == result) ? RESULT_REQUEST_TYPE_CHANGED : result; } if (is_request_subtype_changed) { - LOG4CXX_TRACE( - logger_, "Request subtypes were changed for application: " << app_id); + SDL_LOG_TRACE( + "Request subtypes were changed for application: " << app_id); SetPendingPermissions( app_policy, RESULT_REQUEST_SUBTYPE_CHANGED, permissions_diff); AddResult(app_id, RESULT_REQUEST_SUBTYPE_CHANGED); @@ -489,16 +487,14 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { } if (RESULT_NO_CHANGES == result) { - LOG4CXX_INFO( - logger_, - "Permissions for application:" << app_id << " wasn't changed."); + SDL_LOG_INFO("Permissions for application:" << app_id + << " wasn't changed."); AddResult(app_id, result); return true; } - LOG4CXX_INFO( - logger_, - "Permissions for application:" << app_id << " have been changed."); + SDL_LOG_INFO("Permissions for application:" << app_id + << " have been changed."); if (!IsPredefinedApp(app_policy)) { SetPendingPermissions(app_policy, result, permissions_diff); @@ -677,7 +673,7 @@ bool CheckAppPolicy::IsRequestSubTypeChanged( bool CheckAppPolicy::IsAppPropertiesProvided( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app_policy.second.hybrid_app_preference.is_initialized() || app_policy.second.endpoint.is_initialized() || app_policy.second.enabled.is_initialized() || @@ -691,15 +687,15 @@ bool CheckAppPolicy::IsAppPropertiesProvided( bool CheckAppPolicy::IsAppPropertiesChanged( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!IsAppPropertiesProvided(app_policy)) { return false; } if (!IsKnownAppication(app_policy.first)) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "AppProperties provided for new application: " << app_policy.first); return true; } @@ -710,33 +706,33 @@ bool CheckAppPolicy::IsAppPropertiesChanged( if (app_policy.second.enabled.is_initialized() && app_policy.second.enabled != snapshot_properties.second.enabled) { - LOG4CXX_DEBUG(logger_, "\"enabled\" was changed"); + SDL_LOG_DEBUG("\"enabled\" was changed"); return true; } if (app_policy.second.endpoint.is_initialized() && app_policy.second.endpoint != snapshot_properties.second.endpoint) { - LOG4CXX_DEBUG(logger_, "\"endpoint\" was changed"); + SDL_LOG_DEBUG("\"endpoint\" was changed"); return true; } if (app_policy.second.hybrid_app_preference.is_initialized() && app_policy.second.hybrid_app_preference != snapshot_properties.second.hybrid_app_preference) { - LOG4CXX_DEBUG(logger_, "\"hybrid_app_preference\" was changed"); + SDL_LOG_DEBUG("\"hybrid_app_preference\" was changed"); return true; } if (app_policy.second.auth_token.is_initialized() && app_policy.second.auth_token != snapshot_properties.second.auth_token) { - LOG4CXX_DEBUG(logger_, "\"auth_token\" was changed"); + SDL_LOG_DEBUG("\"auth_token\" was changed"); return true; } if (app_policy.second.cloud_transport_type.is_initialized() && app_policy.second.cloud_transport_type != snapshot_properties.second.cloud_transport_type) { - LOG4CXX_DEBUG(logger_, "\"cloud_transport_type\" was changed"); + SDL_LOG_DEBUG("\"cloud_transport_type\" was changed"); return true; } @@ -745,14 +741,14 @@ bool CheckAppPolicy::IsAppPropertiesChanged( bool CheckAppPolicy::IsEncryptionRequiredFlagChanged( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto get_app_encryption_needed = [](const std::string& policy_app_id, policy_table::ApplicationPolicies& policies) -> rpc::Optional<rpc::Boolean> { auto it = policies.find(policy_app_id); if (policies.end() == it) { - LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id); + SDL_LOG_WARN("App is not present in policies" << policy_app_id); return rpc::Optional<rpc::Boolean>(false); } return it->second.encryption_required; @@ -764,7 +760,7 @@ bool CheckAppPolicy::IsEncryptionRequiredFlagChanged( policy_table::Strings result; auto it = policies.find(policy_app_id); if (policies.end() == it) { - LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id); + SDL_LOG_WARN("App is not present in policies" << policy_app_id); return result; } auto& groups = it->second.groups; @@ -1193,7 +1189,7 @@ void FillFunctionalGroupPermissions( FunctionalGroupNames& names, GroupConsent state, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs::const_iterator it = ids.begin(); FunctionalGroupIDs::const_iterator it_end = ids.end(); for (; it != it_end; ++it) { @@ -1213,7 +1209,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) { FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, const FunctionalGroupIDs& what) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs from_copy(from); FunctionalGroupIDs what_copy(what); @@ -1235,7 +1231,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); @@ -1257,7 +1253,7 @@ FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOG4CXX_INFO(logger_, "Find same groups"); + SDL_LOG_INFO("Find same groups"); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); @@ -1281,7 +1277,7 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) { policy_table::ApplicationPolicies::iterator it_default = app_policies.find(kDefaultId); if (app_policies.end() == it_default) { - LOG4CXX_ERROR(logger_, "No default application policy found in PTU."); + SDL_LOG_ERROR("No default application policy found in PTU."); return false; } diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index 7314fc040d..773c689409 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -202,7 +202,7 @@ struct GroupSorter namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") PolicyManagerImpl::PolicyManagerImpl() : PolicyManager() @@ -253,15 +253,14 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse( } void PolicyManagerImpl::CheckTriggers() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool exceed_ignition_cycles = ExceededIgnitionCycles(); const bool exceed_days = ExceededDays(); - LOG4CXX_DEBUG( - logger_, - "\nDays exceeded: " << std::boolalpha << exceed_days - << "\nIgnition cycles exceeded: " << std::boolalpha - << exceed_ignition_cycles); + SDL_LOG_DEBUG("\nDays exceeded: " << std::boolalpha << exceed_days + << "\nIgnition cycles exceeded: " + << std::boolalpha + << exceed_ignition_cycles); if (exceed_ignition_cycles || exceed_days) { update_status_manager_.ScheduleUpdate(); @@ -464,15 +463,15 @@ void FilterPolicyTable( PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( const std::string& file, const BinaryMessage& pt_content) { - LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size()); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_INFO("LoadPT of size " << pt_content.size()); + SDL_LOG_DEBUG( + "PTU content is: " << std::string(pt_content.begin(), pt_content.end())); // Parse message into table struct std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content); if (!pt_update) { - LOG4CXX_WARN(logger_, "Parsed table pointer is NULL."); + SDL_LOG_WARN("Parsed table pointer is NULL."); return PtProcessingResult::kWrongPtReceived; } @@ -481,7 +480,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( FilterPolicyTable(pt_update->policy_table, current_vd_items); if (!IsPTValid(pt_update, policy_table::PT_UPDATE)) { - LOG4CXX_WARN(logger_, "Received policy table update is not valid"); + SDL_LOG_WARN("Received policy table update is not valid"); return PtProcessingResult::kWrongPtReceived; } @@ -491,8 +490,8 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( // Get current DB data, since it could be updated during awaiting of PTU auto policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed to create snapshot of policy table, trying another exchange"); return PtProcessingResult::kNewPtRequired; } @@ -507,8 +506,8 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( // Replace current data with updated if (!cache_->ApplyUpdate(*pt_update)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Unsuccessful save of updated policy table, trying another exchange"); return PtProcessingResult::kNewPtRequired; } @@ -531,10 +530,10 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( std::map<std::string, StringArray> app_hmi_types; cache_->GetHMIAppTypeAfterUpdate(app_hmi_types); if (!app_hmi_types.empty()) { - LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType"); + SDL_LOG_INFO("app_hmi_types is full calling OnUpdateHMIAppType"); listener_->OnUpdateHMIAppType(app_hmi_types); } else { - LOG4CXX_INFO(logger_, "app_hmi_types empty"); + SDL_LOG_INFO("app_hmi_types empty"); } std::vector<std::string> enabled_apps; @@ -547,11 +546,11 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( } void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ptu_requested_ = false; if (PtProcessingResult::kWrongPtReceived == ptu_result) { - LOG4CXX_DEBUG(logger_, "Wrong PT was received"); + SDL_LOG_DEBUG("Wrong PT was received"); update_status_manager_.OnWrongUpdateReceived(); return; } @@ -561,7 +560,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { if (HasApplicationForPTU()) { update_status_manager_.OnExistedApplicationAdded(true); } else if (PtProcessingResult::kNewPtRequired == ptu_result) { - LOG4CXX_DEBUG(logger_, "New PTU interation is required"); + SDL_LOG_DEBUG("New PTU interation is required"); ForcePTExchange(); return; } @@ -571,8 +570,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { // If there was a user request for policy table update, it should be started // right after current update is finished if (update_status_manager_.IsUpdateRequired()) { - LOG4CXX_DEBUG(logger_, - "PTU was successful and new PTU iteration was scheduled"); + SDL_LOG_DEBUG("PTU was successful and new PTU iteration was scheduled"); StartPTExchange(); return; } @@ -583,7 +581,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges( const std::shared_ptr<policy_table::Table> pt_update, const std::shared_ptr<policy_table::Table> snapshot) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Replace predefined policies with its actual setting, e.g. "123":"default" // to actual values of default section @@ -668,13 +666,13 @@ void PolicyManagerImpl::PrepareNotificationData( const policy_table::Strings& group_names, const std::vector<FunctionalGroupPermission>& group_permission, Permissions& notification_data) { - LOG4CXX_INFO(logger_, "Preparing data for notification."); + SDL_LOG_INFO("Preparing data for notification."); ProcessFunctionalGroup processor(groups, group_permission, notification_data); std::for_each(group_names.begin(), group_names.end(), processor); } std::string PolicyManagerImpl::GetUpdateUrl(int service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); EndpointUrls urls; GetUpdateUrls(service_type, urls); @@ -689,28 +687,28 @@ std::string PolicyManagerImpl::GetUpdateUrl(int service_type) { ++index; } else { - LOG4CXX_ERROR(logger_, "The endpoint entry is empty"); + SDL_LOG_ERROR("The endpoint entry is empty"); } return url; } void PolicyManagerImpl::GetUpdateUrls(const std::string& service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->GetUpdateUrls(service_type, out_end_points); } void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->GetUpdateUrls(service_type, out_end_points); } void PolicyManagerImpl::RequestPTUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { - LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); + SDL_LOG_ERROR("Failed to create snapshot of policy table"); return; } @@ -720,19 +718,19 @@ void PolicyManagerImpl::RequestPTUpdate() { writer_builder["indentation"] = ""; std::string message_string = Json::writeString(writer_builder, value); - LOG4CXX_DEBUG(logger_, "Snapshot contents is : " << message_string); + SDL_LOG_DEBUG("Snapshot contents is : " << message_string); BinaryMessage update(message_string.begin(), message_string.end()); ptu_requested_ = true; listener_->OnSnapshotCreated( update, RetrySequenceDelaysSeconds(), TimeoutExchangeMSec()); } else { - LOG4CXX_ERROR(logger_, "Invalid Policy table snapshot - PTUpdate failed"); + SDL_LOG_ERROR("Invalid Policy table snapshot - PTUpdate failed"); } } void PolicyManagerImpl::StartPTExchange() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (ignition_check) { CheckTriggers(); @@ -741,9 +739,9 @@ void PolicyManagerImpl::StartPTExchange() { if (update_status_manager_.IsAppsSearchInProgress() && update_status_manager_.IsUpdateRequired()) { - LOG4CXX_INFO(logger_, - "Starting exchange skipped, since applications " - "search is in progress."); + SDL_LOG_INFO( + "Starting exchange skipped, since applications " + "search is in progress."); return; } @@ -751,29 +749,29 @@ void PolicyManagerImpl::StartPTExchange() { if (trigger_ptu_) { update_status_manager_.ScheduleUpdate(); } - LOG4CXX_INFO(logger_, - "Starting exchange skipped, since another exchange " - "is in progress."); + SDL_LOG_INFO( + "Starting exchange skipped, since another exchange " + "is in progress."); return; } - LOG4CXX_INFO(logger_, "Policy want to call RequestPTUpdate"); + SDL_LOG_INFO("Policy want to call RequestPTUpdate"); if (listener_) { - LOG4CXX_INFO(logger_, "Listener CanUpdate"); + SDL_LOG_INFO("Listener CanUpdate"); if (update_status_manager_.IsUpdateRequired()) { update_status_manager_.PendingUpdate(); - LOG4CXX_INFO(logger_, "IsUpdateRequired"); + SDL_LOG_INFO("IsUpdateRequired"); RequestPTUpdate(); } } } void PolicyManagerImpl::OnAppsSearchStarted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.OnAppsSearchStarted(); } void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.OnAppsSearchCompleted(); trigger_ptu_ = trigger_ptu; @@ -802,13 +800,13 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes( RequestType::State PolicyManagerImpl::GetAppRequestTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetAppRequestTypesState(policy_app_id); } RequestSubType::State PolicyManagerImpl::GetAppRequestSubTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetAppRequestSubTypesState(policy_app_id); } @@ -890,7 +888,7 @@ void PolicyManagerImpl::GetAppServiceParameters( bool PolicyManagerImpl::UnknownRPCPassthroughAllowed( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->UnknownRPCPassthroughAllowed(policy_app_id); } @@ -900,18 +898,15 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, const PTString& rpc, const RPCParams& rpc_params, CheckPermissionResult& result) { - LOG4CXX_INFO(logger_, - "CheckPermissions for " << app_id << " and rpc " << rpc + SDL_LOG_INFO("CheckPermissions for " << app_id << " and rpc " << rpc << " for " << hmi_level << " level."); Permissions rpc_permissions; // Check, if there are calculated permission present in cache if (!cache_->IsPermissionsCalculated(device_id, app_id, rpc_permissions)) { - LOG4CXX_DEBUG(logger_, - "IsPermissionsCalculated for device: " - << device_id << " and app: " << app_id - << " returns false"); + SDL_LOG_DEBUG("IsPermissionsCalculated for device: " + << device_id << " and app: " << app_id << " returns false"); // Get actual application group permission according to user consents std::vector<FunctionalGroupPermission> app_group_permissions; GetPermissionsForApp(device_id, app_id, app_group_permissions); @@ -934,10 +929,8 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, cache_->AddCalculatedPermissions(device_id, app_id, rpc_permissions); } else { - LOG4CXX_DEBUG(logger_, - "IsPermissionsCalculated for device: " - << device_id << " and app: " << app_id - << " returns true"); + SDL_LOG_DEBUG("IsPermissionsCalculated for device: " + << device_id << " and app: " << app_id << " returns true"); } if (cache_->IsApplicationRevoked(app_id)) { @@ -952,7 +945,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, } const bool known_rpc = rpc_permissions.end() != rpc_permissions.find(rpc); - LOG4CXX_DEBUG(logger_, "Is known rpc " << (known_rpc ? "true" : "false")); + SDL_LOG_DEBUG("Is known rpc " << (known_rpc ? "true" : "false")); if (!known_rpc) { // RPC not found in list == disallowed by backend result.hmi_level_permitted = kRpcDisallowed; @@ -974,20 +967,19 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, rpc_permissions[rpc].hmi_permissions[kUserDisallowedKey].find( hmi_level)) { // RPC found in allowed == allowed by backend, but disallowed by user - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "RPC found in allowed == allowed by backend, but disallowed by user"); result.hmi_level_permitted = kRpcUserDisallowed; } else { - LOG4CXX_DEBUG(logger_, - "HMI level " << hmi_level << " wasn't found " + SDL_LOG_DEBUG("HMI level " << hmi_level << " wasn't found " << " for rpc " << rpc << " and appID " << app_id); return; } if (kRpcAllowed != result.hmi_level_permitted) { - LOG4CXX_DEBUG(logger_, "RPC is not allowed. Stop parameters processing."); + SDL_LOG_DEBUG("RPC is not allowed. Stop parameters processing."); result.list_of_allowed_params = rpc_permissions[rpc].parameter_permissions[kAllowedKey]; @@ -1003,7 +995,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, // permissions, so that flag is processed first if (rpc_permissions[rpc] .parameter_permissions.any_parameter_disallowed_by_user) { - LOG4CXX_DEBUG(logger_, "All parameters are disallowed by user."); + SDL_LOG_DEBUG("All parameters are disallowed by user."); result.list_of_disallowed_params = rpc_params; result.hmi_level_permitted = kRpcUserDisallowed; return; @@ -1011,14 +1003,14 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, if (rpc_permissions[rpc] .parameter_permissions.any_parameter_disallowed_by_policy) { - LOG4CXX_DEBUG(logger_, "All parameters are disallowed by policy."); + SDL_LOG_DEBUG("All parameters are disallowed by policy."); result.list_of_undefined_params = rpc_params; result.hmi_level_permitted = kRpcDisallowed; return; } if (rpc_permissions[rpc].parameter_permissions.any_parameter_allowed) { - LOG4CXX_DEBUG(logger_, "All parameters are allowed."); + SDL_LOG_DEBUG("All parameters are allowed."); result.list_of_allowed_params = rpc_params; return; } @@ -1041,8 +1033,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, RPCParams::const_iterator end = rpc_params.end(); for (; end != parameter; ++parameter) { if (!result.HasParameter(*parameter)) { - LOG4CXX_DEBUG(logger_, - "Parameter " << *parameter + SDL_LOG_DEBUG("Parameter " << *parameter << " is unknown." " Adding to undefined list."); result.list_of_undefined_params.insert(*parameter); @@ -1050,10 +1041,10 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, } if (result.DisallowedInclude(rpc_params)) { - LOG4CXX_DEBUG(logger_, "All parameters are disallowed."); + SDL_LOG_DEBUG("All parameters are disallowed."); result.hmi_level_permitted = kRpcUserDisallowed; } else if (!result.IsAnyAllowed(rpc_params)) { - LOG4CXX_DEBUG(logger_, "There are no parameters allowed."); + SDL_LOG_DEBUG("There are no parameters allowed."); if (!result.list_of_undefined_params.empty()) { result.hmi_level_permitted = kRpcAllowed; @@ -1079,12 +1070,12 @@ policy_table::Strings PolicyManagerImpl::GetGroupsNames( void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( const std::string& device_id, const std::string& application_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (device_id.empty()) { - LOG4CXX_WARN(logger_, - "Couldn't find device info for application id " - "'" << application_id - << "'"); + SDL_LOG_WARN( + "Couldn't find device info for application id " + "'" + << application_id << "'"); return; } @@ -1102,8 +1093,7 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( app_group_permissions, notification_data); - LOG4CXX_INFO(logger_, - "Send notification for application_id:" << application_id); + SDL_LOG_INFO("Send notification for application_id:" << application_id); const ApplicationOnDevice who = {device_id, application_id}; if (access_remote_->IsAppRemoteControl(who)) { @@ -1120,27 +1110,27 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( } bool PolicyManagerImpl::CleanupUnpairedDevices() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->CleanupUnpairedDevices(); } DeviceConsent PolicyManagerImpl::GetUserConsentForDevice( const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetDeviceConsent(device_id); } void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id, const bool is_allowed) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device :" << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device :" << device_id); cache_->SetDeviceConsent(device_id, is_allowed); if (listener_) { listener_->OnDeviceConsentChanged(device_id, is_allowed); } else { - LOG4CXX_WARN(logger_, - "Event listener is not initialized. " - "Can't call OnDeviceConsentChanged"); + SDL_LOG_WARN( + "Event listener is not initialized. " + "Can't call OnDeviceConsentChanged"); } if (is_allowed && listener_->CanUpdate()) { update_status_manager_.OnDeviceConsented(); @@ -1194,7 +1184,7 @@ bool PolicyManagerImpl::ReactOnUserDevConsentForApp( bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, StringArray* nicknames, StringArray* app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool result = nicknames && app_hmi_types; if (result) { cache_->GetInitialAppData(application_id, *nicknames, *app_hmi_types); @@ -1204,23 +1194,23 @@ bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, void PolicyManagerImpl::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device: " << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device: " << device_id); if (!cache_->AddDevice(device_id, connection_type)) { - LOG4CXX_WARN(logger_, "Can't add device."); + SDL_LOG_WARN("Can't add device."); } } void PolicyManagerImpl::OnLocalAppAdded() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.ScheduleUpdate(); StartPTExchange(); } void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id, const DeviceInfo& device_info) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device :" << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device :" << device_id); if (!cache_->SetDeviceData(device_id, device_info.hardware, device_info.firmware_rev, @@ -1229,7 +1219,7 @@ void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id, device_info.carrier, device_info.max_number_rfcom_ports, device_info.connection_type)) { - LOG4CXX_WARN(logger_, "Can't set device data."); + SDL_LOG_WARN("Can't set device data."); } } @@ -1270,19 +1260,18 @@ PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent( void PolicyManagerImpl::CheckPendingPermissionsChanges( const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& current_permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(app_permissions_diff_lock_); PendingPermissions::iterator it_pending = app_permissions_diff_.find(policy_app_id); if (app_permissions_diff_.end() == it_pending) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "No pending permissions had been found for appID: " << policy_app_id); return; } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Pending permissions had been found for appID: " << policy_app_id); // Change appPermissionsConsentNeeded depending on unconsented groups @@ -1294,16 +1283,16 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges( for (; it_groups != it_end_groups; ++it_groups) { if (policy::kGroupUndefined == it_groups->state) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Unconsented groups still present for appID: " << policy_app_id); it_pending->second.appPermissionsConsentNeeded = true; return; } } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Unconsented groups not present anymore for appID: " << policy_app_id); it_pending->second.appPermissionsConsentNeeded = false; return; @@ -1313,7 +1302,7 @@ void PolicyManagerImpl::NotifyPermissionsChanges( const std::string& device_id, const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& app_group_permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Get current functional groups from DB with RPC permissions policy_table::FunctionalGroupings functional_groups; cache_->GetFunctionalGroupings(functional_groups); @@ -1331,7 +1320,7 @@ void PolicyManagerImpl::NotifyPermissionsChanges( void PolicyManagerImpl::SetUserConsentForApp( const PermissionConsent& permissions, const NotificationMode mode) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->ResetCalculatedPermissions(); PermissionConsent verified_permissions = @@ -1340,20 +1329,19 @@ void PolicyManagerImpl::SetUserConsentForApp( bool app_permissions_changed = false; if (!cache_->SetUserPermissionsForApp(verified_permissions, &app_permissions_changed)) { - LOG4CXX_WARN(logger_, "Can't set user permissions for application."); + SDL_LOG_WARN("Can't set user permissions for application."); return; } if (kSilentMode == mode) { - LOG4CXX_WARN(logger_, - "Silent mode is enabled. Application won't be informed."); + SDL_LOG_WARN("Silent mode is enabled. Application won't be informed."); return; } if (!app_permissions_changed) { - LOG4CXX_WARN(logger_, - "Application already has same consents. " - "Notificaton won't be sent."); + SDL_LOG_WARN( + "Application already has same consents. " + "Notificaton won't be sent."); return; } @@ -1371,30 +1359,28 @@ void PolicyManagerImpl::SetUserConsentForApp( } bool PolicyManagerImpl::IsAllowedRetryCountExceeded() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); return retry_sequence_index_ >= retry_sequence_seconds_.size(); } void PolicyManagerImpl::IncrementRetryIndex() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); if (!is_ptu_in_progress_) { - LOG4CXX_TRACE(logger_, - "First PTU iteration, skipping incrementing retry index"); + SDL_LOG_TRACE("First PTU iteration, skipping incrementing retry index"); is_ptu_in_progress_ = true; return; } ++retry_sequence_index_; - LOG4CXX_DEBUG(logger_, - "current retry_sequence_index_ is: " << retry_sequence_index_); + SDL_LOG_DEBUG("current retry_sequence_index_ is: " << retry_sequence_index_); } void PolicyManagerImpl::RetrySequenceFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); listener_->OnPTUFinished(false); ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate); @@ -1407,7 +1393,7 @@ void PolicyManagerImpl::RetrySequenceFailed() { } void PolicyManagerImpl::ResetTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (update_status_manager_.IsUpdatePending()) { uint32_t update_timeout = TimeoutExchangeMSec(); update_status_manager_.ResetTimeout(update_timeout); @@ -1415,14 +1401,14 @@ void PolicyManagerImpl::ResetTimeout() { } void PolicyManagerImpl::OnSystemRequestReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); IncrementRetryIndex(); } bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id, const std::string& policy_app_id, std::string* default_hmi) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeviceConsent device_consent = GetUserConsentForDevice(device_id); const std::string app_id = policy::kDeviceAllowed != device_consent ? kPreDataConsentId @@ -1432,9 +1418,9 @@ bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id, bool PolicyManagerImpl::GetPriority(const std::string& policy_app_id, std::string* priority) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!priority) { - LOG4CXX_WARN(logger_, "Input priority parameter is null."); + SDL_LOG_WARN("Input priority parameter is null."); return false; } @@ -1453,12 +1439,11 @@ void PolicyManagerImpl::GetUserConsentForApp( const std::string& device_id, const std::string& policy_app_id, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalIdType group_types; if (!cache_->GetPermissionsForApp(device_id, policy_app_id, group_types)) { - LOG4CXX_WARN(logger_, - "Can't get user permissions for app " << policy_app_id); + SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id); return; } @@ -1466,7 +1451,7 @@ void PolicyManagerImpl::GetUserConsentForApp( // automatically allowed and it could not be changed by user FunctionalGroupNames group_names; if (!cache_->GetFunctionalGroupNames(group_names)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return; } @@ -1516,12 +1501,11 @@ void PolicyManagerImpl::GetPermissionsForApp( const std::string& device_id, const std::string& policy_app_id, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string app_id_to_check = policy_app_id; if (!cache_->IsApplicationRepresented(policy_app_id)) { - LOG4CXX_WARN(logger_, - "Application with id " << policy_app_id + SDL_LOG_WARN("Application with id " << policy_app_id << " is not found within known apps."); return; } @@ -1544,8 +1528,7 @@ void PolicyManagerImpl::GetPermissionsForApp( cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types); if (!ret) { - LOG4CXX_WARN(logger_, - "Can't get user permissions for app " << policy_app_id); + SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id); return; } @@ -1553,14 +1536,14 @@ void PolicyManagerImpl::GetPermissionsForApp( // automatically allowed and it could not be changed by user FunctionalGroupNames group_names; if (!cache_->GetFunctionalGroupNames(group_names)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return; } // The "default" and "pre_DataConsent" are auto-allowed groups // So, check if application in the one of these mode. if (allowed_by_default) { - LOG4CXX_INFO(logger_, "Get auto allowed groups"); + SDL_LOG_INFO("Get auto allowed groups"); GroupType type = (kDefaultId == app_id_to_check ? kTypeDefault : kTypePreDataConsented); @@ -1619,7 +1602,7 @@ void PolicyManagerImpl::GetPermissionsForApp( std::string& PolicyManagerImpl::GetCurrentDeviceId( const transport_manager::DeviceHandle& device_handle, const std::string& policy_app_id) const { - LOG4CXX_INFO(logger_, "GetDeviceInfo"); + SDL_LOG_INFO("GetDeviceInfo"); last_device_id_ = listener()->OnCurrentDeviceIdUpdateRequired(device_handle, policy_app_id); return last_device_id_; @@ -1630,25 +1613,25 @@ void PolicyManagerImpl::SetSystemLanguage(const std::string& language) { } void PolicyManagerImpl::SetPreloadedPtFlag(const bool is_preloaded) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetPreloadedPtFlag(is_preloaded); } void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetMetaInfo(ccpu_version, wers_country_code, language); } std::string PolicyManagerImpl::GetCCPUVersionFromPT() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetCCPUVersionFromPT(); } uint32_t PolicyManagerImpl::GetNotificationsNumber(const std::string& priority, const bool is_subtle) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetNotificationsNumber(priority, is_subtle); } @@ -1661,10 +1644,10 @@ bool PolicyManagerImpl::IsPTValid( policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { - LOG4CXX_ERROR(logger_, "Policy table is not valid."); + SDL_LOG_ERROR("Policy table is not valid."); rpc::ValidationReport report("policy_table"); policy_table->ReportErrors(&report); - LOG4CXX_DEBUG(logger_, "Errors: " << rpc::PrettyFormat(report)); + SDL_LOG_DEBUG("Errors: " << rpc::PrettyFormat(report)); return false; } return true; @@ -1685,12 +1668,12 @@ void PolicyManagerImpl::UpdateAppConsentWithExternalConsent( const GroupsNames& allowed_groups, const GroupsNames& disallowed_groups, const ConsentProcessingPolicy processing_policy) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (allowed_groups.empty() && disallowed_groups.empty()) { - LOG4CXX_DEBUG(logger_, - "Allowed and disallowed groups are empty, skipping update by " - "external user consent."); + SDL_LOG_DEBUG( + "Allowed and disallowed groups are empty, skipping update by " + "external user consent."); return; } @@ -1733,12 +1716,12 @@ void PolicyManagerImpl::UpdateAppConsentWithExternalConsent( void PolicyManagerImpl::SendOnAppPropertiesChangeNotification( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); listener_->SendOnAppPropertiesChangeNotification(policy_app_id); } void PolicyManagerImpl::ResumePendingAppPolicyActions() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (auto& notify_system_params : notify_system_list_) { NotifySystem(notify_system_params.first, notify_system_params.second); @@ -1768,8 +1751,7 @@ void PolicyManagerImpl::SendPermissionsToApp( const std::string app_id = app_policy.first; if (device_id.empty()) { - LOG4CXX_WARN(logger_, - "Couldn't find device info for application id: " << app_id); + SDL_LOG_WARN("Couldn't find device info for application id: " << app_id); return; } std::vector<FunctionalGroupPermission> group_permissons; @@ -1787,7 +1769,7 @@ void PolicyManagerImpl::SendPermissionsToApp( group_permissons, notification_data); - LOG4CXX_INFO(logger_, "Send notification for application_id: " << app_id); + SDL_LOG_INFO("Send notification for application_id: " << app_id); listener()->OnPermissionsUpdated( device_id, app_id, @@ -1834,7 +1816,7 @@ bool ConsentStatusComparatorFunc(const ExternalConsentStatusItem& i1, bool PolicyManagerImpl::IsNeedToUpdateExternalConsentStatus( const ExternalConsentStatus& new_status) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); typedef std::vector<ExternalConsentStatusItem> ItemV; const ExternalConsentStatus existing_status = cache_->GetExternalConsentEntities(); @@ -1859,15 +1841,15 @@ bool PolicyManagerImpl::IsNeedToUpdateExternalConsentStatus( bool PolicyManagerImpl::SetExternalConsentStatus( const ExternalConsentStatus& status) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (status.empty()) { - LOG4CXX_INFO(logger_, "External consent status is empty, skipping update."); + SDL_LOG_INFO("External consent status is empty, skipping update."); return false; } if (!cache_->SetExternalConsentStatus(status)) { - LOG4CXX_WARN(logger_, "Can't set external user consent status."); + SDL_LOG_WARN("Can't set external user consent status."); return false; } @@ -1880,7 +1862,7 @@ bool PolicyManagerImpl::SetExternalConsentStatus( } ExternalConsentStatus PolicyManagerImpl::GetExternalConsentStatus() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetExternalConsentStatus(); } @@ -1888,7 +1870,7 @@ void PolicyManagerImpl::CalculateGroupsConsentFromExternalConsent( const GroupsByExternalConsentStatus& groups_by_external_consent, GroupsNames& out_allowed_groups, GroupsNames& out_disallowed_groups) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GroupSorter sorter(out_allowed_groups, out_disallowed_groups); std::for_each(groups_by_external_consent.begin(), groups_by_external_consent.end(), @@ -1906,7 +1888,7 @@ void PolicyManagerImpl::CalculateGroupsConsentFromExternalConsent( } bool PolicyManagerImpl::ExceededDays() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); date_time::TimeDuration current_time = date_time::getCurrentTime(); const int kSecondsInDay = 60 * 60 * 24; @@ -1915,16 +1897,16 @@ bool PolicyManagerImpl::ExceededDays() { DCHECK(std::numeric_limits<uint16_t>::max() >= days); if (std::numeric_limits<uint16_t>::max() <= days) { - LOG4CXX_WARN(logger_, "The days since epoch exceeds maximum value."); + SDL_LOG_WARN("The days since epoch exceeds maximum value."); return false; } return 0 == cache_->DaysBeforeExchange(static_cast<uint16_t>(days)); } void PolicyManagerImpl::KmsChanged(int kilometers) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (0 == cache_->KilometersBeforeExchange(kilometers)) { - LOG4CXX_INFO(logger_, "Enough kilometers passed to send for PT update."); + SDL_LOG_INFO("Enough kilometers passed to send for PT update."); update_status_manager_.ScheduleUpdate(); StartPTExchange(); PTUpdatedAt(KILOMETERS, kilometers); @@ -1933,14 +1915,14 @@ void PolicyManagerImpl::KmsChanged(int kilometers) { const boost::optional<bool> PolicyManagerImpl::LockScreenDismissalEnabledState() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->LockScreenDismissalEnabledState(); } const boost::optional<std::string> PolicyManagerImpl::LockScreenDismissalWarningMessage( const std::string& language) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->LockScreenDismissalWarningMessage(language); } @@ -1955,7 +1937,7 @@ std::string PolicyManagerImpl::ForcePTExchange() { } void policy::PolicyManagerImpl::StopRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cache_->UpdateRequired()) { ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate); @@ -1963,7 +1945,7 @@ void policy::PolicyManagerImpl::StopRetrySequence() { } std::string PolicyManagerImpl::ForcePTExchangeAtUserRequest() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.ScheduleManualUpdate(); StartPTExchange(); return update_status_manager_.StringifiedUpdateStatus(); @@ -1975,7 +1957,7 @@ std::string PolicyManagerImpl::GetPolicyTableStatus() const { int PolicyManagerImpl::NextRetryTimeout() { sync_primitives::AutoLock auto_lock(retry_sequence_lock_); - LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_); + SDL_LOG_DEBUG("Index: " << retry_sequence_index_); int next = 0; if (!retry_sequence_seconds_.empty() && @@ -1995,7 +1977,7 @@ void PolicyManagerImpl::RefreshRetrySequence() { void PolicyManagerImpl::ResetRetrySequence( const ResetRetryCountType reset_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); retry_sequence_index_ = 0; is_ptu_in_progress_ = false; @@ -2014,15 +1996,14 @@ const std::vector<int> PolicyManagerImpl::RetrySequenceDelaysSeconds() { } void PolicyManagerImpl::OnExceededTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.OnUpdateTimeoutOccurs(); } void PolicyManagerImpl::OnUpdateStarted() { uint32_t update_timeout = TimeoutExchangeMSec(); - LOG4CXX_DEBUG(logger_, - "Update timeout will be set to (milisec): " << update_timeout); + SDL_LOG_DEBUG("Update timeout will be set to (milisec): " << update_timeout); send_on_update_sent_out_ = policy::kUpdating != update_status_manager_.StringifiedUpdateStatus(); @@ -2033,33 +2014,33 @@ void PolicyManagerImpl::OnUpdateStarted() { } void PolicyManagerImpl::PTUpdatedAt(Counters counter, int value) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetCountersPassedForSuccessfulUpdate(counter, value); cache_->ResetIgnitionCycles(); } void PolicyManagerImpl::Increment(usage_statistics::GlobalCounterId type) { - LOG4CXX_INFO(logger_, "Increment without app id"); + SDL_LOG_INFO("Increment without app id"); cache_->Increment(type); } void PolicyManagerImpl::Increment(const std::string& app_id, usage_statistics::AppCounterId type) { - LOG4CXX_DEBUG(logger_, "Increment " << app_id << " AppCounter: " << type); + SDL_LOG_DEBUG("Increment " << app_id << " AppCounter: " << type); cache_->Increment(app_id, type); } void PolicyManagerImpl::Set(const std::string& app_id, usage_statistics::AppInfoId type, const std::string& value) { - LOG4CXX_INFO(logger_, "Set " << app_id); + SDL_LOG_INFO("Set " << app_id); cache_->Set(app_id, type, value); } void PolicyManagerImpl::Add(const std::string& app_id, usage_statistics::AppStopwatchId type, int32_t timespan_seconds) { - LOG4CXX_INFO(logger_, "Add " << app_id); + SDL_LOG_INFO("Add " << app_id); cache_->Add(app_id, type, timespan_seconds); } @@ -2069,9 +2050,9 @@ bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const { bool PolicyManagerImpl::IsConsentNeeded(const std::string& device_id, const std::string& app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const int count = cache_->CountUnconsentedGroups(app_id, device_id); - LOG4CXX_DEBUG(logger_, "There are: " << count << " unconsented groups."); + SDL_LOG_DEBUG("There are: " << count << " unconsented groups."); return count != 0; } @@ -2113,7 +2094,7 @@ bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) const { void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) { if (!cache_->SetUnpairedDevice(device_id)) { - LOG4CXX_DEBUG(logger_, "Could not set unpaired flag for " << device_id); + SDL_LOG_DEBUG("Could not set unpaired flag for " << device_id); return; } SetUserConsentForDevice(device_id, false); @@ -2129,17 +2110,17 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile( void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->OnDeviceSwitching(device_id_from, device_id_to); } const MetaInfo PolicyManagerImpl::GetMetaInfo() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetMetaInfo(); } std::string PolicyManagerImpl::RetrieveCertificate() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetCertificate(); } @@ -2149,12 +2130,12 @@ bool PolicyManagerImpl::HasCertificate() const { void PolicyManagerImpl::SetDecryptedCertificate( const std::string& certificate) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetDecryptedCertificate(certificate); } AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const AppIdURL next_app_url = RetrySequenceUrl(retry_sequence_url_, urls); @@ -2216,19 +2197,18 @@ StatusNotifier PolicyManagerImpl::AddApplication( const std::string& device_id, const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto device_consent = GetUserConsentForDevice(device_id); - LOG4CXX_DEBUG(logger_, - "check_device_id: " << device_id << " check_device_consent: " + SDL_LOG_DEBUG("check_device_id: " << device_id << " check_device_consent: " << device_consent); sync_primitives::AutoLock lock(apps_registration_lock_); if (IsNewApplication(application_id)) { - LOG4CXX_DEBUG(logger_, "Adding new application"); + SDL_LOG_DEBUG("Adding new application"); AddNewApplication(device_id, application_id, device_consent); return std::make_shared<CallStatusChange>(update_status_manager_, device_consent); } - LOG4CXX_DEBUG(logger_, "Promote existed application"); + SDL_LOG_DEBUG("Promote existed application"); PromoteExistedApplication(device_id, application_id, device_consent); if (!ptu_requested_) { update_status_manager_.OnExistedApplicationAdded(cache_->UpdateRequired()); @@ -2243,7 +2223,7 @@ void PolicyManagerImpl::RemoveAppConsentForGroup( bool PolicyManagerImpl::IsPredataPolicy( const std::string& policy_app_id) const { - LOG4CXX_INFO(logger_, "IsPredataApp"); + SDL_LOG_INFO("IsPredataApp"); return cache_->IsPredataPolicy(policy_app_id); } @@ -2260,7 +2240,7 @@ void PolicyManagerImpl::ProcessExternalConsentStatusForApp( CalculateGroupsConsentFromExternalConsent( groups_by_status, allowed_groups, disallowed_groups); - LOG4CXX_DEBUG(logger_, "check device_id: " << device_id); + SDL_LOG_DEBUG("check device_id: " << device_id); UpdateAppConsentWithExternalConsent(device_id, application_id, allowed_groups, @@ -2271,20 +2251,20 @@ void PolicyManagerImpl::ProcessExternalConsentStatusForApp( void PolicyManagerImpl::AddNewApplication(const std::string& device_id, const std::string& application_id, DeviceConsent device_consent) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (kDeviceHasNoConsent == device_consent || kDeviceDisallowed == device_consent) { - LOG4CXX_INFO(logger_, - "Setting " - << policy::kPreDataConsentId - << " permissions for application id: " << application_id); + SDL_LOG_INFO( + + "Setting " << policy::kPreDataConsentId + << " permissions for application id: " << application_id); cache_->SetPredataPolicy(application_id); } else { - LOG4CXX_INFO(logger_, - "Setting " - << policy::kDefaultId - << " permissions for application id: " << application_id); + SDL_LOG_INFO( + + "Setting " << policy::kDefaultId + << " permissions for application id: " << application_id); cache_->SetDefaultPolicy(application_id); } @@ -2300,16 +2280,15 @@ void PolicyManagerImpl::PromoteExistedApplication( DeviceConsent device_consent) { // If device consent changed to allowed during application being // disconnected, app permissions should be changed also - LOG4CXX_DEBUG(logger_, - "kDeviceAllowed == device_consent: " - << (kDeviceAllowed == device_consent) - << " device_consent: " << device_consent); + SDL_LOG_DEBUG("kDeviceAllowed == device_consent: " + << (kDeviceAllowed == device_consent) + << " device_consent: " << device_consent); if (kDeviceAllowed == device_consent && cache_->IsPredataPolicy(application_id)) { - LOG4CXX_INFO(logger_, - "Setting " - << policy::kDefaultId - << " permissions for application id: " << application_id); + SDL_LOG_INFO( + + "Setting " << policy::kDefaultId + << " permissions for application id: " << application_id); cache_->SetDefaultPolicy(application_id); } ProcessExternalConsentStatusForApp( @@ -2322,7 +2301,7 @@ bool PolicyManagerImpl::IsNewApplication( } bool PolicyManagerImpl::ResetPT(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->ResetCalculatedPermissions(); const bool result = cache_->ResetPT(file_name); if (result) { @@ -2332,19 +2311,17 @@ bool PolicyManagerImpl::ResetPT(const std::string& file_name) { } bool PolicyManagerImpl::CheckAppStorageFolder() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string app_storage_folder = get_settings().app_storage_folder(); - LOG4CXX_DEBUG(logger_, "AppStorageFolder " << app_storage_folder); + SDL_LOG_DEBUG("AppStorageFolder " << app_storage_folder); if (!file_system::DirectoryExists(app_storage_folder)) { - LOG4CXX_WARN(logger_, - "Storage directory doesn't exist " << app_storage_folder); + SDL_LOG_WARN("Storage directory doesn't exist " << app_storage_folder); return false; } if (!(file_system::IsWritingAllowed(app_storage_folder) && file_system::IsReadingAllowed(app_storage_folder))) { - LOG4CXX_WARN(logger_, - "Storage directory doesn't have read/write permissions " - << app_storage_folder); + SDL_LOG_WARN("Storage directory doesn't have read/write permissions " + << app_storage_folder); return false; } return true; @@ -2352,10 +2329,10 @@ bool PolicyManagerImpl::CheckAppStorageFolder() const { bool PolicyManagerImpl::InitPT(const std::string& file_name, const PolicySettings* settings) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); settings_ = settings; if (!CheckAppStorageFolder()) { - LOG4CXX_ERROR(logger_, "Can not read/write into AppStorageFolder"); + SDL_LOG_ERROR("Can not read/write into AppStorageFolder"); return false; } const bool ret = cache_->Init(file_name, settings); @@ -2375,7 +2352,7 @@ uint32_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const { } void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!is_update_needed) { ResetRetrySequence(ResetRetryCountType::kResetInternally); @@ -2402,7 +2379,7 @@ void PolicyManagerImpl::SetDefaultHmiTypes( const transport_manager::DeviceHandle& device_handle, const std::string& application_id, const std::vector<int>& hmi_types) { - LOG4CXX_INFO(logger_, "SetDefaultHmiTypes"); + SDL_LOG_INFO("SetDefaultHmiTypes"); const auto device_id = GetCurrentDeviceId(device_handle, application_id); ApplicationOnDevice who = {device_id, application_id}; access_remote_->SetDefaultHmiTypes(who, hmi_types); @@ -2416,7 +2393,7 @@ struct HMITypeToInt { bool PolicyManagerImpl::GetHMITypes(const std::string& application_id, std::vector<int>* app_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cache_->IsDefaultPolicy(application_id)) { return false; } @@ -2433,7 +2410,7 @@ bool PolicyManagerImpl::GetHMITypes(const std::string& application_id, bool PolicyManagerImpl::CheckModule(const PTString& app_id, const PTString& module) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::ModuleType module_type; return EnumFromJsonString(module, &module_type) && access_remote_->CheckModuleType(app_id, module_type); @@ -2444,16 +2421,15 @@ void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) { if (GetDefaultHmi(who.dev_id, who.app_id, &default_hmi)) { listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi); } else { - LOG4CXX_WARN( - logger_, - "Couldn't get default HMI level for application " << who.app_id); + SDL_LOG_WARN("Couldn't get default HMI level for application " + << who.app_id); } } void PolicyManagerImpl::GetPermissions(const std::string device_id, const std::string application_id, Permissions* data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(data); std::vector<FunctionalGroupPermission> app_group_permissions; GetPermissionsForApp(device_id, application_id, app_group_permissions); @@ -2528,7 +2504,7 @@ const rpc::Optional<rpc::Boolean> PolicyManagerImpl::GetAppEncryptionRequired( const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace rpc::policy_table_interface_base; DCHECK(kDeviceId != policy_app_id); @@ -2548,7 +2524,7 @@ const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp( const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<std::string> policy_app_ids; const auto apps = cache_->GetPolicyAppIDs(); @@ -2562,14 +2538,14 @@ const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs() bool PolicyManagerImpl::FunctionGroupNeedEncryption( const std::string& policy_group) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupings functional_groupings; cache_->GetFunctionalGroupings(functional_groupings); const auto& grouping_itr = functional_groupings.find(policy_group); if (grouping_itr == functional_groupings.end()) { - LOG4CXX_WARN(logger_, "Group " << policy_group << " not found"); + SDL_LOG_WARN("Group " << policy_group << " not found"); return false; } @@ -2582,7 +2558,7 @@ bool PolicyManagerImpl::FunctionGroupNeedEncryption( const std::string PolicyManagerImpl::GetPolicyFunctionName( const uint32_t function_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return policy_table::EnumToJsonString( static_cast<policy_table::FunctionID>(function_id)); } @@ -2605,12 +2581,13 @@ const std::vector<std::string> PolicyManagerImpl::GetRPCsForFunctionGroup( } // namespace policy -__attribute__((visibility("default"))) policy::PolicyManager* CreateManager() { +__attribute__((visibility("default"))) policy::PolicyManager* CreateManager( + logger::Logger* logger_instance) { + logger::Logger::instance(logger_instance); return new policy::PolicyManagerImpl(); } __attribute__((visibility("default"))) void DeleteManager( policy::PolicyManager* pm) { delete pm; - DELETE_THREAD_LOGGER(policy::logger_); } diff --git a/src/components/policy/policy_external/src/policy_table.cc b/src/components/policy/policy_external/src/policy_table.cc index 8ca6b698d1..7d82e8b635 100644 --- a/src/components/policy/policy_external/src/policy_table.cc +++ b/src/components/policy/policy_external/src/policy_table.cc @@ -38,7 +38,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") PolicyTable::PolicyTable() : pt_data_(new SQLPTExtRepresentation()) {} @@ -46,7 +46,7 @@ PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { - LOG4CXX_INFO(logger_, "Destroying policy table."); + SDL_LOG_INFO("Destroying policy table."); } } // namespace policy diff --git a/src/components/policy/policy_external/src/policy_table/validation.cc b/src/components/policy/policy_external/src/policy_table/validation.cc index 12a79748d7..89c5992fab 100644 --- a/src/components/policy/policy_external/src/policy_table/validation.cc +++ b/src/components/policy/policy_external/src/policy_table/validation.cc @@ -14,7 +14,7 @@ bool IsPredefinedApplication(const std::string& app_id) { namespace rpc { namespace policy_table_interface_base { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") bool VerifyPredefinedApp(ApplicationPolicies::value_type& app_policies) { const std::string& app_id = app_policies.first; @@ -25,18 +25,17 @@ bool VerifyPredefinedApp(ApplicationPolicies::value_type& app_policies) { RequestTypes& predefined_request_types = *app_policies.second.RequestType; if (!predefined_request_types.is_valid()) { - LOG4CXX_WARN(logger_, - app_id << " policy invalid RequestTypes will be cleaned."); + SDL_LOG_WARN(app_id << " policy invalid RequestTypes will be cleaned."); predefined_request_types.CleanUp(); if (PT_PRELOADED == app_policies.second.GetPolicyTableType() && predefined_request_types.is_cleaned_up()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + app_id << " policy RequestTypes is empty after clean-up. Exiting."); return false; } - LOG4CXX_WARN(logger_, app_id << " request types have cleaned up."); + SDL_LOG_WARN(app_id << " request types have cleaned up."); } return true; } @@ -56,13 +55,13 @@ bool ApplicationPoliciesSection::Validate() const { // Default and PreData policies are mandatory if (apps.end() == it_default_policy || apps.end() == it_pre_data_policy) { - LOG4CXX_ERROR(logger_, "Default or preData policy is not present."); + SDL_LOG_ERROR("Default or preData policy is not present."); return false; } // Device policy is mandatory if (!device.is_initialized()) { - LOG4CXX_ERROR(logger_, "Device policy is not present."); + SDL_LOG_ERROR("Device policy is not present."); return false; } @@ -89,52 +88,48 @@ bool ApplicationPoliciesSection::Validate() const { continue; } - LOG4CXX_TRACE(logger_, "Checking app Request Types..."); + SDL_LOG_TRACE("Checking app Request Types..."); RequestTypes& app_request_types = *iter->second.RequestType; if (app_request_types.is_omitted()) { - LOG4CXX_WARN(logger_, - "RequestTypes omitted for " - << app_id << " Will be replaced with default."); + SDL_LOG_WARN("RequestTypes omitted for " + << app_id << " Will be replaced with default."); app_request_types = *apps[kDefaultApp].RequestType; ++iter; continue; } if (!app_request_types.is_valid()) { - LOG4CXX_WARN( - logger_, - "Invalid RequestTypes for " << app_id << " Will be cleaned up."); + SDL_LOG_WARN("Invalid RequestTypes for " << app_id + << " Will be cleaned up."); app_request_types.CleanUp(); if (app_request_types.is_cleaned_up()) { if (PT_PRELOADED == pt_type) { - LOG4CXX_ERROR(logger_, - "RequestTypes empty after clean-up for " - << app_id << " Exiting."); + SDL_LOG_ERROR("RequestTypes empty after clean-up for " + << app_id << " Exiting."); return false; } - LOG4CXX_WARN(logger_, - "RequestTypes empty after clean-up for " - << app_id << " Will be replaced with default."); + SDL_LOG_WARN("RequestTypes empty after clean-up for " + << app_id << " Will be replaced with default."); app_request_types = *apps[kDefaultApp].RequestType; } - LOG4CXX_DEBUG(logger_, "Clean up for " << app_id << " is done."); + SDL_LOG_DEBUG("Clean up for " << app_id << " is done."); ++iter; continue; } if (app_request_types.is_empty()) { - LOG4CXX_WARN(logger_, "RequestTypes is empty for " << app_id); + SDL_LOG_WARN("RequestTypes is empty for " << app_id); } ++iter; } - LOG4CXX_TRACE(logger_, "Checking app Request SubTypes..."); + SDL_LOG_TRACE("Checking app Request SubTypes..."); iter = apps.begin(); while (iter != end_iter) { if (it_default_policy == iter || it_pre_data_policy == iter) { @@ -146,9 +141,9 @@ bool ApplicationPoliciesSection::Validate() const { !app_params.RequestSubType.is_initialized(); if (is_request_subtype_omitted) { - LOG4CXX_WARN(logger_, - "App policy RequestSubTypes omitted." - " Will be replaced with default."); + SDL_LOG_WARN( + "App policy RequestSubTypes omitted." + " Will be replaced with default."); app_params.RequestSubType = apps[kDefaultApp].RequestSubType; ++iter; continue; @@ -156,7 +151,7 @@ bool ApplicationPoliciesSection::Validate() const { const bool is_request_subtype_empty = app_params.RequestSubType->empty(); if (is_request_subtype_empty) { - LOG4CXX_WARN(logger_, "App policy RequestSubTypes empty."); + SDL_LOG_WARN("App policy RequestSubTypes empty."); } ++iter; } @@ -260,8 +255,7 @@ bool ModuleConfig::Validate() const { ++it_endpoints) { const URLList& endpoint_list = it_endpoints->second; if (endpoint_list.end() == endpoint_list.find(kDefaultApp)) { - LOG4CXX_ERROR(logger_, - "Endpoint " << it_endpoints->first + SDL_LOG_ERROR("Endpoint " << it_endpoints->first << "does not contain default group"); return false; } @@ -332,8 +326,8 @@ bool VehicleDataItem::Validate() const { }; if (!ValidateTypes()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Unknown type: " << std::string(type) << " of " << std::string(key)); return false; } diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc index c8a1b5d7ea..05b45e5f1c 100644 --- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc @@ -41,7 +41,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") SQLPTExtRepresentation::SQLPTExtRepresentation() {} SQLPTExtRepresentation::SQLPTExtRepresentation(bool in_memory) @@ -76,7 +76,7 @@ bool SQLPTExtRepresentation::ResetUserConsent() { bool SQLPTExtRepresentation::ResetDeviceConsents() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kResetDeviceConsents)) { - LOG4CXX_WARN(logger_, "Incorrect delete statement from device_consents."); + SDL_LOG_WARN("Incorrect delete statement from device_consents."); return false; } return query.Exec(); @@ -90,10 +90,10 @@ bool SQLPTExtRepresentation::GetUserPermissionsForDevice( const std::string& device_id, StringArray* consented_groups, StringArray* disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) { - LOG4CXX_WARN(logger_, "Incorrect select from device consented groups"); + SDL_LOG_WARN("Incorrect select from device consented groups"); return false; } query.Bind(0, device_id); @@ -118,9 +118,9 @@ bool SQLPTExtRepresentation::GetPermissionsForApp( const std::string& device_id, const std::string& policy_app_id, FunctionalIdType* group_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!group_types) { - LOG4CXX_WARN(logger_, "Input parameter for group types is null."); + SDL_LOG_WARN("Input parameter for group types is null."); return false; } // Get all app groups for specified device and application @@ -171,7 +171,7 @@ bool SQLPTExtRepresentation::GetPermissionsForApp( bool SQLPTExtRepresentation::GetDeviceGroupsFromPolicies( policy_table::Strings* groups, policy_table::Strings* preconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (groups) { GatherAppGroup(kDeviceId, groups); } @@ -189,17 +189,17 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery count_query(db()); if (!count_query.Prepare(sql_pt_ext::kCountDevice)) { - LOG4CXX_WARN(logger_, "Incorrect statement for count of device."); + SDL_LOG_WARN("Incorrect statement for count of device."); return false; } count_query.Bind(0, device_id); if (!count_query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect count of device."); + SDL_LOG_WARN("Incorrect count of device."); return false; } @@ -209,7 +209,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, if (update) { utils::dbms::SQLQuery update_query(db()); if (!update_query.Prepare(sql_pt_ext::kUpdateDevice)) { - LOG4CXX_WARN(logger_, "Incorrect statement for udpate device."); + SDL_LOG_WARN("Incorrect statement for udpate device."); return false; } @@ -223,7 +223,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, update_query.Bind(7, connection_type); if (!update_query.Exec() || !update_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect update for device."); + SDL_LOG_WARN("Incorrect update for device."); return false; } @@ -233,7 +233,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, // Insert new data utils::dbms::SQLQuery insert_query(db()); if (!insert_query.Prepare(sql_pt_ext::kInsertDevice)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for device."); + SDL_LOG_WARN("Incorrect insert statement for device."); return false; } @@ -247,7 +247,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, insert_query.Bind(7, connection_type); if (!insert_query.Exec() || !insert_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert to device."); + SDL_LOG_WARN("Incorrect insert to device."); return false; } @@ -260,17 +260,17 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( const std::string& device_id, const StringArray& consented_groups, const StringArray& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery count_query(db()); if (!count_query.Prepare(sql_pt_ext::kCountDeviceConsentGroup)) { - LOG4CXX_WARN(logger_, "Incorrect count of device consented groups"); + SDL_LOG_WARN("Incorrect count of device consented groups"); return false; } count_query.Bind(0, device_id); if (!count_query.Exec()) { - LOG4CXX_WARN(logger_, "Failed count of device consented groups"); + SDL_LOG_WARN("Failed count of device consented groups"); return false; } @@ -281,8 +281,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( // Update old values if (update) { if (!query.Prepare(sql_pt_ext::kUpdateDeviceConsentedGroup)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Incorrect statement for updating consented groups on device"); return false; } @@ -298,8 +297,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( query.Bind(3, *it_consented_groups); // TODO(AOleynik): Get this info from external data if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Failed update of device allowed consented groups."); + SDL_LOG_WARN("Failed update of device allowed consented groups."); return false; } } @@ -315,8 +313,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( query.Bind(2, device_id); query.Bind(3, *it_disallowed_groups); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Failed update of device disallowed consented groups."); + SDL_LOG_WARN("Failed update of device disallowed consented groups."); return false; } } @@ -326,8 +323,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( // Insert new values if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) { - LOG4CXX_WARN(logger_, - "Incorrect statement of inserting to device consented groups"); + SDL_LOG_WARN("Incorrect statement of inserting to device consented groups"); return false; } @@ -341,8 +337,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( // TODO(AOleynik): Get this info from external data query.Bind(3, std::string("GUI")); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Failed insert to device allowed consented groups."); + SDL_LOG_WARN("Failed insert to device allowed consented groups."); return false; } } @@ -357,8 +352,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( query.Bind(2, false); query.Bind(3); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Failed insert to device disallowed consented groups."); + SDL_LOG_WARN("Failed insert to device disallowed consented groups."); return false; } } @@ -376,15 +370,13 @@ bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp( if (IsPredataPolicy(app_id)) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kHasAppPreloadedGroups)) { - LOG4CXX_WARN(logger_, - "Incorrect statement for has app preloaded groups"); + SDL_LOG_WARN("Incorrect statement for has app preloaded groups"); return false; } query.Bind(0, app_id); query.Bind(1, kPreDataConsentId); if (!query.Exec()) { - LOG4CXX_WARN(logger_, - "Incorrect select for app has predataconsted groups"); + SDL_LOG_WARN("Incorrect select for app has predataconsted groups"); return false; } if (query.GetInteger(0) > 0) { @@ -408,7 +400,7 @@ bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp( bool SQLPTExtRepresentation::SetUserPermissionsForApp( const PermissionConsent& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO(AOleynik): Handle situation, when no application was specified, i.e. // general permissions were set std::vector<FunctionalGroupPermission>::const_iterator it = @@ -420,7 +412,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( for (; it != it_end; ++it) { utils::dbms::SQLQuery counter(db()); if (!counter.Prepare(sql_pt_ext::kCountAppConsents)) { - LOG4CXX_WARN(logger_, "Incorrect statement for consent group count."); + SDL_LOG_WARN("Incorrect statement for consent group count."); return false; } @@ -428,7 +420,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( counter.Bind(1, permissions.policy_app_id); counter.Bind(2, static_cast<int>((*it).group_id)); if (!counter.Exec()) { - LOG4CXX_WARN(logger_, "Incorrent count on consent groups."); + SDL_LOG_WARN("Incorrent count on consent groups."); return false; } @@ -437,7 +429,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( // Update already present consent record if (update_required) { if (!query.Prepare(sql_pt_ext::kUpdateGroupPermissions)) { - LOG4CXX_WARN(logger_, "Incorrect statement for update consent groups."); + SDL_LOG_WARN("Incorrect statement for update consent groups."); return false; } @@ -452,9 +444,9 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( query.Bind(4, permissions.device_id); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Incorrect update on user defined permissions " - "for app groups."); + SDL_LOG_WARN( + "Incorrect update on user defined permissions " + "for app groups."); return false; } continue; @@ -462,8 +454,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( // Insert new consent record if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) { - LOG4CXX_WARN(logger_, - "Incorrect statement for update app group permissions."); + SDL_LOG_WARN("Incorrect statement for update app group permissions."); return false; } @@ -478,9 +469,9 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( query.Bind(4, permissions.consent_source); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Incorrect insert to user defined permissions " - "for app groups."); + SDL_LOG_WARN( + "Incorrect insert to user defined permissions " + "for app groups."); return false; } continue; @@ -493,7 +484,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( utils::dbms::SQLQuery query(db()); std::vector<UserFriendlyMessage> result; if (!query.Prepare(sql_pt_ext::kSelectFriendlyMsg)) { - LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages."); + SDL_LOG_WARN("Incorrect statement for select friendly messages."); return result; } @@ -511,7 +502,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( query.Bind(1, msg_language); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect select from friendly messages."); + SDL_LOG_WARN("Incorrect select from friendly messages."); return result; } @@ -527,9 +518,9 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( result.push_back(msg); if (!query.Reset()) { - LOG4CXX_WARN(logger_, - "Failed reset statement for selecting friendly " - "messages."); + SDL_LOG_WARN( + "Failed reset statement for selecting friendly " + "messages."); return result; } } @@ -540,7 +531,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages( policy_table::ConsumerFriendlyMessages* messages) const { if (NULL == messages) { - LOG4CXX_ERROR(logger_, "NULL pointer has been passed to fill"); + SDL_LOG_ERROR("NULL pointer has been passed to fill"); return false; } @@ -583,7 +574,7 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages( } } } else { - LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages."); + SDL_LOG_WARN("Incorrect statement for select friendly messages."); } return result; } @@ -591,10 +582,10 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages( bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateMetaParams)) { - LOG4CXX_WARN(logger_, "Incorrect statement for insert to module meta."); + SDL_LOG_WARN("Incorrect statement for insert to module meta."); return false; } @@ -603,22 +594,22 @@ bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version, query.Bind(2, language); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert to module meta."); + SDL_LOG_WARN("Incorrect insert to module meta."); return false; } return true; } bool SQLPTExtRepresentation::IsMetaInfoPresent() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectMetaParams)) { - LOG4CXX_WARN(logger_, "Incorrect statement for selecting meta info."); + SDL_LOG_WARN("Incorrect statement for selecting meta info."); return false; } if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect select from module meta."); + SDL_LOG_WARN("Incorrect select from module meta."); return false; } @@ -626,17 +617,17 @@ bool SQLPTExtRepresentation::IsMetaInfoPresent() { } bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateMetaLanguage)) { - LOG4CXX_WARN(logger_, "Incorrect statement for update meta language."); + SDL_LOG_WARN("Incorrect statement for update meta language."); return false; } query.Bind(0, language); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update for meta language."); + SDL_LOG_WARN("Incorrect update for meta language."); return false; } @@ -645,46 +636,46 @@ bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) { bool SQLPTExtRepresentation::SaveApplicationPoliciesSection( const policy_table::ApplicationPoliciesSection& policies) { - LOG4CXX_INFO(logger_, "SaveApplicationPolicies ext"); + SDL_LOG_INFO("SaveApplicationPolicies ext"); utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); + SDL_LOG_WARN("Incorrect delete from app_group."); return false; } utils::dbms::SQLQuery query_delete_preconsented(db()); if (!query_delete_preconsented.Exec(sql_pt_ext::kDeletePreconsentedGroups)) { - LOG4CXX_WARN(logger_, "Incorrect delete from preconsented_group."); + SDL_LOG_WARN("Incorrect delete from preconsented_group."); return false; } if (!query_delete.Exec(sql_pt::kDeleteApplication)) { - LOG4CXX_WARN(logger_, "Incorrect delete from application."); + SDL_LOG_WARN("Incorrect delete from application."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestType)) { - LOG4CXX_WARN(logger_, "Incorrect delete from request type."); + SDL_LOG_WARN("Incorrect delete from request type."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestSubType)) { - LOG4CXX_WARN(logger_, "Incorrect delete from request subtype."); + SDL_LOG_WARN("Incorrect delete from request subtype."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs."); + SDL_LOG_WARN("Incorrect delete from handled rpcs."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect delete from service names."); + SDL_LOG_WARN("Incorrect delete from service names."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled service types."); + SDL_LOG_WARN("Incorrect delete from handled service types."); return false; } @@ -755,7 +746,7 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy( utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + SDL_LOG_WARN("Incorrect insert statement into application."); return false; } @@ -799,7 +790,7 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy( : app_query.Bind(16); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -843,8 +834,7 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy( const policy_table::DevicePolicy& device) { utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement into application (device)."); + SDL_LOG_WARN("Incorrect insert statement into application (device)."); return false; } app_query.Bind(0, kDeviceId); @@ -859,7 +849,7 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy( app_query.Bind(7, 0); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -875,10 +865,10 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy( bool SQLPTExtRepresentation::GatherApplicationPoliciesSection( policy_table::ApplicationPoliciesSection* policies) const { - LOG4CXX_INFO(logger_, "Gather applications policies"); + SDL_LOG_INFO("Gather applications policies"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectAppPolicies)) { - LOG4CXX_WARN(logger_, "Incorrect select from app_policies"); + SDL_LOG_WARN("Incorrect select from app_policies"); return false; } @@ -990,7 +980,7 @@ void SQLPTExtRepresentation::GatherPreconsentedGroup( const std::string& app_id, policy_table::Strings* groups) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select from preconsented group"); + SDL_LOG_WARN("Incorrect select from preconsented group"); return; } @@ -1002,10 +992,10 @@ void SQLPTExtRepresentation::GatherPreconsentedGroup( bool SQLPTExtRepresentation::GatherUsageAndErrorCounts( policy_table::UsageAndErrorCounts* counts) const { - LOG4CXX_INFO(logger_, "Gather Usage and Error Counts."); + SDL_LOG_INFO("Gather Usage and Error Counts."); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectUsageAndErrorCount) || !query.Exec()) { - LOG4CXX_INFO(logger_, "Failed select from user_and_error_count"); + SDL_LOG_INFO("Failed select from user_and_error_count"); return false; } @@ -1020,9 +1010,8 @@ bool SQLPTExtRepresentation::GatherAppLevels( policy_table::AppLevels* apps) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectAppLevels)) { - LOG4CXX_INFO(logger_, - "Failed select from app_level. SQLError = " - << query.LastError().text()); + SDL_LOG_INFO("Failed select from app_level. SQLError = " + << query.LastError().text()); return false; } while (query.Next()) { @@ -1051,10 +1040,10 @@ bool SQLPTExtRepresentation::GatherAppLevels( void SQLPTExtRepresentation::GatherDeviceData( policy_table::DeviceData* data) const { - LOG4CXX_INFO(logger_, "Gather device data."); + SDL_LOG_INFO("Gather device data."); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectDeviceData)) { - LOG4CXX_WARN(logger_, "Incorrect select statement for device data."); + SDL_LOG_WARN("Incorrect select statement for device data."); return; } data->mark_initialized(); @@ -1076,12 +1065,11 @@ void SQLPTExtRepresentation::GatherDeviceData( void SQLPTExtRepresentation::GatherConsentGroup( const std::string& device_id, policy_table::UserConsentRecords* records) const { - LOG4CXX_INFO(logger_, "Gather consent records."); + SDL_LOG_INFO("Gather consent records."); utils::dbms::SQLQuery query(db()); // Fill data for device if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for device consented groups."); + SDL_LOG_WARN("Incorrect select statement for device consented groups."); return; } @@ -1107,8 +1095,7 @@ void SQLPTExtRepresentation::GatherConsentGroup( // Fill data for applications if (!query.Prepare(sql_pt_ext::kSelectConsentGroup)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for app consented groups."); + SDL_LOG_WARN("Incorrect select statement for app consented groups."); return; } @@ -1135,8 +1122,8 @@ void SQLPTExtRepresentation::GatherConsentGroup( // Fill data for ExternalConsent consents if (!query.Prepare(sql_pt_ext::kSelectExternalConsentStatusGroup)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Incorrect select statement for ExternalConsent consented groups."); return; } @@ -1159,31 +1146,31 @@ void SQLPTExtRepresentation::GatherConsentGroup( bool SQLPTExtRepresentation::SaveDeviceData( const policy_table::DeviceData& devices) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery drop_device_query(db()); const std::string drop_device = "DELETE FROM `device`"; if (!drop_device_query.Exec(drop_device)) { - LOG4CXX_WARN(logger_, "Could not clear device table."); + SDL_LOG_WARN("Could not clear device table."); return false; } utils::dbms::SQLQuery drop_device_consents_query(db()); const std::string drop_device_consents = "DELETE FROM `device_consent_group`"; if (!drop_device_consents_query.Exec(drop_device_consents)) { - LOG4CXX_WARN(logger_, "Could not clear device consents."); + SDL_LOG_WARN("Could not clear device consents."); return false; } utils::dbms::SQLQuery drop_user_consents_query(db()); const std::string drop_user_consents = "DELETE FROM `consent_group`"; if (!drop_user_consents_query.Exec(drop_user_consents)) { - LOG4CXX_WARN(logger_, "Could not clear user consents."); + SDL_LOG_WARN("Could not clear user consents."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kInsertDeviceData)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for device data."); + SDL_LOG_WARN("Incorrect insert statement for device data."); return false; } @@ -1200,7 +1187,7 @@ bool SQLPTExtRepresentation::SaveDeviceData( query.Bind(7, *(it->second.connection_type)); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into device data."); + SDL_LOG_WARN("Incorrect insert into device data."); return false; } @@ -1216,7 +1203,7 @@ bool SQLPTExtRepresentation::SaveDeviceData( bool SQLPTExtRepresentation::SaveConsentGroup( const std::string& device_id, const policy_table::UserConsentRecords& records) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); policy_table::UserConsentRecords::const_iterator it = records.begin(); @@ -1230,8 +1217,7 @@ bool SQLPTExtRepresentation::SaveConsentGroup( for (; it_groups != it_groups_end; ++it_groups) { if (kDeviceId == it->first) { if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for device consent group."); + SDL_LOG_WARN("Incorrect insert statement for device consent group."); return false; } query.Bind(0, device_id); @@ -1241,16 +1227,13 @@ bool SQLPTExtRepresentation::SaveConsentGroup( 3, std::string(policy_table::EnumToJsonString(*(it->second.input)))); query.Bind(4, std::string(*(it->second.time_stamp))); - LOG4CXX_INFO(logger_, - "Device:" - << "time stamp " - << std::string(*(it->second.time_stamp)) << " group " - << it_groups->first << " consent " - << it_groups->second); + SDL_LOG_INFO("Device:" + << "time stamp " << std::string(*(it->second.time_stamp)) + << " group " << it_groups->first << " consent " + << it_groups->second); } else { if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for consent group."); + SDL_LOG_WARN("Incorrect insert statement for consent group."); return false; } query.Bind(0, device_id); @@ -1262,16 +1245,14 @@ bool SQLPTExtRepresentation::SaveConsentGroup( std::string(policy_table::EnumToJsonString(*(it->second.input)))); query.Bind(5, std::string(*(it->second.time_stamp))); query.Bind(6, (it->second.consent_last_updated)); - LOG4CXX_INFO(logger_, - "Device:" - << "time stamp " - << std::string(*(it->second.time_stamp)) << " group " - << it_groups->first << " consent " - << it_groups->second); + SDL_LOG_INFO("Device:" + << "time stamp " << std::string(*(it->second.time_stamp)) + << " group " << it_groups->first << " consent " + << it_groups->second); } if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into consent group."); + SDL_LOG_WARN("Incorrect insert into consent group."); return false; } } @@ -1284,8 +1265,7 @@ bool SQLPTExtRepresentation::SaveConsentGroup( for (; end_external_consent_consent != it_external_consent_consent; ++it_external_consent_consent) { if (!query.Prepare(sql_pt_ext::kInsertExternalConsentStatusGroups)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for external consent group."); + SDL_LOG_WARN("Incorrect insert statement for external consent group."); return false; } query.Bind(0, device_id); @@ -1296,14 +1276,13 @@ bool SQLPTExtRepresentation::SaveConsentGroup( 4, std::string(policy_table::EnumToJsonString(*(it->second.input)))); query.Bind(5, std::string(*(it->second.time_stamp))); query.Bind(6, (it->second.ext_consent_last_updated)); - LOG4CXX_INFO(logger_, - "Device:" - << "time stamp " << std::string(*(it->second.time_stamp)) - << " group " << it_external_consent_consent->first - << " consent " << it_external_consent_consent->second); + SDL_LOG_INFO("Device:" + << "time stamp " << std::string(*(it->second.time_stamp)) + << " group " << it_external_consent_consent->first + << " consent " << it_external_consent_consent->second); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into external consent group."); + SDL_LOG_WARN("Incorrect insert into external consent group."); return false; } } // external_consent_consent_group @@ -1314,10 +1293,10 @@ bool SQLPTExtRepresentation::SaveConsentGroup( bool SQLPTExtRepresentation::SavePreconsentedGroup( const std::string& app_id, const policy_table::Strings& groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kInsertPreconsentedGroups)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for preconsented groups"); + SDL_LOG_WARN("Incorrect insert statement for preconsented groups"); return false; } @@ -1326,7 +1305,7 @@ bool SQLPTExtRepresentation::SavePreconsentedGroup( query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into preconsented groups."); + SDL_LOG_WARN("Incorrect insert into preconsented groups."); return false; } } @@ -1336,7 +1315,7 @@ bool SQLPTExtRepresentation::SavePreconsentedGroup( void SQLPTExtRepresentation::GatherModuleMeta( policy_table::ModuleMeta* meta) const { - LOG4CXX_INFO(logger_, "Gather Module Meta Info"); + SDL_LOG_INFO("Gather Module Meta Info"); utils::dbms::SQLQuery query(db()); if (query.Prepare(sql_pt_ext::kSelectModuleMeta) && query.Next()) { *meta->ccpu_version = query.GetString(0); @@ -1354,19 +1333,19 @@ void SQLPTExtRepresentation::Increment(const std::string& type) const { std::string update_counter = "UPDATE `usage_and_error_count` SET `" + type + "` = `" + type + "` + 1"; if (!query.Exec(update_counter)) { - LOG4CXX_INFO(logger_, "Failed updating global counter"); + SDL_LOG_INFO("Failed updating global counter"); } } bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kCountAppLevel)) { - LOG4CXX_INFO(logger_, "Incorrect statement of count app_level"); + SDL_LOG_INFO("Incorrect statement of count app_level"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Failed count app_level"); + SDL_LOG_INFO("Failed count app_level"); return false; } return query.GetInteger(0) > 0; @@ -1374,10 +1353,10 @@ bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const { bool SQLPTExtRepresentation::GetAllAppGroups(const std::string& policy_app_id, FunctionalGroupIDs& all_groups) { - LOG4CXX_INFO(logger_, "GetAllAppGroups for '" << policy_app_id << "'"); + SDL_LOG_INFO("GetAllAppGroups for '" << policy_app_id << "'"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectAppGroupsId)) { - LOG4CXX_WARN(logger_, "Incorrect statement for select app groups id."); + SDL_LOG_WARN("Incorrect statement for select app groups id."); return false; } @@ -1395,10 +1374,10 @@ bool SQLPTExtRepresentation::GetConsentedGroups( const std::string& device_id, FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectConsentedGroupsId)) { - LOG4CXX_WARN(logger_, "Incorrect statement for select consent groups id."); + SDL_LOG_WARN("Incorrect statement for select consent groups id."); return false; } @@ -1418,11 +1397,10 @@ bool SQLPTExtRepresentation::GetConsentedGroups( bool SQLPTExtRepresentation::GetPreconsentedGroups( const std::string& policy_app_id, FunctionalGroupIDs& preconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroupsId)) { - LOG4CXX_WARN(logger_, - "Incorrect statement for select preconsented groups id."); + SDL_LOG_WARN("Incorrect statement for select preconsented groups id."); return false; } @@ -1437,11 +1415,10 @@ bool SQLPTExtRepresentation::GetPreconsentedGroups( bool SQLPTExtRepresentation::GetFunctionalGroupNames( FunctionalGroupNames& names) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectFunctionalGroupNames)) { - LOG4CXX_WARN(logger_, - "Incorrect statement for select functional groups names."); + SDL_LOG_WARN("Incorrect statement for select functional groups names."); return false; } @@ -1491,12 +1468,12 @@ void SQLPTExtRepresentation::Increment(const std::string& app_id, "VALUES (?, 1)"; } if (!query.Prepare(sql_counter)) { - LOG4CXX_INFO(logger_, "Incorrect statement of update app counter"); + SDL_LOG_INFO("Incorrect statement of update app counter"); return; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Failed updating app counter"); + SDL_LOG_INFO("Failed updating app counter"); } } @@ -1517,13 +1494,13 @@ void SQLPTExtRepresentation::Set(const std::string& app_id, "VALUES (?, ?)"; } if (!query.Prepare(sql_info)) { - LOG4CXX_INFO(logger_, "Incorrect statement of update app info"); + SDL_LOG_INFO("Incorrect statement of update app info"); return; } query.Bind(0, value); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Failed updating app info"); + SDL_LOG_INFO("Failed updating app info"); } } @@ -1543,29 +1520,29 @@ void SQLPTExtRepresentation::Add(const std::string& app_id, "VALUES (?, ?)"; } if (!query.Prepare(sql_stopwatch)) { - LOG4CXX_INFO(logger_, "Incorrect statement of update app stopwatch"); + SDL_LOG_INFO("Incorrect statement of update app stopwatch"); return; } query.Bind(0, seconds); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Failed updating app stopwatch"); + SDL_LOG_INFO("Failed updating app stopwatch"); } } bool SQLPTExtRepresentation::GetDefaultHMI(const std::string& policy_app_id, std::string* default_hmi) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectDefaultHmi)) { - LOG4CXX_INFO(logger_, "Incorrect statement for default hmi."); + SDL_LOG_INFO("Incorrect statement for default hmi."); return false; } query.Bind(0, policy_app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Error during default hmi getting."); + SDL_LOG_INFO("Error during default hmi getting."); return false; } @@ -1583,10 +1560,10 @@ bool SQLPTExtRepresentation::CountUnconsentedGroups( const std::string& policy_app_id, const std::string& device_id, int* result) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kCountUnconsentedGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select for unconsented groups."); + SDL_LOG_WARN("Incorrect select for unconsented groups."); return false; } @@ -1596,7 +1573,7 @@ bool SQLPTExtRepresentation::CountUnconsentedGroups( query.Bind(3, kPreDataConsentId); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Error during executing unconsented groups."); + SDL_LOG_INFO("Error during executing unconsented groups."); return false; } *result = query.GetInteger(0); @@ -1607,7 +1584,7 @@ bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string& message, const std::string& language) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kHasMsgLanguageCode)) { - LOG4CXX_WARN(logger_, "Incorrect statement for message language check."); + SDL_LOG_WARN("Incorrect statement for message language check."); return false; } @@ -1615,7 +1592,7 @@ bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string& message, query.Bind(1, language); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to check message language code."); + SDL_LOG_WARN("Failed to check message language code."); return false; } @@ -1628,7 +1605,7 @@ bool SQLPTExtRepresentation::SaveMessageString( const policy_table::MessageString& strings) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertMessageString)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for message."); + SDL_LOG_WARN("Incorrect insert statement for message."); return false; } @@ -1651,7 +1628,7 @@ bool SQLPTExtRepresentation::SaveMessageString( } if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into message."); + SDL_LOG_WARN("Incorrect insert into message."); return false; } @@ -1668,7 +1645,7 @@ bool SQLPTExtRepresentation::SaveModuleMeta( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSaveModuleMeta)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for module_meta."); + SDL_LOG_WARN("Incorrect insert statement for module_meta."); return false; } const int64_t odometer = *(meta.pt_exchanged_at_odometer_x); @@ -1682,7 +1659,7 @@ bool SQLPTExtRepresentation::SaveModuleMeta( query.Bind(6, *(meta.vin)); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update for module_meta."); + SDL_LOG_WARN("Incorrect update for module_meta."); return false; } @@ -1693,11 +1670,11 @@ bool SQLPTExtRepresentation::SaveAppCounters( const rpc::policy_table_interface_base::AppLevels& app_levels) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app level."); + SDL_LOG_WARN("Incorrect delete from app level."); return false; } if (!query.Prepare(sql_pt::kInsertAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app level."); + SDL_LOG_WARN("Incorrect insert statement for app level."); return false; } @@ -1721,7 +1698,7 @@ bool SQLPTExtRepresentation::SaveAppCounters( query.Bind(15, it->second.count_of_tls_errors); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app level."); + SDL_LOG_WARN("Incorrect insert into app level."); return false; } } @@ -1732,7 +1709,7 @@ bool SQLPTExtRepresentation::SaveGlobalCounters( const rpc::policy_table_interface_base::UsageAndErrorCounts& counts) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateGlobalCounters)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for global counters."); + SDL_LOG_WARN("Incorrect insert statement for global counters."); return false; } @@ -1741,7 +1718,7 @@ bool SQLPTExtRepresentation::SaveGlobalCounters( query.Bind(2, *counts.count_of_sync_reboots); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into global counters."); + SDL_LOG_WARN("Incorrect insert into global counters."); return false; } @@ -1750,22 +1727,22 @@ bool SQLPTExtRepresentation::SaveGlobalCounters( bool SQLPTExtRepresentation::CleanupUnpairedDevices( const DeviceIds& device_ids) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery delete_device_query(db()); if (!delete_device_query.Prepare(sql_pt::kDeleteDevice)) { - LOG4CXX_WARN(logger_, "Incorrect statement for device delete."); + SDL_LOG_WARN("Incorrect statement for device delete."); return true; } utils::dbms::SQLQuery delete_device_consent_query(db()); if (!delete_device_consent_query.Prepare(sql_pt_ext::kDeleteDeviceConsent)) { - LOG4CXX_WARN(logger_, "Incorrect statement for delete device consent."); + SDL_LOG_WARN("Incorrect statement for delete device consent."); return false; } utils::dbms::SQLQuery delete_app_consent_query(db()); if (!delete_app_consent_query.Prepare(sql_pt_ext::kDeleteAppConsent)) { - LOG4CXX_WARN(logger_, "Incorrect statement for delete app consent."); + SDL_LOG_WARN("Incorrect statement for delete app consent."); return false; } @@ -1774,20 +1751,20 @@ bool SQLPTExtRepresentation::CleanupUnpairedDevices( for (; it != it_end; ++it) { delete_device_query.Bind(0, (*it)); if (!delete_device_query.Exec() || !delete_device_query.Reset()) { - LOG4CXX_WARN(logger_, "Failed to delete from device"); + SDL_LOG_WARN("Failed to delete from device"); return false; } delete_device_consent_query.Bind(0, (*it)); if (!delete_device_consent_query.Exec() || !delete_device_consent_query.Reset()) { - LOG4CXX_WARN(logger_, "Failed to delete from device consent."); + SDL_LOG_WARN("Failed to delete from device consent."); return false; } delete_app_consent_query.Bind(0, (*it)); if (!delete_app_consent_query.Exec() || !delete_app_consent_query.Reset()) { - LOG4CXX_WARN(logger_, "Failed to delete from app consent."); + SDL_LOG_WARN("Failed to delete from app consent."); return false; } } @@ -1797,22 +1774,22 @@ bool SQLPTExtRepresentation::CleanupUnpairedDevices( bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } @@ -1835,26 +1812,25 @@ bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) { } bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) { - LOG4CXX_INFO(logger_, - "SQLPTExtRepresentation::SetPredataPolicy for " << app_id); + SDL_LOG_INFO("SQLPTExtRepresentation::SetPredataPolicy for " << app_id); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } @@ -1878,13 +1854,13 @@ bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) { bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectApplicationIsPreData)) { - LOG4CXX_WARN(logger_, "Incorrect select application is pre_dataConsented"); + SDL_LOG_WARN("Incorrect select application is pre_dataConsented"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select application is pre_dataConsented"); + SDL_LOG_WARN("Failed select application is pre_dataConsented"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -1892,17 +1868,17 @@ bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const { bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id, bool is_pre_data) { - LOG4CXX_TRACE(logger_, "Set flag is_predata of application"); + SDL_LOG_TRACE("Set flag is_predata of application"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateIsPredata)) { - LOG4CXX_WARN(logger_, "Incorect statement for updating is_predata"); + SDL_LOG_WARN("Incorect statement for updating is_predata"); return false; } query.Bind(0, is_pre_data); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update is_predata"); + SDL_LOG_WARN("Failed update is_predata"); return false; } return true; @@ -1910,27 +1886,27 @@ bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id, bool SQLPTExtRepresentation::SetUnpairedDevice(const std::string& device_id, bool unpaired) const { - LOG4CXX_TRACE(logger_, "Set unpaired device: " << device_id); + SDL_LOG_TRACE("Set unpaired device: " << device_id); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateUnpairedDevice)) { - LOG4CXX_WARN(logger_, "Incorect statement for updating unpaired device"); + SDL_LOG_WARN("Incorect statement for updating unpaired device"); return false; } query.Bind(0, unpaired); query.Bind(1, device_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update unpaired device"); + SDL_LOG_WARN("Failed update unpaired device"); return false; } return true; } bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const { - LOG4CXX_TRACE(logger_, "Get list of unpaired devices"); + SDL_LOG_TRACE("Get list of unpaired devices"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectUnpairedDevices)) { - LOG4CXX_WARN(logger_, "Incorect statement for selecting unpaired devices"); + SDL_LOG_WARN("Incorect statement for selecting unpaired devices"); return false; } @@ -1943,7 +1919,7 @@ bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const { bool SQLPTExtRepresentation::SetVINValue(const std::string& value) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateModuleMetaVinParam)) { - LOG4CXX_WARN(logger_, "Incorect statement for updating module_meta params"); + SDL_LOG_WARN("Incorect statement for updating module_meta params"); return false; } @@ -1951,18 +1927,17 @@ bool SQLPTExtRepresentation::SetVINValue(const std::string& value) { const bool result = query.Exec(); if (!result) { - LOG4CXX_WARN(logger_, "Failed update module_meta"); + SDL_LOG_WARN("Failed update module_meta"); } return result; } bool SQLPTExtRepresentation::SaveExternalConsentStatus( const ExternalConsentStatus& status) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kInsertExternalConsentStatus)) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for saving external consent status."); + SDL_LOG_ERROR("Incorrect statement for saving external consent status."); return false; } @@ -1978,7 +1953,7 @@ bool SQLPTExtRepresentation::SaveExternalConsentStatus( policy::kStatusOn == it->status_ ? std::string("ON") : std::string("OFF")); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR(logger_, "Error during ExternalConsent status saving."); + SDL_LOG_ERROR("Error during ExternalConsent status saving."); return false; } } @@ -1987,11 +1962,10 @@ bool SQLPTExtRepresentation::SaveExternalConsentStatus( } ExternalConsentStatus SQLPTExtRepresentation::GetExternalConsentStatus() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectExternalConsentStatus)) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for selecting external consent status."); + SDL_LOG_ERROR("Incorrect statement for selecting external consent status."); return ExternalConsentStatus(); } @@ -2013,14 +1987,14 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup( const std::string& functional_group_name) const { utils::dbms::SQLQuery query_group_id(db()); if (!query_group_id.Prepare(sql_pt_ext::kSelectGroupId)) { - LOG4CXX_WARN(logger_, "Incorect statement for select group name."); + SDL_LOG_WARN("Incorect statement for select group name."); return false; } query_group_id.Bind(0, functional_group_name); if (!query_group_id.Exec()) { - LOG4CXX_WARN(logger_, "Failed to select group id."); + SDL_LOG_WARN("Failed to select group id."); return false; } @@ -2028,7 +2002,7 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kDeleteAppGroupConsent)) { - LOG4CXX_WARN(logger_, "Incorect statement for remove app consent."); + SDL_LOG_WARN("Incorect statement for remove app consent."); return false; } @@ -2036,7 +2010,7 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup( query.Bind(1, id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to remove app consent."); + SDL_LOG_WARN("Failed to remove app consent."); return false; } diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index a7658740c4..36e363d922 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -51,7 +51,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") namespace dbms = utils::dbms; @@ -108,8 +108,8 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id, utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRpc)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Incorrect select statement from rpcs" << query.LastError().text()); return; } @@ -119,8 +119,7 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id, bool ret = query.Next(); result.hmi_level_permitted = ret ? kRpcAllowed : kRpcDisallowed; - LOG4CXX_INFO(logger_, - "Level is " << (result.hmi_level_permitted == kRpcAllowed + SDL_LOG_INFO("Level is " << (result.hmi_level_permitted == kRpcAllowed ? "permitted" : "not permitted")); std::string parameter; @@ -141,7 +140,7 @@ bool SQLPTRepresentation::IsPTPreloaded() { int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectIgnitionCycles) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select ignition cycles"); + SDL_LOG_WARN("Can not select ignition cycles"); return 0; } int limit = query.GetInteger(0); @@ -157,7 +156,7 @@ int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { int SQLPTRepresentation::KilometersBeforeExchange(int current) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectKilometers) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select kilometers"); + SDL_LOG_WARN("Can not select kilometers"); return 0; } int limit = query.GetInteger(0); @@ -173,17 +172,16 @@ int SQLPTRepresentation::KilometersBeforeExchange(int current) { bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( int kilometers, int days_after_epoch) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateCountersSuccessfulUpdate)) { - LOG4CXX_WARN(logger_, - "Wrong update query for counters on successful update."); + SDL_LOG_WARN("Wrong update query for counters on successful update."); return false; } query.Bind(0, kilometers); query.Bind(1, days_after_epoch); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to update counters on successful update."); + SDL_LOG_WARN("Failed to update counters on successful update."); return false; } return true; @@ -192,7 +190,7 @@ bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( int SQLPTRepresentation::DaysBeforeExchange(uint16_t current) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectDays) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select days"); + SDL_LOG_WARN("Can not select days"); return 0; } int limit = query.GetInteger(0); @@ -212,7 +210,7 @@ int SQLPTRepresentation::DaysBeforeExchange(uint16_t current) { int SQLPTRepresentation::TimeoutResponse() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) { - LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence"); + SDL_LOG_INFO("Can not select timeout response for retry sequence"); const int defaultTimeout = 30 * date_time::MILLISECONDS_IN_SECOND; return defaultTimeout; } @@ -222,8 +220,7 @@ int SQLPTRepresentation::TimeoutResponse() { bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { - LOG4CXX_INFO(logger_, - "Incorrect select statement from seconds between retries"); + SDL_LOG_INFO("Incorrect select statement from seconds between retries"); return false; } while (query.Next()) { @@ -246,8 +243,7 @@ std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg( } EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { - LOG4CXX_INFO(logger_, - "SQLPTRepresentation::GetUpdateUrls for " << service_type); + SDL_LOG_INFO("SQLPTRepresentation::GetUpdateUrls for " << service_type); utils::dbms::SQLQuery query(db()); EndpointUrls ret; if (query.Prepare(sql_pt::kSelectEndpoint)) { @@ -262,23 +258,23 @@ EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { ret.push_back(data); } } else { - LOG4CXX_WARN(logger_, "Invalid select endpoints statement."); + SDL_LOG_WARN("Invalid select endpoints statement."); } return ret; } int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectNotificationsPerPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for priority " - "notification number."); + SDL_LOG_WARN( + "Incorrect select statement for priority " + "notification number."); return 0; } query.Bind(0, priority); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority."); + SDL_LOG_WARN("Incorrect select from notifications by priority."); return 0; } @@ -291,21 +287,21 @@ int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, std::string* priority) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (NULL == priority) { - LOG4CXX_WARN(logger_, "Input priority parameter is null."); + SDL_LOG_WARN("Input priority parameter is null."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectPriority)) { - LOG4CXX_INFO(logger_, "Incorrect statement for priority."); + SDL_LOG_INFO("Incorrect statement for priority."); return false; } query.Bind(0, policy_app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Error during select priority."); + SDL_LOG_INFO("Error during select priority."); return false; } @@ -321,7 +317,7 @@ bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { settings_ = settings; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef BUILD_TESTS open_counter_ = 0; #endif // BUILD_TESTS @@ -334,60 +330,57 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { } #endif // __QNX__ if (!db_->Open()) { - LOG4CXX_ERROR(logger_, "Failed opening database."); - LOG4CXX_INFO(logger_, "Starting opening retries."); + SDL_LOG_ERROR("Failed opening database."); + SDL_LOG_INFO("Starting opening retries."); const uint16_t attempts = get_settings().attempts_to_open_policy_db(); - LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts); + SDL_LOG_DEBUG("Total attempts number is: " << attempts); bool is_opened = false; const uint16_t open_attempt_timeout_ms = get_settings().open_attempt_timeout_ms(); const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000; - LOG4CXX_DEBUG(logger_, - "Open attempt timeout(ms) is: " << open_attempt_timeout_ms); + SDL_LOG_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms); for (int i = 0; i < attempts; ++i) { usleep(sleep_interval_mcsec); - LOG4CXX_INFO(logger_, "Attempt: " << i + 1); + SDL_LOG_INFO("Attempt: " << i + 1); #ifdef BUILD_TESTS ++open_counter_; #endif // BUILD_TESTS if (db_->Open()) { - LOG4CXX_INFO(logger_, "Database opened."); + SDL_LOG_INFO("Database opened."); is_opened = true; break; } } if (!is_opened) { - LOG4CXX_ERROR(logger_, - "Open retry sequence failed. Tried " - << attempts << " attempts with " - << open_attempt_timeout_ms - << " open timeout(ms) for each."); + SDL_LOG_ERROR("Open retry sequence failed. Tried " + << attempts << " attempts with " << open_attempt_timeout_ms + << " open timeout(ms) for each."); return InitResult::FAIL; } } #ifndef __QNX__ if (!db_->IsReadWrite()) { - LOG4CXX_ERROR(logger_, "There are no read/write permissions for database"); + SDL_LOG_ERROR("There are no read/write permissions for database"); return InitResult::FAIL; } #endif // __QNX__ utils::dbms::SQLQuery check_pages(db()); if (!check_pages.Prepare(sql_pt::kCheckPgNumber) || !check_pages.Next()) { - LOG4CXX_WARN(logger_, "Incorrect pragma for page counting."); + SDL_LOG_WARN("Incorrect pragma for page counting."); } else { if (0 < check_pages.GetInteger(0)) { utils::dbms::SQLQuery db_check(db()); if (!db_check.Prepare(sql_pt::kCheckDBIntegrity)) { - LOG4CXX_WARN(logger_, "Incorrect pragma for integrity check."); + SDL_LOG_WARN("Incorrect pragma for integrity check."); } else { while (db_check.Next()) { if (db_check.GetString(0).compare("ok") == 0) { utils::dbms::SQLQuery check_first_run(db()); if (check_first_run.Prepare(sql_pt::kIsFirstRun) && check_first_run.Next()) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "Selecting is first run " << check_first_run.GetBoolean(0)); if (check_first_run.GetBoolean(0)) { utils::dbms::SQLQuery set_not_first_run(db()); @@ -395,12 +388,11 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { return InitResult::SUCCESS; } } else { - LOG4CXX_WARN(logger_, "Incorrect select is first run"); + SDL_LOG_WARN("Incorrect select is first run"); } return InitResult::EXISTS; } else { - LOG4CXX_ERROR(logger_, - "Existing policy table representation is invlaid."); + SDL_LOG_ERROR("Existing policy table representation is invlaid."); // TODO(PV): add handle return InitResult::FAIL; } @@ -410,14 +402,14 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { } utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed creating schema of database: " << query.LastError().text()); return InitResult::FAIL; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return InitResult::FAIL; } @@ -432,8 +424,7 @@ bool SQLPTRepresentation::Close() { bool SQLPTRepresentation::Drop() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDropSchema)) { - LOG4CXX_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_LOG_WARN("Failed dropping database: " << query.LastError().text()); return false; } return true; @@ -446,13 +437,12 @@ void SQLPTRepresentation::WriteDb() { bool SQLPTRepresentation::Clear() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteData)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -462,19 +452,18 @@ bool SQLPTRepresentation::Clear() { bool SQLPTRepresentation::RefreshDB() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDropSchema)) { - LOG4CXX_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_LOG_WARN("Failed dropping database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed creating schema of database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -483,7 +472,7 @@ bool SQLPTRepresentation::RefreshDB() { std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto table = std::make_shared<policy_table::Table>(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); @@ -503,17 +492,17 @@ std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() void SQLPTRepresentation::GatherModuleMeta( policy_table::ModuleMeta* meta) const { - LOG4CXX_INFO(logger_, "Gather Module Meta Info"); + SDL_LOG_INFO("Gather Module Meta Info"); meta->mark_initialized(); // Section Module Meta is empty for SDL specific } void SQLPTRepresentation::GatherModuleConfig( policy_table::ModuleConfig* config) const { - LOG4CXX_INFO(logger_, "Gather Configuration Info"); + SDL_LOG_INFO("Gather Configuration Info"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectModuleConfig) || !query.Next()) { - LOG4CXX_WARN(logger_, "Incorrect select statement for module config"); + SDL_LOG_WARN("Incorrect select statement for module config"); } else { *config->preloaded_pt = query.GetBoolean(0); config->exchange_after_x_ignition_cycles = query.GetInteger(1); @@ -532,7 +521,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery endpoints(db()); if (!endpoints.Prepare(sql_pt::kSelectEndpoints)) { - LOG4CXX_WARN(logger_, "Incorrect select statement for endpoints"); + SDL_LOG_WARN("Incorrect select statement for endpoints"); } else { while (endpoints.Next()) { const std::string& url = endpoints.GetString(0); @@ -544,7 +533,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery endpoint_properties(db()); if (!endpoint_properties.Prepare(sql_pt::kSelectEndpointProperties)) { - LOG4CXX_ERROR(logger_, "Incorrect statement for Endpoint properties"); + SDL_LOG_ERROR("Incorrect statement for Endpoint properties"); } else { while (endpoint_properties.Next()) { const std::string& service = endpoint_properties.GetString(0); @@ -556,7 +545,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery notifications(db()); if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) { - LOG4CXX_WARN(logger_, "Incorrect select statement for notifications"); + SDL_LOG_WARN("Incorrect select statement for notifications"); } else { while (notifications.Next()) { config->notifications_per_minute_by_priority[notifications.GetString(0)] = @@ -565,8 +554,7 @@ void SQLPTRepresentation::GatherModuleConfig( } utils::dbms::SQLQuery subtle_notifications(db()); if (!subtle_notifications.Prepare(sql_pt::kSelectSubtleNotificationsPerMin)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for subtle notifications"); + SDL_LOG_WARN("Incorrect select statement for subtle notifications"); } else { while (subtle_notifications.Next()) { (*config->subtle_notifications_per_minute_by_priority) @@ -576,8 +564,7 @@ void SQLPTRepresentation::GatherModuleConfig( } utils::dbms::SQLQuery seconds(db()); if (!seconds.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { - LOG4CXX_INFO(logger_, - "Incorrect select statement from seconds between retries"); + SDL_LOG_INFO("Incorrect select statement from seconds between retries"); } else { while (seconds.Next()) { config->seconds_between_retries.push_back(seconds.GetInteger(0)); @@ -587,7 +574,7 @@ void SQLPTRepresentation::GatherModuleConfig( bool SQLPTRepresentation::GatherUsageAndErrorCounts( policy_table::UsageAndErrorCounts* counts) const { - LOG4CXX_INFO(logger_, "Gather Usage and Error Counts."); + SDL_LOG_INFO("Gather Usage and Error Counts."); utils::dbms::SQLQuery query(db()); if (query.Prepare(sql_pt::kSelectAppLevels)) { policy_table::AppLevel app_level_empty; @@ -601,7 +588,7 @@ bool SQLPTRepresentation::GatherUsageAndErrorCounts( void SQLPTRepresentation::GatherDeviceData( policy_table::DeviceData* data) const { - LOG4CXX_INFO(logger_, "Gather device data."); + SDL_LOG_INFO("Gather device data."); data->mark_initialized(); utils::dbms::SQLQuery query(db()); @@ -616,24 +603,23 @@ void SQLPTRepresentation::GatherDeviceData( bool SQLPTRepresentation::GatherFunctionalGroupings( policy_table::FunctionalGroupings* groups) const { - LOG4CXX_INFO(logger_, "Gather Functional Groupings info"); + SDL_LOG_INFO("Gather Functional Groupings info"); utils::dbms::SQLQuery func_group(db()); if (!func_group.Prepare(sql_pt::kSelectFunctionalGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select from functional_groupings"); + SDL_LOG_WARN("Incorrect select from functional_groupings"); return false; } utils::dbms::SQLQuery rpcs(db()); if (!rpcs.Prepare(sql_pt::kSelectAllRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select all from rpc"); + SDL_LOG_WARN("Incorrect select all from rpc"); return false; } utils::dbms::SQLQuery external_consent_entities(db()); if (!external_consent_entities.Prepare( sql_pt::kSelectExternalConsentEntities)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for 'external_consent_entities'."); + SDL_LOG_WARN("Incorrect select statement for 'external_consent_entities'."); return false; } @@ -702,10 +688,10 @@ bool SQLPTRepresentation::GatherFunctionalGroupings( bool SQLPTRepresentation::GatherConsumerFriendlyMessages( policy_table::ConsumerFriendlyMessages* messages) const { - LOG4CXX_INFO(logger_, "Gather Consumer Friendly Messages"); + SDL_LOG_INFO("Gather Consumer Friendly Messages"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectUserMsgsVersion) || !query.Next()) { - LOG4CXX_WARN(logger_, "Incorrect select from consumer_friendly_messages"); + SDL_LOG_WARN("Incorrect select from consumer_friendly_messages"); return false; } @@ -743,7 +729,7 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages( } } } else { - LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages."); + SDL_LOG_WARN("Incorrect statement for select friendly messages."); } return true; @@ -751,10 +737,10 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages( bool SQLPTRepresentation::GatherApplicationPoliciesSection( policy_table::ApplicationPoliciesSection* policies) const { - LOG4CXX_INFO(logger_, "Gather applications policies"); + SDL_LOG_INFO("Gather applications policies"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppPolicies)) { - LOG4CXX_WARN(logger_, "Incorrect select from app_policies"); + SDL_LOG_WARN("Incorrect select from app_policies"); return false; } @@ -855,8 +841,7 @@ bool SQLPTRepresentation::GatherVehicleData( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataSchemaVersion) || !query.Next()) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for vehicle data schema version"); + SDL_LOG_ERROR("Incorrect statement for vehicle data schema version"); return false; } *vehicle_data->schema_version = query.GetString(0); @@ -888,7 +873,7 @@ bool SQLPTRepresentation::GatherVehicleDataItems( } bool SQLPTRepresentation::Save(const policy_table::Table& table) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); db_->BeginTransaction(); if (!SaveFunctionalGroupings(table.policy_table.functional_groupings)) { db_->RollbackTransaction(); @@ -933,23 +918,23 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( const policy_table::FunctionalGroupings& groups) { utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteRpc)) { - LOG4CXX_WARN(logger_, "Incorrect delete from rpc."); + SDL_LOG_WARN("Incorrect delete from rpc."); return false; } if (!query_delete.Exec(sql_pt::kDeleteExternalConsentEntities)) { - LOG4CXX_WARN(logger_, "Incorrect delete from external consent entities."); + SDL_LOG_WARN("Incorrect delete from external consent entities."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteFunctionalGroup)) { - LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries."); + SDL_LOG_WARN("Incorrect delete from seconds between retries."); return false; } if (!query.Prepare(sql_pt::kInsertFunctionalGroup)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for functional groups"); + SDL_LOG_WARN("Incorrect insert statement for functional groups"); return false; } @@ -974,7 +959,7 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( ? query.Bind(3, *(groups_it->second.encryption_required)) : query.Bind(3); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into functional groups"); + SDL_LOG_WARN("Incorrect insert into functional groups"); return false; } @@ -1008,7 +993,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, utils::dbms::SQLQuery query_parameter(db()); if (!query.Prepare(sql_pt::kInsertRpc) || !query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for rpc"); + SDL_LOG_WARN("Incorrect insert statement for rpc"); return false; } @@ -1028,7 +1013,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, query_parameter.Bind(2, std::string(*ps_it)); query_parameter.Bind(3, group_id); if (!query_parameter.Exec() || !query_parameter.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter"); + SDL_LOG_WARN("Incorrect insert into rpc with parameter"); return false; } } @@ -1041,7 +1026,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, std::string(policy_table::EnumToJsonString(policy_table::P_EMPTY))); query_parameter.Bind(3, group_id); if (!query_parameter.Exec() || !query_parameter.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter"); + SDL_LOG_WARN("Incorrect insert into rpc with parameter"); return false; } } else { @@ -1049,7 +1034,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, query.Bind(1, std::string(policy_table::EnumToJsonString(*hmi_it))); query.Bind(2, group_id); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc"); + SDL_LOG_WARN("Incorrect insert into rpc"); return false; } } @@ -1063,32 +1048,32 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection( const policy_table::ApplicationPoliciesSection& policies) { utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); + SDL_LOG_WARN("Incorrect delete from app_group."); return false; } if (!query_delete.Exec(sql_pt::kDeleteApplication)) { - LOG4CXX_WARN(logger_, "Incorrect delete from application."); + SDL_LOG_WARN("Incorrect delete from application."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestType)) { - LOG4CXX_WARN(logger_, "Incorrect delete from request type."); + SDL_LOG_WARN("Incorrect delete from request type."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs."); + SDL_LOG_WARN("Incorrect delete from handled rpcs."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect delete from service names."); + SDL_LOG_WARN("Incorrect delete from service names."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled service types."); + SDL_LOG_WARN("Incorrect delete from handled service types."); return false; } @@ -1132,8 +1117,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( const policy_table::ApplicationPolicies::value_type& app) { utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt::kInsertApplication)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement into application (device)."); + SDL_LOG_WARN("Incorrect insert statement into application (device)."); return false; } @@ -1173,7 +1157,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( : app_query.Bind(13); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -1219,7 +1203,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( const policy_table::DevicePolicy& device) { utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt::kInsertApplication)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + SDL_LOG_WARN("Incorrect insert statement into application."); return false; } @@ -1232,7 +1216,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( app_query.Bind(5); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -1245,7 +1229,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( bool SQLPTRepresentation::SaveVehicleDataItems( const policy_table::VehicleDataItems& vehicle_data_items) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeleteVehicleDataItems(); for (const auto& item : vehicle_data_items) { if (!InsertVehicleDataItem(item)) { @@ -1257,18 +1241,17 @@ bool SQLPTRepresentation::SaveVehicleDataItems( bool SQLPTRepresentation::SaveVehicleData( const policy_table::VehicleData& vehicle_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (vehicle_data.is_initialized() && vehicle_data.schema_version.is_initialized()) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertVehicleDataSchemaVersion)) { - LOG4CXX_WARN(logger_, - "Incorrect insert of schema_version to vehicle_data."); + SDL_LOG_WARN("Incorrect insert of schema_version to vehicle_data."); return false; } query.Bind(0, *vehicle_data.schema_version); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Failed to insert schema_version to vehicle_data."); + SDL_LOG_WARN("Failed to insert schema_version to vehicle_data."); return false; } } @@ -1285,20 +1268,19 @@ bool SQLPTRepresentation::SaveAppGroup( const std::string& app_id, const policy_table::Strings& app_groups) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppGroup)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app group"); + SDL_LOG_WARN("Incorrect insert statement for app group"); return false; } - LOG4CXX_INFO(logger_, "SaveAppGroup"); + SDL_LOG_INFO("SaveAppGroup"); policy_table::Strings::const_iterator it; for (it = app_groups.begin(); it != app_groups.end(); ++it) { std::string ssss = *it; - LOG4CXX_INFO(logger_, "Group: " << ssss); + SDL_LOG_INFO("Group: " << ssss); query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN( - logger_, - "Incorrect insert into app group." << query.LastError().text()); + SDL_LOG_WARN("Incorrect insert into app group." + << query.LastError().text()); return false; } } @@ -1310,7 +1292,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id, const policy_table::Strings& nicknames) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertNickname)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for nickname"); + SDL_LOG_WARN("Incorrect insert statement for nickname"); return false; } @@ -1319,7 +1301,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id, query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into nickname."); + SDL_LOG_WARN("Incorrect insert into nickname."); return false; } } @@ -1331,7 +1313,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id, const policy_table::AppHMITypes& types) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app type"); + SDL_LOG_WARN("Incorrect insert statement for app type"); return false; } @@ -1340,7 +1322,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id, query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app type."); + SDL_LOG_WARN("Incorrect insert into app type."); return false; } } @@ -1352,29 +1334,29 @@ bool SQLPTRepresentation::SaveRequestType( const std::string& app_id, const policy_table::RequestTypes& types) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRequestType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for request types."); + SDL_LOG_WARN("Incorrect insert statement for request types."); return false; } policy_table::RequestTypes::const_iterator it; if (!types.empty()) { - LOG4CXX_WARN(logger_, "Request types not empty."); + SDL_LOG_WARN("Request types not empty."); for (it = types.begin(); it != types.end(); ++it) { query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + SDL_LOG_WARN("Incorrect insert into request types."); return false; } } } else if (types.is_initialized()) { - LOG4CXX_WARN(logger_, "Request types empty."); + SDL_LOG_WARN("Request types empty."); query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString( policy_table::RequestType::RT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + SDL_LOG_WARN("Incorrect insert into request types."); return false; } } @@ -1386,29 +1368,29 @@ bool SQLPTRepresentation::SaveRequestSubType( const policy_table::RequestSubTypes& request_subtypes) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRequestSubType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes."); + SDL_LOG_WARN("Incorrect insert statement for request subtypes."); return false; } policy_table::Strings::const_iterator it; if (!request_subtypes.empty()) { - LOG4CXX_TRACE(logger_, "Request subtypes are not empty."); + SDL_LOG_TRACE("Request subtypes are not empty."); for (it = request_subtypes.begin(); it != request_subtypes.end(); ++it) { query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + SDL_LOG_WARN("Incorrect insert into request subtypes."); return false; } } } else if (request_subtypes.is_initialized()) { - LOG4CXX_WARN(logger_, "Request subtypes empty."); + SDL_LOG_WARN("Request subtypes empty."); query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString( policy_table::RequestType::RT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + SDL_LOG_WARN("Incorrect insert into request subtypes."); return false; } } @@ -1418,11 +1400,11 @@ bool SQLPTRepresentation::SaveRequestSubType( bool SQLPTRepresentation::SaveAppServiceParameters( const std::string& app_id, const policy_table::AppServiceParameters& app_service_parameters) { - LOG4CXX_INFO(logger_, "Save app service parameters"); + SDL_LOG_INFO("Save app service parameters"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app service types"); + SDL_LOG_WARN("Incorrect insert statement for app service types"); return false; } policy_table::AppServiceParameters::const_iterator it; @@ -1435,14 +1417,14 @@ bool SQLPTRepresentation::SaveAppServiceParameters( query.Bind(1, it->first); query.Bind(2, app_id); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Insert execute failed for into app service types"); + SDL_LOG_WARN("Insert execute failed for into app service types"); return false; } // Insert app names array into db utils::dbms::SQLQuery service_name_query(db()); if (!service_name_query.Prepare(sql_pt::kInsertAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app service names"); + SDL_LOG_WARN("Incorrect insert statement for app service names"); return false; } @@ -1450,11 +1432,11 @@ bool SQLPTRepresentation::SaveAppServiceParameters( if (app_service_names.is_initialized() && app_service_names->empty()) { // App service names is an empty array - LOG4CXX_DEBUG(logger_, "App Service Names is Empty Array"); + SDL_LOG_DEBUG("App Service Names is Empty Array"); service_name_query.Bind(0, static_cast<int64_t>(id)); service_name_query.Bind(1); if (!service_name_query.Exec() || !service_name_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into empty app service names"); + SDL_LOG_WARN("Incorrect insert into empty app service names"); return false; } } else { @@ -1465,7 +1447,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( service_name_query.Bind(0, static_cast<int64_t>(id)); service_name_query.Bind(1, *names_it); if (!service_name_query.Exec() || !service_name_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app service names"); + SDL_LOG_WARN("Incorrect insert into app service names"); return false; } } @@ -1474,8 +1456,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( // Insert handled rpcs array into db utils::dbms::SQLQuery handled_rpcs_query(db()); if (!handled_rpcs_query.Prepare(sql_pt::kInsertAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for app service handled rpcs"); + SDL_LOG_WARN("Incorrect insert statement for app service handled rpcs"); return false; } @@ -1486,7 +1467,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( handled_rpcs_query.Bind(0, static_cast<int64_t>(id)); handled_rpcs_query.Bind(1, static_cast<int32_t>(rpc_it->function_id)); if (!handled_rpcs_query.Exec() || !handled_rpcs_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app service handled rpcs"); + SDL_LOG_WARN("Incorrect insert into app service handled rpcs"); return false; } } @@ -1503,7 +1484,7 @@ bool SQLPTRepresentation::SaveModuleConfig( const policy_table::ModuleConfig& config) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateModuleConfig)) { - LOG4CXX_WARN(logger_, "Incorrect update statement for module config"); + SDL_LOG_WARN("Incorrect update statement for module config"); return false; } @@ -1532,7 +1513,7 @@ bool SQLPTRepresentation::SaveModuleConfig( : query.Bind(10); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update module config"); + SDL_LOG_WARN("Incorrect update module config"); return false; } @@ -1565,12 +1546,12 @@ bool SQLPTRepresentation::SaveServiceEndpoints( const policy_table::ServiceEndpoints& endpoints) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteEndpoint)) { - LOG4CXX_WARN(logger_, "Incorrect delete from endpoint."); + SDL_LOG_WARN("Incorrect delete from endpoint."); return false; } if (!query.Prepare(sql_pt::kInsertEndpoint)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for endpoint"); + SDL_LOG_WARN("Incorrect insert statement for endpoint"); return false; } @@ -1586,7 +1567,7 @@ bool SQLPTRepresentation::SaveServiceEndpoints( query.Bind(1, *url_it); query.Bind(2, app_it->first); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into endpoint"); + SDL_LOG_WARN("Incorrect insert into endpoint"); return false; } } @@ -1600,8 +1581,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( const policy_table::ServiceEndpointProperties& endpoint_properties) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertEndpointVersion)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Incorrect insert of endpoint property to endpoint_properties."); return false; } @@ -1611,8 +1591,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( query.Bind(1, endpoint_property.second.version); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Failed to insert endpoint property into endpoint_properties."); return false; } @@ -1623,13 +1602,13 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( bool SQLPTRepresentation::SaveConsumerFriendlyMessages( const policy_table::ConsumerFriendlyMessages& messages) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // According CRS-2419 If there is no “consumer_friendly_messages” key, // the current local consumer_friendly_messages section shall be maintained in // the policy table. So it won't be changed/updated if (!messages.messages.is_initialized()) { - LOG4CXX_INFO(logger_, "ConsumerFriendlyMessages messages list is empty"); + SDL_LOG_INFO("ConsumerFriendlyMessages messages list is empty"); return true; } @@ -1640,18 +1619,18 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( } if (!delete_query_exec_result) { - LOG4CXX_WARN(logger_, "Failed to delete messages from DB."); + SDL_LOG_WARN("Failed to delete messages from DB."); return false; } if (!query.Prepare(sql_pt::kUpdateVersion)) { - LOG4CXX_WARN(logger_, "Invalid update messages version statement."); + SDL_LOG_WARN("Invalid update messages version statement."); return false; } query.Bind(0, messages.version); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to update messages version number in DB."); + SDL_LOG_WARN("Failed to update messages version number in DB."); return false; } @@ -1678,13 +1657,13 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( bool SQLPTRepresentation::SaveMessageType(const std::string& type) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertMessageType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for message type."); + SDL_LOG_WARN("Incorrect insert statement for message type."); return false; } query.Bind(0, type); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into message type."); + SDL_LOG_WARN("Incorrect insert into message type."); return false; } @@ -1694,13 +1673,13 @@ bool SQLPTRepresentation::SaveMessageType(const std::string& type) { bool SQLPTRepresentation::SaveLanguage(const std::string& code) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertLanguage)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for language."); + SDL_LOG_WARN("Incorrect insert statement for language."); return false; } query.Bind(0, code); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into language."); + SDL_LOG_WARN("Incorrect insert into language."); return false; } @@ -1759,8 +1738,7 @@ policy_table::VehicleDataItems SQLPTRepresentation::SelectCompositeVehicleDataItems() const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectCompositeVehicleDataItemsKey)) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for parameterized vehicle data items"); + SDL_LOG_ERROR("Incorrect statement for parameterized vehicle data items"); return policy_table::VehicleDataItems(); } @@ -1784,8 +1762,7 @@ policy_table::VehicleDataItems SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectPrimitiveVehicleDataItems)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Incorrect statement for non parameterized vehicle data items"); return policy_table::VehicleDataItems(); } @@ -1805,17 +1782,15 @@ SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const { bool SQLPTRepresentation::DeleteVehicleDataItems() const { utils::dbms::SQLQuery query(db()); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!query.Exec(sql_pt::kDeleteVehicleDataItems)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kDeleteVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } return true; @@ -1833,12 +1808,11 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries( const policy_table::SecondsBetweenRetries& seconds) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteSecondsBetweenRetries)) { - LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries."); + SDL_LOG_WARN("Incorrect delete from seconds between retries."); return false; } if (!query.Prepare(sql_pt::kInsertSecondsBetweenRetry)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for seconds between retries."); + SDL_LOG_WARN("Incorrect insert statement for seconds between retries."); return false; } @@ -1846,7 +1820,7 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries( query.Bind(0, static_cast<int>(i)); query.Bind(1, seconds[i]); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into seconds between retries."); + SDL_LOG_WARN("Incorrect insert into seconds between retries."); return false; } } @@ -1858,8 +1832,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( const policy_table::NumberOfNotificationsPerMinute& notifications) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertNotificationsByPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for notifications by priority."); + SDL_LOG_WARN("Incorrect insert statement for notifications by priority."); return false; } @@ -1868,7 +1841,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( query.Bind(0, it->first); query.Bind(1, it->second); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority."); + SDL_LOG_WARN("Incorrect insert into notifications by priority."); return false; } } @@ -1880,8 +1853,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute( const policy_table::NumberOfNotificationsPerMinute& notifications) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertSubtleNotificationsByPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for notifications by priority."); + SDL_LOG_WARN("Incorrect insert statement for notifications by priority."); return false; } @@ -1890,7 +1862,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute( query.Bind(0, it->first); query.Bind(1, it->second); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority."); + SDL_LOG_WARN("Incorrect insert into notifications by priority."); return false; } } @@ -1902,7 +1874,7 @@ bool SQLPTRepresentation::SaveDeviceData( const policy_table::DeviceData& devices) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertDeviceData)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for device data."); + SDL_LOG_WARN("Incorrect insert statement for device data."); return false; } @@ -1910,7 +1882,7 @@ bool SQLPTRepresentation::SaveDeviceData( for (it = devices.begin(); it != devices.end(); ++it) { query.Bind(0, it->first); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into device data."); + SDL_LOG_WARN("Incorrect insert into device data."); return false; } } @@ -1923,11 +1895,11 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( const_cast<policy_table::UsageAndErrorCounts&>(counts).mark_initialized(); utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app level."); + SDL_LOG_WARN("Incorrect delete from app level."); return false; } if (!query.Prepare(sql_pt::kInsertAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app level."); + SDL_LOG_WARN("Incorrect insert statement for app level."); return false; } @@ -1937,7 +1909,7 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( for (it = app_levels.begin(); it != app_levels.end(); ++it) { query.Bind(0, it->first); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app level."); + SDL_LOG_WARN("Incorrect insert into app level."); return false; } } @@ -1947,23 +1919,22 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( void SQLPTRepresentation::IncrementIgnitionCycles() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kIncrementIgnitionCycles)) { - LOG4CXX_WARN(logger_, "Failed incrementing ignition cycles"); + SDL_LOG_WARN("Failed incrementing ignition cycles"); } } void SQLPTRepresentation::ResetIgnitionCycles() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kResetIgnitionCycles)) { - LOG4CXX_WARN(logger_, "Failed to reset ignition cycles number."); + SDL_LOG_WARN("Failed to reset ignition cycles number."); } } bool SQLPTRepresentation::UpdateRequired() const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectFlagUpdateRequired) || !query.Exec()) { - LOG4CXX_WARN(logger_, - "Failed select update required flag from module meta"); + SDL_LOG_WARN("Failed select update required flag from module meta"); return false; } return query.GetBoolean(0); @@ -1974,34 +1945,33 @@ void SQLPTRepresentation::SaveUpdateRequired(bool value) { // TODO(AOleynik): Quick fix, will be reworked if (!query.Prepare(/*sql_pt::kUpdateFlagUpdateRequired*/ "UPDATE `module_meta` SET `flag_update_required` = ?")) { - LOG4CXX_WARN(logger_, - "Incorrect update into module meta (update_required): " - << strerror(errno)); + SDL_LOG_WARN("Incorrect update into module meta (update_required): " + << strerror(errno)); return; } query.Bind(0, value); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update module meta (update_required)"); + SDL_LOG_WARN("Failed update module meta (update_required)"); } } bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, StringArray* nicknames, StringArray* app_types) { - LOG4CXX_INFO(logger_, "Getting initial application data."); + SDL_LOG_INFO("Getting initial application data."); utils::dbms::SQLQuery app_names(db()); if (!app_names.Prepare(sql_pt::kSelectNicknames)) { - LOG4CXX_WARN(logger_, "Incorrect select from app nicknames"); + SDL_LOG_WARN("Incorrect select from app nicknames"); return false; } utils::dbms::SQLQuery app_hmi_types(db()); if (!app_hmi_types.Prepare(sql_pt::kSelectAppTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } dbms::SQLQuery module_types(db()); if (!module_types.Prepare(sql_pt::kSelectModuleTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from module types"); + SDL_LOG_WARN("Incorrect select from module types"); return false; } @@ -2026,7 +1996,7 @@ bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, bool SQLPTRepresentation::GetFunctionalGroupings( policy_table::FunctionalGroupings& groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return GatherFunctionalGroupings(&groups); } @@ -2034,7 +2004,7 @@ bool SQLPTRepresentation::GatherAppType( const std::string& app_id, policy_table::AppHMITypes* app_types) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } @@ -2054,7 +2024,7 @@ bool SQLPTRepresentation::GatherRequestType( policy_table::RequestTypes* request_types) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRequestTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from request types."); + SDL_LOG_WARN("Incorrect select from request types."); return false; } @@ -2078,7 +2048,7 @@ bool SQLPTRepresentation::GatherRequestSubType( policy_table::RequestSubTypes* request_subtypes) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRequestSubTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from request subtypes."); + SDL_LOG_WARN("Incorrect select from request subtypes."); return false; } @@ -2098,22 +2068,22 @@ bool SQLPTRepresentation::GatherRequestSubType( bool SQLPTRepresentation::GatherAppServiceParameters( const std::string& app_id, policy_table::AppServiceParameters* app_service_parameters) const { - LOG4CXX_INFO(logger_, "Gather app service info"); + SDL_LOG_INFO("Gather app service info"); utils::dbms::SQLQuery service_type_query(db()); if (!service_type_query.Prepare(sql_pt::kSelectAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from service_types"); + SDL_LOG_WARN("Incorrect select from service_types"); return false; } utils::dbms::SQLQuery service_name_query(db()); if (!service_name_query.Prepare(sql_pt::kSelectAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect select all from app_service_names"); + SDL_LOG_WARN("Incorrect select all from app_service_names"); return false; } utils::dbms::SQLQuery handled_rpcs_query(db()); if (!handled_rpcs_query.Prepare(sql_pt::kSelectAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select all from app_service_handled_rpcs"); + SDL_LOG_WARN("Incorrect select all from app_service_handled_rpcs"); return false; } @@ -2125,7 +2095,7 @@ bool SQLPTRepresentation::GatherAppServiceParameters( service_name_query.Bind(0, service_type_id); while (service_name_query.Next()) { - LOG4CXX_DEBUG(logger_, "Loading service name"); + SDL_LOG_DEBUG("Loading service name"); (*app_service_parameters)[service_type].service_names->push_back( service_name_query.GetString(0)); (*app_service_parameters)[service_type].service_names->mark_initialized(); @@ -2140,11 +2110,11 @@ bool SQLPTRepresentation::GatherAppServiceParameters( } if (!service_name_query.Reset()) { - LOG4CXX_ERROR(logger_, "Could not reset service_name query"); + SDL_LOG_ERROR("Could not reset service_name query"); return false; } if (!handled_rpcs_query.Reset()) { - LOG4CXX_ERROR(logger_, "Could not reset handled_rpcs query"); + SDL_LOG_ERROR("Could not reset handled_rpcs query"); return false; } } @@ -2156,7 +2126,7 @@ bool SQLPTRepresentation::GatherNickName( const std::string& app_id, policy_table::Strings* nicknames) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectNicknames)) { - LOG4CXX_WARN(logger_, "Incorrect select from app nicknames"); + SDL_LOG_WARN("Incorrect select from app nicknames"); return false; } @@ -2171,7 +2141,7 @@ bool SQLPTRepresentation::GatherAppGroup( const std::string& app_id, policy_table::Strings* app_groups) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select from app groups"); + SDL_LOG_WARN("Incorrect select from app groups"); return false; } @@ -2184,10 +2154,10 @@ bool SQLPTRepresentation::GatherAppGroup( bool SQLPTRepresentation::GatherRemoteControlDenied(const std::string& app_id, bool* denied) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRemoteControlDenied)) { - LOG4CXX_WARN(logger_, "Incorrect select remote control flag"); + SDL_LOG_WARN("Incorrect select remote control flag"); return false; } query.Bind(0, app_id); @@ -2203,7 +2173,7 @@ bool SQLPTRepresentation::GatherModuleType( const std::string& app_id, policy_table::ModuleTypes* app_types) const { dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectModuleTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } @@ -2224,17 +2194,17 @@ bool SQLPTRepresentation::GatherModuleType( bool SQLPTRepresentation::SaveRemoteControlDenied(const std::string& app_id, bool deny) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateRemoteControlDenied)) { - LOG4CXX_WARN(logger_, "Incorrect update statement for remote control flag"); + SDL_LOG_WARN("Incorrect update statement for remote control flag"); return false; } - LOG4CXX_DEBUG(logger_, "App: " << app_id << std::boolalpha << " - " << deny); + SDL_LOG_DEBUG("App: " << app_id << std::boolalpha << " - " << deny); query.Bind(0, deny); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update remote control flag."); + SDL_LOG_WARN("Incorrect update remote control flag."); return false; } return true; @@ -2244,7 +2214,7 @@ bool SQLPTRepresentation::SaveModuleType( const std::string& app_id, const policy_table::ModuleTypes& types) { dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertModuleType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for module type"); + SDL_LOG_WARN("Incorrect insert statement for module type"); return false; } @@ -2254,10 +2224,9 @@ bool SQLPTRepresentation::SaveModuleType( query.Bind(0, app_id); std::string module(policy_table::EnumToJsonString(*it)); query.Bind(1, module); - LOG4CXX_DEBUG(logger_, - "Module(app: " << app_id << ", type: " << module << ")"); + SDL_LOG_DEBUG("Module(app: " << app_id << ", type: " << module << ")"); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into module type."); + SDL_LOG_WARN("Incorrect insert into module type."); return false; } } @@ -2267,21 +2236,21 @@ bool SQLPTRepresentation::SaveModuleType( std::string(policy_table::EnumToJsonString( policy_table::ModuleType::MT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into module types."); + SDL_LOG_WARN("Incorrect insert into module types."); return false; } } else { - LOG4CXX_WARN(logger_, "Module Type omitted."); + SDL_LOG_WARN("Module Type omitted."); } return true; } bool SQLPTRepresentation::SaveAccessModule( TypeAccess access, const policy_table::AccessModules& modules) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAccessModule)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for access module"); + SDL_LOG_WARN("Incorrect insert statement for access module"); return false; } @@ -2292,12 +2261,12 @@ bool SQLPTRepresentation::SaveAccessModule( query.Bind(0, name); query.Bind(1, access); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into access module."); + SDL_LOG_WARN("Incorrect insert into access module."); return false; } int id = query.LastInsertId(); if (!query.Reset()) { - LOG4CXX_WARN(logger_, "Couldn't reset query access module."); + SDL_LOG_WARN("Couldn't reset query access module."); return false; } if (!SaveRemoteRpc(id, rpcs)) { @@ -2309,10 +2278,10 @@ bool SQLPTRepresentation::SaveAccessModule( bool SQLPTRepresentation::GatherAccessModule( TypeAccess access, policy_table::AccessModules* modules) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAccessModules)) { - LOG4CXX_WARN(logger_, "Incorrect select from access module"); + SDL_LOG_WARN("Incorrect select from access module"); return false; } @@ -2331,10 +2300,10 @@ bool SQLPTRepresentation::GatherAccessModule( bool SQLPTRepresentation::SaveRemoteRpc(int module_id, const policy_table::RemoteRpcs& rpcs) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRemoteRpc)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for remote rpc"); + SDL_LOG_WARN("Incorrect insert statement for remote rpc"); return false; } policy_table::RemoteRpcs::const_iterator i; @@ -2347,7 +2316,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, query.Bind(1, name); query.Bind(2); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + SDL_LOG_WARN("Incorrect insert into remote rpc."); return false; } } else { @@ -2357,7 +2326,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, query.Bind(1, name); query.Bind(2, param); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + SDL_LOG_WARN("Incorrect insert into remote rpc."); return false; } } @@ -2368,10 +2337,10 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, bool SQLPTRepresentation::GatherRemoteRpc( int module_id, policy_table::RemoteRpcs* rpcs) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRemoteRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select from remote rpc"); + SDL_LOG_WARN("Incorrect select from remote rpc"); return false; } @@ -2394,7 +2363,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, bool is_predata) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateApplicationCustomData)) { - LOG4CXX_WARN(logger_, "Incorrect update in application"); + SDL_LOG_WARN("Incorrect update in application"); return false; } @@ -2404,7 +2373,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, query.Bind(3, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update in application"); + SDL_LOG_WARN("Failed update in application"); return false; } @@ -2415,13 +2384,13 @@ bool SQLPTRepresentation::IsApplicationRevoked( const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationRevoked)) { - LOG4CXX_WARN(logger_, "Incorrect select from is_revoked of application"); + SDL_LOG_WARN("Incorrect select from is_revoked of application"); } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select is_revoked of application"); + SDL_LOG_WARN("Failed select is_revoked of application"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -2430,13 +2399,13 @@ bool SQLPTRepresentation::IsApplicationRepresented( const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationRepresented)) { - LOG4CXX_WARN(logger_, "Incorrect select application by id"); + SDL_LOG_WARN("Incorrect select application by id"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select application by id"); + SDL_LOG_WARN("Failed select application by id"); return false; } return query.GetInteger(0) != 0; @@ -2445,13 +2414,13 @@ bool SQLPTRepresentation::IsApplicationRepresented( bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationIsDefault)) { - LOG4CXX_WARN(logger_, "Incorrect select application by id"); + SDL_LOG_WARN("Incorrect select application by id"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select application by id"); + SDL_LOG_WARN("Failed select application by id"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -2464,12 +2433,12 @@ bool SQLPTRepresentation::IsPredataPolicy(const std::string& app_id) const { bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } @@ -2514,17 +2483,17 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { bool SQLPTRepresentation::SetIsDefault(const std::string& app_id, bool is_default) const { - LOG4CXX_TRACE(logger_, "Set flag is_default of application"); + SDL_LOG_TRACE("Set flag is_default of application"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateIsDefault)) { - LOG4CXX_WARN(logger_, "Incorect statement for updating is_default"); + SDL_LOG_WARN("Incorect statement for updating is_default"); return false; } query.Bind(0, is_default); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update is_default"); + SDL_LOG_WARN("Failed update is_default"); return false; } return true; @@ -2535,18 +2504,16 @@ void SQLPTRepresentation::RemoveDB() const { } bool SQLPTRepresentation::IsDBVersionActual() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectDBVersion) || !query.Exec()) { - LOG4CXX_ERROR(logger_, - "Failed to get DB version: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to get DB version: " << query.LastError().text()); return false; } const int32_t saved_db_version = query.GetInteger(0); const int32_t current_db_version = GetDBVersion(); - LOG4CXX_DEBUG(logger_, - "Saved DB version is: " << saved_db_version + SDL_LOG_DEBUG("Saved DB version is: " << saved_db_version << ". Current DB vesion is: " << current_db_version); @@ -2554,21 +2521,19 @@ bool SQLPTRepresentation::IsDBVersionActual() const { } bool SQLPTRepresentation::UpdateDBVersion() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateDBVersion)) { - LOG4CXX_ERROR(logger_, - "Incorrect DB version query: " << query.LastError().text()); + SDL_LOG_ERROR("Incorrect DB version query: " << query.LastError().text()); return false; } const int32_t db_version = GetDBVersion(); - LOG4CXX_DEBUG(logger_, "DB version will be updated to: " << db_version); + SDL_LOG_DEBUG("DB version will be updated to: " << db_version); query.Bind(0, db_version); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, - "DB version getting failed: " << query.LastError().text()); + SDL_LOG_ERROR("DB version getting failed: " << query.LastError().text()); return false; } @@ -2581,9 +2546,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataItem)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return result; } @@ -2600,9 +2564,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem( if (policy_table::VehicleDataItem::kStruct == static_cast<std::string>(vdi.type)) { if (!param_query.Prepare(sql_pt::kSelectVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << param_query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << param_query.LastError().text()); return policy_table::VehicleDataItems(); } @@ -2634,21 +2597,19 @@ bool SQLPTRepresentation::InsertVehicleDataItem( utils::dbms::SQLQuery query(db()); if (!vehicle_data_item.is_initialized() || !vehicle_data_item.is_valid()) { - LOG4CXX_ERROR(logger_, "Vehicle data item is not initialized."); + SDL_LOG_ERROR("Vehicle data item is not initialized."); return false; } if (VehicleDataItemExists(vehicle_data_item)) { - LOG4CXX_INFO(logger_, - static_cast<std::string>(vehicle_data_item.key) - << " is already stored."); + SDL_LOG_INFO(static_cast<std::string>(vehicle_data_item.key) + << " is already stored."); return true; } if (!query.Prepare(sql_pt::kInsertVehicleDataItem)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return false; } @@ -2691,10 +2652,9 @@ bool SQLPTRepresentation::InsertVehicleDataItem( : query.Bind(14); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR(logger_, - "Failed to insert vehicle data item: " - << static_cast<std::string>(vehicle_data_item.key) - << ". Error: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to insert vehicle data item: " + << static_cast<std::string>(vehicle_data_item.key) + << ". Error: " << query.LastError().text()); return false; } @@ -2707,14 +2667,13 @@ bool SQLPTRepresentation::InsertVehicleDataItem( if (stored_vehicle_data_item_params.end() != stored_vehicle_data_item_params.find(param.name)) { - LOG4CXX_DEBUG(logger_, "Parameter already stored."); + SDL_LOG_DEBUG("Parameter already stored."); continue; } if (!query.Prepare(sql_pt::kInsertVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return false; } @@ -2724,11 +2683,11 @@ bool SQLPTRepresentation::InsertVehicleDataItem( query.Bind(3, param.key); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed to insert to vehicle data item relations helper table: " - << static_cast<std::string>(param.key) - << ". Error: " << query.LastError().text()); + << static_cast<std::string>(param.key) + << ". Error: " << query.LastError().text()); return false; } stored_vehicle_data_item_params[param.name] = param.key; @@ -2742,9 +2701,8 @@ bool SQLPTRepresentation::VehicleDataItemExists( const policy_table::VehicleDataItem& vehicle_data_item) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataItemWithVersion)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement for vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement for vehicle data item. " + << query.LastError().text()); return false; } @@ -2758,10 +2716,9 @@ bool SQLPTRepresentation::VehicleDataItemExists( : query.Bind(3); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, - "Failed to retrieve vehicle data item: " - << std::string(vehicle_data_item.key) - << ". Error: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to retrieve vehicle data item: " + << std::string(vehicle_data_item.key) + << ". Error: " << query.LastError().text()); return false; } return !query.IsNull(0); @@ -2785,18 +2742,18 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, const std::string& destination) { utils::dbms::SQLQuery source_app(db()); if (!source_app.Prepare(sql_pt::kSelectApplicationFull)) { - LOG4CXX_WARN(logger_, "Incorrect select statement from application."); + SDL_LOG_WARN("Incorrect select statement from application."); return false; } source_app.Bind(0, source); if (!source_app.Exec()) { - LOG4CXX_WARN(logger_, "Failed selecting from application."); + SDL_LOG_WARN("Failed selecting from application."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertApplicationFull)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement into application full."); + SDL_LOG_WARN("Incorrect insert statement into application full."); return false; } query.Bind(0, destination); @@ -2834,7 +2791,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, : query.Bind(18, source_app.GetBoolean(17)); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed inserting into application."); + SDL_LOG_WARN("Failed inserting into application."); return false; } return true; @@ -2843,13 +2800,13 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, void SQLPTRepresentation::SetPreloaded(bool value) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdatePreloaded)) { - LOG4CXX_WARN(logger_, "Incorrect statement of updating preloaded."); + SDL_LOG_WARN("Incorrect statement of updating preloaded."); return; } query.Bind(0, value); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed updating preloaded."); + SDL_LOG_WARN("Failed updating preloaded."); return; } } @@ -2864,8 +2821,7 @@ bool SQLPTRepresentation::SaveExternalConsentEntities( ExternalConsentEntitiesType type) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kInsertExternalConsentEntity)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for external consent entities."); + SDL_LOG_WARN("Incorrect insert statement for external consent entities."); return false; } @@ -2882,8 +2838,7 @@ bool SQLPTRepresentation::SaveExternalConsentEntities( query.Bind(2, it_entity->entity_id); query.Bind(3, external_consent_entity_type); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR(logger_, - "Can't insert '" << external_consent_entity_type + SDL_LOG_ERROR("Can't insert '" << external_consent_entity_type << "' external consent entity."); return false; } diff --git a/src/components/policy/policy_external/src/update_status_manager.cc b/src/components/policy/policy_external/src/update_status_manager.cc index c50aefd0eb..59b95a405c 100644 --- a/src/components/policy/policy_external/src/update_status_manager.cc +++ b/src/components/policy/policy_external/src/update_status_manager.cc @@ -37,7 +37,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) @@ -52,7 +52,7 @@ UpdateStatusManager::UpdateStatusManager() } UpdateStatusManager::~UpdateStatusManager() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(update_status_thread_delegate_); DCHECK(thread_); thread_->Stop(threads::Thread::kThreadSoftStop); @@ -61,7 +61,7 @@ UpdateStatusManager::~UpdateStatusManager() { } void UpdateStatusManager::ProcessEvent(UpdateEvent event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(status_lock_); current_status_->ProcessEvent(this, event); last_processed_event_ = event; @@ -81,14 +81,14 @@ void UpdateStatusManager::set_listener(PolicyListener* listener) { } void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(update_status_thread_delegate_); update_status_thread_delegate_->updateTimeOut(update_timeout); ProcessEvent(kOnUpdateSentOut); } void UpdateStatusManager::OnUpdateTimeoutOccurs() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto& ptu_retry_handler = listener_->ptu_retry_handler(); @@ -103,25 +103,25 @@ void UpdateStatusManager::OnUpdateTimeoutOccurs() { } void UpdateStatusManager::OnValidUpdateReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_thread_delegate_->updateTimeOut(0); // Stop Timer ProcessEvent(kOnValidUpdateReceived); } void UpdateStatusManager::ResetTimeout(uint32_t update_timeout) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_thread_delegate_->updateTimeOut( update_timeout); // Restart Timer } void UpdateStatusManager::OnWrongUpdateReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_thread_delegate_->updateTimeOut(0); // Stop Timer ProcessEvent(kOnWrongUpdateReceived); } void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_update_required) { ProcessEvent(kOnResetPolicyTableRequireUpdate); return; @@ -130,13 +130,13 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { } void UpdateStatusManager::OnResetRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnResetRetrySequence); } void UpdateStatusManager::OnExistedApplicationAdded( const bool is_update_required) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_update_required) { current_status_.reset(new UpToDateStatus()); ProcessEvent(kScheduleUpdate); @@ -144,13 +144,13 @@ void UpdateStatusManager::OnExistedApplicationAdded( } void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (kDeviceAllowed != consent) { - LOG4CXX_DEBUG(logger_, "Application registered from non-consented device"); + SDL_LOG_DEBUG("Application registered from non-consented device"); app_registered_from_non_consented_device_ = true; return; } - LOG4CXX_DEBUG(logger_, "Application registered from consented device"); + SDL_LOG_DEBUG("Application registered from consented device"); app_registered_from_non_consented_device_ = false; if (kOnResetRetrySequence == last_processed_event_) { current_status_.reset(new UpToDateStatus()); @@ -161,7 +161,7 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { } void UpdateStatusManager::OnDeviceConsented() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app_registered_from_non_consented_device_) { ProcessEvent(kOnNewAppRegistered); } @@ -176,17 +176,17 @@ bool UpdateStatusManager::IsUpdatePending() const { } void UpdateStatusManager::ScheduleUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kScheduleUpdate); } void UpdateStatusManager::PendingUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kPendingUpdate); } void UpdateStatusManager::ScheduleManualUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kScheduleManualUpdate); } @@ -195,19 +195,19 @@ std::string UpdateStatusManager::StringifiedUpdateStatus() const { } void policy::UpdateStatusManager::OnAppsSearchStarted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); apps_search_in_progress_ = true; } void policy::UpdateStatusManager::OnAppsSearchCompleted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); apps_search_in_progress_ = false; } bool policy::UpdateStatusManager::IsAppsSearchInProgress() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); return apps_search_in_progress_; } @@ -244,22 +244,22 @@ UpdateStatusManager::UpdateThreadDelegate::UpdateThreadDelegate( : timeout_(0) , stop_flag_(false) , update_status_manager_(update_status_manager) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Create UpdateThreadDelegate"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Create UpdateThreadDelegate"); } UpdateStatusManager::UpdateThreadDelegate::~UpdateThreadDelegate() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Delete UpdateThreadDelegate"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Delete UpdateThreadDelegate"); } void UpdateStatusManager::UpdateThreadDelegate::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "UpdateStatusManager thread started (started normal)"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("UpdateStatusManager thread started (started normal)"); sync_primitives::AutoLock auto_lock(state_lock_); while (false == stop_flag_) { if (timeout_ > 0) { - LOG4CXX_DEBUG(logger_, "Timeout is greater then 0"); + SDL_LOG_DEBUG("Timeout is greater then 0"); sync_primitives::ConditionalVariable::WaitStatus wait_status = termination_condition_.WaitFor(auto_lock, timeout_); if (sync_primitives::ConditionalVariable::kTimeout == wait_status) { @@ -276,16 +276,16 @@ void UpdateStatusManager::UpdateThreadDelegate::threadMain() { } void UpdateStatusManager::UpdateThreadDelegate::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); stop_flag_ = true; - LOG4CXX_DEBUG(logger_, "before notify"); + SDL_LOG_DEBUG("before notify"); termination_condition_.NotifyOne(); } void UpdateStatusManager::UpdateThreadDelegate::updateTimeOut( const uint32_t timeout_ms) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); timeout_ = timeout_ms; termination_condition_.NotifyOne(); diff --git a/src/components/policy/policy_regular/src/access_remote_impl.cc b/src/components/policy/policy_regular/src/access_remote_impl.cc index f743a4d56e..439fbcc8d2 100644 --- a/src/components/policy/policy_regular/src/access_remote_impl.cc +++ b/src/components/policy/policy_regular/src/access_remote_impl.cc @@ -36,7 +36,7 @@ #include "policy/cache_manager.h" #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl") +SDL_CREATE_LOG_VARIABLE("PolicyManagerImpl") using policy_table::DeviceData; using policy_table::FunctionalGroupings; @@ -48,11 +48,10 @@ struct ToHMIType { policy_table::AppHMITypes::value_type operator()(int item) const { policy_table::AppHMIType type = static_cast<policy_table::AppHMIType>(item); if (!IsValidEnum(type)) { - LOG4CXX_WARN(logger_, "HMI type isn't known " << item); + SDL_LOG_WARN("HMI type isn't known " << item); type = policy_table::AHT_DEFAULT; } - LOG4CXX_DEBUG(logger_, - "HMI type: " << item << " - " << EnumToJsonString(type)); + SDL_LOG_DEBUG("HMI type: " << item << " - " << EnumToJsonString(type)); return policy_table::AppHMITypes::value_type(type); } }; @@ -94,7 +93,7 @@ AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache) bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, policy_table::ModuleType module) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!cache_->IsApplicationRepresented(app_id)) { return false; } @@ -117,10 +116,10 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules, const std::string& module_name, const std::string& rpc_name, RemoteControlParams* input) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::AccessModules::const_iterator i = modules.find(module_name); if (i == modules.end()) { - LOG4CXX_DEBUG(logger_, "Module " << module_name << " wasn't found"); + SDL_LOG_DEBUG("Module " << module_name << " wasn't found"); return false; } @@ -133,19 +132,19 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules, const policy_table::Strings& parameters = j->second; return CompareParameters(parameters, input); } - LOG4CXX_DEBUG(logger_, "RPC " << rpc_name << " wasn't found"); + SDL_LOG_DEBUG("RPC " << rpc_name << " wasn't found"); return false; } bool AccessRemoteImpl::CompareParameters( const policy_table::Strings& parameters, RemoteControlParams* input) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (parameters.empty()) { return true; } if (input->empty()) { - LOG4CXX_DEBUG(logger_, "Input is empty"); + SDL_LOG_DEBUG("Input is empty"); return false; } @@ -157,7 +156,7 @@ bool AccessRemoteImpl::CompareParameters( void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, const std::vector<int>& hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); HMIList::mapped_type types; std::transform(hmi_types.begin(), hmi_types.end(), @@ -168,7 +167,7 @@ void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( const ApplicationOnDevice& who) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cache_->IsDefaultPolicy(who.app_id)) { return hmi_types_[who]; } else { @@ -180,12 +179,12 @@ const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( const policy_table::Strings& AccessRemoteImpl::GetGroups( const ApplicationOnDevice& who) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetGroups(who.app_id); } bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const policy_table::AppHMITypes& hmi_types = HmiTypes(who); return std::find(hmi_types.begin(), hmi_types.end(), @@ -195,7 +194,7 @@ bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) { bool AccessRemoteImpl::GetPermissionsForApp(const std::string& device_id, const std::string& app_id, FunctionalIdType& group_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GetGroupsIds(device_id, app_id, group_types[kTypeGeneral]); GetGroupsIds(device_id, kDefaultId, group_types[kTypeDefault]); GetGroupsIds( @@ -221,7 +220,7 @@ void AccessRemoteImpl::GetGroupsIds(const std::string& device_id, groups.end(), groups_ids.begin(), &CacheManager::GenerateHash); - LOG4CXX_DEBUG(logger_, "Groups Ids: " << groups_ids); + SDL_LOG_DEBUG("Groups Ids: " << groups_ids); } bool AccessRemoteImpl::GetModuleTypes(const std::string& application_id, diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index 7c491a28a5..5a75c47725 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -60,22 +60,22 @@ namespace policy_table = rpc::policy_table_interface_base; namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") -#define CACHE_MANAGER_CHECK(return_value) \ - { \ - if (!pt_) { \ - LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \ - return return_value; \ - } \ +#define CACHE_MANAGER_CHECK(return_value) \ + { \ + if (!pt_) { \ + SDL_LOG_WARN("The cache manager is not initialized"); \ + return return_value; \ + } \ } -#define CACHE_MANAGER_CHECK_VOID() \ - { \ - if (!pt_) { \ - LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \ - return; \ - } \ +#define CACHE_MANAGER_CHECK_VOID() \ + { \ + if (!pt_) { \ + SDL_LOG_WARN("The cache manager is not initialized"); \ + return; \ + } \ } struct LanguageFinder { @@ -110,14 +110,14 @@ CacheManager::CacheManager() , update_required(false) , removed_custom_vd_items_() , settings_(nullptr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); backuper_ = new BackgroundBackuper(this); backup_thread_ = threads::CreateThread("Backup thread", backuper_); backup_thread_->Start(); } CacheManager::~CacheManager() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(backuper_locker_); backup_thread_->Stop(threads::Thread::kThreadSoftStop); delete backup_thread_->GetDelegate(); @@ -130,7 +130,7 @@ const policy_table::Strings& CacheManager::GetGroups(const PTString& app_id) { } const policy_table::Strings CacheManager::GetPolicyAppIDs() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto apps = pt_->policy_table.app_policies_section.apps; @@ -204,18 +204,18 @@ bool CacheManager::GetUserPermissionsForDevice( const std::string& device_id, StringArray& consented_groups, StringArray& disallowed_groups) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); return true; } void CacheManager::GetAllAppGroups(const std::string& app_id, FunctionalGroupIDs& all_group_ids) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); if (kDeviceId == app_id) { - LOG4CXX_INFO(logger_, "Devices doesn't have groups"); + SDL_LOG_INFO("Devices doesn't have groups"); return; } @@ -238,7 +238,7 @@ void CacheManager::GetAllAppGroups(const std::string& app_id, void CacheManager::GetPreConsentedGroups( const std::string& app_id, FunctionalGroupIDs& preconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); } @@ -246,7 +246,7 @@ void CacheManager::GetConsentedGroups(const std::string& device_id, const std::string& app_id, FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); } @@ -254,7 +254,7 @@ void CacheManager::GetUnconsentedGroups( const std::string& device_id, const std::string& policy_app_id, FunctionalGroupIDs& unconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); } @@ -264,7 +264,7 @@ void CacheManager::RemoveAppConsentForGroup(const std::string& app_id, } bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); pt_->policy_table.functional_groupings = @@ -355,7 +355,7 @@ policy_table::VehicleDataItems CacheManager::CollectCustomVDItems( void CacheManager::GetHMIAppTypeAfterUpdate( std::map<std::string, StringArray>& app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator policy_iter_begin = @@ -419,7 +419,7 @@ std::string CacheManager::currentDateTime() { bool CacheManager::GetPermissionsForApp(const std::string& device_id, const std::string& app_id, FunctionalIdType& group_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GetAllAppGroups(app_id, group_types[kTypeGeneral]); GetAllAppGroups(kDefaultId, group_types[kTypeDefault]); GetAllAppGroups(kPreDataConsentId, group_types[kTypePreDataConsented]); @@ -429,14 +429,14 @@ bool CacheManager::GetPermissionsForApp(const std::string& device_id, bool CacheManager::GetDeviceGroupsFromPolicies( policy_table::Strings& groups, policy_table::Strings& preconsented_groups) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); return true; } bool CacheManager::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); @@ -462,7 +462,7 @@ bool CacheManager::SetDeviceData(const std::string& device_id, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); @@ -474,7 +474,7 @@ bool CacheManager::SetUserPermissionsForDevice( const std::string& device_id, const StringArray& consented_groups, const StringArray& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); Backup(); @@ -483,7 +483,7 @@ bool CacheManager::SetUserPermissionsForDevice( bool CacheManager::ReactOnUserDevConsentForApp(const std::string& app_id, bool is_device_allowed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); bool result = true; Backup(); @@ -509,7 +509,7 @@ void CacheManager::GetGroupNameByHashID(const int32_t group_id, bool CacheManager::SetUserPermissionsForApp( const PermissionConsent& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); Backup(); @@ -541,7 +541,7 @@ void CacheManager::CheckPermissions(const policy_table::Strings& groups, const PTString& hmi_level, const PTString& rpc, CheckPermissionResult& result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -600,14 +600,14 @@ int CacheManager::IgnitionCyclesBeforeExchange() { static_cast<int>( pt_->policy_table.module_config.exchange_after_x_ignition_cycles), 0); - LOG4CXX_DEBUG(logger_, "IgnitionCyclesBeforeExchange limit:" << limit); + SDL_LOG_DEBUG("IgnitionCyclesBeforeExchange limit:" << limit); uint8_t current = 0; const int last_exch = static_cast<int>( *pt_->policy_table.module_meta->ignition_cycles_since_last_exchange); current = std::max(last_exch, 0); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "IgnitionCyclesBeforeExchange current:" << static_cast<int>(current)); return std::max(limit - current, 0); @@ -620,16 +620,16 @@ int CacheManager::KilometersBeforeExchange(int current) { std::max(static_cast<int>( pt_->policy_table.module_config.exchange_after_x_kilometers), 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange limit:" << limit); + SDL_LOG_DEBUG("KilometersBeforeExchange limit:" << limit); int last = 0; const int odo_val = static_cast<int>( *pt_->policy_table.module_meta->pt_exchanged_at_odometer_x); last = std::max(odo_val, 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange last:" << last); + SDL_LOG_DEBUG("KilometersBeforeExchange last:" << last); const int actual = std::max((current - last), 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange actual:" << actual); + SDL_LOG_DEBUG("KilometersBeforeExchange actual:" << actual); return std::max(limit - actual, 0); } @@ -640,18 +640,16 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate( switch (counter) { case KILOMETERS: *pt_->policy_table.module_meta->pt_exchanged_at_odometer_x = value; - LOG4CXX_DEBUG(logger_, - "SetCountersPassedForSuccessfulUpdate km:" << value); + SDL_LOG_DEBUG("SetCountersPassedForSuccessfulUpdate km:" << value); break; case DAYS_AFTER_EPOCH: *pt_->policy_table.module_meta->pt_exchanged_x_days_after_epoch = value; - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "SetCountersPassedForSuccessfulUpdate days after epoch:" << value); break; default: - LOG4CXX_ERROR(logger_, - "Unknown counter was requested to set: " << counter); + SDL_LOG_ERROR("Unknown counter was requested to set: " << counter); return false; } @@ -660,7 +658,7 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate( } int CacheManager::DaysBeforeExchange(int current) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(0); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -672,14 +670,13 @@ int CacheManager::DaysBeforeExchange(int current) { } const uint8_t limit = pt_->policy_table.module_config.exchange_after_x_days; - LOG4CXX_DEBUG(logger_, - "Exchange after: " << static_cast<int>(limit) << " days"); + SDL_LOG_DEBUG("Exchange after: " << static_cast<int>(limit) << " days"); - LOG4CXX_DEBUG(logger_, "Epoch since last update: " << *days_after_epoch); + SDL_LOG_DEBUG("Epoch since last update: " << *days_after_epoch); const uint16_t actual = std::max(static_cast<uint16_t>(current - *days_after_epoch), uint16_t(0)); - LOG4CXX_DEBUG(logger_, "The days since last update: " << actual); + SDL_LOG_DEBUG("The days since last update: " << actual); return std::max(limit - actual, 0); } @@ -691,7 +688,7 @@ void CacheManager::IncrementIgnitionCycles() { *pt_->policy_table.module_meta->ignition_cycles_since_last_exchange); (*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange) = ign_val + 1; - LOG4CXX_DEBUG(logger_, "IncrementIgnitionCycles ignitions:" << ign_val); + SDL_LOG_DEBUG("IncrementIgnitionCycles ignitions:" << ign_val); Backup(); } @@ -914,7 +911,7 @@ void CacheManager::SetHybridAppPreference( void CacheManager::GetAppServiceParameters( const std::string& policy_app_id, policy_table::AppServiceParameters* app_service_parameters) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -944,24 +941,23 @@ bool CacheManager::UnknownRPCPassthroughAllowed( const boost::optional<bool> CacheManager::LockScreenDismissalEnabledState() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); boost::optional<bool> empty; CACHE_MANAGER_CHECK(empty); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ModuleConfig& module_config = pt_->policy_table.module_config; if (module_config.lock_screen_dismissal_enabled.is_initialized()) { - LOG4CXX_TRACE(logger_, - "state = " << *module_config.lock_screen_dismissal_enabled); + SDL_LOG_TRACE("state = " << *module_config.lock_screen_dismissal_enabled); return boost::optional<bool>(*module_config.lock_screen_dismissal_enabled); } - LOG4CXX_TRACE(logger_, "state = empty"); + SDL_LOG_TRACE("state = empty"); return empty; } const boost::optional<std::string> CacheManager::LockScreenDismissalWarningMessage( const std::string& language) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); boost::optional<std::string> empty; CACHE_MANAGER_CHECK(empty); @@ -983,7 +979,7 @@ CacheManager::LockScreenDismissalWarningMessage( std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( const std::vector<std::string>& msg_codes, const std::string& language) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<UserFriendlyMessage> result; CACHE_MANAGER_CHECK(result); @@ -1003,10 +999,9 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( msg_languages.languages.begin(), msg_languages.languages.end(), finder); if (msg_languages.languages.end() == it_language) { - LOG4CXX_WARN(logger_, - "Language " - << language - << " haven't been found for message code: " << *it); + SDL_LOG_WARN("Language " + << language + << " haven't been found for message code: " << *it); LanguageFinder fallback_language_finder("en-us"); @@ -1016,8 +1011,7 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( fallback_language_finder); if (msg_languages.languages.end() == it_fallback_language) { - LOG4CXX_ERROR(logger_, - "No fallback language found for message code: " << *it); + SDL_LOG_ERROR("No fallback language found for message code: " << *it); continue; } @@ -1058,10 +1052,10 @@ void CacheManager::GetUpdateUrls(const uint32_t service_type, void CacheManager::GetUpdateUrls(const std::string& service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); - LOG4CXX_DEBUG(logger_, "Search service value is: " << service_type); + SDL_LOG_DEBUG("Search service value is: " << service_type); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ServiceEndpoints::const_iterator iter = @@ -1145,7 +1139,7 @@ bool CacheManager::GetPriority(const std::string& policy_app_id, void CacheManager::CheckSnapshotInitialization() { CACHE_MANAGER_CHECK_VOID(); if (!snapshot_) { - LOG4CXX_ERROR(logger_, "Snapshot pointer is not initialized"); + SDL_LOG_ERROR("Snapshot pointer is not initialized"); return; } @@ -1177,8 +1171,7 @@ void CacheManager::CheckSnapshotInitialization() { snapshot_->policy_table.consumer_friendly_messages->messages = rpc::Optional<policy_table::Messages>(); } else { - LOG4CXX_WARN(logger_, - "policy_table.consumer_friendly_messages is not initialized"); + SDL_LOG_WARN("policy_table.consumer_friendly_messages is not initialized"); } /* policy_table.usage_and_error_counts are required for PTS and @@ -1256,22 +1249,21 @@ void CacheManager::CheckSnapshotInitialization() { } } } else { - LOG4CXX_WARN(logger_, "app_level is not initialized"); + SDL_LOG_WARN("app_level is not initialized"); } } policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff( const policy_table::VehicleDataItems& items_before, const policy_table::VehicleDataItems& items_after) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (items_before.empty()) { - LOG4CXX_DEBUG(logger_, "No custom VD items found in policy"); + SDL_LOG_DEBUG("No custom VD items found in policy"); return policy_table::VehicleDataItems(); } if (items_after.empty()) { - LOG4CXX_DEBUG(logger_, - "All custom VD items were removed after policy update"); + SDL_LOG_DEBUG("All custom VD items were removed after policy update"); return items_before; } @@ -1289,19 +1281,18 @@ policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff( } } - LOG4CXX_DEBUG(logger_, - "Found " << removed_items.size() << " removed VD items"); + SDL_LOG_DEBUG("Found " << removed_items.size() << " removed VD items"); return removed_items; } void CacheManager::SetRemovedCustomVdItems( const policy_table::VehicleDataItems& removed_items) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); removed_custom_vd_items_ = removed_items; } void CacheManager::PersistData() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (backup_.use_count() != 0) { if (pt_.use_count() != 0) { // Comma expression is used to hold the lock only during the constructor @@ -1359,7 +1350,7 @@ void CacheManager::PersistData() { } void CacheManager::ResetCalculatedPermissions() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_.clear(); } @@ -1367,9 +1358,8 @@ void CacheManager::ResetCalculatedPermissions() { void CacheManager::AddCalculatedPermissions(const std::string& device_id, const std::string& policy_app_id, const Permissions& permissions) { - LOG4CXX_DEBUG(logger_, - "AddCalculatedPermissions for device: " - << device_id << " and app: " << policy_app_id); + SDL_LOG_DEBUG("AddCalculatedPermissions for device: " + << device_id << " and app: " << policy_app_id); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_[device_id][policy_app_id] = permissions; } @@ -1377,9 +1367,8 @@ void CacheManager::AddCalculatedPermissions(const std::string& device_id, bool CacheManager::IsPermissionsCalculated(const std::string& device_id, const std::string& policy_app_id, Permissions& permission) { - LOG4CXX_DEBUG(logger_, - "IsPermissionsCalculated for device: " - << device_id << " and app: " << policy_app_id); + SDL_LOG_DEBUG("IsPermissionsCalculated for device: " + << device_id << " and app: " << policy_app_id); sync_primitives::AutoLock lock(calculated_permissions_lock_); CalculatedPermissions::const_iterator it = calculated_permissions_.find(device_id); @@ -1443,7 +1432,7 @@ std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { bool CacheManager::GetInitialAppData(const std::string& app_id, StringArray& nicknames, StringArray& app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -1466,7 +1455,7 @@ bool CacheManager::GetInitialAppData(const std::string& app_id, bool CacheManager::GetFunctionalGroupings( policy_table::FunctionalGroupings& groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); const policy_table::FunctionalGroupings& f_groupings = @@ -1478,15 +1467,15 @@ bool CacheManager::GetFunctionalGroupings( int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); - LOG4CXX_DEBUG(logger_, "Application id: " << policy_app_id); + SDL_LOG_DEBUG("Application id: " << policy_app_id); int result = 0; return result; } void CacheManager::SetPreloadedPtFlag(const bool is_preloaded) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); *(pt_->policy_table.module_config.preloaded_pt) = is_preloaded; Backup(); } @@ -1507,7 +1496,7 @@ bool CacheManager::SetMetaInfo(const std::string& ccpu_version, } std::string CacheManager::GetCCPUVersionFromPT() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc::Optional<policy_table::ModuleMeta>& module_meta = pt_->policy_table.module_meta; return *(module_meta->ccpu_version); @@ -1526,7 +1515,7 @@ bool CacheManager::SetSystemLanguage(const std::string& language) { } bool CacheManager::GetFunctionalGroupNames(FunctionalGroupNames& names) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); rpc::policy_table_interface_base::FunctionalGroupings::iterator iter = @@ -1598,7 +1587,7 @@ void CacheManager::Increment(const std::string& app_id, .count_of_tls_errors; break; default: - LOG4CXX_WARN(logger_, "Type app counter is unknown"); + SDL_LOG_WARN("Type app counter is unknown"); return; } Backup(); @@ -1619,7 +1608,7 @@ void CacheManager::Set(const std::string& app_id, .app_registration_language_vui = value; break; default: - LOG4CXX_WARN(logger_, "Type app info is unknown"); + SDL_LOG_WARN("Type app info is unknown"); return; } Backup(); @@ -1649,7 +1638,7 @@ void CacheManager::Add(const std::string& app_id, .minutes_in_hmi_none += minutes; break; default: - LOG4CXX_WARN(logger_, "Type app stopwatch is unknown"); + SDL_LOG_WARN("Type app stopwatch is unknown"); return; } Backup(); @@ -1706,8 +1695,7 @@ bool CacheManager::SetPredataPolicy(const std::string& app_id) { pt_->policy_table.app_policies_section.apps.find(kPreDataConsentId); if (pt_->policy_table.app_policies_section.apps.end() == iter) { - LOG4CXX_ERROR(logger_, - "Could not set " << kPreDataConsentId + SDL_LOG_ERROR("Could not set " << kPreDataConsentId << " permissions for app " << app_id); return false; } @@ -1756,20 +1744,18 @@ bool CacheManager::SetUnpairedDevice(const std::string& device_id, const bool result = pt_->policy_table.device_data->end() != pt_->policy_table.device_data->find(device_id); if (!result) { - LOG4CXX_DEBUG(logger_, - "Couldn't set unpaired flag for device id " - << device_id << " , since it wasn't found."); + SDL_LOG_DEBUG("Couldn't set unpaired flag for device id " + << device_id << " , since it wasn't found."); return false; } sync_primitives::AutoLock lock(unpaired_lock_); if (unpaired) { is_unpaired_.insert(device_id); - LOG4CXX_DEBUG(logger_, "Unpaired flag was set for device id " << device_id); + SDL_LOG_DEBUG("Unpaired flag was set for device id " << device_id); } else { is_unpaired_.erase(device_id); - LOG4CXX_DEBUG(logger_, - "Unpaired flag was removed for device id " << device_id); + SDL_LOG_DEBUG("Unpaired flag was removed for device id " << device_id); } return result; } @@ -1793,20 +1779,20 @@ bool CacheManager::IsApplicationRepresented(const std::string& app_id) const { bool CacheManager::Init(const std::string& file_name, const PolicySettings* settings) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); settings_ = settings; InitResult init_result = backup_->Init(settings); bool result = true; switch (init_result) { case InitResult::EXISTS: { - LOG4CXX_INFO(logger_, "Policy Table exists, was loaded correctly."); + SDL_LOG_INFO("Policy Table exists, was loaded correctly."); result = LoadFromBackup(); if (result) { if (!backup_->IsDBVersionActual()) { - LOG4CXX_INFO(logger_, "DB version is NOT actual"); + SDL_LOG_INFO("DB version is NOT actual"); if (!backup_->RefreshDB()) { - LOG4CXX_ERROR(logger_, "RefreshDB() failed"); + SDL_LOG_ERROR("RefreshDB() failed"); return false; } backup_->UpdateDBVersion(); @@ -1818,24 +1804,22 @@ bool CacheManager::Init(const std::string& file_name, } } break; case InitResult::SUCCESS: { - LOG4CXX_INFO(logger_, "Policy Table was inited successfully"); + SDL_LOG_INFO("Policy Table was inited successfully"); result = LoadFromFile(file_name, *pt_); std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); - LOG4CXX_DEBUG(logger_, - "Check if snapshot is valid: " << std::boolalpha << result); + SDL_LOG_DEBUG("Check if snapshot is valid: " << std::boolalpha << result); if (!result) { rpc::ValidationReport report("policy_table"); snapshot->ReportErrors(&report); - LOG4CXX_DEBUG(logger_, - "Validation report: " << rpc::PrettyFormat(report)); + SDL_LOG_DEBUG("Validation report: " << rpc::PrettyFormat(report)); return result; } if (!UnwrapAppPolicies(pt_->policy_table.app_policies_section.apps)) { - LOG4CXX_ERROR(logger_, "Cannot unwrap application policies"); + SDL_LOG_ERROR("Cannot unwrap application policies"); } backup_->UpdateDBVersion(); @@ -1843,7 +1827,7 @@ bool CacheManager::Init(const std::string& file_name, } break; default: { result = false; - LOG4CXX_ERROR(logger_, "Failed to init policy table."); + SDL_LOG_ERROR("Failed to init policy table."); } break; } @@ -1853,12 +1837,11 @@ bool CacheManager::Init(const std::string& file_name, void CacheManager::FillDeviceSpecificData() {} bool CacheManager::LoadFromBackup() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(cache_lock_); pt_ = backup_->GenerateSnapshot(); update_required = backup_->UpdateRequired(); - LOG4CXX_DEBUG(logger_, - "Update required flag from backup: " << std::boolalpha + SDL_LOG_DEBUG("Update required flag from backup: " << std::boolalpha << update_required); FillDeviceSpecificData(); @@ -1888,10 +1871,10 @@ void CacheManager::MakeLowerCaseAppNames(policy_table::Table& pt) const { bool CacheManager::LoadFromFile(const std::string& file_name, policy_table::Table& table) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); BinaryMessage json_string; if (!file_system::ReadBinaryFile(file_name, json_string)) { - LOG4CXX_FATAL(logger_, "Failed to read pt file."); + SDL_LOG_FATAL("Failed to read pt file."); return false; } @@ -1904,27 +1887,25 @@ bool CacheManager::LoadFromFile(const std::string& file_name, std::string json(json_string.begin(), json_string.end()); const size_t json_len = json.length(); if (!reader->parse(json.c_str(), json.c_str() + json_len, &value, &err)) { - LOG4CXX_FATAL(logger_, "Preloaded PT is corrupted: " << err); + SDL_LOG_FATAL("Preloaded PT is corrupted: " << err); return false; } - LOG4CXX_TRACE(logger_, "Start create PT"); + SDL_LOG_TRACE("Start create PT"); sync_primitives::AutoLock locker(cache_lock_); table = policy_table::Table(&value); Json::StreamWriterBuilder writer_builder; - LOG4CXX_DEBUG(logger_, "PT out:"); - LOG4CXX_DEBUG(logger_, - Json::writeString(writer_builder, table.ToJsonValue())); + SDL_LOG_DEBUG("PT out:"); + SDL_LOG_DEBUG(Json::writeString(writer_builder, table.ToJsonValue())); MakeLowerCaseAppNames(table); if (!table.is_valid()) { rpc::ValidationReport report("policy_table"); table.ReportErrors(&report); - LOG4CXX_FATAL(logger_, - "Parsed table is not valid " << rpc::PrettyFormat(report)); + SDL_LOG_FATAL("Parsed table is not valid " << rpc::PrettyFormat(report)); return false; } @@ -1962,25 +1943,22 @@ int32_t CacheManager::GenerateHash(const std::string& str_to_hash) { RequestType::State CacheManager::GetAppRequestTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::iterator app_policies_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request types for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id); return RequestType::State::UNAVAILABLE; } const policy_table::RequestTypes& request_types = *app_policies_iter->second.RequestType; if (!request_types.is_initialized()) { - LOG4CXX_DEBUG(logger_, - "Request types for " << policy_app_id << " are OMITTED"); + SDL_LOG_DEBUG("Request types for " << policy_app_id << " are OMITTED"); return RequestType::State::OMITTED; } if (request_types.empty()) { - LOG4CXX_DEBUG(logger_, - "Request types for " << policy_app_id << " are EMPTY"); + SDL_LOG_DEBUG("Request types for " << policy_app_id << " are EMPTY"); return RequestType::State::EMPTY; } return RequestType::State::AVAILABLE; @@ -1989,19 +1967,17 @@ RequestType::State CacheManager::GetAppRequestTypesState( void CacheManager::GetAppRequestTypes( const std::string& policy_app_id, std::vector<std::string>& request_types) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); if (kDeviceId == policy_app_id) { - LOG4CXX_DEBUG(logger_, - "Request types not applicable for app_id " << kDeviceId); + SDL_LOG_DEBUG("Request types not applicable for app_id " << kDeviceId); return; } policy_table::ApplicationPolicies::iterator policy_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request types for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id); return; } @@ -2013,25 +1989,22 @@ void CacheManager::GetAppRequestTypes( RequestSubType::State CacheManager::GetAppRequestSubTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::iterator app_policies_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request subtypes for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id); return RequestSubType::State::UNAVAILABLE; } const policy_table::RequestSubTypes& request_subtypes = *app_policies_iter->second.RequestSubType; if (!request_subtypes.is_initialized()) { - LOG4CXX_DEBUG(logger_, - "Request subtypes for " << policy_app_id << " are OMITTED"); + SDL_LOG_DEBUG("Request subtypes for " << policy_app_id << " are OMITTED"); return RequestSubType::State::OMITTED; } if (request_subtypes.empty()) { - LOG4CXX_DEBUG(logger_, - "Request subtypes for " << policy_app_id << " are EMPTY"); + SDL_LOG_DEBUG("Request subtypes for " << policy_app_id << " are EMPTY"); return RequestSubType::State::EMPTY; } return RequestSubType::State::AVAILABLE; @@ -2040,19 +2013,17 @@ RequestSubType::State CacheManager::GetAppRequestSubTypesState( void CacheManager::GetAppRequestSubTypes( const std::string& policy_app_id, std::vector<std::string>& request_types) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); if (kDeviceId == policy_app_id) { - LOG4CXX_DEBUG(logger_, - "Request subtypes not applicable for app_id " << kDeviceId); + SDL_LOG_DEBUG("Request subtypes not applicable for app_id " << kDeviceId); return; } policy_table::ApplicationPolicies::iterator policy_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request subtypes for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id); return; } @@ -2072,10 +2043,10 @@ std::string CacheManager::GetCertificate() const { } bool CacheManager::MergePreloadPT(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::Table table; if (!LoadFromFile(file_name, table)) { - LOG4CXX_DEBUG(logger_, "Unable to load preloaded PT."); + SDL_LOG_DEBUG("Unable to load preloaded PT."); return false; } @@ -2097,7 +2068,7 @@ bool CacheManager::MergePreloadPT(const std::string& file_name) { void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::ModuleConfig copy(pt.module_config); pt.module_config = new_pt.module_config; @@ -2108,19 +2079,19 @@ void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt, void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::FunctionalGroupings::const_iterator it = new_pt.functional_groupings.begin(); for (; it != new_pt.functional_groupings.end(); ++it) { - LOG4CXX_DEBUG(logger_, "Merge functional group: " << it->first); + SDL_LOG_DEBUG("Merge functional group: " << it->first); pt.functional_groupings[it->first] = it->second; } } void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); pt.app_policies_section.device = const_cast<policy_table::PolicyTable&>(new_pt) .app_policies_section.device; @@ -2136,7 +2107,7 @@ void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (new_pt.consumer_friendly_messages.is_initialized()) { if (!pt.consumer_friendly_messages.is_initialized()) { pt.consumer_friendly_messages = new_pt.consumer_friendly_messages; @@ -2147,9 +2118,9 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, pt.consumer_friendly_messages->version = new_pt.consumer_friendly_messages->version; for (; it != new_pt.consumer_friendly_messages->messages->end(); ++it) { - LOG4CXX_DEBUG(logger_, "Merge CFM: " << it->first); + SDL_LOG_DEBUG("Merge CFM: " << it->first); if (!(pt.consumer_friendly_messages->messages.is_initialized())) { - LOG4CXX_DEBUG(logger_, "CFM not initialized."); + SDL_LOG_DEBUG("CFM not initialized."); } (*pt.consumer_friendly_messages->messages)[it->first] = it->second; } @@ -2159,7 +2130,7 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, void CacheManager::MergeVD(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); pt.vehicle_data.assign_if_valid(new_pt.vehicle_data); } @@ -2171,8 +2142,8 @@ const PolicySettings& CacheManager::get_settings() const { void CacheManager::OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_INFO(logger_, "Implementation does not support user consents."); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_INFO("Implementation does not support user consents."); } CacheManager::BackgroundBackuper::BackgroundBackuper( @@ -2180,26 +2151,26 @@ CacheManager::BackgroundBackuper::BackgroundBackuper( : cache_manager_(cache_manager) , stop_flag_(false) , new_data_available_(false) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } CacheManager::BackgroundBackuper::~BackgroundBackuper() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void CacheManager::BackgroundBackuper::InternalBackup() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(cache_manager_); while (new_data_available_) { new_data_available_ = false; - LOG4CXX_DEBUG(logger_, "DoBackup"); + SDL_LOG_DEBUG("DoBackup"); cache_manager_->PersistData(); } } void CacheManager::BackgroundBackuper::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(need_backup_lock_); while (!stop_flag_) { { @@ -2209,20 +2180,20 @@ void CacheManager::BackgroundBackuper::threadMain() { if (new_data_available_ || stop_flag_) { continue; } - LOG4CXX_DEBUG(logger_, "Wait for a next backup"); + SDL_LOG_DEBUG("Wait for a next backup"); backup_notifier_.Wait(need_backup_lock_); } } void CacheManager::BackgroundBackuper::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(need_backup_lock_); stop_flag_ = true; backup_notifier_.NotifyOne(); } void CacheManager::BackgroundBackuper::DoBackup() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(need_backup_lock_); new_data_available_ = true; backup_notifier_.NotifyOne(); @@ -2230,7 +2201,7 @@ void CacheManager::BackgroundBackuper::DoBackup() { EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag( const std::string& application) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); return pt_->policy_table.app_policies_section.apps[application] @@ -2239,14 +2210,14 @@ EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag( EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag( const std::string& functional_group) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto& functional_groupings = pt_->policy_table.functional_groupings; const auto& grouping_itr = functional_groupings.find(functional_group); if (grouping_itr == functional_groupings.end()) { - LOG4CXX_WARN(logger_, "Group " << functional_group << " not found"); + SDL_LOG_WARN("Group " << functional_group << " not found"); return EncryptionRequired(rpc::Boolean(false)); } @@ -2256,14 +2227,13 @@ EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag( void CacheManager::GetApplicationParams( const std::string& application_name, policy_table::ApplicationParams& application_params) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto apps = pt_->policy_table.app_policies_section.apps; const auto it = apps.find(application_name); if (apps.end() == it) { - LOG4CXX_WARN(logger_, - "Application " << application_name << " was not found"); + SDL_LOG_WARN("Application " << application_name << " was not found"); return; } diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc index 08f1fbb177..7d99ff51c0 100644 --- a/src/components/policy/policy_regular/src/policy_helper.cc +++ b/src/components/policy/policy_regular/src/policy_helper.cc @@ -44,7 +44,7 @@ namespace custom_str = utils::custom_string; namespace { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") bool CompareStrings(const StringsValueType& first, const StringsValueType& second) { @@ -302,7 +302,7 @@ std::vector<FunctionalGroupPermission> policy::CheckAppPolicy::GetRevokedGroups( FunctionalGroupNames groups_attributes; if (!pm_->cache_->GetFunctionalGroupNames(groups_attributes)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return std::vector<FunctionalGroupPermission>(); } @@ -339,8 +339,8 @@ void policy::CheckAppPolicy::NotifySystem( auto& listener = *pm_->listener(); const auto devices_ids = listener.GetDevicesIds(app_policy.first); if (devices_ids.empty()) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Couldn't find device info for application id: " << app_policy.first); return; } @@ -352,7 +352,7 @@ void policy::CheckAppPolicy::NotifySystem( bool CheckAppPolicy::IsAppRevoked( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Application params are not initialized = application revoked // i.e. "123":null return app_policy.second.is_null(); @@ -380,7 +380,7 @@ bool CheckAppPolicy::NicknamesMatch( void CheckAppPolicy::AddResult(const std::string& app_id, PermissionsCheckResult result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto item = std::make_pair(app_id, result); out_results_.insert(item); } @@ -395,8 +395,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { } if (!IsKnownAppication(app_id)) { - LOG4CXX_WARN(logger_, - "Application:" << app_id << " is not present in snapshot."); + SDL_LOG_WARN("Application:" << app_id << " is not present in snapshot."); return true; } @@ -427,16 +426,14 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { } } if (RESULT_NO_CHANGES == result) { - LOG4CXX_INFO( - logger_, - "Permissions for application:" << app_id << " wasn't changed."); + SDL_LOG_INFO("Permissions for application:" << app_id + << " wasn't changed."); AddResult(app_id, RESULT_NO_CHANGES); return true; } - LOG4CXX_INFO( - logger_, - "Permissions for application:" << app_id << " have been changed."); + SDL_LOG_INFO("Permissions for application:" << app_id + << " have been changed."); if (IsPredefinedApp(app_policy)) { const auto& snapshot_app_policy_begin = @@ -616,7 +613,7 @@ bool CheckAppPolicy::IsRequestSubTypeChanged( bool CheckAppPolicy::IsAppPropertiesProvided( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app_policy.second.hybrid_app_preference.is_initialized() || app_policy.second.endpoint.is_initialized() || app_policy.second.enabled.is_initialized() || @@ -630,15 +627,15 @@ bool CheckAppPolicy::IsAppPropertiesProvided( bool CheckAppPolicy::IsAppPropertiesChanged( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!IsAppPropertiesProvided(app_policy)) { return false; } if (!IsKnownAppication(app_policy.first)) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "AppProperties provided for new application: " << app_policy.first); return true; } @@ -649,33 +646,33 @@ bool CheckAppPolicy::IsAppPropertiesChanged( if (app_policy.second.enabled.is_initialized() && app_policy.second.enabled != snapshot_properties.second.enabled) { - LOG4CXX_DEBUG(logger_, "\"enabled\" was changed"); + SDL_LOG_DEBUG("\"enabled\" was changed"); return true; } if (app_policy.second.endpoint.is_initialized() && app_policy.second.endpoint != snapshot_properties.second.endpoint) { - LOG4CXX_DEBUG(logger_, "\"endpoint\" was changed"); + SDL_LOG_DEBUG("\"endpoint\" was changed"); return true; } if (app_policy.second.hybrid_app_preference.is_initialized() && app_policy.second.hybrid_app_preference != snapshot_properties.second.hybrid_app_preference) { - LOG4CXX_DEBUG(logger_, "\"hybrid_app_preference\" was changed"); + SDL_LOG_DEBUG("\"hybrid_app_preference\" was changed"); return true; } if (app_policy.second.auth_token.is_initialized() && app_policy.second.auth_token != snapshot_properties.second.auth_token) { - LOG4CXX_DEBUG(logger_, "\"auth_token\" was changed"); + SDL_LOG_DEBUG("\"auth_token\" was changed"); return true; } if (app_policy.second.cloud_transport_type.is_initialized() && app_policy.second.cloud_transport_type != snapshot_properties.second.cloud_transport_type) { - LOG4CXX_DEBUG(logger_, "\"cloud_transport_type\" was changed"); + SDL_LOG_DEBUG("\"cloud_transport_type\" was changed"); return true; } @@ -690,7 +687,7 @@ bool CheckAppPolicy::IsEncryptionRequiredFlagChanged( -> rpc::Optional<rpc::Boolean> { auto it = policies.find(policy_app_id); if (policies.end() == it) { - LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id); + SDL_LOG_WARN("App is not present in policies " << policy_app_id); return rpc::Optional<rpc::Boolean>(false); } return it->second.encryption_required; @@ -702,7 +699,7 @@ bool CheckAppPolicy::IsEncryptionRequiredFlagChanged( policy_table::Strings result; auto it = policies.find(policy_app_id); if (policies.end() == it) { - LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id); + SDL_LOG_WARN("App is not present in policies " << policy_app_id); return result; } auto& groups = it->second.groups; @@ -1047,7 +1044,7 @@ void FillFunctionalGroupPermissions( FunctionalGroupNames& names, GroupConsent state, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs::const_iterator it = ids.begin(); FunctionalGroupIDs::const_iterator it_end = ids.end(); for (; it != it_end; ++it) { @@ -1067,7 +1064,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) { FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, const FunctionalGroupIDs& what) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs from_copy(from); FunctionalGroupIDs what_copy(what); @@ -1089,7 +1086,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); @@ -1111,7 +1108,7 @@ FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOG4CXX_INFO(logger_, "Find same groups"); + SDL_LOG_INFO("Find same groups"); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); @@ -1142,9 +1139,9 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) { (*it).second = (*it_default).second; it->second.set_to_string(kDefaultId); } else { - LOG4CXX_ERROR(logger_, - "There is no default application policy was " - "found in PTU."); + SDL_LOG_ERROR( + "There is no default application policy was " + "found in PTU."); return false; } } diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index 174d0d5d12..36beeeb07f 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -60,7 +60,7 @@ const uint32_t kDefaultRetryTimeoutInMSec = namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") PolicyManagerImpl::PolicyManagerImpl() : PolicyManager() @@ -126,15 +126,14 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray( #endif void PolicyManagerImpl::CheckTriggers() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool exceed_ignition_cycles = ExceededIgnitionCycles(); const bool exceed_days = ExceededDays(); - LOG4CXX_DEBUG( - logger_, - "\nDays exceeded: " << std::boolalpha << exceed_days - << "\nIgnition cycles exceeded: " << std::boolalpha - << exceed_ignition_cycles); + SDL_LOG_DEBUG("\nDays exceeded: " << std::boolalpha << exceed_days + << "\nIgnition cycles exceeded: " + << std::boolalpha + << exceed_ignition_cycles); if (exceed_ignition_cycles || exceed_days) { update_status_manager_.ScheduleUpdate(); @@ -327,9 +326,9 @@ void FilterPolicyTable( PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( const std::string& file, const BinaryMessage& pt_content) { - LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size()); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_INFO("LoadPT of size " << pt_content.size()); + SDL_LOG_DEBUG( + "PTU content is: " << std::string(pt_content.begin(), pt_content.end())); #ifdef USE_HMI_PTU_DECRYPTION @@ -343,7 +342,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( std::shared_ptr<policy_table::Table> pt_update = ParseArray(pt_content); #endif if (!pt_update) { - LOG4CXX_WARN(logger_, "Parsed table pointer is NULL."); + SDL_LOG_WARN("Parsed table pointer is NULL."); ; return PtProcessingResult::kWrongPtReceived; } @@ -354,13 +353,13 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( FilterPolicyTable(pt_update->policy_table, current_vd_items); if (!IsPTValid(pt_update, policy_table::PT_UPDATE)) { - LOG4CXX_WARN(logger_, "Received policy table update is not valid"); + SDL_LOG_WARN("Received policy table update is not valid"); return PtProcessingResult::kWrongPtReceived; } // Update finished, no need retry if (timer_retry_sequence_.is_running()) { - LOG4CXX_INFO(logger_, "Stop retry sequence"); + SDL_LOG_INFO("Stop retry sequence"); timer_retry_sequence_.Stop(); } @@ -371,8 +370,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( // Get current DB data, since it could be updated during awaiting of PTU auto policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Failed to create snapshot of policy table, trying another exchange"); return PtProcessingResult::kNewPtRequired; } @@ -387,8 +385,8 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( // Replace current data with updated if (!cache_->ApplyUpdate(*pt_update)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Unsuccessful save of updated policy table, trying another exchange"); return PtProcessingResult::kNewPtRequired; } @@ -403,10 +401,10 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( std::map<std::string, StringArray> app_hmi_types; cache_->GetHMIAppTypeAfterUpdate(app_hmi_types); if (!app_hmi_types.empty()) { - LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType"); + SDL_LOG_INFO("app_hmi_types is full calling OnUpdateHMIAppType"); listener_->OnUpdateHMIAppType(app_hmi_types); } else { - LOG4CXX_INFO(logger_, "app_hmi_types empty" << pt_content.size()); + SDL_LOG_INFO("app_hmi_types empty" << pt_content.size()); } std::vector<std::string> enabled_apps; @@ -419,10 +417,10 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( } void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ptu_requested_ = false; if (PtProcessingResult::kWrongPtReceived == ptu_result) { - LOG4CXX_DEBUG(logger_, "Wrong PT was received"); + SDL_LOG_DEBUG("Wrong PT was received"); update_status_manager_.OnWrongUpdateReceived(); return; } @@ -430,7 +428,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { update_status_manager_.OnValidUpdateReceived(); if (PtProcessingResult::kNewPtRequired == ptu_result) { - LOG4CXX_DEBUG(logger_, "New PTU interation is required"); + SDL_LOG_DEBUG("New PTU interation is required"); ForcePTExchange(); return; } @@ -440,8 +438,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { // If there was a user request for policy table update, it should be started // right after current update is finished if (update_status_manager_.IsUpdateRequired() && HasApplicationForPTU()) { - LOG4CXX_DEBUG(logger_, - "PTU was successful and new PTU iteration was scheduled"); + SDL_LOG_DEBUG("PTU was successful and new PTU iteration was scheduled"); StartPTExchange(); return; } @@ -452,7 +449,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { void PolicyManagerImpl::ProcessAppPolicyCheckResults( const CheckAppPolicyResults& results, const rpc::policy_table_interface_base::ApplicationPolicies& app_policies) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationsPoliciesActions actions_for_apps_policies; FillActionsForAppPolicies filler(actions_for_apps_policies, app_policies); @@ -508,12 +505,12 @@ void PolicyManagerImpl::ProcessActionsForAppPolicies( void PolicyManagerImpl::SendOnAppPropertiesChangeNotification( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); listener_->SendOnAppPropertiesChangeNotification(policy_app_id); } void PolicyManagerImpl::ResumePendingAppPolicyActions() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (auto& notify_system_params : notify_system_list_) { NotifySystem(notify_system_params.first, notify_system_params.second); @@ -566,7 +563,7 @@ void PolicyManagerImpl::SendPermissionsToApp( CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges( const std::shared_ptr<policy_table::Table> pt_update, const std::shared_ptr<policy_table::Table> snapshot) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Replace predefined policies with its actual setting, e.g. "123":"default" // to actual values of default section @@ -597,31 +594,31 @@ void PolicyManagerImpl::PrepareNotificationData( const policy_table::Strings& group_names, const std::vector<FunctionalGroupPermission>& group_permission, Permissions& notification_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessFunctionalGroup processor(groups, group_permission, notification_data); std::for_each(group_names.begin(), group_names.end(), processor); } void PolicyManagerImpl::GetUpdateUrls(const std::string& service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->GetUpdateUrls(service_type, out_end_points); } void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->GetUpdateUrls(service_type, out_end_points); } bool PolicyManagerImpl::RequestPTUpdate(const PTUIterationType iteration_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); BinaryMessage update; if (PTUIterationType::DefaultIteration == iteration_type) { std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { - LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); + SDL_LOG_ERROR("Failed to create snapshot of policy table"); return false; } @@ -632,7 +629,7 @@ bool PolicyManagerImpl::RequestPTUpdate(const PTUIterationType iteration_type) { writer_builder["indentation"] = ""; std::string message_string = Json::writeString(writer_builder, value); - LOG4CXX_DEBUG(logger_, "Snapshot contents is : " << message_string); + SDL_LOG_DEBUG("Snapshot contents is : " << message_string); update = BinaryMessage(message_string.begin(), message_string.end()); } @@ -647,24 +644,24 @@ std::string PolicyManagerImpl::GetIconUrl( } void PolicyManagerImpl::StartPTExchange() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool update_required = update_status_manager_.IsUpdateRequired(); if (update_status_manager_.IsAppsSearchInProgress() && update_required) { update_status_manager_.ScheduleUpdate(); - LOG4CXX_INFO(logger_, - "Starting exchange skipped, since applications " - "search is in progress."); + SDL_LOG_INFO( + "Starting exchange skipped, since applications " + "search is in progress."); return; } if (update_status_manager_.IsUpdatePending() && update_required) { if (trigger_ptu_) update_status_manager_.ScheduleUpdate(); - LOG4CXX_INFO(logger_, - "Starting exchange skipped, since another exchange " - "is in progress."); + SDL_LOG_INFO( + "Starting exchange skipped, since another exchange " + "is in progress."); return; } @@ -682,8 +679,7 @@ void PolicyManagerImpl::StartPTExchange() { const uint32_t timeout_msec = NextRetryTimeout(); if (timeout_msec) { - LOG4CXX_DEBUG(logger_, - "Start retry sequence timeout = " << timeout_msec); + SDL_LOG_DEBUG("Start retry sequence timeout = " << timeout_msec); timer_retry_sequence_.Start(timeout_msec, timer::kPeriodic); } } @@ -692,12 +688,12 @@ void PolicyManagerImpl::StartPTExchange() { } void PolicyManagerImpl::OnAppsSearchStarted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.OnAppsSearchStarted(); } void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.OnAppsSearchCompleted(); trigger_ptu_ = trigger_ptu; @@ -709,13 +705,13 @@ void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) { } void PolicyManagerImpl::OnLocalAppAdded() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.ScheduleUpdate(); StartPTExchange(); } void PolicyManagerImpl::UpdatePTUReadyAppsCount(const uint32_t new_app_count) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); applications_pending_ptu_count_ = new_app_count; } @@ -723,7 +719,7 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile( const std::string& device_id, const std::string& application_id) { if (application_id != last_registered_policy_app_id_) { if (last_registered_policy_app_id_.empty()) { - LOG4CXX_DEBUG(logger_, "Stopping update after first app is registered"); + SDL_LOG_DEBUG("Stopping update after first app is registered"); // ResetRetrySequence(ResetRetryCountType::kResetInternally); StopRetrySequence(); } @@ -736,7 +732,7 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile( void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->OnDeviceSwitching(device_id_from, device_id_to); } @@ -749,13 +745,13 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes( RequestType::State PolicyManagerImpl::GetAppRequestTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetAppRequestTypesState(policy_app_id); } RequestSubType::State PolicyManagerImpl::GetAppRequestSubTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetAppRequestSubTypesState(policy_app_id); } @@ -836,7 +832,7 @@ void PolicyManagerImpl::GetAppServiceParameters( bool PolicyManagerImpl::UnknownRPCPassthroughAllowed( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->UnknownRPCPassthroughAllowed(policy_app_id); } @@ -846,23 +842,21 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, const PTString& rpc, const RPCParams& rpc_params, CheckPermissionResult& result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!cache_->IsApplicationRepresented(app_id)) { - LOG4CXX_WARN(logger_, "Application " << app_id << " isn't exist"); + SDL_LOG_WARN("Application " << app_id << " isn't exist"); return; } - LOG4CXX_INFO(logger_, - "CheckPermissions for " << app_id << " and rpc " << rpc + SDL_LOG_INFO("CheckPermissions for " << app_id << " and rpc " << rpc << " for " << hmi_level << " level."); ApplicationOnDevice who = {device_id, app_id}; policy_table::Strings groups; if (access_remote_->IsAppRemoteControl(who)) { groups = access_remote_->GetGroups(who); - LOG4CXX_INFO(logger_, - "CheckPermissions for " << app_id << " and rpc " << rpc + SDL_LOG_INFO("CheckPermissions for " << app_id << " and rpc " << rpc << " for " << hmi_level << " level."); } else { groups = cache_->GetGroups(app_id); @@ -886,7 +880,7 @@ bool PolicyManagerImpl::ResetUserConsent() { void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( const std::string& device_id, const std::string& application_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<FunctionalGroupPermission> app_group_permissions; GetPermissionsForApp(device_id, application_id, app_group_permissions); @@ -905,8 +899,7 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( app_group_permissions, notification_data); - LOG4CXX_INFO(logger_, - "Send notification for application_id: " << application_id); + SDL_LOG_INFO("Send notification for application_id: " << application_id); std::string default_hmi = "NONE"; @@ -922,21 +915,21 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( } bool PolicyManagerImpl::CleanupUnpairedDevices() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // For SDL-specific it doesn't matter return true; } DeviceConsent PolicyManagerImpl::GetUserConsentForDevice( const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return kDeviceAllowed; } void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id, bool is_allowed) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device :" << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device :" << device_id); DeviceConsent current_consent = GetUserConsentForDevice(device_id); bool is_current_device_allowed = DeviceConsent::kDeviceAllowed == current_consent ? true : false; @@ -946,7 +939,7 @@ void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id, if (DeviceConsent::kDeviceHasNoConsent != current_consent && is_current_device_allowed == is_allowed) { const std::string consent = is_allowed ? "allowed" : "disallowed"; - LOG4CXX_INFO(logger_, "Device is already " << consent << "."); + SDL_LOG_INFO("Device is already " << consent << "."); return; } } @@ -964,7 +957,7 @@ bool PolicyManagerImpl::ReactOnUserDevConsentForApp( bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, StringArray* nicknames, StringArray* app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool result = nicknames && app_hmi_types; if (result) { cache_->GetInitialAppData(application_id, *nicknames, *app_hmi_types); @@ -974,17 +967,17 @@ bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, void PolicyManagerImpl::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device: " << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device: " << device_id); if (!cache_->AddDevice(device_id, connection_type)) { - LOG4CXX_WARN(logger_, "Can't add device."); + SDL_LOG_WARN("Can't add device."); } } void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id, const DeviceInfo& device_info) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device :" << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device :" << device_id); } PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent( @@ -1024,19 +1017,18 @@ PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent( void PolicyManagerImpl::CheckPendingPermissionsChanges( const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& current_permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(app_permissions_diff_lock_); std::map<std::string, AppPermissions>::iterator it_pending = app_permissions_diff_.find(policy_app_id); if (app_permissions_diff_.end() == it_pending) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "No pending permissions had been found for appID: " << policy_app_id); return; } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Pending permissions had been found for appID: " << policy_app_id); // Change appPermissionsConsentNeeded depending on unconsented groups @@ -1048,16 +1040,16 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges( for (; it_groups != it_end_groups; ++it_groups) { if (policy::kGroupUndefined == it_groups->state) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Unconsented groups still present for appID: " << policy_app_id); it_pending->second.appPermissionsConsentNeeded = true; return; } } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Unconsented groups not present anymore for appID: " << policy_app_id); it_pending->second.appPermissionsConsentNeeded = false; return; @@ -1065,13 +1057,13 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges( void PolicyManagerImpl::SetUserConsentForApp( const PermissionConsent& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id, const std::string& policy_app_id, std::string* default_hmi) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const DeviceConsent device_consent = GetUserConsentForDevice(device_id); const std::string app_id = policy::kDeviceAllowed != device_consent ? kPreDataConsentId @@ -1081,9 +1073,9 @@ bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id, bool PolicyManagerImpl::GetPriority(const std::string& policy_app_id, std::string* priority) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!priority) { - LOG4CXX_WARN(logger_, "Input priority parameter is null."); + SDL_LOG_WARN("Input priority parameter is null."); return false; } @@ -1099,12 +1091,11 @@ void PolicyManagerImpl::GetUserConsentForApp( const std::string& device_id, const std::string& policy_app_id, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalIdType group_types; if (!cache_->GetPermissionsForApp(device_id, policy_app_id, group_types)) { - LOG4CXX_WARN(logger_, - "Can't get user permissions for app " << policy_app_id); + SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id); return; } @@ -1112,7 +1103,7 @@ void PolicyManagerImpl::GetUserConsentForApp( // automatically allowed and it could not be changed by user FunctionalGroupNames group_names; if (!cache_->GetFunctionalGroupNames(group_names)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return; } @@ -1147,7 +1138,7 @@ void PolicyManagerImpl::GetPermissionsForApp( const std::string& device_id, const std::string& policy_app_id, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string app_id_to_check = policy_app_id; bool allowed_by_default = false; @@ -1172,8 +1163,7 @@ void PolicyManagerImpl::GetPermissionsForApp( } if (!ret) { - LOG4CXX_WARN(logger_, - "Can't get user permissions for app " << policy_app_id); + SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id); return; } @@ -1181,14 +1171,14 @@ void PolicyManagerImpl::GetPermissionsForApp( // automatically allowed and it could not be changed by user FunctionalGroupNames group_names; if (!cache_->GetFunctionalGroupNames(group_names)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return; } // The "default" and "pre_DataConsent" are auto-allowed groups // So, check if application in the one of these mode. if (allowed_by_default) { - LOG4CXX_INFO(logger_, "Get auto allowed groups"); + SDL_LOG_INFO("Get auto allowed groups"); GroupType type = (kDefaultId == app_id_to_check ? kTypeDefault : kTypePreDataConsented); @@ -1212,7 +1202,7 @@ void PolicyManagerImpl::GetPermissionsForApp( std::string& PolicyManagerImpl::GetCurrentDeviceId( const transport_manager::DeviceHandle& device_handle, const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); last_device_id_ = listener()->OnCurrentDeviceIdUpdateRequired(device_handle, policy_app_id); return last_device_id_; @@ -1221,25 +1211,25 @@ std::string& PolicyManagerImpl::GetCurrentDeviceId( void PolicyManagerImpl::SetSystemLanguage(const std::string& language) {} void PolicyManagerImpl::SetPreloadedPtFlag(const bool is_preloaded) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetPreloadedPtFlag(is_preloaded); } void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetMetaInfo(ccpu_version, wers_country_code, language); } std::string PolicyManagerImpl::GetCCPUVersionFromPT() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetCCPUVersionFromPT(); } uint32_t PolicyManagerImpl::GetNotificationsNumber(const std::string& priority, const bool is_subtle) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetNotificationsNumber(priority, is_subtle); } @@ -1252,10 +1242,10 @@ bool PolicyManagerImpl::IsPTValid( policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { - LOG4CXX_ERROR(logger_, "Policy table is not valid."); + SDL_LOG_ERROR("Policy table is not valid."); rpc::ValidationReport report("policy_table"); policy_table->ReportErrors(&report); - LOG4CXX_DEBUG(logger_, "Errors: " << rpc::PrettyFormat(report)); + SDL_LOG_DEBUG("Errors: " << rpc::PrettyFormat(report)); return false; } return true; @@ -1267,7 +1257,7 @@ const PolicySettings& PolicyManagerImpl::get_settings() const { } bool PolicyManagerImpl::ExceededDays() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); date_time::TimeDuration current_time = date_time::getCurrentTime(); const int kSecondsInDay = 60 * 60 * 24; @@ -1277,9 +1267,9 @@ bool PolicyManagerImpl::ExceededDays() { } void PolicyManagerImpl::KmsChanged(int kilometers) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (0 == cache_->KilometersBeforeExchange(kilometers)) { - LOG4CXX_INFO(logger_, "Enough kilometers passed to send for PT update."); + SDL_LOG_INFO("Enough kilometers passed to send for PT update."); update_status_manager_.ScheduleUpdate(); StartPTExchange(); PTUpdatedAt(KILOMETERS, kilometers); @@ -1310,7 +1300,7 @@ std::string PolicyManagerImpl::ForcePTExchange() { } void PolicyManagerImpl::StopRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (timer_retry_sequence_.is_running()) { timer_retry_sequence_.Stop(); @@ -1332,9 +1322,9 @@ std::string PolicyManagerImpl::GetPolicyTableStatus() const { } uint32_t PolicyManagerImpl::NextRetryTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); - LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_); + SDL_LOG_DEBUG("Index: " << retry_sequence_index_); uint32_t next = 0u; if (retry_sequence_seconds_.empty() || retry_sequence_index_ > retry_sequence_seconds_.size()) { @@ -1358,7 +1348,7 @@ uint32_t PolicyManagerImpl::NextRetryTimeout() { } void PolicyManagerImpl::RefreshRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); retry_sequence_timeout_ = cache_->TimeoutResponse(); retry_sequence_seconds_.clear(); @@ -1367,7 +1357,7 @@ void PolicyManagerImpl::RefreshRetrySequence() { void PolicyManagerImpl::ResetRetrySequence( const ResetRetryCountType reset_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); retry_sequence_index_ = 0; retry_sequence_url_ = RetrySequenceURL(); @@ -1396,33 +1386,33 @@ void PolicyManagerImpl::OnUpdateStarted() { } void PolicyManagerImpl::PTUpdatedAt(Counters counter, int value) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetCountersPassedForSuccessfulUpdate(counter, value); cache_->ResetIgnitionCycles(); } void PolicyManagerImpl::Increment(usage_statistics::GlobalCounterId type) { - LOG4CXX_INFO(logger_, "Increment without app id"); + SDL_LOG_INFO("Increment without app id"); cache_->Increment(type); } void PolicyManagerImpl::Increment(const std::string& app_id, usage_statistics::AppCounterId type) { - LOG4CXX_DEBUG(logger_, "Increment " << app_id << " AppCounter: " << type); + SDL_LOG_DEBUG("Increment " << app_id << " AppCounter: " << type); cache_->Increment(app_id, type); } void PolicyManagerImpl::Set(const std::string& app_id, usage_statistics::AppInfoId type, const std::string& value) { - LOG4CXX_INFO(logger_, "Set " << app_id); + SDL_LOG_INFO("Set " << app_id); cache_->Set(app_id, type, value); } void PolicyManagerImpl::Add(const std::string& app_id, usage_statistics::AppStopwatchId type, int32_t timespan_seconds) { - LOG4CXX_INFO(logger_, "Add " << app_id); + SDL_LOG_INFO("Add " << app_id); cache_->Add(app_id, type, timespan_seconds); } @@ -1432,7 +1422,7 @@ bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const { bool PolicyManagerImpl::IsConsentNeeded(const std::string& device_id, const std::string& app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return false; } @@ -1471,12 +1461,12 @@ bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) const { void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) {} std::string PolicyManagerImpl::RetrieveCertificate() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetCertificate(); } AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const AppIdURL next_app_url = RetrySequenceUrl(retry_sequence_url_, urls); @@ -1539,7 +1529,7 @@ StatusNotifier PolicyManagerImpl::AddApplication( const std::string& device_id, const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto device_consent = GetUserConsentForDevice(device_id); sync_primitives::AutoLock lock(apps_registration_lock_); if (IsNewApplication(application_id)) { @@ -1561,20 +1551,20 @@ void PolicyManagerImpl::RemoveAppConsentForGroup( bool PolicyManagerImpl::IsPredataPolicy( const std::string& policy_app_id) const { - LOG4CXX_INFO(logger_, "IsPredataApp"); + SDL_LOG_INFO("IsPredataApp"); return cache_->IsPredataPolicy(policy_app_id); } void PolicyManagerImpl::AddNewApplication(const std::string& application_id, DeviceConsent device_consent) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetDefaultPolicy(application_id); } void PolicyManagerImpl::PromoteExistedApplication( const std::string& application_id, DeviceConsent device_consent) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // If device consent changed to allowed during application being // disconnected, app permissions should be changed also if (kDeviceAllowed == device_consent && @@ -1589,7 +1579,7 @@ bool PolicyManagerImpl::IsNewApplication( } bool PolicyManagerImpl::ResetPT(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->ResetCalculatedPermissions(); const bool result = cache_->ResetPT(file_name); if (result) { @@ -1599,19 +1589,17 @@ bool PolicyManagerImpl::ResetPT(const std::string& file_name) { } bool PolicyManagerImpl::CheckAppStorageFolder() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string app_storage_folder = get_settings().app_storage_folder(); - LOG4CXX_DEBUG(logger_, "AppStorageFolder " << app_storage_folder); + SDL_LOG_DEBUG("AppStorageFolder " << app_storage_folder); if (!file_system::DirectoryExists(app_storage_folder)) { - LOG4CXX_WARN(logger_, - "Storage directory doesn't exist " << app_storage_folder); + SDL_LOG_WARN("Storage directory doesn't exist " << app_storage_folder); return false; } if (!(file_system::IsWritingAllowed(app_storage_folder) && file_system::IsReadingAllowed(app_storage_folder))) { - LOG4CXX_WARN(logger_, - "Storage directory doesn't have read/write permissions " - << app_storage_folder); + SDL_LOG_WARN("Storage directory doesn't have read/write permissions " + << app_storage_folder); return false; } return true; @@ -1619,10 +1607,10 @@ bool PolicyManagerImpl::CheckAppStorageFolder() const { bool PolicyManagerImpl::InitPT(const std::string& file_name, const PolicySettings* settings) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); settings_ = settings; if (!CheckAppStorageFolder()) { - LOG4CXX_ERROR(logger_, "Can not read/write into AppStorageFolder"); + SDL_LOG_ERROR("Can not read/write into AppStorageFolder"); return false; } const bool ret = cache_->Init(file_name, settings); @@ -1646,7 +1634,7 @@ uint32_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const { } void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!is_update_needed) { ResetRetrySequence(ResetRetryCountType::kResetInternally); @@ -1660,7 +1648,7 @@ void PolicyManagerImpl::set_cache_manager( } void PolicyManagerImpl::ResetTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (update_status_manager_.IsUpdatePending()) { if (timer_retry_sequence_.is_running()) { timer_retry_sequence_.Stop(); @@ -1670,13 +1658,13 @@ void PolicyManagerImpl::ResetTimeout() { } void PolicyManagerImpl::OnPTUIterationTimeout() { - LOG4CXX_DEBUG(logger_, "Start new retry sequence"); + SDL_LOG_DEBUG("Start new retry sequence"); const bool is_exceeded_retries_count = (retry_sequence_seconds_.size() < retry_sequence_index_); if (is_exceeded_retries_count) { - LOG4CXX_WARN(logger_, "Exceeded allowed PTU retry count"); + SDL_LOG_WARN("Exceeded allowed PTU retry count"); listener_->OnPTUTimeOut(); ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate); if (timer_retry_sequence_.is_running()) { @@ -1692,7 +1680,7 @@ void PolicyManagerImpl::OnPTUIterationTimeout() { update_status_manager_.OnUpdateTimeoutOccurs(); const uint32_t timeout_msec = NextRetryTimeout(); - LOG4CXX_DEBUG(logger_, "New retry sequence timeout = " << timeout_msec); + SDL_LOG_DEBUG("New retry sequence timeout = " << timeout_msec); if (!timeout_msec) { if (timer_retry_sequence_.is_running()) { timer_retry_sequence_.Stop(); @@ -1712,7 +1700,7 @@ void PolicyManagerImpl::SetDefaultHmiTypes( const transport_manager::DeviceHandle& device_handle, const std::string& application_id, const std::vector<int>& hmi_types) { - LOG4CXX_INFO(logger_, "SetDefaultHmiTypes"); + SDL_LOG_INFO("SetDefaultHmiTypes"); const std::string device_id = GetCurrentDeviceId(device_handle, application_id); ApplicationOnDevice who = {device_id, application_id}; @@ -1727,7 +1715,7 @@ struct HMITypeToInt { bool PolicyManagerImpl::GetHMITypes(const std::string& application_id, std::vector<int>* app_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cache_->IsDefaultPolicy(application_id)) { return false; } @@ -1744,7 +1732,7 @@ bool PolicyManagerImpl::GetHMITypes(const std::string& application_id, bool PolicyManagerImpl::CheckModule(const PTString& app_id, const PTString& module) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::ModuleType module_type; return EnumFromJsonString(module, &module_type) && access_remote_->CheckModuleType(app_id, module_type); @@ -1755,16 +1743,15 @@ void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) { if (GetDefaultHmi(who.dev_id, who.app_id, &default_hmi)) { listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi); } else { - LOG4CXX_WARN( - logger_, - "Couldn't get default HMI level for application " << who.app_id); + SDL_LOG_WARN("Couldn't get default HMI level for application " + << who.app_id); } } void PolicyManagerImpl::GetPermissions(const std::string device_id, const std::string application_id, Permissions* data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(data); std::vector<FunctionalGroupPermission> app_group_permissions; GetPermissionsForApp(device_id, application_id, app_group_permissions); @@ -1826,7 +1813,7 @@ void PolicyManagerImpl::set_access_remote( bool PolicyManagerImpl::AppNeedEncryption( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto encryption_required = cache_->GetAppEncryptionRequiredFlag(policy_app_id); @@ -1835,13 +1822,13 @@ bool PolicyManagerImpl::AppNeedEncryption( const rpc::Optional<rpc::Boolean> PolicyManagerImpl::GetAppEncryptionRequired( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetAppEncryptionRequiredFlag(policy_app_id); } const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace rpc::policy_table_interface_base; DCHECK(kDeviceId != policy_app_id); @@ -1861,7 +1848,7 @@ const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp( const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<std::string> policy_app_ids; const auto apps = cache_->GetPolicyAppIDs(); @@ -1875,13 +1862,13 @@ const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs() bool PolicyManagerImpl::FunctionGroupNeedEncryption( const std::string& policy_group) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupings functional_groupings; cache_->GetFunctionalGroupings(functional_groupings); const auto& grouping_itr = functional_groupings.find(policy_group); if (grouping_itr == functional_groupings.end()) { - LOG4CXX_WARN(logger_, "Group " << policy_group << " not found"); + SDL_LOG_WARN("Group " << policy_group << " not found"); return false; } @@ -1893,7 +1880,7 @@ bool PolicyManagerImpl::FunctionGroupNeedEncryption( } void PolicyManagerImpl::TriggerPTUOnStartupIfRequired() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (ignition_check) { StartPTExchange(); } @@ -1923,12 +1910,13 @@ const std::vector<std::string> PolicyManagerImpl::GetRPCsForFunctionGroup( } // namespace policy -__attribute__((visibility("default"))) policy::PolicyManager* CreateManager() { +__attribute__((visibility("default"))) policy::PolicyManager* CreateManager( + logger::Logger* logger_instance) { + logger::Logger::instance(logger_instance); return new policy::PolicyManagerImpl(); } __attribute__((visibility("default"))) void DeleteManager( policy::PolicyManager* pm) { delete pm; - DELETE_THREAD_LOGGER(policy::logger_); } diff --git a/src/components/policy/policy_regular/src/policy_table.cc b/src/components/policy/policy_regular/src/policy_table.cc index b0fa5739da..dd6eef0c45 100644 --- a/src/components/policy/policy_regular/src/policy_table.cc +++ b/src/components/policy/policy_regular/src/policy_table.cc @@ -38,7 +38,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") PolicyTable::PolicyTable() : pt_data_(new SQLPTRepresentation()) {} @@ -46,7 +46,7 @@ PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { - LOG4CXX_INFO(logger_, "Destroying policy table."); + SDL_LOG_INFO("Destroying policy table."); } } // namespace policy diff --git a/src/components/policy/policy_regular/src/policy_table/validation.cc b/src/components/policy/policy_regular/src/policy_table/validation.cc index 14b6d657c2..c98a0ed5f0 100644 --- a/src/components/policy/policy_regular/src/policy_table/validation.cc +++ b/src/components/policy/policy_regular/src/policy_table/validation.cc @@ -12,7 +12,7 @@ bool IsTypeInvalid( namespace rpc { namespace policy_table_interface_base { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") void RemoveInvalidTypes(RequestTypes& types) { types.erase(std::remove_if(types.begin(), types.end(), &IsTypeInvalid), @@ -30,13 +30,13 @@ bool ApplicationPoliciesSection::Validate() const { // Default and PreData policies are mandatory if (apps.end() == it_default_policy || apps.end() == it_pre_data_policy) { - LOG4CXX_ERROR(logger_, "Default or preData policy is not present."); + SDL_LOG_ERROR("Default or preData policy is not present."); return false; } // Device policy is mandatory if (!device.is_initialized()) { - LOG4CXX_ERROR(logger_, "Device policy is not present."); + SDL_LOG_ERROR("Device policy is not present."); return false; } @@ -45,17 +45,15 @@ bool ApplicationPoliciesSection::Validate() const { return true; } - LOG4CXX_TRACE(logger_, "Checking app Request Types..."); + SDL_LOG_TRACE("Checking app Request Types..."); if (!it_default_policy->second.RequestType.is_valid()) { - LOG4CXX_WARN(logger_, - "Default policy RequestTypes are not valid. Will be cleaned."); + SDL_LOG_WARN("Default policy RequestTypes are not valid. Will be cleaned."); RemoveInvalidTypes(*it_default_policy->second.RequestType); // If preloaded does not have valid default types - validation fails // Otherwise default will be empty, i.e. all types allowed if (PT_PRELOADED == pt_type) { if (it_default_policy->second.RequestType->empty()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Default policy RequestTypes empty after clean-up. Exiting."); return false; } @@ -78,46 +76,43 @@ bool ApplicationPoliciesSection::Validate() const { if (PT_PRELOADED == pt_type) { if (!is_request_type_valid) { - LOG4CXX_WARN(logger_, - "App policy RequestTypes are not valid. Will be cleaned."); + SDL_LOG_WARN("App policy RequestTypes are not valid. Will be cleaned."); RemoveInvalidTypes(*app_params.RequestType); if (app_params.RequestType->empty()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "App policy RequestTypes empty after clean-up. Exiting."); return false; } } } else { if (is_request_type_omitted) { - LOG4CXX_WARN(logger_, - "App policy RequestTypes omitted." - " Will be replaced with default."); + SDL_LOG_WARN( + "App policy RequestTypes omitted." + " Will be replaced with default."); app_params.RequestType = apps[kDefaultApp].RequestType; ++iter; continue; } if (!is_request_type_valid) { - LOG4CXX_WARN(logger_, - "App policy RequestTypes are invalid. Will be cleaned."); + SDL_LOG_WARN("App policy RequestTypes are invalid. Will be cleaned."); RemoveInvalidTypes(*app_params.RequestType); if (app_params.RequestType->empty()) { - LOG4CXX_WARN(logger_, - "App policy RequestTypes empty after clean-up." - " Will be replaced with default."); + SDL_LOG_WARN( + "App policy RequestTypes empty after clean-up." + " Will be replaced with default."); app_params.RequestType = apps[kDefaultApp].RequestType; ++iter; continue; } } if (is_request_type_empty) { - LOG4CXX_WARN(logger_, "App policy RequestTypes empty."); + SDL_LOG_WARN("App policy RequestTypes empty."); } } ++iter; } - LOG4CXX_TRACE(logger_, "Checking app Request SubTypes..."); + SDL_LOG_TRACE("Checking app Request SubTypes..."); iter = apps.begin(); while (iter != end_iter) { if (it_default_policy == iter || it_pre_data_policy == iter) { @@ -129,9 +124,9 @@ bool ApplicationPoliciesSection::Validate() const { !app_params.RequestSubType.is_initialized(); if (is_request_subtype_omitted) { - LOG4CXX_WARN(logger_, - "App policy RequestSubTypes omitted." - " Will be replaced with default."); + SDL_LOG_WARN( + "App policy RequestSubTypes omitted." + " Will be replaced with default."); app_params.RequestSubType = apps[kDefaultApp].RequestSubType; ++iter; continue; @@ -139,7 +134,7 @@ bool ApplicationPoliciesSection::Validate() const { const bool is_request_subtype_empty = app_params.RequestSubType->empty(); if (is_request_subtype_empty) { - LOG4CXX_WARN(logger_, "App policy RequestSubTypes empty."); + SDL_LOG_WARN("App policy RequestSubTypes empty."); } ++iter; } @@ -222,8 +217,7 @@ bool ModuleConfig::Validate() const { ++it_endpoints) { const URLList& endpoint_list = it_endpoints->second; if (endpoint_list.end() == endpoint_list.find(kDefaultApp)) { - LOG4CXX_ERROR(logger_, - "Endpoint " << it_endpoints->first + SDL_LOG_ERROR("Endpoint " << it_endpoints->first << "does not contain default group"); return false; } @@ -294,8 +288,8 @@ bool VehicleDataItem::Validate() const { }; if (!ValidateTypes()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Unknown type: " << std::string(type) << " of " << std::string(key)); return false; } diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc index 043b413c13..49b7f2e7be 100644 --- a/src/components/policy/policy_regular/src/sql_pt_representation.cc +++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc @@ -49,7 +49,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") namespace { template <typename T, typename K> @@ -92,8 +92,8 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id, utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRpc)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Incorrect select statement from rpcs" << query.LastError().text()); return; } @@ -103,8 +103,7 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id, bool ret = query.Next(); result.hmi_level_permitted = ret ? kRpcAllowed : kRpcDisallowed; - LOG4CXX_INFO(logger_, - "Level is " << (result.hmi_level_permitted == kRpcAllowed + SDL_LOG_INFO("Level is " << (result.hmi_level_permitted == kRpcAllowed ? "permitted" : "not permitted")); std::string parameter; @@ -125,7 +124,7 @@ bool SQLPTRepresentation::IsPTPreloaded() { int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectIgnitionCycles) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select ignition cycles"); + SDL_LOG_WARN("Can not select ignition cycles"); return 0; } int limit = query.GetInteger(0); @@ -141,7 +140,7 @@ int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { int SQLPTRepresentation::KilometersBeforeExchange(int current) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectKilometers) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select kilometers"); + SDL_LOG_WARN("Can not select kilometers"); return 0; } int limit = query.GetInteger(0); @@ -157,17 +156,16 @@ int SQLPTRepresentation::KilometersBeforeExchange(int current) { bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( int kilometers, int days_after_epoch) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateCountersSuccessfulUpdate)) { - LOG4CXX_WARN(logger_, - "Wrong update query for counters on successful update."); + SDL_LOG_WARN("Wrong update query for counters on successful update."); return false; } query.Bind(0, kilometers); query.Bind(1, days_after_epoch); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to update counters on successful update."); + SDL_LOG_WARN("Failed to update counters on successful update."); return false; } return true; @@ -176,7 +174,7 @@ bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( int SQLPTRepresentation::DaysBeforeExchange(int current) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectDays) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select days"); + SDL_LOG_WARN("Can not select days"); return 0; } int limit = query.GetInteger(0); @@ -197,7 +195,7 @@ int SQLPTRepresentation::DaysBeforeExchange(int current) { int SQLPTRepresentation::TimeoutResponse() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) { - LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence"); + SDL_LOG_INFO("Can not select timeout response for retry sequence"); const int defaultTimeout = 30 * date_time::MILLISECONDS_IN_SECOND; return defaultTimeout; } @@ -207,8 +205,7 @@ int SQLPTRepresentation::TimeoutResponse() { bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { - LOG4CXX_INFO(logger_, - "Incorrect select statement from seconds between retries"); + SDL_LOG_INFO("Incorrect select statement from seconds between retries"); return false; } while (query.Next()) { @@ -231,8 +228,7 @@ std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg( } EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { - LOG4CXX_INFO(logger_, - "SQLPTRepresentation::GetUpdateUrls for " << service_type); + SDL_LOG_INFO("SQLPTRepresentation::GetUpdateUrls for " << service_type); utils::dbms::SQLQuery query(db()); EndpointUrls ret; if (query.Prepare(sql_pt::kSelectEndpoint)) { @@ -247,23 +243,23 @@ EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { ret.push_back(data); } } else { - LOG4CXX_WARN(logger_, "Invalid select endpoints statement."); + SDL_LOG_WARN("Invalid select endpoints statement."); } return ret; } int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectNotificationsPerPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for priority " - "notification number."); + SDL_LOG_WARN( + "Incorrect select statement for priority " + "notification number."); return 0; } query.Bind(0, priority); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority."); + SDL_LOG_WARN("Incorrect select from notifications by priority."); return 0; } @@ -276,21 +272,21 @@ int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, std::string* priority) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (NULL == priority) { - LOG4CXX_WARN(logger_, "Input priority parameter is null."); + SDL_LOG_WARN("Input priority parameter is null."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectPriority)) { - LOG4CXX_INFO(logger_, "Incorrect statement for priority."); + SDL_LOG_INFO("Incorrect statement for priority."); return false; } query.Bind(0, policy_app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Error during select priority."); + SDL_LOG_INFO("Error during select priority."); return false; } @@ -306,7 +302,7 @@ bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { settings_ = settings; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef BUILD_TESTS open_counter_ = 0; #endif // BUILD_TESTS @@ -319,59 +315,56 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { } if (!db_->Open()) { - LOG4CXX_ERROR(logger_, "Failed opening database."); - LOG4CXX_INFO(logger_, "Starting opening retries."); + SDL_LOG_ERROR("Failed opening database."); + SDL_LOG_INFO("Starting opening retries."); const uint16_t attempts = get_settings().attempts_to_open_policy_db(); - LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts); + SDL_LOG_DEBUG("Total attempts number is: " << attempts); bool is_opened = false; const uint16_t open_attempt_timeout_ms = get_settings().open_attempt_timeout_ms(); const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000; - LOG4CXX_DEBUG(logger_, - "Open attempt timeout(ms) is: " << open_attempt_timeout_ms); + SDL_LOG_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms); for (int i = 0; i < attempts; ++i) { usleep(sleep_interval_mcsec); - LOG4CXX_INFO(logger_, "Attempt: " << i + 1); + SDL_LOG_INFO("Attempt: " << i + 1); #ifdef BUILD_TESTS ++open_counter_; #endif // BUILD_TESTS if (db_->Open()) { - LOG4CXX_INFO(logger_, "Database opened."); + SDL_LOG_INFO("Database opened."); is_opened = true; break; } } if (!is_opened) { - LOG4CXX_ERROR(logger_, - "Open retry sequence failed. Tried " - << attempts << " attempts with " - << open_attempt_timeout_ms - << " open timeout(ms) for each."); + SDL_LOG_ERROR("Open retry sequence failed. Tried " + << attempts << " attempts with " << open_attempt_timeout_ms + << " open timeout(ms) for each."); return InitResult::FAIL; } } if (!db_->IsReadWrite()) { - LOG4CXX_ERROR(logger_, "There are no read/write permissions for database"); + SDL_LOG_ERROR("There are no read/write permissions for database"); return InitResult::FAIL; } utils::dbms::SQLQuery check_pages(db()); if (!check_pages.Prepare(sql_pt::kCheckPgNumber) || !check_pages.Next()) { - LOG4CXX_WARN(logger_, "Incorrect pragma for page counting."); + SDL_LOG_WARN("Incorrect pragma for page counting."); } else { if (0 < check_pages.GetInteger(0)) { utils::dbms::SQLQuery db_check(db()); if (!db_check.Prepare(sql_pt::kCheckDBIntegrity)) { - LOG4CXX_WARN(logger_, "Incorrect pragma for integrity check."); + SDL_LOG_WARN("Incorrect pragma for integrity check."); } else { while (db_check.Next()) { if (db_check.GetString(0).compare("ok") == 0) { utils::dbms::SQLQuery check_first_run(db()); if (check_first_run.Prepare(sql_pt::kIsFirstRun) && check_first_run.Next()) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "Selecting is first run " << check_first_run.GetBoolean(0)); if (check_first_run.GetBoolean(0)) { utils::dbms::SQLQuery set_not_first_run(db()); @@ -379,12 +372,11 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { return InitResult::SUCCESS; } } else { - LOG4CXX_WARN(logger_, "Incorrect select is first run"); + SDL_LOG_WARN("Incorrect select is first run"); } return InitResult::EXISTS; } else { - LOG4CXX_ERROR(logger_, - "Existing policy table representation is invlaid."); + SDL_LOG_ERROR("Existing policy table representation is invlaid."); // TODO(PV): add handle return InitResult::FAIL; } @@ -394,14 +386,14 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { } utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed creating schema of database: " << query.LastError().text()); return InitResult::FAIL; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return InitResult::FAIL; } @@ -416,8 +408,7 @@ bool SQLPTRepresentation::Close() { bool SQLPTRepresentation::Drop() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDropSchema)) { - LOG4CXX_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_LOG_WARN("Failed dropping database: " << query.LastError().text()); return false; } return true; @@ -430,13 +421,12 @@ void SQLPTRepresentation::WriteDb() { bool SQLPTRepresentation::Clear() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteData)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -446,19 +436,18 @@ bool SQLPTRepresentation::Clear() { bool SQLPTRepresentation::RefreshDB() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDropSchema)) { - LOG4CXX_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_LOG_WARN("Failed dropping database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed creating schema of database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -467,7 +456,7 @@ bool SQLPTRepresentation::RefreshDB() { std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto table = std::make_shared<policy_table::Table>(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); @@ -487,7 +476,7 @@ std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() void SQLPTRepresentation::GatherModuleMeta( policy_table::ModuleMeta* meta) const { - LOG4CXX_INFO(logger_, "Gather Module Meta Info"); + SDL_LOG_INFO("Gather Module Meta Info"); utils::dbms::SQLQuery query(db()); if (query.Prepare(sql_pt::kSelectModuleMeta) && query.Next()) { *meta->pt_exchanged_at_odometer_x = query.GetInteger(0); @@ -499,10 +488,10 @@ void SQLPTRepresentation::GatherModuleMeta( void SQLPTRepresentation::GatherModuleConfig( policy_table::ModuleConfig* config) const { - LOG4CXX_INFO(logger_, "Gather Configuration Info"); + SDL_LOG_INFO("Gather Configuration Info"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectModuleConfig) || !query.Next()) { - LOG4CXX_WARN(logger_, "Incorrect select statement for module config"); + SDL_LOG_WARN("Incorrect select statement for module config"); } else { *config->preloaded_pt = query.GetBoolean(0); config->exchange_after_x_ignition_cycles = query.GetInteger(1); @@ -520,7 +509,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery endpoints(db()); if (!endpoints.Prepare(sql_pt::kSelectEndpoints)) { - LOG4CXX_WARN(logger_, "Incorrect select statement for endpoints"); + SDL_LOG_WARN("Incorrect select statement for endpoints"); } else { while (endpoints.Next()) { const std::string& url = endpoints.GetString(0); @@ -532,7 +521,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery endpoint_properties(db()); if (!endpoint_properties.Prepare(sql_pt::kSelectEndpointProperties)) { - LOG4CXX_ERROR(logger_, "Incorrect statement for Endpoint properties"); + SDL_LOG_ERROR("Incorrect statement for Endpoint properties"); } else { while (endpoint_properties.Next()) { const std::string& service = endpoint_properties.GetString(0); @@ -544,7 +533,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery notifications(db()); if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) { - LOG4CXX_WARN(logger_, "Incorrect select statement for notifications"); + SDL_LOG_WARN("Incorrect select statement for notifications"); } else { while (notifications.Next()) { config->notifications_per_minute_by_priority[notifications.GetString(0)] = @@ -553,8 +542,7 @@ void SQLPTRepresentation::GatherModuleConfig( } utils::dbms::SQLQuery subtle_notifications(db()); if (!subtle_notifications.Prepare(sql_pt::kSelectSubtleNotificationsPerMin)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for subtle notifications"); + SDL_LOG_WARN("Incorrect select statement for subtle notifications"); } else { while (subtle_notifications.Next()) { (*config->subtle_notifications_per_minute_by_priority) @@ -564,8 +552,7 @@ void SQLPTRepresentation::GatherModuleConfig( } utils::dbms::SQLQuery seconds(db()); if (!seconds.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { - LOG4CXX_INFO(logger_, - "Incorrect select statement from seconds between retries"); + SDL_LOG_INFO("Incorrect select statement from seconds between retries"); } else { while (seconds.Next()) { config->seconds_between_retries.push_back(seconds.GetInteger(0)); @@ -575,7 +562,7 @@ void SQLPTRepresentation::GatherModuleConfig( bool SQLPTRepresentation::GatherUsageAndErrorCounts( policy_table::UsageAndErrorCounts* counts) const { - LOG4CXX_INFO(logger_, "Gather Usage and Error Counts."); + SDL_LOG_INFO("Gather Usage and Error Counts."); utils::dbms::SQLQuery query(db()); if (query.Prepare(sql_pt::kSelectAppLevels)) { policy_table::AppLevel app_level; @@ -592,7 +579,7 @@ bool SQLPTRepresentation::GatherUsageAndErrorCounts( void SQLPTRepresentation::GatherDeviceData( policy_table::DeviceData* data) const { - LOG4CXX_INFO(logger_, "Gather device data."); + SDL_LOG_INFO("Gather device data."); data->mark_initialized(); utils::dbms::SQLQuery query(db()); @@ -608,15 +595,15 @@ void SQLPTRepresentation::GatherDeviceData( bool SQLPTRepresentation::GatherFunctionalGroupings( policy_table::FunctionalGroupings* groups) const { - LOG4CXX_INFO(logger_, "Gather Functional Groupings info"); + SDL_LOG_INFO("Gather Functional Groupings info"); utils::dbms::SQLQuery functional_group(db()); if (!functional_group.Prepare(sql_pt::kSelectFunctionalGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select from functional_groupings"); + SDL_LOG_WARN("Incorrect select from functional_groupings"); return false; } utils::dbms::SQLQuery rpcs(db()); if (!rpcs.Prepare(sql_pt::kSelectAllRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select all from rpc"); + SDL_LOG_WARN("Incorrect select all from rpc"); return false; } @@ -672,10 +659,10 @@ bool SQLPTRepresentation::GatherFunctionalGroupings( bool SQLPTRepresentation::GatherConsumerFriendlyMessages( policy_table::ConsumerFriendlyMessages* messages) const { - LOG4CXX_INFO(logger_, "Gather Consumer Friendly Messages"); + SDL_LOG_INFO("Gather Consumer Friendly Messages"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectUserMsgsVersion) || !query.Next()) { - LOG4CXX_WARN(logger_, "Incorrect select from consumer_friendly_messages"); + SDL_LOG_WARN("Incorrect select from consumer_friendly_messages"); return false; } @@ -713,24 +700,24 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages( } } } else { - LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages."); + SDL_LOG_WARN("Incorrect statement for select friendly messages."); } return true; } bool SQLPTRepresentation::SetMetaInfo(const std::string& ccpu_version) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateMetaParams)) { - LOG4CXX_WARN(logger_, "Incorrect statement for insert to module meta."); + SDL_LOG_WARN("Incorrect statement for insert to module meta."); return false; } query.Bind(0, ccpu_version); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert to module meta."); + SDL_LOG_WARN("Incorrect insert to module meta."); return false; } return true; @@ -738,10 +725,10 @@ bool SQLPTRepresentation::SetMetaInfo(const std::string& ccpu_version) { bool SQLPTRepresentation::GatherApplicationPoliciesSection( policy_table::ApplicationPoliciesSection* policies) const { - LOG4CXX_INFO(logger_, "Gather applications policies"); + SDL_LOG_INFO("Gather applications policies"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppPolicies)) { - LOG4CXX_WARN(logger_, "Incorrect select from app_policies"); + SDL_LOG_WARN("Incorrect select from app_policies"); return false; } @@ -844,8 +831,7 @@ bool SQLPTRepresentation::GatherVehicleData( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataSchemaVersion) || !query.Next()) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for vehicle data schema version"); + SDL_LOG_ERROR("Incorrect statement for vehicle data schema version"); return false; } *vehicle_data->schema_version = query.GetString(0); @@ -856,7 +842,7 @@ bool SQLPTRepresentation::GatherVehicleData( bool SQLPTRepresentation::GatherVehicleDataItems( policy_table::VehicleDataItems* vehicle_data_items) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto parameterized_vdi = SelectCompositeVehicleDataItems(); if (!parameterized_vdi.is_initialized()) { return false; @@ -878,7 +864,7 @@ bool SQLPTRepresentation::GatherVehicleDataItems( } bool SQLPTRepresentation::Save(const policy_table::Table& table) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); db_->BeginTransaction(); if (!SaveFunctionalGroupings(table.policy_table.functional_groupings)) { db_->RollbackTransaction(); @@ -923,17 +909,17 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( const policy_table::FunctionalGroupings& groups) { utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteRpc)) { - LOG4CXX_WARN(logger_, "Incorrect delete from rpc."); + SDL_LOG_WARN("Incorrect delete from rpc."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteFunctionalGroup)) { - LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries."); + SDL_LOG_WARN("Incorrect delete from seconds between retries."); return false; } if (!query.Prepare(sql_pt::kInsertFunctionalGroup)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for functional groups"); + SDL_LOG_WARN("Incorrect insert statement for functional groups"); return false; } @@ -958,7 +944,7 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( ? query.Bind(3, *(it->second.encryption_required)) : query.Bind(3); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into functional groups"); + SDL_LOG_WARN("Incorrect insert into functional groups"); return false; } @@ -971,12 +957,12 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( bool SQLPTRepresentation::SaveRpcs(int64_t group_id, const policy_table::Rpc& rpcs) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); utils::dbms::SQLQuery query_parameter(db()); if (!query.Prepare(sql_pt::kInsertRpc) || !query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for rpc"); + SDL_LOG_WARN("Incorrect insert statement for rpc"); return false; } @@ -996,7 +982,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, query_parameter.Bind(2, std::string(*ps_it)); query_parameter.Bind(3, group_id); if (!query_parameter.Exec() || !query_parameter.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter"); + SDL_LOG_WARN("Incorrect insert into rpc with parameter"); return false; } } @@ -1009,7 +995,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, std::string(policy_table::EnumToJsonString(policy_table::P_EMPTY))); query_parameter.Bind(3, group_id); if (!query_parameter.Exec() || !query_parameter.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter"); + SDL_LOG_WARN("Incorrect insert into rpc with parameter"); return false; } } else { @@ -1017,7 +1003,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, query.Bind(1, std::string(policy_table::EnumToJsonString(*hmi_it))); query.Bind(2, group_id); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc"); + SDL_LOG_WARN("Incorrect insert into rpc"); return false; } } @@ -1031,40 +1017,40 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection( const policy_table::ApplicationPoliciesSection& policies) { utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); + SDL_LOG_WARN("Incorrect delete from app_group."); return false; } if (!query_delete.Exec(sql_pt::kDeleteModuleTypes)) { - LOG4CXX_WARN(logger_, "Incorrect delete from module_type."); + SDL_LOG_WARN("Incorrect delete from module_type."); return false; } if (!query_delete.Exec(sql_pt::kDeleteApplication)) { - LOG4CXX_WARN(logger_, "Incorrect delete from application."); + SDL_LOG_WARN("Incorrect delete from application."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestType)) { - LOG4CXX_WARN(logger_, "Incorrect delete from request type."); + SDL_LOG_WARN("Incorrect delete from request type."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestSubType)) { - LOG4CXX_WARN(logger_, "Incorrect delete from request subtype."); + SDL_LOG_WARN("Incorrect delete from request subtype."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs."); + SDL_LOG_WARN("Incorrect delete from handled rpcs."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect delete from service names."); + SDL_LOG_WARN("Incorrect delete from service names."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled service types."); + SDL_LOG_WARN("Incorrect delete from handled service types."); return false; } @@ -1108,8 +1094,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( const policy_table::ApplicationPolicies::value_type& app) { utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt::kInsertApplication)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement into application (device)."); + SDL_LOG_WARN("Incorrect insert statement into application (device)."); return false; } @@ -1149,7 +1134,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( : app_query.Bind(13); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -1198,7 +1183,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( const policy_table::DevicePolicy& device) { utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt::kInsertApplication)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + SDL_LOG_WARN("Incorrect insert statement into application."); return false; } @@ -1210,7 +1195,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( app_query.Bind(4, 0); app_query.Bind(5); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -1221,20 +1206,19 @@ bool SQLPTRepresentation::SaveAppGroup( const std::string& app_id, const policy_table::Strings& app_groups) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppGroup)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app group"); + SDL_LOG_WARN("Incorrect insert statement for app group"); return false; } - LOG4CXX_INFO(logger_, "SaveAppGroup"); + SDL_LOG_INFO("SaveAppGroup"); policy_table::Strings::const_iterator it; for (it = app_groups.begin(); it != app_groups.end(); ++it) { std::string ssss = *it; - LOG4CXX_INFO(logger_, "Group: " << ssss); + SDL_LOG_INFO("Group: " << ssss); query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN( - logger_, - "Incorrect insert into app group." << query.LastError().text()); + SDL_LOG_WARN("Incorrect insert into app group." + << query.LastError().text()); return false; } } @@ -1246,7 +1230,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id, const policy_table::Strings& nicknames) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertNickname)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for nickname"); + SDL_LOG_WARN("Incorrect insert statement for nickname"); return false; } @@ -1255,7 +1239,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id, query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into nickname."); + SDL_LOG_WARN("Incorrect insert into nickname."); return false; } } @@ -1267,7 +1251,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id, const policy_table::AppHMITypes& types) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app type"); + SDL_LOG_WARN("Incorrect insert statement for app type"); return false; } @@ -1276,7 +1260,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id, query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app type."); + SDL_LOG_WARN("Incorrect insert into app type."); return false; } } @@ -1288,29 +1272,29 @@ bool SQLPTRepresentation::SaveRequestType( const std::string& app_id, const policy_table::RequestTypes& types) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRequestType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for request types."); + SDL_LOG_WARN("Incorrect insert statement for request types."); return false; } policy_table::RequestTypes::const_iterator it; if (!types.empty()) { - LOG4CXX_WARN(logger_, "Request types not empty."); + SDL_LOG_WARN("Request types not empty."); for (it = types.begin(); it != types.end(); ++it) { query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + SDL_LOG_WARN("Incorrect insert into request types."); return false; } } } else if (types.is_initialized()) { - LOG4CXX_WARN(logger_, "Request types empty."); + SDL_LOG_WARN("Request types empty."); query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString( policy_table::RequestType::RT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + SDL_LOG_WARN("Incorrect insert into request types."); return false; } } @@ -1322,29 +1306,29 @@ bool SQLPTRepresentation::SaveRequestSubType( const policy_table::RequestSubTypes& request_subtypes) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRequestSubType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes."); + SDL_LOG_WARN("Incorrect insert statement for request subtypes."); return false; } policy_table::Strings::const_iterator it; if (!request_subtypes.empty()) { - LOG4CXX_TRACE(logger_, "Request subtypes are not empty."); + SDL_LOG_TRACE("Request subtypes are not empty."); for (it = request_subtypes.begin(); it != request_subtypes.end(); ++it) { query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + SDL_LOG_WARN("Incorrect insert into request subtypes."); return false; } } } else if (request_subtypes.is_initialized()) { - LOG4CXX_WARN(logger_, "Request subtypes empty."); + SDL_LOG_WARN("Request subtypes empty."); query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString( policy_table::RequestType::RT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + SDL_LOG_WARN("Incorrect insert into request subtypes."); return false; } } @@ -1354,11 +1338,11 @@ bool SQLPTRepresentation::SaveRequestSubType( bool SQLPTRepresentation::SaveAppServiceParameters( const std::string& app_id, const policy_table::AppServiceParameters& app_service_parameters) { - LOG4CXX_INFO(logger_, "Save app service parameters"); + SDL_LOG_INFO("Save app service parameters"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app service types"); + SDL_LOG_WARN("Incorrect insert statement for app service types"); return false; } policy_table::AppServiceParameters::const_iterator it; @@ -1371,14 +1355,14 @@ bool SQLPTRepresentation::SaveAppServiceParameters( query.Bind(1, it->first); query.Bind(2, app_id); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Insert execute failed for into app service types"); + SDL_LOG_WARN("Insert execute failed for into app service types"); return false; } // Insert app names array into db utils::dbms::SQLQuery service_name_query(db()); if (!service_name_query.Prepare(sql_pt::kInsertAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app service names"); + SDL_LOG_WARN("Incorrect insert statement for app service names"); return false; } @@ -1386,11 +1370,11 @@ bool SQLPTRepresentation::SaveAppServiceParameters( if (app_service_names.is_initialized() && app_service_names->empty()) { // App service names is an empty array - LOG4CXX_DEBUG(logger_, "App Service Names is Empty Array"); + SDL_LOG_DEBUG("App Service Names is Empty Array"); service_name_query.Bind(0, static_cast<int64_t>(id)); service_name_query.Bind(1); if (!service_name_query.Exec() || !service_name_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into empty app service names"); + SDL_LOG_WARN("Incorrect insert into empty app service names"); return false; } } else { @@ -1401,7 +1385,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( service_name_query.Bind(0, static_cast<int64_t>(id)); service_name_query.Bind(1, *names_it); if (!service_name_query.Exec() || !service_name_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app service names"); + SDL_LOG_WARN("Incorrect insert into app service names"); return false; } } @@ -1410,8 +1394,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( // Insert handled rpcs array into db utils::dbms::SQLQuery handled_rpcs_query(db()); if (!handled_rpcs_query.Prepare(sql_pt::kInsertAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for app service handled rpcs"); + SDL_LOG_WARN("Incorrect insert statement for app service handled rpcs"); return false; } @@ -1422,7 +1405,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( handled_rpcs_query.Bind(0, static_cast<int64_t>(id)); handled_rpcs_query.Bind(1, static_cast<int32_t>(rpc_it->function_id)); if (!handled_rpcs_query.Exec() || !handled_rpcs_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app service handled rpcs"); + SDL_LOG_WARN("Incorrect insert into app service handled rpcs"); return false; } } @@ -1434,7 +1417,7 @@ bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSaveModuleMeta)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for module_meta."); + SDL_LOG_WARN("Incorrect insert statement for module_meta."); return false; } const int64_t odometer = *(meta.pt_exchanged_at_odometer_x); @@ -1444,7 +1427,7 @@ bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) { query.Bind(2, *(meta.ignition_cycles_since_last_exchange)); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update for module_meta."); + SDL_LOG_WARN("Incorrect update for module_meta."); return false; } @@ -1455,7 +1438,7 @@ bool SQLPTRepresentation::SaveModuleConfig( const policy_table::ModuleConfig& config) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateModuleConfig)) { - LOG4CXX_WARN(logger_, "Incorrect update statement for module config"); + SDL_LOG_WARN("Incorrect update statement for module config"); return false; } @@ -1478,7 +1461,7 @@ bool SQLPTRepresentation::SaveModuleConfig( ? query.Bind(9, *(config.lock_screen_dismissal_enabled)) : query.Bind(9); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update module config"); + SDL_LOG_WARN("Incorrect update module config"); return false; } @@ -1511,12 +1494,12 @@ bool SQLPTRepresentation::SaveServiceEndpoints( const policy_table::ServiceEndpoints& endpoints) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteEndpoint)) { - LOG4CXX_WARN(logger_, "Incorrect delete from endpoint."); + SDL_LOG_WARN("Incorrect delete from endpoint."); return false; } if (!query.Prepare(sql_pt::kInsertEndpoint)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for endpoint"); + SDL_LOG_WARN("Incorrect insert statement for endpoint"); return false; } @@ -1532,7 +1515,7 @@ bool SQLPTRepresentation::SaveServiceEndpoints( query.Bind(1, *url_it); query.Bind(2, app_it->first); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into endpoint"); + SDL_LOG_WARN("Incorrect insert into endpoint"); return false; } } @@ -1546,8 +1529,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( const policy_table::ServiceEndpointProperties& endpoint_properties) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertEndpointVersion)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Incorrect insert of endpoint property to endpoint_properties."); return false; } @@ -1557,8 +1539,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( query.Bind(1, endpoint_property.second.version); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Failed to insert endpoint property into endpoint_properties."); return false; } @@ -1569,13 +1550,13 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( bool SQLPTRepresentation::SaveConsumerFriendlyMessages( const policy_table::ConsumerFriendlyMessages& messages) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // According CRS-2419 If there is no “consumer_friendly_messages” key, // the current local consumer_friendly_messages section shall be maintained in // the policy table. So it won't be changed/updated if (!messages.messages.is_initialized()) { - LOG4CXX_INFO(logger_, "ConsumerFriendlyMessages messages list is empty"); + SDL_LOG_INFO("ConsumerFriendlyMessages messages list is empty"); return true; } @@ -1586,18 +1567,18 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( } if (!delete_query_exec_result) { - LOG4CXX_WARN(logger_, "Failed to delete messages from DB."); + SDL_LOG_WARN("Failed to delete messages from DB."); return false; } if (!query.Prepare(sql_pt::kUpdateVersion)) { - LOG4CXX_WARN(logger_, "Invalid update messages version statement."); + SDL_LOG_WARN("Invalid update messages version statement."); return false; } query.Bind(0, messages.version); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to update messages version number in DB."); + SDL_LOG_WARN("Failed to update messages version number in DB."); return false; } @@ -1624,13 +1605,13 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( bool SQLPTRepresentation::SaveMessageType(const std::string& type) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertMessageType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for message type."); + SDL_LOG_WARN("Incorrect insert statement for message type."); return false; } query.Bind(0, type); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into message type."); + SDL_LOG_WARN("Incorrect insert into message type."); return false; } @@ -1640,13 +1621,13 @@ bool SQLPTRepresentation::SaveMessageType(const std::string& type) { bool SQLPTRepresentation::SaveLanguage(const std::string& code) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertLanguage)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for language."); + SDL_LOG_WARN("Incorrect insert statement for language."); return false; } query.Bind(0, code); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into language."); + SDL_LOG_WARN("Incorrect insert into language."); return false; } @@ -1659,7 +1640,7 @@ bool SQLPTRepresentation::SaveMessageString( const policy_table::MessageString& strings) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertMessageString)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for message."); + SDL_LOG_WARN("Incorrect insert statement for message."); return false; } @@ -1686,7 +1667,7 @@ bool SQLPTRepresentation::SaveMessageString( } if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into message."); + SDL_LOG_WARN("Incorrect insert into message."); return false; } return true; @@ -1696,12 +1677,11 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries( const policy_table::SecondsBetweenRetries& seconds) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteSecondsBetweenRetries)) { - LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries."); + SDL_LOG_WARN("Incorrect delete from seconds between retries."); return false; } if (!query.Prepare(sql_pt::kInsertSecondsBetweenRetry)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for seconds between retries."); + SDL_LOG_WARN("Incorrect insert statement for seconds between retries."); return false; } @@ -1709,7 +1689,7 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries( query.Bind(0, static_cast<int>(i)); query.Bind(1, seconds[i]); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into seconds between retries."); + SDL_LOG_WARN("Incorrect insert into seconds between retries."); return false; } } @@ -1721,8 +1701,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( const policy_table::NumberOfNotificationsPerMinute& notifications) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertNotificationsByPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for notifications by priority."); + SDL_LOG_WARN("Incorrect insert statement for notifications by priority."); return false; } @@ -1731,7 +1710,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( query.Bind(0, it->first); query.Bind(1, it->second); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority."); + SDL_LOG_WARN("Incorrect insert into notifications by priority."); return false; } } @@ -1743,8 +1722,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute( const policy_table::NumberOfNotificationsPerMinute& notifications) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertSubtleNotificationsByPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for notifications by priority."); + SDL_LOG_WARN("Incorrect insert statement for notifications by priority."); return false; } @@ -1753,7 +1731,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute( query.Bind(0, it->first); query.Bind(1, it->second); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority."); + SDL_LOG_WARN("Incorrect insert into notifications by priority."); return false; } } @@ -1765,7 +1743,7 @@ bool SQLPTRepresentation::SaveDeviceData( const policy_table::DeviceData& devices) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertDeviceData)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for device data."); + SDL_LOG_WARN("Incorrect insert statement for device data."); return false; } @@ -1773,7 +1751,7 @@ bool SQLPTRepresentation::SaveDeviceData( for (it = devices.begin(); it != devices.end(); ++it) { query.Bind(0, it->first); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into device data."); + SDL_LOG_WARN("Incorrect insert into device data."); return false; } } @@ -1786,11 +1764,11 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( const_cast<policy_table::UsageAndErrorCounts&>(counts).mark_initialized(); utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app level."); + SDL_LOG_WARN("Incorrect delete from app level."); return false; } if (!query.Prepare(sql_pt::kInsertAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app level."); + SDL_LOG_WARN("Incorrect insert statement for app level."); return false; } @@ -1801,7 +1779,7 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( query.Bind(0, it->first); query.Bind(1, it->second.count_of_tls_errors); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app level."); + SDL_LOG_WARN("Incorrect insert into app level."); return false; } } @@ -1810,18 +1788,17 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( bool SQLPTRepresentation::SaveVehicleData( const policy_table::VehicleData& vehicle_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (vehicle_data.is_initialized() && vehicle_data.schema_version.is_initialized()) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertVehicleDataSchemaVersion)) { - LOG4CXX_WARN(logger_, - "Incorrect insert of schema_version to vehicle_data."); + SDL_LOG_WARN("Incorrect insert of schema_version to vehicle_data."); return false; } query.Bind(0, (*vehicle_data.schema_version)); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Failed to insert schema_version to vehicle_data."); + SDL_LOG_WARN("Failed to insert schema_version to vehicle_data."); return false; } } @@ -1836,7 +1813,7 @@ bool SQLPTRepresentation::SaveVehicleData( bool SQLPTRepresentation::SaveVehicleDataItems( const policy_table::VehicleDataItems& vehicle_data_items) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeleteVehicleDataItems(); for (const auto& item : vehicle_data_items) { if (!InsertVehicleDataItem(item)) { @@ -1849,23 +1826,22 @@ bool SQLPTRepresentation::SaveVehicleDataItems( void SQLPTRepresentation::IncrementIgnitionCycles() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kIncrementIgnitionCycles)) { - LOG4CXX_WARN(logger_, "Failed incrementing ignition cycles"); + SDL_LOG_WARN("Failed incrementing ignition cycles"); } } void SQLPTRepresentation::ResetIgnitionCycles() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kResetIgnitionCycles)) { - LOG4CXX_WARN(logger_, "Failed to reset ignition cycles number."); + SDL_LOG_WARN("Failed to reset ignition cycles number."); } } bool SQLPTRepresentation::UpdateRequired() const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectFlagUpdateRequired) || !query.Exec()) { - LOG4CXX_WARN(logger_, - "Failed select update required flag from module meta"); + SDL_LOG_WARN("Failed select update required flag from module meta"); return false; } return query.GetBoolean(0); @@ -1876,29 +1852,28 @@ void SQLPTRepresentation::SaveUpdateRequired(bool value) { // TODO(AOleynik): Quick fix, will be reworked if (!query.Prepare(/*sql_pt::kUpdateFlagUpdateRequired*/ "UPDATE `module_meta` SET `flag_update_required` = ?")) { - LOG4CXX_WARN(logger_, - "Incorrect update into module meta (update_required): " - << strerror(errno)); + SDL_LOG_WARN("Incorrect update into module meta (update_required): " + << strerror(errno)); return; } query.Bind(0, value); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update module meta (update_required)"); + SDL_LOG_WARN("Failed update module meta (update_required)"); } } bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, StringArray* nicknames, StringArray* app_types) { - LOG4CXX_INFO(logger_, "Getting initial application data."); + SDL_LOG_INFO("Getting initial application data."); utils::dbms::SQLQuery app_names(db()); if (!app_names.Prepare(sql_pt::kSelectNicknames)) { - LOG4CXX_WARN(logger_, "Incorrect select from app nicknames"); + SDL_LOG_WARN("Incorrect select from app nicknames"); return false; } utils::dbms::SQLQuery app_hmi_types(db()); if (!app_hmi_types.Prepare(sql_pt::kSelectAppTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } app_names.Bind(0, app_id); @@ -1916,7 +1891,7 @@ bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, bool SQLPTRepresentation::GetFunctionalGroupings( policy_table::FunctionalGroupings& groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return GatherFunctionalGroupings(&groups); } @@ -1924,7 +1899,7 @@ bool SQLPTRepresentation::GatherAppType( const std::string& app_id, policy_table::AppHMITypes* app_types) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } @@ -1944,7 +1919,7 @@ bool SQLPTRepresentation::GatherRequestType( policy_table::RequestTypes* request_types) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRequestTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from request types."); + SDL_LOG_WARN("Incorrect select from request types."); return false; } @@ -1968,7 +1943,7 @@ bool SQLPTRepresentation::GatherRequestSubType( policy_table::RequestSubTypes* request_subtypes) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRequestSubTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from request subtypes."); + SDL_LOG_WARN("Incorrect select from request subtypes."); return false; } @@ -1988,22 +1963,22 @@ bool SQLPTRepresentation::GatherRequestSubType( bool SQLPTRepresentation::GatherAppServiceParameters( const std::string& app_id, policy_table::AppServiceParameters* app_service_parameters) const { - LOG4CXX_INFO(logger_, "Gather app service info"); + SDL_LOG_INFO("Gather app service info"); utils::dbms::SQLQuery service_type_query(db()); if (!service_type_query.Prepare(sql_pt::kSelectAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from service_types"); + SDL_LOG_WARN("Incorrect select from service_types"); return false; } utils::dbms::SQLQuery service_name_query(db()); if (!service_name_query.Prepare(sql_pt::kSelectAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect select all from app_service_names"); + SDL_LOG_WARN("Incorrect select all from app_service_names"); return false; } utils::dbms::SQLQuery handled_rpcs_query(db()); if (!handled_rpcs_query.Prepare(sql_pt::kSelectAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select all from app_service_handled_rpcs"); + SDL_LOG_WARN("Incorrect select all from app_service_handled_rpcs"); return false; } @@ -2011,12 +1986,12 @@ bool SQLPTRepresentation::GatherAppServiceParameters( while (service_type_query.Next()) { const int service_type_id = service_type_query.GetInteger(0); std::string service_type = service_type_query.GetString(1); - LOG4CXX_WARN(logger_, "Load service type from pt: " << service_type); + SDL_LOG_WARN("Load service type from pt: " << service_type); (*app_service_parameters)[service_type] = policy_table::AppServiceInfo(); service_name_query.Bind(0, service_type_id); while (service_name_query.Next()) { - LOG4CXX_DEBUG(logger_, "Loading service name"); + SDL_LOG_DEBUG("Loading service name"); (*app_service_parameters)[service_type].service_names->push_back( service_name_query.GetString(0)); (*app_service_parameters)[service_type].service_names->mark_initialized(); @@ -2031,11 +2006,11 @@ bool SQLPTRepresentation::GatherAppServiceParameters( } if (!service_name_query.Reset()) { - LOG4CXX_ERROR(logger_, "Could not reset service_name query"); + SDL_LOG_ERROR("Could not reset service_name query"); return false; } if (!handled_rpcs_query.Reset()) { - LOG4CXX_ERROR(logger_, "Could not reset handled_rpcs query"); + SDL_LOG_ERROR("Could not reset handled_rpcs query"); return false; } } @@ -2047,7 +2022,7 @@ bool SQLPTRepresentation::GatherNickName( const std::string& app_id, policy_table::Strings* nicknames) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectNicknames)) { - LOG4CXX_WARN(logger_, "Incorrect select from app nicknames"); + SDL_LOG_WARN("Incorrect select from app nicknames"); return false; } @@ -2062,7 +2037,7 @@ bool SQLPTRepresentation::GatherAppGroup( const std::string& app_id, policy_table::Strings* app_groups) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select from app groups"); + SDL_LOG_WARN("Incorrect select from app groups"); return false; } @@ -2075,10 +2050,10 @@ bool SQLPTRepresentation::GatherAppGroup( bool SQLPTRepresentation::GatherRemoteControlDenied(const std::string& app_id, bool* denied) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRemoteControlDenied)) { - LOG4CXX_WARN(logger_, "Incorrect select remote control flag"); + SDL_LOG_WARN("Incorrect select remote control flag"); return false; } query.Bind(0, app_id); @@ -2094,7 +2069,7 @@ bool SQLPTRepresentation::GatherModuleType( const std::string& app_id, policy_table::ModuleTypes* app_types) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectModuleTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } @@ -2115,17 +2090,17 @@ bool SQLPTRepresentation::GatherModuleType( bool SQLPTRepresentation::SaveRemoteControlDenied(const std::string& app_id, bool deny) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateRemoteControlDenied)) { - LOG4CXX_WARN(logger_, "Incorrect update statement for remote control flag"); + SDL_LOG_WARN("Incorrect update statement for remote control flag"); return false; } - LOG4CXX_DEBUG(logger_, "App: " << app_id << std::boolalpha << " - " << deny); + SDL_LOG_DEBUG("App: " << app_id << std::boolalpha << " - " << deny); query.Bind(0, deny); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update remote control flag."); + SDL_LOG_WARN("Incorrect update remote control flag."); return false; } return true; @@ -2135,7 +2110,7 @@ bool SQLPTRepresentation::SaveModuleType( const std::string& app_id, const policy_table::ModuleTypes& types) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertModuleType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for module type"); + SDL_LOG_WARN("Incorrect insert statement for module type"); return false; } @@ -2145,10 +2120,9 @@ bool SQLPTRepresentation::SaveModuleType( query.Bind(0, app_id); std::string module(policy_table::EnumToJsonString(*it)); query.Bind(1, module); - LOG4CXX_DEBUG(logger_, - "Module(app: " << app_id << ", type: " << module << ")"); + SDL_LOG_DEBUG("Module(app: " << app_id << ", type: " << module << ")"); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into module type."); + SDL_LOG_WARN("Incorrect insert into module type."); return false; } } @@ -2158,21 +2132,21 @@ bool SQLPTRepresentation::SaveModuleType( std::string(policy_table::EnumToJsonString( policy_table::ModuleType::MT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into module types."); + SDL_LOG_WARN("Incorrect insert into module types."); return false; } } else { - LOG4CXX_WARN(logger_, "Module Type omitted."); + SDL_LOG_WARN("Module Type omitted."); } return true; } bool SQLPTRepresentation::SaveAccessModule( TypeAccess access, const policy_table::AccessModules& modules) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAccessModule)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for access module"); + SDL_LOG_WARN("Incorrect insert statement for access module"); return false; } @@ -2183,12 +2157,12 @@ bool SQLPTRepresentation::SaveAccessModule( query.Bind(0, name); query.Bind(1, access); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into access module."); + SDL_LOG_WARN("Incorrect insert into access module."); return false; } int id = query.LastInsertId(); if (!query.Reset()) { - LOG4CXX_WARN(logger_, "Couldn't reset query access module."); + SDL_LOG_WARN("Couldn't reset query access module."); return false; } if (!SaveRemoteRpc(id, rpcs)) { @@ -2200,10 +2174,10 @@ bool SQLPTRepresentation::SaveAccessModule( bool SQLPTRepresentation::GatherAccessModule( TypeAccess access, policy_table::AccessModules* modules) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAccessModules)) { - LOG4CXX_WARN(logger_, "Incorrect select from access module"); + SDL_LOG_WARN("Incorrect select from access module"); return false; } @@ -2222,10 +2196,10 @@ bool SQLPTRepresentation::GatherAccessModule( bool SQLPTRepresentation::SaveRemoteRpc(int module_id, const policy_table::RemoteRpcs& rpcs) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRemoteRpc)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for remote rpc"); + SDL_LOG_WARN("Incorrect insert statement for remote rpc"); return false; } policy_table::RemoteRpcs::const_iterator i; @@ -2238,7 +2212,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, query.Bind(1, name); query.Bind(2); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + SDL_LOG_WARN("Incorrect insert into remote rpc."); return false; } } else { @@ -2248,7 +2222,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, query.Bind(1, name); query.Bind(2, param); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + SDL_LOG_WARN("Incorrect insert into remote rpc."); return false; } } @@ -2259,10 +2233,10 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, bool SQLPTRepresentation::GatherRemoteRpc( int module_id, policy_table::RemoteRpcs* rpcs) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRemoteRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select from remote rpc"); + SDL_LOG_WARN("Incorrect select from remote rpc"); return false; } @@ -2285,7 +2259,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, bool is_predata) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateApplicationCustomData)) { - LOG4CXX_WARN(logger_, "Incorrect update in application"); + SDL_LOG_WARN("Incorrect update in application"); return false; } @@ -2295,7 +2269,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, query.Bind(3, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update in application"); + SDL_LOG_WARN("Failed update in application"); return false; } @@ -2306,13 +2280,13 @@ bool SQLPTRepresentation::IsApplicationRevoked( const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationRevoked)) { - LOG4CXX_WARN(logger_, "Incorrect select from is_revoked of application"); + SDL_LOG_WARN("Incorrect select from is_revoked of application"); } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select is_revoked of application"); + SDL_LOG_WARN("Failed select is_revoked of application"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -2321,13 +2295,13 @@ bool SQLPTRepresentation::IsApplicationRepresented( const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationRepresented)) { - LOG4CXX_WARN(logger_, "Incorrect select application by id"); + SDL_LOG_WARN("Incorrect select application by id"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select application by id"); + SDL_LOG_WARN("Failed select application by id"); return false; } return query.GetInteger(0) != 0; @@ -2336,13 +2310,13 @@ bool SQLPTRepresentation::IsApplicationRepresented( bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationIsDefault)) { - LOG4CXX_WARN(logger_, "Incorrect select application by id"); + SDL_LOG_WARN("Incorrect select application by id"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select application by id"); + SDL_LOG_WARN("Failed select application by id"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -2355,12 +2329,12 @@ bool SQLPTRepresentation::IsPredataPolicy(const std::string& app_id) const { bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } @@ -2404,17 +2378,17 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { bool SQLPTRepresentation::SetIsDefault(const std::string& app_id, bool is_default) const { - LOG4CXX_TRACE(logger_, "Set flag is_default of application"); + SDL_LOG_TRACE("Set flag is_default of application"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateIsDefault)) { - LOG4CXX_WARN(logger_, "Incorect statement for updating is_default"); + SDL_LOG_WARN("Incorect statement for updating is_default"); return false; } query.Bind(0, is_default); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update is_default"); + SDL_LOG_WARN("Failed update is_default"); return false; } return true; @@ -2425,18 +2399,16 @@ void SQLPTRepresentation::RemoveDB() const { } bool SQLPTRepresentation::IsDBVersionActual() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectDBVersion) || !query.Exec()) { - LOG4CXX_ERROR(logger_, - "Failed to get DB version: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to get DB version: " << query.LastError().text()); return false; } const int32_t saved_db_version = query.GetInteger(0); const int32_t current_db_version = GetDBVersion(); - LOG4CXX_DEBUG(logger_, - "Saved DB version is: " << saved_db_version + SDL_LOG_DEBUG("Saved DB version is: " << saved_db_version << ". Current DB vesion is: " << current_db_version); @@ -2444,21 +2416,19 @@ bool SQLPTRepresentation::IsDBVersionActual() const { } bool SQLPTRepresentation::UpdateDBVersion() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateDBVersion)) { - LOG4CXX_ERROR(logger_, - "Incorrect DB version query: " << query.LastError().text()); + SDL_LOG_ERROR("Incorrect DB version query: " << query.LastError().text()); return false; } const int32_t db_version = GetDBVersion(); - LOG4CXX_DEBUG(logger_, "DB version will be updated to: " << db_version); + SDL_LOG_DEBUG("DB version will be updated to: " << db_version); query.Bind(0, db_version); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, - "DB version getting failed: " << query.LastError().text()); + SDL_LOG_ERROR("DB version getting failed: " << query.LastError().text()); return false; } @@ -2477,18 +2447,18 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, const std::string& destination) { utils::dbms::SQLQuery source_app(db()); if (!source_app.Prepare(sql_pt::kSelectApplicationFull)) { - LOG4CXX_WARN(logger_, "Incorrect select statement from application."); + SDL_LOG_WARN("Incorrect select statement from application."); return false; } source_app.Bind(0, source); if (!source_app.Exec()) { - LOG4CXX_WARN(logger_, "Failed selecting from application."); + SDL_LOG_WARN("Failed selecting from application."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertApplicationFull)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + SDL_LOG_WARN("Incorrect insert statement into application."); return false; } query.Bind(0, destination); @@ -2526,7 +2496,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, : query.Bind(18, source_app.GetBoolean(17)); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed inserting into application."); + SDL_LOG_WARN("Failed inserting into application."); return false; } return true; @@ -2535,13 +2505,13 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, void SQLPTRepresentation::SetPreloaded(bool value) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdatePreloaded)) { - LOG4CXX_WARN(logger_, "Incorrect statement of updating preloaded."); + SDL_LOG_WARN("Incorrect statement of updating preloaded."); return; } query.Bind(0, value); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed updating preloaded."); + SDL_LOG_WARN("Failed updating preloaded."); return; } } @@ -2554,9 +2524,8 @@ bool SQLPTRepresentation::VehicleDataItemExists( const policy_table::VehicleDataItem& vehicle_data_item) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataItemWithVersion)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement for vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement for vehicle data item. " + << query.LastError().text()); return false; } @@ -2570,10 +2539,9 @@ bool SQLPTRepresentation::VehicleDataItemExists( : query.Bind(3); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, - "Failed to retrieve vehicle data item: " - << std::string(vehicle_data_item.key) - << ". Error: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to retrieve vehicle data item: " + << std::string(vehicle_data_item.key) + << ". Error: " << query.LastError().text()); return false; } return !query.IsNull(0); @@ -2585,9 +2553,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataItem)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return result; } @@ -2604,9 +2571,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem( if (policy_table::VehicleDataItem::kStruct == static_cast<std::string>(vdi.type)) { if (!param_query.Prepare(sql_pt::kSelectVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << param_query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << param_query.LastError().text()); return policy_table::VehicleDataItems(); } @@ -2687,21 +2653,19 @@ bool SQLPTRepresentation::InsertVehicleDataItem( utils::dbms::SQLQuery query(db()); if (!vehicle_data_item.is_initialized() || !vehicle_data_item.is_valid()) { - LOG4CXX_ERROR(logger_, "Vehicle data item is not initialized."); + SDL_LOG_ERROR("Vehicle data item is not initialized."); return false; } if (VehicleDataItemExists(vehicle_data_item)) { - LOG4CXX_INFO(logger_, - static_cast<std::string>(vehicle_data_item.key) - << " is already stored."); + SDL_LOG_INFO(static_cast<std::string>(vehicle_data_item.key) + << " is already stored."); return true; } if (!query.Prepare(sql_pt::kInsertVehicleDataItem)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return false; } @@ -2744,10 +2708,9 @@ bool SQLPTRepresentation::InsertVehicleDataItem( : query.Bind(14); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR(logger_, - "Failed to insert vehicle data item: " - << static_cast<std::string>(vehicle_data_item.key) - << ". Error: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to insert vehicle data item: " + << static_cast<std::string>(vehicle_data_item.key) + << ". Error: " << query.LastError().text()); return false; } @@ -2760,14 +2723,13 @@ bool SQLPTRepresentation::InsertVehicleDataItem( if (stored_vehicle_data_item_params.end() != stored_vehicle_data_item_params.find(param.name)) { - LOG4CXX_DEBUG(logger_, "Parameter already stored."); + SDL_LOG_DEBUG("Parameter already stored."); continue; }; if (!query.Prepare(sql_pt::kInsertVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return false; } @@ -2777,11 +2739,11 @@ bool SQLPTRepresentation::InsertVehicleDataItem( query.Bind(3, param.key); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed to insert to vehicle data item relations helper table: " - << static_cast<std::string>(param.key) - << ". Error: " << query.LastError().text()); + << static_cast<std::string>(param.key) + << ". Error: " << query.LastError().text()); return false; } stored_vehicle_data_item_params[param.name] = param.key; @@ -2794,10 +2756,9 @@ bool SQLPTRepresentation::InsertVehicleDataItem( policy_table::VehicleDataItems SQLPTRepresentation::SelectCompositeVehicleDataItems() const { utils::dbms::SQLQuery query(db()); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!query.Prepare(sql_pt::kSelectCompositeVehicleDataItemsKey)) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for parameterized vehicle data items"); + SDL_LOG_ERROR("Incorrect statement for parameterized vehicle data items"); return policy_table::VehicleDataItems(); } @@ -2820,10 +2781,9 @@ SQLPTRepresentation::SelectCompositeVehicleDataItems() const { policy_table::VehicleDataItems SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const { utils::dbms::SQLQuery query(db()); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!query.Prepare(sql_pt::kSelectPrimitiveVehicleDataItems)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Incorrect statement for non parameterized vehicle data items"); return policy_table::VehicleDataItems(); } @@ -2843,17 +2803,15 @@ SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const { bool SQLPTRepresentation::DeleteVehicleDataItems() const { utils::dbms::SQLQuery query(db()); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!query.Exec(sql_pt::kDeleteVehicleDataItems)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kDeleteVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } diff --git a/src/components/policy/policy_regular/src/update_status_manager.cc b/src/components/policy/policy_regular/src/update_status_manager.cc index 1ba3d0f394..9ac51c3f93 100644 --- a/src/components/policy/policy_regular/src/update_status_manager.cc +++ b/src/components/policy/policy_regular/src/update_status_manager.cc @@ -36,7 +36,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) @@ -55,7 +55,7 @@ void UpdateStatusManager::ProcessEvent(UpdateEvent event) { } void UpdateStatusManager::PendingUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kPendingUpdate); } @@ -72,27 +72,27 @@ void UpdateStatusManager::set_listener(PolicyListener* listener) { } void UpdateStatusManager::OnUpdateSentOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnUpdateSentOut); } void UpdateStatusManager::OnUpdateTimeoutOccurs() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnUpdateTimeout); } void UpdateStatusManager::OnValidUpdateReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnValidUpdateReceived); } void UpdateStatusManager::OnWrongUpdateReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnWrongUpdateReceived); } void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_update_required) { ProcessEvent(kOnResetPolicyTableRequireUpdate); return; @@ -101,13 +101,13 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { } void UpdateStatusManager::OnResetRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnResetRetrySequence); } void UpdateStatusManager::OnExistedApplicationAdded( const bool is_update_required) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_update_required) { current_status_.reset(new UpToDateStatus()); ProcessEvent(kScheduleUpdate); @@ -115,7 +115,7 @@ void UpdateStatusManager::OnExistedApplicationAdded( } void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (kDeviceAllowed != consent) { app_registered_from_non_consented_device_ = true; return; @@ -130,7 +130,7 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { } void UpdateStatusManager::OnDeviceConsented() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app_registered_from_non_consented_device_) { ProcessEvent(kOnNewAppRegistered); } @@ -157,19 +157,19 @@ std::string UpdateStatusManager::StringifiedUpdateStatus() const { } void policy::UpdateStatusManager::OnAppsSearchStarted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); apps_search_in_progress_ = true; } void policy::UpdateStatusManager::OnAppsSearchCompleted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); apps_search_in_progress_ = false; } bool policy::UpdateStatusManager::IsAppsSearchInProgress() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); return apps_search_in_progress_; } @@ -182,7 +182,7 @@ void UpdateStatusManager::DoTransition() { current_status_ = next_status_; next_status_.reset(); - LOG4CXX_DEBUG(logger_, "last_processed_event_ = " << last_processed_event_); + SDL_LOG_DEBUG("last_processed_event_ = " << last_processed_event_); const bool is_update_pending = policy::StatusProcessingSnapshot == current_status_->get_status(); |