diff options
Diffstat (limited to 'src/components/application_manager/src')
48 files changed, 2313 insertions, 2760 deletions
diff --git a/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc b/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc index 691f8d3259..4dafe9a8e6 100644 --- a/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc +++ b/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc @@ -40,7 +40,7 @@ #include "utils/timer_task_impl.h" namespace app_launch { -CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") +SDL_CREATE_LOG_VARIABLE("AppLaunch") AppLaunchCtrlImpl::AppLaunchCtrlImpl( AppLaunchData& data, @@ -57,7 +57,7 @@ AppLaunchCtrlImpl::AppLaunchCtrlImpl( void AppLaunchCtrlImpl::OnAppRegistered( const application_manager::Application& app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO (AKutsan) : get device mac ApplicationDataPtr app_data = std::make_shared<ApplicationData>( app.policy_app_id(), app.bundle_id(), app.mac_address()); @@ -82,7 +82,7 @@ bool HmiLevelSorter(const std::pair<int32_t, ApplicationDataPtr>& lval, } void AppLaunchCtrlImpl::OnDeviceConnected(const std::string& device_mac) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<ApplicationDataPtr> apps_on_device = app_launch_data_.GetApplicationDataByDevice(device_mac); std::vector<std::pair<int32_t, ApplicationDataPtr> > apps_hmi_levels; @@ -104,12 +104,12 @@ void AppLaunchCtrlImpl::OnDeviceConnected(const std::string& device_mac) { if (apps_on_device.size() > 0) { device_apps_launcher_.LaunchAppsOnDevice(device_mac, apps_on_device); } else { - LOG4CXX_DEBUG(logger_, "No apps in saved for device " << device_mac); + SDL_LOG_DEBUG("No apps in saved for device " << device_mac); } } void AppLaunchCtrlImpl::OnMasterReset() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_launch_data_.Clear(); } } // namespace app_launch diff --git a/src/components/application_manager/src/app_launch/app_launch_data_db.cc b/src/components/application_manager/src/app_launch/app_launch_data_db.cc index a931b96fa1..7c015b0707 100644 --- a/src/components/application_manager/src/app_launch/app_launch_data_db.cc +++ b/src/components/application_manager/src/app_launch/app_launch_data_db.cc @@ -39,7 +39,7 @@ #include "application_manager/smart_object_keys.h" namespace app_launch { -CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") +SDL_CREATE_LOG_VARIABLE("AppLaunch") AppLaunchDataDB::AppLaunchDataDB(const AppLaunchSettings& settings, DbStorage db_storage) @@ -56,8 +56,8 @@ AppLaunchDataDB::AppLaunchDataDB(const AppLaunchSettings& settings, #endif // __QNX__ DCHECK(db_.get()); } else { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_ERROR(logger_, "Get not existed type of database storage"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_ERROR("Get not existed type of database storage"); } // Connect to resumption DB @@ -69,48 +69,44 @@ AppLaunchDataDB::~AppLaunchDataDB() { } bool AppLaunchDataDB::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); 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 = settings_.app_launch_max_retry_attempt(); - 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 = settings_.app_launch_retry_wait_time(); const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000u; - 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 (size_t i = 0u; i < attempts; ++i) { usleep(sleep_interval_mcsec); - LOG4CXX_INFO(logger_, "Attempt: " << i + 1); + SDL_LOG_INFO("Attempt: " << i + 1); 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 false; } } #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 false; } #endif // __QNX__ utils::dbms::SQLQuery query(db()); if (!query.Exec(kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Failed creating schema of database: " << query.LastError().text()); return false; } @@ -119,20 +115,20 @@ bool AppLaunchDataDB::Init() { } bool AppLaunchDataDB::Persist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool retVal = false; if (!init_successeful_) { - LOG4CXX_ERROR(logger_, - "AppLaunch data base was not successfully " - "initialize, AppLaunch won't work!"); + SDL_LOG_ERROR( + "AppLaunch data base was not successfully " + "initialize, AppLaunch won't work!"); return retVal; } if ((retVal = WriteDb())) { - LOG4CXX_DEBUG(logger_, "App_lauch had been successfully saved."); + SDL_LOG_DEBUG("App_lauch had been successfully saved."); } else { - LOG4CXX_WARN(logger_, "Fail to save app_launch data."); + SDL_LOG_WARN("Fail to save app_launch data."); } return retVal; @@ -140,21 +136,20 @@ bool AppLaunchDataDB::Persist() { bool AppLaunchDataDB::IsAppDataAlreadyExisted( const ApplicationData& app_data) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool retVal = false; if (!init_successeful_) { - LOG4CXX_ERROR(logger_, - "AppLaunch data base was not successfully " - "initialize, AppLaunch won't work!"); + SDL_LOG_ERROR( + "AppLaunch data base was not successfully " + "initialize, AppLaunch won't work!"); return retVal; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(kFindApplicationData)) { - LOG4CXX_WARN(logger_, - "Problem with verification queries 'kFindApplicationData'"); + SDL_LOG_WARN("Problem with verification queries 'kFindApplicationData'"); return retVal; } @@ -165,31 +160,30 @@ bool AppLaunchDataDB::IsAppDataAlreadyExisted( if (query.Exec()) { retVal = query.GetBoolean(result_query); } else { - LOG4CXX_WARN(logger_, - "Failed execute query 'kGetNumberOfApplicationData'. Reson: " - << query.LastError().text()); + SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: " + << query.LastError().text()); } return retVal; } bool AppLaunchDataDB::RefreshAppSessionTime(const ApplicationData& app_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool retVal = false; if (!init_successeful_) { - LOG4CXX_ERROR(logger_, - "AppLaunch data base was not successfully " - "initialize, AppLaunch won't work!"); + SDL_LOG_ERROR( + "AppLaunch data base was not successfully " + "initialize, AppLaunch won't work!"); return retVal; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(kRefreshApplicationDataSessionTime)) { - LOG4CXX_WARN(logger_, - "Problem with verification queries " - "'kRefreshApplicationDataSessionTime'"); + SDL_LOG_WARN( + "Problem with verification queries " + "'kRefreshApplicationDataSessionTime'"); return retVal; } @@ -198,33 +192,31 @@ bool AppLaunchDataDB::RefreshAppSessionTime(const ApplicationData& app_data) { query.Bind(bundle_id_index, app_data.bundle_id_); if (query.Exec()) { - LOG4CXX_DEBUG(logger_, "Dare&time last session were updated successfully"); + SDL_LOG_DEBUG("Dare&time last session were updated successfully"); retVal = WriteDb(); } else { - LOG4CXX_WARN(logger_, - "Failed execute query 'kGetNumberOfApplicationData'. Reson: " - << query.LastError().text()); + SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: " + << query.LastError().text()); } return retVal; } bool AppLaunchDataDB::AddNewAppData(const ApplicationData& app_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool retVal = false; if (!init_successeful_) { - LOG4CXX_ERROR(logger_, - "AppLaunch data base was not successfully " - "initialize, AppLaunch won't work!"); + SDL_LOG_ERROR( + "AppLaunch data base was not successfully " + "initialize, AppLaunch won't work!"); return retVal; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(kAddApplicationData)) { - LOG4CXX_WARN(logger_, - "Problem with verification queries 'kAddApplicationData'"); + SDL_LOG_WARN("Problem with verification queries 'kAddApplicationData'"); return retVal; } @@ -234,12 +226,11 @@ bool AppLaunchDataDB::AddNewAppData(const ApplicationData& app_data) { retVal = query.Exec(); if (retVal) { - LOG4CXX_DEBUG(logger_, "New application data was added successfully"); + SDL_LOG_DEBUG("New application data was added successfully"); retVal = WriteDb(); } else { - LOG4CXX_WARN(logger_, - "Failed execute query 'kGetNumberOfApplicationData'. Reson: " - << query.LastError().text()); + SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: " + << query.LastError().text()); } return retVal; @@ -247,21 +238,20 @@ bool AppLaunchDataDB::AddNewAppData(const ApplicationData& app_data) { std::vector<ApplicationDataPtr> AppLaunchDataDB::GetAppDataByDevMac( const std::string& dev_mac) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<ApplicationDataPtr> dev_apps; if (!init_successeful_) { - LOG4CXX_ERROR(logger_, - "AppLaunch data base was not successfully " - "initialize, AppLaunch won't work!"); + SDL_LOG_ERROR( + "AppLaunch data base was not successfully " + "initialize, AppLaunch won't work!"); return dev_apps; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(kGetApplicationDataByDevID)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Problem with verification queries 'kGetApplicationDataByDevID'"); return dev_apps; } @@ -269,8 +259,7 @@ std::vector<ApplicationDataPtr> AppLaunchDataDB::GetAppDataByDevMac( query.Bind(device_mac_index, dev_mac); const bool retVal = query.Exec(); if (retVal) { - LOG4CXX_INFO(logger_, - "Values of ignition off counts were updated successfully"); + SDL_LOG_INFO("Values of ignition off counts were updated successfully"); do { const std::string device_mac = query.GetString(device_mac_index); const std::string mobile_app_id = query.GetString(application_id_index); @@ -278,106 +267,97 @@ std::vector<ApplicationDataPtr> AppLaunchDataDB::GetAppDataByDevMac( dev_apps.push_back(std::make_shared<ApplicationData>( mobile_app_id, bundle_id, device_mac)); } while (query.Next()); - LOG4CXX_DEBUG(logger_, "All application data has been successfully loaded"); + SDL_LOG_DEBUG("All application data has been successfully loaded"); } else { - LOG4CXX_WARN(logger_, - "Failed execute query 'kGetNumberOfApplicationData'. Reson: " - << query.LastError().text()); + SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: " + << query.LastError().text()); } return dev_apps; } bool AppLaunchDataDB::Clear() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool retVal = false; utils::dbms::SQLQuery query(db()); retVal = query.Exec(kDropSchema); if (retVal) { - LOG4CXX_INFO(logger_, "App_Launch table had been cleared successfully"); + SDL_LOG_INFO("App_Launch table had been cleared successfully"); retVal = WriteDb(); init_successeful_ = false; } else { - LOG4CXX_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_LOG_WARN("Failed dropping database: " << query.LastError().text()); } return retVal; } uint32_t AppLaunchDataDB::GetCurentNumberOfAppData() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t number_of_app_data = 0u; if (!init_successeful_) { - LOG4CXX_ERROR(logger_, - "AppLaunch data base was not successfully " - "initialize, AppLaunch won't work!"); + SDL_LOG_ERROR( + "AppLaunch data base was not successfully " + "initialize, AppLaunch won't work!"); return number_of_app_data; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(kGetNumberOfApplicationData)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Problem with verification queries 'kGetNumberOfApplicationData'"); return number_of_app_data; } if (query.Exec()) { - LOG4CXX_INFO(logger_, - "Values of ignition off counts were updated successfully"); + SDL_LOG_INFO("Values of ignition off counts were updated successfully"); number_of_app_data = query.GetInteger(result_query); - LOG4CXX_DEBUG( - logger_, - "Total cout saved mobile applications is " << number_of_app_data); + SDL_LOG_DEBUG("Total cout saved mobile applications is " + << number_of_app_data); } else { - LOG4CXX_WARN(logger_, - "Failed execute query 'kGetNumberOfApplicationData'. Reson: " - << query.LastError().text()); + SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: " + << query.LastError().text()); } return number_of_app_data; } bool AppLaunchDataDB::DeleteOldestAppData() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool retVal = false; if (!init_successeful_) { - LOG4CXX_ERROR(logger_, - "AppLaunch data base was not successfully " - "initialize, AppLaunch won't work!"); + SDL_LOG_ERROR( + "AppLaunch data base was not successfully " + "initialize, AppLaunch won't work!"); return retVal; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(kDeleteOldestAppData)) { - LOG4CXX_WARN(logger_, - "Problem with verification queries 'kDeleteOldestAppData'"); + SDL_LOG_WARN("Problem with verification queries 'kDeleteOldestAppData'"); return retVal; } if ((retVal = query.Exec())) { - LOG4CXX_INFO(logger_, - "Values of ignition off counts were updated successfully"); + SDL_LOG_INFO("Values of ignition off counts were updated successfully"); retVal = WriteDb(); } else { - LOG4CXX_WARN(logger_, - "Failed execute query 'kGetNumberOfApplicationData'. Reson: " - << query.LastError().text()); + SDL_LOG_WARN("Failed execute query 'kGetNumberOfApplicationData'. Reson: " + << query.LastError().text()); } return retVal; } bool AppLaunchDataDB::WriteDb() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return db_->Backup(); } diff --git a/src/components/application_manager/src/app_launch/app_launch_data_impl.cc b/src/components/application_manager/src/app_launch/app_launch_data_impl.cc index c095cc9d94..524c1e393b 100644 --- a/src/components/application_manager/src/app_launch/app_launch_data_impl.cc +++ b/src/components/application_manager/src/app_launch/app_launch_data_impl.cc @@ -34,7 +34,7 @@ namespace app_launch { -CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") +SDL_CREATE_LOG_VARIABLE("AppLaunch") AppLaunchDataImpl::AppLaunchDataImpl(const AppLaunchSettings& settings) : settings_(settings) @@ -43,24 +43,24 @@ AppLaunchDataImpl::AppLaunchDataImpl(const AppLaunchSettings& settings) AppLaunchDataImpl::~AppLaunchDataImpl() {} bool AppLaunchDataImpl::AddApplicationData(const ApplicationData& app_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool retVal = true; if (app_data.device_mac_.empty() == false && app_data.mobile_app_id_.empty() == false && app_data.bundle_id_.empty() == false) { if (IsAppDataAlreadyExisted(app_data)) { - LOG4CXX_INFO(logger_, "This application data already existed"); + SDL_LOG_INFO("This application data already existed"); retVal &= RefreshAppSessionTime(app_data); } else { if (GetCurentNumberOfAppData() >= get_max_number_iOS_devs()) { - LOG4CXX_INFO(logger_, - "Max number of application data have. It will be deleted " - "the oldest one"); + SDL_LOG_INFO( + "Max number of application data have. It will be deleted " + "the oldest one"); retVal &= DeleteOldestAppData(); } retVal &= AddNewAppData(app_data); - LOG4CXX_INFO(logger_, "Added new application data to DB"); + SDL_LOG_INFO("Added new application data to DB"); } } else { retVal = false; @@ -70,11 +70,11 @@ bool AppLaunchDataImpl::AddApplicationData(const ApplicationData& app_data) { std::vector<ApplicationDataPtr> AppLaunchDataImpl::GetApplicationDataByDevice( const std::string& dev_mac) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<ApplicationDataPtr> apps = GetAppDataByDevMac(dev_mac); if (apps.empty()) { - LOG4CXX_DEBUG(logger_, "No application founded by mac" << dev_mac); + SDL_LOG_DEBUG("No application found by device mac " << dev_mac); } return apps; diff --git a/src/components/application_manager/src/app_launch/app_launch_data_json.cc b/src/components/application_manager/src/app_launch/app_launch_data_json.cc index 86d585f215..d618e63e15 100644 --- a/src/components/application_manager/src/app_launch/app_launch_data_json.cc +++ b/src/components/application_manager/src/app_launch/app_launch_data_json.cc @@ -38,7 +38,7 @@ namespace app_launch { -CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") +SDL_CREATE_LOG_VARIABLE("AppLaunch") AppLaunchDataJson::AppLaunchDataJson( const AppLaunchSettings& settings, @@ -50,16 +50,16 @@ AppLaunchDataJson::~AppLaunchDataJson() {} Json::Value& AppLaunchDataJson::GetSavedApplicationDataList( Json::Value& dictionary) const { using namespace application_manager; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(app_launch_json_lock_); Json::Value& app_launch = GetApplicationData(dictionary); if (!app_launch.isMember(strings::app_launch_list)) { app_launch[strings::app_launch_list] = Json::Value(Json::arrayValue); - LOG4CXX_WARN(logger_, "app_list section is missed"); + SDL_LOG_WARN("app_list section is missed"); } Json::Value& app_launch_list = app_launch[strings::app_launch_list]; if (!app_launch_list.isArray()) { - LOG4CXX_ERROR(logger_, "app_launch_list type INVALID rewrite"); + SDL_LOG_ERROR("app_launch_list type INVALID rewrite"); app_launch_list = Json::Value(Json::arrayValue); } return app_launch_list; @@ -68,15 +68,15 @@ Json::Value& AppLaunchDataJson::GetSavedApplicationDataList( Json::Value& AppLaunchDataJson::GetApplicationData( Json::Value& dictionary) const { using namespace application_manager; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(app_launch_json_lock_); if (!dictionary.isMember(strings::app_launch)) { dictionary[strings::app_launch] = Json::Value(Json::objectValue); - LOG4CXX_WARN(logger_, "app_launch section is missed"); + SDL_LOG_WARN("app_launch section is missed"); } Json::Value& app_launch = dictionary[strings::app_launch]; if (!app_launch.isObject()) { - LOG4CXX_ERROR(logger_, "resumption type INVALID rewrite"); + SDL_LOG_ERROR("resumption type INVALID rewrite"); app_launch = Json::Value(Json::objectValue); } return app_launch; @@ -87,7 +87,7 @@ Json::Value& AppLaunchDataJson::GetApplicationListAndIndex( int32_t& found_index, Json::Value& dictionary) const { using namespace application_manager; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(app_launch_json_lock_); Json::Value& apps_list = GetSavedApplicationDataList(dictionary); @@ -116,7 +116,7 @@ Json::Value& AppLaunchDataJson::GetApplicationListAndIndex( bool AppLaunchDataJson::IsAppDataAlreadyExisted( const ApplicationData& app_data) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); int32_t index = NotFound; @@ -130,7 +130,7 @@ bool AppLaunchDataJson::IsAppDataAlreadyExisted( bool AppLaunchDataJson::RefreshAppSessionTime(const ApplicationData& app_data) { using namespace application_manager; using namespace date_time; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool retVal = false; int32_t index = NotFound; @@ -152,7 +152,7 @@ bool AppLaunchDataJson::RefreshAppSessionTime(const ApplicationData& app_data) { bool AppLaunchDataJson::AddNewAppData(const ApplicationData& app_data) { using namespace application_manager; using namespace date_time; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(app_launch_json_lock_); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); @@ -166,18 +166,17 @@ bool AppLaunchDataJson::AddNewAppData(const ApplicationData& app_data) { static_cast<Json::Value::UInt64>(getSecs(getCurrentTime())); accessor.GetMutableData().set_dictionary(dictionary); - LOG4CXX_DEBUG(logger_, - "New application data saved. Detatils device_id: " - << app_data.device_mac_ - << ", app_id: " << app_data.mobile_app_id_ - << ", bundle_id: " << app_data.bundle_id_ << "."); + SDL_LOG_DEBUG("New application data saved. Detatils device_id: " + << app_data.device_mac_ + << ", app_id: " << app_data.mobile_app_id_ + << ", bundle_id: " << app_data.bundle_id_ << "."); return true; } std::vector<ApplicationDataPtr> AppLaunchDataJson::GetAppDataByDevMac( const std::string& dev_mac) const { using namespace application_manager; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(app_launch_json_lock_); std::vector<ApplicationDataPtr> dev_apps; resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); @@ -207,32 +206,30 @@ std::vector<ApplicationDataPtr> AppLaunchDataJson::GetAppDataByDevMac( } bool AppLaunchDataJson::Clear() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); GetSavedApplicationDataList(dictionary).clear(); accessor.GetMutableData().set_dictionary(dictionary); - LOG4CXX_DEBUG(logger_, - "Application launch JSON section successfully cleared."); + SDL_LOG_DEBUG("Application launch JSON section successfully cleared."); return true; } uint32_t AppLaunchDataJson::GetCurentNumberOfAppData() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); const uint32_t list_size = GetSavedApplicationDataList(dictionary).size(); accessor.GetMutableData().set_dictionary(dictionary); - LOG4CXX_DEBUG(logger_, - "Successfully was gotten app_launch list. Size: " << list_size); + SDL_LOG_DEBUG("Successfully was gotten app_launch list. Size: " << list_size); return list_size; } bool AppLaunchDataJson::DeleteOldestAppData() { using namespace application_manager; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(app_launch_json_lock_); std::vector<uint64_t> temp_array; std::vector<Json::Value> temp_json_list; @@ -279,14 +276,14 @@ bool AppLaunchDataJson::DeleteOldestAppData() { GetSavedApplicationDataList(dictionary).append(item); } accessor.GetMutableData().set_dictionary(dictionary); - LOG4CXX_DEBUG( - logger_, "Oldest application launch data had been successfully deleted."); + SDL_LOG_DEBUG( + "Oldest application launch data had been successfully deleted."); return true; } bool AppLaunchDataJson::Persist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); last_state_wrapper_->get_accessor().GetMutableData().SaveToFileSystem(); return true; } diff --git a/src/components/application_manager/src/app_launch/apps_launcher.cc b/src/components/application_manager/src/app_launch/apps_launcher.cc index 993a57364e..bf1fa2fb5d 100644 --- a/src/components/application_manager/src/app_launch/apps_launcher.cc +++ b/src/components/application_manager/src/app_launch/apps_launcher.cc @@ -28,7 +28,7 @@ struct LauncherGenerator { const uint16_t app_launch_retry_wait_time_; }; -CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") +SDL_CREATE_LOG_VARIABLE("AppLaunch") AppsLauncher::AppsLauncher( connection_handler::ConnectionHandler& connection_handler, const uint16_t max_number_of_ios_device, @@ -45,7 +45,7 @@ AppsLauncher::AppsLauncher( } void AppsLauncher::StartLaunching(ApplicationDataPtr app_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(launchers_lock_); DCHECK_OR_RETURN_VOID(!free_launchers_.empty()) const AppLaunchers::iterator it = free_launchers_.begin(); @@ -75,18 +75,17 @@ void AppsLauncher::StopLaunching(ApplicationDataPtr app_data) { free_launchers_.push_back(launcher); works_launchers_.erase(it); } else { - LOG4CXX_DEBUG(logger_, - "Unable to StopLaunching" << app_data->mobile_app_id_); + SDL_LOG_DEBUG("Unable to StopLaunching" << app_data->mobile_app_id_); } } void AppsLauncher::OnLaunched(ApplicationDataPtr app_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); StopLaunching(app_data); } void AppsLauncher::OnRetryAttemptsExhausted(ApplicationDataPtr app_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); StopLaunching(app_data); } @@ -110,8 +109,7 @@ void AppsLauncher::Launcher::PosponedLaunch( app_data_ = app_data; retry_index_ = 0; retry_timer_.Start(app_launch_retry_wait_time_, timer::kPeriodic); - LOG4CXX_DEBUG(logger_, - "Applicaiton " << app_data->mobile_app_id_ << " on device " + SDL_LOG_DEBUG("Applicaiton " << app_data->mobile_app_id_ << " on device " << app_data->device_mac_ << " will be launched in " << app_launch_retry_wait_time_ << " ms"); @@ -125,8 +123,7 @@ void AppsLauncher::Launcher::Clear() { void AppsLauncher::Launcher::LaunchNow() { if (retry_index_++ < app_launch_max_retry_attempt_) { - LOG4CXX_DEBUG(logger_, - "Run App " << app_data_->mobile_app_id_ << "with bundle " + SDL_LOG_DEBUG("Run App " << app_data_->mobile_app_id_ << "with bundle " << app_data_->bundle_id_ << " On Device " << app_data_->device_mac_); diff --git a/src/components/application_manager/src/app_launch/device_apps_launcher.cc b/src/components/application_manager/src/app_launch/device_apps_launcher.cc index 9a7a6658fe..0a1bea3714 100644 --- a/src/components/application_manager/src/app_launch/device_apps_launcher.cc +++ b/src/components/application_manager/src/app_launch/device_apps_launcher.cc @@ -12,7 +12,7 @@ #include "utils/timer_task_impl.h" namespace app_launch { -CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") +SDL_CREATE_LOG_VARIABLE("AppLaunch") typedef std::pair<std::string, std::vector<ApplicationDataPtr> > AppsOnDevice; typedef std::shared_ptr<AppsOnDevice> AppsOnDevicePtr; @@ -58,9 +58,8 @@ class Launcher { device_launcher_.settings().wait_time_between_apps(), timer::kSingleShot); } else { - LOG4CXX_DEBUG( - logger_, - "All Apps on " << apps_on_device_->first << " postponed launched"); + SDL_LOG_DEBUG("All Apps on " << apps_on_device_->first + << " postponed launched"); device_launcher_.StopLaunchingAppsOnDevice(apps_on_device_->first); } } @@ -135,9 +134,8 @@ bool DeviceAppsLauncherImpl::LauncherFinder::operator()( bool DeviceAppsLauncherImpl::LaunchAppsOnDevice( const std::string& device_mac, const std::vector<ApplicationDataPtr>& applications_to_launch) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "On Device " << device_mac << " will be launched " + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("On Device " << device_mac << " will be launched " << applications_to_launch.size() << " apps"); AppsOnDevicePtr apps_on_device = std::make_shared<AppsOnDevice>(device_mac, applications_to_launch); @@ -153,7 +151,7 @@ bool DeviceAppsLauncherImpl::LaunchAppsOnDevice( bool DeviceAppsLauncherImpl::StopLaunchingAppsOnDevice( const std::string& device_mac) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(launchers_lock_); const Launchers::iterator it = std::find_if(works_launchers_.begin(), works_launchers_.end(), diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc index 3e7b4b99fe..6bc970c8a3 100644 --- a/src/components/application_manager/src/app_service_manager.cc +++ b/src/components/application_manager/src/app_service_manager.cc @@ -45,7 +45,7 @@ #include "smart_objects/enum_schema_item.h" #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceManager") +SDL_CREATE_LOG_VARIABLE("AppServiceManager") namespace application_manager { @@ -59,14 +59,14 @@ AppServiceManager::AppServiceManager(ApplicationManager& app_manager, , rpc_passing_handler_(*this, app_manager_) {} AppServiceManager::~AppServiceManager() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } smart_objects::SmartObject AppServiceManager::PublishAppService( const smart_objects::SmartObject& manifest, const bool mobile_service, const uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string str_to_hash = ""; std::string service_id = ""; @@ -86,13 +86,12 @@ smart_objects::SmartObject AppServiceManager::PublishAppService( auto found_service_id = found_service->record[strings::service_id].asString(); if (service_by_name_id != found_service_id) { - LOG4CXX_WARN(logger_, - "A service already exists with this name, rejecting"); + SDL_LOG_WARN("A service already exists with this name, rejecting"); return smart_objects::SmartObject(); } } } - LOG4CXX_WARN(logger_, "Service already exists for this provider, updating"); + SDL_LOG_WARN("Service already exists for this provider, updating"); published_services_lock_.Acquire(); found_service->record[strings::service_manifest] = manifest; found_service->record[strings::service_published] = true; @@ -114,7 +113,7 @@ smart_objects::SmartObject AppServiceManager::PublishAppService( if (manifest.keyExists(strings::service_name) && FindServiceByName(manifest[strings::service_name].asString())) { - LOG4CXX_WARN(logger_, "A service already exists with this name, rejecting"); + SDL_LOG_WARN("A service already exists with this name, rejecting"); return smart_objects::SmartObject(); } @@ -183,14 +182,14 @@ smart_objects::SmartObject AppServiceManager::PublishAppService( } bool AppServiceManager::UnpublishAppService(const std::string service_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); auto it = published_services_.find(service_id); if (it == published_services_.end()) { - LOG4CXX_ERROR(logger_, "Service id does not exist in published services"); + SDL_LOG_ERROR("Service id does not exist in published services"); return false; } - LOG4CXX_DEBUG(logger_, "Unpublishing app service: " << service_id); + SDL_LOG_DEBUG("Unpublishing app service: " << service_id); SetServicePublished(service_id, false); smart_objects::SmartObject msg_params; @@ -222,8 +221,8 @@ bool AppServiceManager::UnpublishAppService(const std::string service_id) { } void AppServiceManager::UnpublishServices(const uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Unpublishing all app services: " << connection_key); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Unpublishing all app services: " << connection_key); std::list<std::string> app_published_services; { @@ -242,7 +241,7 @@ void AppServiceManager::UnpublishServices(const uint32_t connection_key) { } void AppServiceManager::OnAppActivated(ApplicationConstSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); auto it = published_services_.begin(); // Activate all services published by the app @@ -255,7 +254,7 @@ void AppServiceManager::OnAppActivated(ApplicationConstSharedPtr app) { std::vector<smart_objects::SmartObject> AppServiceManager::GetAllServiceRecords() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<smart_objects::SmartObject> services; sync_primitives::AutoLock lock(published_services_lock_); for (auto it = published_services_.begin(); it != published_services_.end(); @@ -269,16 +268,15 @@ void AppServiceManager::GetProviderByType(const std::string& service_type, const bool mobile_consumer, ApplicationSharedPtr& app, bool& hmi_service) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto active_service = ActiveServiceForType(service_type); if (!active_service) { - LOG4CXX_ERROR(logger_, - "There is no active service for the given service type: " - << service_type); + SDL_LOG_ERROR("There is no active service for the given service type: " + << service_type); return; } - LOG4CXX_DEBUG(logger_, "Found provider for service type: " << service_type); + SDL_LOG_DEBUG("Found provider for service type: " << service_type); GetProviderFromService(*active_service, mobile_consumer, app, hmi_service); } @@ -286,15 +284,15 @@ void AppServiceManager::GetProviderByID(const std::string& service_id, const bool mobile_consumer, ApplicationSharedPtr& app, bool& hmi_service) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); auto it = published_services_.find(service_id); if (it == published_services_.end()) { - LOG4CXX_ERROR(logger_, "Service id does not exist in published services"); + SDL_LOG_ERROR("Service id does not exist in published services"); return; } - LOG4CXX_DEBUG(logger_, "Found provider with service ID: " << service_id); + SDL_LOG_DEBUG("Found provider with service ID: " << service_id); GetProviderFromService(it->second, mobile_consumer, app, hmi_service); } @@ -302,11 +300,11 @@ void AppServiceManager::GetProviderFromService(const AppService& service, const bool mobile_consumer, ApplicationSharedPtr& app, bool& hmi_service) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (mobile_consumer && !service.record[strings::service_manifest][strings::allow_app_consumers] .asBool()) { - LOG4CXX_ERROR(logger_, "Service does not support app consumers"); + SDL_LOG_ERROR("Service does not support app consumers"); return; } bool mobile_service = service.mobile_service; @@ -319,11 +317,11 @@ void AppServiceManager::GetProviderFromService(const AppService& service, } bool AppServiceManager::SetDefaultService(const std::string service_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); auto it = published_services_.find(service_id); if (it == published_services_.end()) { - LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id); + SDL_LOG_ERROR("Unable to find published service " << service_id); return false; } AppService& service = it->second; @@ -350,17 +348,17 @@ bool AppServiceManager::SetDefaultService(const std::string service_id) { } bool AppServiceManager::RemoveDefaultService(const std::string service_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); auto it = published_services_.find(service_id); if (it == published_services_.end()) { - LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id); + SDL_LOG_ERROR("Unable to find published service " << service_id); return false; } AppService& service = it->second; if (!service.default_service) { - LOG4CXX_ERROR(logger_, "Service was not default " << service_id); + SDL_LOG_ERROR("Service was not default " << service_id); return false; } service.default_service = false; @@ -377,17 +375,17 @@ bool AppServiceManager::RemoveDefaultService(const std::string service_id) { } bool AppServiceManager::ActivateAppService(const std::string service_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); auto it = published_services_.find(service_id); if (it == published_services_.end()) { - LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id); + SDL_LOG_ERROR("Unable to find published service " << service_id); return false; } smart_objects::SmartObject& service = it->second.record; if (service[strings::service_active].asBool()) { - LOG4CXX_DEBUG(logger_, "Service was already active " << service_id); + SDL_LOG_DEBUG("Service was already active " << service_id); return true; } @@ -424,11 +422,11 @@ bool AppServiceManager::ActivateAppService(const std::string service_id) { } bool AppServiceManager::DeactivateAppService(const std::string service_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); auto it = published_services_.find(service_id); if (it == published_services_.end()) { - LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id); + SDL_LOG_ERROR("Unable to find published service " << service_id); return false; } smart_objects::SmartObject& service = it->second.record; @@ -465,7 +463,7 @@ bool AppServiceManager::DeactivateAppService(const std::string service_id) { AppService* AppServiceManager::ActiveServiceForType( const std::string service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); for (auto it = published_services_.begin(); it != published_services_.end(); ++it) { @@ -481,7 +479,7 @@ AppService* AppServiceManager::ActiveServiceForType( AppService* AppServiceManager::EmbeddedServiceForType( const std::string service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); for (auto it = published_services_.begin(); it != published_services_.end(); ++it) { @@ -496,7 +494,7 @@ AppService* AppServiceManager::EmbeddedServiceForType( AppService* AppServiceManager::FindServiceByPolicyAppID( const std::string policy_app_id, const std::string type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); for (auto it = published_services_.begin(); it != published_services_.end(); ++it) { @@ -513,12 +511,12 @@ AppService* AppServiceManager::FindServiceByPolicyAppID( } AppService* AppServiceManager::FindServiceByID(const std::string service_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); auto it = published_services_.find(service_id); if (it == published_services_.end()) { - LOG4CXX_ERROR(logger_, "Service id does not exist in published services"); + SDL_LOG_ERROR("Service id does not exist in published services"); return NULL; } return &(it->second); @@ -526,7 +524,7 @@ AppService* AppServiceManager::FindServiceByID(const std::string service_id) { AppService* AppServiceManager::FindServiceByProvider( const uint32_t connection_key, const std::string service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); for (auto& service : published_services_) { if (service.second.connection_key == connection_key && @@ -539,7 +537,7 @@ AppService* AppServiceManager::FindServiceByProvider( } AppService* AppServiceManager::FindServiceByName(std::string name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); for (auto& service : published_services_) { if (service.second.record[strings::service_manifest][strings::service_name] @@ -552,7 +550,7 @@ AppService* AppServiceManager::FindServiceByName(std::string name) { std::string AppServiceManager::DefaultServiceByType( const std::string service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto last_state_accessor = last_state_->get_accessor(); Json::Value dictionary = last_state_accessor.GetData().dictionary(); @@ -564,11 +562,11 @@ std::string AppServiceManager::DefaultServiceByType( void AppServiceManager::SetServicePublished(const std::string service_id, const bool service_published) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(published_services_lock_); auto it = published_services_.find(service_id); if (it == published_services_.end()) { - LOG4CXX_ERROR(logger_, "Service id does not exist in published services"); + SDL_LOG_ERROR("Service id does not exist in published services"); return; } it->second.record[strings::service_published] = service_published; @@ -584,7 +582,7 @@ std::string AppServiceManager::GetPolicyAppID(AppService service) { bool AppServiceManager::UpdateNavigationCapabilities( smart_objects::SmartObject& out_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string navi_service_type; ns_smart_device_link::ns_smart_objects:: EnumConversionHelper<mobile_apis::AppServiceType::eType>::EnumToString( @@ -623,7 +621,7 @@ void AppServiceManager::AppServiceUpdated( const smart_objects::SmartObject& service_record, const mobile_apis::ServiceUpdateReason::eType update_reason, smart_objects::SmartObject& msg_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& services = msg_params[strings::system_capability][strings::app_services_capabilities] [strings::app_services]; diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc index 0bf992d68b..35d95c3efd 100644 --- a/src/components/application_manager/src/application_data_impl.cc +++ b/src/components/application_manager/src/application_data_impl.cc @@ -37,7 +37,7 @@ #include "utils/logger.h" namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("ApplicationManager") namespace { struct CommandIdComparator { @@ -400,14 +400,14 @@ DynamicApplicationDataImpl::display_capabilities() const { smart_objects::SmartObjectSPtr DynamicApplicationDataImpl::display_capabilities( const WindowID window_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto result_display_caps = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Array); const auto window_caps = (*display_capabilities_)[0][strings::window_capabilities].asArray(); if (!window_caps) { - LOG4CXX_WARN(logger_, "Current window capabilities are empty"); + SDL_LOG_WARN("Current window capabilities are empty"); // SDL still needs to retreive display capabilities return display_capabilities_; } @@ -566,7 +566,7 @@ void DynamicApplicationDataImpl::set_night_color_scheme( } void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis::PredefinedWindows; smart_objects::SmartObject template_config(smart_objects::SmartType_Map); template_config[strings::template_layout] = layout; @@ -575,7 +575,7 @@ void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) { void DynamicApplicationDataImpl::set_display_capabilities( const smart_objects::SmartObject& display_capabilities) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& incoming_window_capabilities = display_capabilities[0][strings::window_capabilities]; @@ -628,7 +628,7 @@ void DynamicApplicationDataImpl::set_display_capabilities( void DynamicApplicationDataImpl::remove_window_capability( const WindowID window_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto window_capabilities = (*display_capabilities_)[0][strings::window_capabilities].asArray(); @@ -645,9 +645,8 @@ void DynamicApplicationDataImpl::remove_window_capability( } } - LOG4CXX_WARN( - logger_, - "No window id " << window_id << " found in display capabilities"); + SDL_LOG_WARN("No window id " << window_id + << " found in display capabilities"); } bool DynamicApplicationDataImpl::menu_layout_supported( @@ -682,7 +681,7 @@ bool DynamicApplicationDataImpl::menu_layout_supported( void DynamicApplicationDataImpl::set_window_layout(const WindowID window_id, const std::string& layout) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject template_config(smart_objects::SmartType_Map); template_config[strings::template_layout] = layout; @@ -691,21 +690,21 @@ void DynamicApplicationDataImpl::set_window_layout(const WindowID window_id, void DynamicApplicationDataImpl::set_day_color_scheme( const WindowID window_id, const smart_objects::SmartObject& color_scheme) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(color_scheme.getType() == smart_objects::SmartType_Map); window_templates_[window_id][strings::day_color_scheme] = color_scheme; } void DynamicApplicationDataImpl::set_night_color_scheme( const WindowID window_id, const smart_objects::SmartObject& color_scheme) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(color_scheme.getType() == smart_objects::SmartType_Map); window_templates_[window_id][strings::night_color_scheme] = color_scheme; } std::string DynamicApplicationDataImpl::window_layout( const WindowID window_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); AppWindowsTemplates::const_iterator window_template_it = window_templates_.find(window_id); @@ -722,7 +721,7 @@ std::string DynamicApplicationDataImpl::window_layout( smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme( const WindowID window_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); AppWindowsTemplates::const_iterator window_template_it = window_templates_.find(window_id); @@ -739,7 +738,7 @@ smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme( smart_objects::SmartObject DynamicApplicationDataImpl::night_color_scheme( const WindowID window_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); AppWindowsTemplates::const_iterator window_template_it = window_templates_.find(window_id); @@ -765,7 +764,7 @@ void DynamicApplicationDataImpl::SetGlobalProperties( (this->*callback)(param); } } else { - LOG4CXX_WARN(logger_, "Invalid or Null smart object"); + SDL_LOG_WARN("Invalid or Null smart object"); } } @@ -776,11 +775,10 @@ void DynamicApplicationDataImpl::AddCommand( CommandsMap::const_iterator it = commands_.find(internal_id); if (commands_.end() == it) { commands_[internal_id] = new smart_objects::SmartObject(command); - LOG4CXX_DEBUG(logger_, - "Command with internal number " - << internal_id << " and id " - << (*commands_[internal_id])[strings::cmd_id].asUInt() - << " is added."); + SDL_LOG_DEBUG("Command with internal number " + << internal_id << " and id " + << (*commands_[internal_id])[strings::cmd_id].asUInt() + << " is added."); } } @@ -793,16 +791,14 @@ void DynamicApplicationDataImpl::RemoveCommand(const uint32_t cmd_id) { if (it != commands_.end()) { delete it->second; - LOG4CXX_DEBUG(logger_, - "Command with internal number " << (it->first) << " and id " + SDL_LOG_DEBUG("Command with internal number " << (it->first) << " and id " << cmd_id << " is removed."); commands_.erase(it); return; } - LOG4CXX_WARN( - logger_, - "Command with id " << cmd_id << " is not found. Removal skipped."); + SDL_LOG_WARN("Command with id " << cmd_id + << " is not found. Removal skipped."); } smart_objects::SmartObject* DynamicApplicationDataImpl::FindCommand( @@ -814,8 +810,7 @@ smart_objects::SmartObject* DynamicApplicationDataImpl::FindCommand( find_if(commands_.begin(), commands_.end(), is_id_equal); if (it != commands_.end()) { - LOG4CXX_DEBUG(logger_, - "Command with internal number " << (it->first) << " and id " + SDL_LOG_DEBUG("Command with internal number " << (it->first) << " and id " << cmd_id << " is found."); return it->second; } @@ -876,7 +871,7 @@ DynamicApplicationDataImpl::window_optional_params_map() const { void DynamicApplicationDataImpl::SetWindowInfo( const WindowID window_id, const smart_objects::SmartObject& window_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto it = window_params_map_.find(window_id); if (window_params_map_.end() == it) { window_params_map_[window_id] = @@ -886,12 +881,12 @@ void DynamicApplicationDataImpl::SetWindowInfo( DisplayCapabilitiesBuilder& DynamicApplicationDataImpl::display_capabilities_builder() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return display_capabilities_builder_; } void DynamicApplicationDataImpl::RemoveWindowInfo(const WindowID window_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); window_params_map_.erase(window_id); } diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 27c7411d15..3708c45cfa 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -73,7 +73,7 @@ mobile_apis::FileType::eType StringToFileType(const char* str) { } } // namespace -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("ApplicationManager") namespace application_manager { @@ -81,7 +81,7 @@ void SwitchApplicationParameters(ApplicationSharedPtr app, const uint32_t app_id, const size_t device_id, const std::string& mac_address) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::shared_ptr<ApplicationImpl> application = std::dynamic_pointer_cast<ApplicationImpl>(app); DCHECK_OR_RETURN_VOID(application); @@ -231,7 +231,7 @@ void ApplicationImpl::ChangeSupportingAppHMIType() { } void ApplicationImpl::set_is_navi(bool option) { - LOG4CXX_TRACE(logger_, "option " << std::boolalpha << option); + SDL_LOG_TRACE("option " << std::boolalpha << option); is_navi_ = option; } @@ -248,52 +248,50 @@ bool ApplicationImpl::is_voice_communication_supported() const { } void ApplicationImpl::set_voice_communication_supported(bool option) { - LOG4CXX_TRACE(logger_, "option " << std::boolalpha << option); + SDL_LOG_TRACE("option " << std::boolalpha << option); is_voice_communication_application_ = option; } bool ApplicationImpl::IsAudioApplication() const { const bool is_audio_app = is_media_application() || is_voice_communication_supported() || is_navi(); - LOG4CXX_DEBUG(logger_, - std::boolalpha << "is audio app --> ((is_media_app: " - << is_media_application() << ")" - << " || (is_voice_communication_app: " - << is_voice_communication_supported() << ")" - << " || (is_navi: " << is_navi() << ")) --> " - << is_audio_app); + SDL_LOG_DEBUG(std::boolalpha + << "is audio app --> ((is_media_app: " << is_media_application() + << ")" + << " || (is_voice_communication_app: " + << is_voice_communication_supported() << ")" + << " || (is_navi: " << is_navi() << ")) --> " << is_audio_app); return is_audio_app; } bool ApplicationImpl::IsVideoApplication() const { const bool is_video_app = is_navi() || mobile_projection_enabled(); - LOG4CXX_DEBUG(logger_, - std::boolalpha - << "is video app --> ((is_navi: " << is_navi() << ")" - << " || (mobile_projection: " << mobile_projection_enabled() - << ")) --> " << is_video_app); + SDL_LOG_DEBUG(std::boolalpha + << "is video app --> ((is_navi: " << is_navi() << ")" + << " || (mobile_projection: " << mobile_projection_enabled() + << ")) --> " << is_video_app); return is_video_app; } void ApplicationImpl::SetRegularState(const WindowID window_id, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); state_.AddState(window_id, state); } void ApplicationImpl::RemovePostponedState(const WindowID window_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); state_.RemoveState(window_id, HmiState::STATE_ID_POSTPONED); } void ApplicationImpl::SetPostponedState(const WindowID window_id, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); state_.AddState(window_id, state); } void ApplicationImpl::set_mobile_projection_enabled(bool option) { - LOG4CXX_TRACE(logger_, "option " << std::boolalpha << option); + SDL_LOG_TRACE("option " << std::boolalpha << option); mobile_projection_enabled_ = option; } @@ -302,7 +300,7 @@ bool ApplicationImpl::mobile_projection_enabled() const { } void ApplicationImpl::set_webengine_projection_enabled(const bool option) { - LOG4CXX_TRACE(logger_, "option " << std::boolalpha << option); + SDL_LOG_TRACE("option " << std::boolalpha << option); webengine_projection_enabled_ = option; } @@ -319,13 +317,13 @@ struct StateIDComparator { }; void ApplicationImpl::AddHMIState(const WindowID window_id, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); state_.AddState(window_id, state); } void ApplicationImpl::RemoveHMIState(const WindowID window_id, HmiState::StateID state_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); state_.RemoveState(window_id, state_id); } @@ -340,8 +338,7 @@ const HmiStatePtr ApplicationImpl::RegularHmiState( } WindowNames ApplicationImpl::GetWindowNames() const { - LOG4CXX_DEBUG(logger_, - "Collecting window names for application " << app_id()); + SDL_LOG_DEBUG("Collecting window names for application " << app_id()); WindowNames window_names; std::string stringified_window_names; @@ -355,13 +352,12 @@ WindowNames ApplicationImpl::GetWindowNames() const { (stringified_window_names.empty() ? "" : ",") + window_name; } - LOG4CXX_DEBUG(logger_, - "Existing window names: [" + stringified_window_names + "]"); + SDL_LOG_DEBUG("Existing window names: [" + stringified_window_names + "]"); return window_names; } WindowIds ApplicationImpl::GetWindowIds() const { - LOG4CXX_DEBUG(logger_, "Collecting window IDs for application " << app_id()); + SDL_LOG_DEBUG("Collecting window IDs for application " << app_id()); return state_.GetWindowIds(); } @@ -474,7 +470,7 @@ void ApplicationImpl::set_name(const custom_str::CustomString& name) { } void ApplicationImpl::set_is_media_application(bool option) { - LOG4CXX_TRACE(logger_, "option " << std::boolalpha << option); + SDL_LOG_TRACE("option " << std::boolalpha << option); is_media_ = option; } @@ -541,13 +537,13 @@ bool ApplicationImpl::audio_streaming_allowed() const { bool ApplicationImpl::SetVideoConfig(protocol_handler::ServiceType service_type, const smart_objects::SmartObject& params) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (ServiceType::kMobileNav == service_type) { // See StartStreaming(). We issue SetVideoConfig and StartStream // only when streaming is not approved yet if (!video_streaming_approved()) { - LOG4CXX_TRACE(logger_, "Video streaming not approved"); + SDL_LOG_TRACE("Video streaming not approved"); MessageHelper::SendNaviSetVideoConfig( app_id(), application_manager_, params); return true; @@ -559,19 +555,19 @@ bool ApplicationImpl::SetVideoConfig(protocol_handler::ServiceType service_type, void ApplicationImpl::StartStreaming( protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (ServiceType::kMobileNav == service_type) { - LOG4CXX_TRACE(logger_, "ServiceType = Video"); + SDL_LOG_TRACE("ServiceType = Video"); if (!video_streaming_approved()) { - LOG4CXX_TRACE(logger_, "Video streaming not approved"); + SDL_LOG_TRACE("Video streaming not approved"); MessageHelper::SendNaviStartStream(app_id(), application_manager_); set_video_stream_retry_number(0); } } else if (ServiceType::kAudio == service_type) { - LOG4CXX_TRACE(logger_, "ServiceType = Audio"); + SDL_LOG_TRACE("ServiceType = Audio"); if (!audio_streaming_approved()) { - LOG4CXX_TRACE(logger_, "Audio streaming not approved"); + SDL_LOG_TRACE("Audio streaming not approved"); MessageHelper::SendAudioStartStream(app_id(), application_manager_); set_audio_stream_retry_number(0); } @@ -581,7 +577,7 @@ void ApplicationImpl::StartStreaming( void ApplicationImpl::StopStreamingForce( protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // see the comment in StopStreaming() sync_primitives::AutoLock lock(streaming_stop_lock_); @@ -598,7 +594,7 @@ void ApplicationImpl::StopStreamingForce( void ApplicationImpl::StopStreaming( protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // since WakeUpStreaming() is called from another thread, it is possible that // the stream will be restarted after we call SuspendStreaming() and before @@ -617,7 +613,7 @@ void ApplicationImpl::StopStreaming( } void ApplicationImpl::StopNaviStreaming() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); video_stream_suspend_timer_.Stop(); MessageHelper::SendNaviStopStream(app_id(), application_manager_); set_video_streaming_approved(false); @@ -625,7 +621,7 @@ void ApplicationImpl::StopNaviStreaming() { } void ApplicationImpl::StopAudioStreaming() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); audio_stream_suspend_timer_.Stop(); MessageHelper::SendAudioStopStream(app_id(), application_manager_); set_audio_streaming_approved(false); @@ -635,7 +631,7 @@ void ApplicationImpl::StopAudioStreaming() { void ApplicationImpl::SuspendStreaming( protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (ServiceType::kMobileNav == service_type) { video_stream_suspend_timer_.Stop(); @@ -655,7 +651,7 @@ void ApplicationImpl::SuspendStreaming( void ApplicationImpl::WakeUpStreaming( protocol_handler::ServiceType service_type, uint32_t timer_len) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // See the comment in StopStreaming(). Also, please make sure that we acquire // streaming_stop_lock_ then xxx_streaming_suspended_lock_ in this order! @@ -692,15 +688,15 @@ void ApplicationImpl::WakeUpStreaming( void ApplicationImpl::OnVideoStreamSuspend() { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_INFO(logger_, "Suspend video streaming by timer"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_INFO("Suspend video streaming by timer"); SuspendStreaming(ServiceType::kMobileNav); } void ApplicationImpl::OnAudioStreamSuspend() { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_INFO(logger_, "Suspend audio streaming by timer"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_INFO("Suspend audio streaming by timer"); SuspendStreaming(ServiceType::kAudio); } @@ -816,8 +812,7 @@ mobile_api::HMILevel::eType ApplicationImpl::deferred_resumption_hmi_level() bool ApplicationImpl::AddFile(const AppFile& file) { if (app_files_.count(file.file_name) == 0) { - LOG4CXX_INFO(logger_, - "AddFile file " << file.file_name << " File type is " + SDL_LOG_INFO("AddFile file " << file.file_name << " File type is " << file.file_type); app_files_[file.file_name] = file; return true; @@ -827,8 +822,7 @@ bool ApplicationImpl::AddFile(const AppFile& file) { bool ApplicationImpl::UpdateFile(const AppFile& file) { if (app_files_.count(file.file_name) != 0) { - LOG4CXX_INFO(logger_, - "UpdateFile file " << file.file_name << " File type is " + SDL_LOG_INFO("UpdateFile file " << file.file_name << " File type is " << file.file_type); app_files_[file.file_name] = file; return true; @@ -839,8 +833,7 @@ bool ApplicationImpl::UpdateFile(const AppFile& file) { bool ApplicationImpl::DeleteFile(const std::string& file_name) { AppFilesMap::iterator it = app_files_.find(file_name); if (it != app_files_.end()) { - LOG4CXX_INFO(logger_, - "DeleteFile file " << it->second.file_name << " File type is " + SDL_LOG_INFO("DeleteFile file " << it->second.file_name << " File type is " << it->second.file_type); app_files_.erase(it); return true; @@ -898,8 +891,7 @@ bool ApplicationImpl::AreCommandLimitsExceeded( CommandNumberTimeLimit::iterator it = cmd_number_to_time_limits_.find(cmd_id); if (cmd_number_to_time_limits_.end() == it) { - LOG4CXX_WARN(logger_, - "Limits for command id " << cmd_id << "had not been set."); + SDL_LOG_WARN("Limits for command id " << cmd_id << "had not been set."); return true; } @@ -915,19 +907,18 @@ bool ApplicationImpl::AreCommandLimitsExceeded( frequency_restrictions = application_manager_.get_settings().get_vehicle_data_frequency(); } else { - LOG4CXX_INFO(logger_, "No restrictions for request"); + SDL_LOG_INFO("No restrictions for request"); return false; } - LOG4CXX_INFO(logger_, - "Time Info: " - << "\n Current: " << date_time::getSecs(current) - << "\n Limit: (" << date_time::getSecs(limit.first) - << "," << limit.second - << ")" - "\n frequency_restrictions: (" - << frequency_restrictions.first << "," - << frequency_restrictions.second << ")"); + SDL_LOG_INFO("Time Info: " + << "\n Current: " << date_time::getSecs(current) + << "\n Limit: (" << date_time::getSecs(limit.first) << "," + << limit.second + << ")" + "\n frequency_restrictions: (" + << frequency_restrictions.first << "," + << frequency_restrictions.second << ")"); if (date_time::getSecs(current) < date_time::getSecs(limit.first) + frequency_restrictions.second) { if (limit.second < frequency_restrictions.first) { @@ -986,7 +977,7 @@ bool ApplicationImpl::AreCommandLimitsExceeded( break; } default: { - LOG4CXX_WARN(logger_, "Limit source is not implemented."); + SDL_LOG_WARN("Limit source is not implemented."); break; } } @@ -1019,7 +1010,7 @@ void ApplicationImpl::set_is_application_data_changed( } void ApplicationImpl::UpdateHash() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hash_val_ = utils::gen_hash(application_manager_.get_settings().hash_string_size()); set_is_application_data_changed(true); @@ -1056,7 +1047,7 @@ void ApplicationImpl::CleanupFiles() { app_files_it = app_files_.find(file_name); if ((app_files_it == app_files_.end()) || (!app_files_it->second.is_persistent)) { - LOG4CXX_INFO(logger_, "DeleteFile file " << file_name); + SDL_LOG_INFO("DeleteFile file " << file_name); file_system::DeleteFile(file_name); } } @@ -1108,9 +1099,8 @@ void ApplicationImpl::LoadPersistentFiles() { file.file_type = StringToFileType(file_type.c_str()); } - LOG4CXX_INFO(logger_, - "Loaded persistent file " - << file.file_name << " File type is " << file.file_type); + SDL_LOG_INFO("Loaded persistent file " + << file.file_name << " File type is " << file.file_type); AddFile(file); } } @@ -1172,7 +1162,7 @@ struct FindSoftButtonId { }; bool ApplicationImpl::IsSubscribedToSoftButton(const uint32_t softbutton_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(cmd_softbuttonid_lock_); CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin(); for (; it != cmd_softbuttonid_.end(); ++it) { @@ -1188,7 +1178,7 @@ bool ApplicationImpl::IsSubscribedToSoftButton(const uint32_t softbutton_id) { } WindowID ApplicationImpl::GetSoftButtonWindowID(const uint32_t softbutton_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(cmd_softbuttonid_lock_); CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin(); @@ -1224,9 +1214,9 @@ void ApplicationImpl::set_audio_streaming_state( const mobile_api::AudioStreamingState::eType& state) { if (!(is_media_application() || is_navi()) && state != mobile_api::AudioStreamingState::NOT_AUDIBLE) { - LOG4CXX_WARN(logger_, - "Trying to set audio streaming state" - " for non-media application to different from NOT_AUDIBLE"); + SDL_LOG_WARN( + "Trying to set audio streaming state" + " for non-media application to different from NOT_AUDIBLE"); return; } @@ -1253,7 +1243,7 @@ void ApplicationImpl::set_hmi_level( DCHECK_OR_RETURN_VOID(app) application_manager_.state_controller().SetRegularState( app, window_id, new_hmi_level); - LOG4CXX_INFO(logger_, "hmi_level = " << new_hmi_level); + SDL_LOG_INFO("hmi_level = " << new_hmi_level); usage_report_.RecordHmiStateChanged(new_hmi_level); } diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 5e1ae3bc3a..5beb25a05e 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -117,8 +117,7 @@ DeviceTypes devicesType = { bool device_id_comparator(const std::string& device_id, ApplicationSharedPtr app) { DCHECK_OR_RETURN(app, false); - LOG4CXX_DEBUG(logger_, - "Data to compare: device_id : " << device_id << " app mac: " + SDL_LOG_DEBUG("Data to compare: device_id : " << device_id << " app mac: " << app->mac_address()); return device_id == app->mac_address(); @@ -228,7 +227,7 @@ ApplicationManagerImpl::ApplicationManagerImpl( } ApplicationManagerImpl::~ApplicationManagerImpl() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_stopping_ = true; SendOnSDLClose(); @@ -244,7 +243,7 @@ ApplicationManagerImpl::~ApplicationManagerImpl() { mobile_so_factory_ = NULL; } protocol_handler_ = NULL; - LOG4CXX_DEBUG(logger_, "Destroying Policy Handler"); + SDL_LOG_DEBUG("Destroying Policy Handler"); RemovePolicyObserver(this); { @@ -463,7 +462,7 @@ void ApplicationManagerImpl::IviInfoUpdated(const std::string& vehicle_info, } void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); sync_primitives::AutoLock lock(applications_list_lock_ptr_); const mobile_apis::HMILevel::eType default_level = GetDefaultHmiLevel(app); @@ -471,14 +470,14 @@ void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) { } void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); commands_holder_->Resume(app, CommandHolder::CommandType::kMobileCommand); commands_holder_->Resume(app, CommandHolder::CommandType::kHmiCommand); } bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( ApplicationConstSharedPtr app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool voice_state = app->is_voice_communication_supported(); bool media_state = app->is_media_application(); bool navi_state = app->is_navi(); @@ -546,7 +545,7 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( const std::shared_ptr<smart_objects::SmartObject>& request_for_registration) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& message = *request_for_registration; uint32_t connection_key = @@ -561,7 +560,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( DCHECK_OR_RETURN(connection_handler_, ApplicationSharedPtr()); if (connection_handler().get_session_observer().GetDataOnSessionKey( connection_key, &app_id, &sessions_list, &device_id) == -1) { - LOG4CXX_ERROR(logger_, "Failed to create application: no connection info."); + SDL_LOG_ERROR("Failed to create application: no connection info."); std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( connection_key, @@ -581,20 +580,18 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( std::string connection_type; if (connection_handler().get_session_observer().GetDataOnDeviceID( device_id, NULL, NULL, &device_mac, &connection_type) == -1) { - LOG4CXX_DEBUG(logger_, "Failed to extract device mac for id " << device_id); + SDL_LOG_DEBUG("Failed to extract device mac for id " << device_id); } else { - LOG4CXX_DEBUG(logger_, - "Device mac for id" << device_id << " is " << device_mac); + SDL_LOG_DEBUG("Device mac for id " << device_id << " is " << device_mac); } - LOG4CXX_DEBUG(logger_, "Restarting application list update timer"); + SDL_LOG_DEBUG("Restarting application list update timer"); GetPolicyHandler().OnAppsSearchStarted(); uint32_t timeout = get_settings().application_list_update_timeout(); application_list_update_timer_.Start(timeout, timer::kSingleShot); if (!is_all_apps_allowed_) { - LOG4CXX_WARN(logger_, - "RegisterApplication: access to app's disabled by user"); + SDL_LOG_WARN("RegisterApplication: access to app's disabled by user"); std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( connection_key, @@ -780,10 +777,10 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) { using namespace mobile_api; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(app, false); - LOG4CXX_DEBUG(logger_, "Activating application with id:" << app->app_id()); + SDL_LOG_DEBUG("Activating application with id: " << app->app_id()); // Remove from resumption if app was activated by user resume_controller().OnAppActivated(app); @@ -799,9 +796,9 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) { mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed( ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app) { - LOG4CXX_ERROR(logger_, "Application pointer invalid"); + SDL_LOG_ERROR("Application pointer invalid"); NOTREACHED(); return mobile_api::HMILevel::INVALID_ENUM; } @@ -818,27 +815,24 @@ mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed( } else if (is_active_app_exist && (!is_audio_app)) { result = GetDefaultHmiLevel(app); } - LOG4CXX_ERROR( - logger_, - "is_audio_app : " << is_audio_app - << "; does_audio_app_with_same_type_exist : " - << does_audio_app_with_same_type_exist - << "; is_active_app_exist : " << is_active_app_exist - << "; result : " << result); + SDL_LOG_ERROR("is_audio_app : " + << is_audio_app << "; does_audio_app_with_same_type_exist : " + << does_audio_app_with_same_type_exist + << "; is_active_app_exist : " << is_active_app_exist + << "; result : " << result); return result; } void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) { // TODO(VS): Call function from ConnectionHandler if (!connection_handler_) { - LOG4CXX_WARN(logger_, "Connection handler is not set."); + SDL_LOG_WARN("Connection handler is not set."); return; } connection_handler::DeviceHandle handle; if (!connection_handler().GetDeviceID(device_mac, &handle)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Attempt to connect to invalid device with mac:" << device_mac); return; } @@ -846,7 +840,7 @@ void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) { } void ApplicationManagerImpl::OnHMIReady() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT connection_handler_->CreateWebEngineDevice(); @@ -871,7 +865,7 @@ void ApplicationManagerImpl::OnHMIReady() { } void ApplicationManagerImpl::RequestForInterfacesAvailability() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::shared_ptr<smart_objects::SmartObject> is_ivi_ready( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::VehicleInfo_IsReady, *this)); @@ -912,7 +906,7 @@ std::string ApplicationManagerImpl::PolicyIDByIconUrl(const std::string url) { auto policy_id = x.first; std::string icon_url = GetPolicyHandler().GetIconUrl(policy_id); if (icon_url == url) { - LOG4CXX_DEBUG(logger_, "Matched icon url: " << url); + SDL_LOG_DEBUG("Matched icon url: " << url); x.second.pending_request = false; return policy_id; } @@ -937,7 +931,7 @@ void ApplicationManagerImpl::SetIconFileFromSystemRequest( const std::string app_icon_dir(settings_.app_icons_folder()); const std::string full_icon_path(app_icon_dir + "/" + policy_id); if (file_system::FileExists(full_icon_path)) { - LOG4CXX_DEBUG(logger_, "Set Icon Path: " << full_icon_path); + SDL_LOG_DEBUG("Set Icon Path: " << full_icon_path); AppFile file; file.is_persistent = true; file.is_download_complete = true; @@ -962,14 +956,14 @@ void ApplicationManagerImpl::SetIconFileFromSystemRequest( void ApplicationManagerImpl::DisconnectCloudApp(ApplicationSharedPtr app) { #if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT) - LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function"); + SDL_LOG_TRACE("Cloud app support is disabled. Exiting function"); return; #else std::string policy_app_id = app->policy_app_id(); policy::AppProperties app_properties; GetPolicyHandler().GetAppProperties(policy_app_id, app_properties); if (app->IsRegistered() && app->is_cloud_app()) { - LOG4CXX_DEBUG(logger_, "Disabled app is registered, unregistering now"); + SDL_LOG_DEBUG("Disabled app is registered, unregistering now"); GetRPCService().ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( app->app_id(), @@ -989,17 +983,17 @@ void ApplicationManagerImpl::DisconnectCloudApp(ApplicationSharedPtr app) { app_properties.transport_type, app_properties.hybrid_app_preference}; // Create device in pending state - LOG4CXX_DEBUG(logger_, "Re-adding the cloud app device"); + SDL_LOG_DEBUG("Re-adding the cloud app device"); connection_handler().AddCloudAppDevice(policy_app_id, properties); #endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT } void ApplicationManagerImpl::RefreshCloudAppInformation() { #if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT) - LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function"); + SDL_LOG_TRACE("Cloud app support is disabled. Exiting function"); return; #else - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_stopping()) { return; } @@ -1035,7 +1029,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() { GetPolicyHandler().GetInitialAppData(policy_id, &nicknames, &app_hmi_types); if (nicknames.empty()) { - LOG4CXX_ERROR(logger_, "Cloud App missing nickname"); + SDL_LOG_ERROR("Cloud App missing nickname"); continue; } else if (mobile_apis::HybridAppPreference::MOBILE == hybrid_app_preference) { @@ -1045,9 +1039,8 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() { auto apps = applications_by_name(*nickname_it); for (auto app : apps) { if (app.use_count() != 0 && !app->is_cloud_app()) { - LOG4CXX_ERROR(logger_, - "Mobile app already registered for cloud app: " - << *nickname_it); + SDL_LOG_ERROR("Mobile app already registered for cloud app: " + << *nickname_it); duplicate_found = true; break; } @@ -1083,13 +1076,13 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() { std::string url = GetPolicyHandler().GetIconUrl(policy_id); if (url.empty()) { - LOG4CXX_DEBUG(logger_, "No Icon Url for cloud app"); + SDL_LOG_DEBUG("No Icon Url for cloud app"); continue; } auto app_icon_it = app_icon_map_.find(policy_id); if (app_icon_it != app_icon_map_.end()) { - LOG4CXX_DEBUG(logger_, "Cloud App Already Exists in Icon Map"); + SDL_LOG_DEBUG("Cloud App Already Exists in Icon Map"); continue; } @@ -1097,8 +1090,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() { const std::string full_icon_path(app_icon_dir + "/" + policy_id); if (!file_system::FileExists(full_icon_path)) { AppIconInfo icon_info(app_properties.endpoint, false); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Inserting cloud app into icon map: " << app_icon_map_.size()); app_icon_map_.insert( std::pair<std::string, AppIconInfo>(policy_id, icon_info)); @@ -1121,9 +1113,8 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() { ApplicationSet::iterator it = std::find_if( apps_to_register_.begin(), apps_to_register_.end(), finder); if (it == apps_to_register_.end()) { - LOG4CXX_DEBUG( - logger_, - "Unable to find app to remove (" << policy_app_id << "), skipping"); + SDL_LOG_DEBUG("Unable to find app to remove (" << policy_app_id + << "), skipping"); continue; } app = *it; @@ -1132,7 +1123,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() { // If the disabled app is registered, unregistered it before destroying the // device if (app->IsRegistered() && app->is_cloud_app()) { - LOG4CXX_DEBUG(logger_, "Disabled app is registered, unregistering now"); + SDL_LOG_DEBUG("Disabled app is registered, unregistering now"); GetRPCService().ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( app->app_id(), @@ -1148,7 +1139,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() { // Update app list if disabled apps were removed if (removed_app_count > 0) { - LOG4CXX_DEBUG(logger_, "Removed " << removed_app_count << " disabled apps"); + SDL_LOG_DEBUG("Removed " << removed_app_count << " disabled apps"); SendUpdateAppList(); } #endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT @@ -1158,7 +1149,7 @@ void ApplicationManagerImpl::CreatePendingApplication( const transport_manager::ConnectionUID connection_id, const transport_manager::DeviceInfo& device_info, connection_handler::DeviceHandle device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string name = device_info.name(); pending_device_map_lock_ptr_->Acquire(); @@ -1178,7 +1169,7 @@ void ApplicationManagerImpl::CreatePendingApplication( policy_app_id, &nicknames, &app_hmi_types); if (nicknames.empty()) { - LOG4CXX_ERROR(logger_, "Cloud App missing nickname"); + SDL_LOG_ERROR("Cloud App missing nickname"); return; } @@ -1194,7 +1185,7 @@ void ApplicationManagerImpl::CreatePendingApplication( *this)); if (!application) { - LOG4CXX_INFO(logger_, "Could not create application"); + SDL_LOG_INFO("Could not create application"); return; } @@ -1214,9 +1205,8 @@ void ApplicationManagerImpl::CreatePendingApplication( &hybrid_app_preference_enum); if (!app_properties.hybrid_app_preference.empty() && !convert_result) { - LOG4CXX_ERROR(logger_, - "Could not convert string to enum: " - << app_properties.hybrid_app_preference); + SDL_LOG_ERROR("Could not convert string to enum: " + << app_properties.hybrid_app_preference); return; } @@ -1228,33 +1218,29 @@ void ApplicationManagerImpl::CreatePendingApplication( application->set_cloud_app_certificate(app_properties.certificate); sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_); - LOG4CXX_DEBUG(logger_, - "apps_to_register_ size before: " << apps_to_register_.size()); + SDL_LOG_DEBUG("apps_to_register_ size before: " << apps_to_register_.size()); apps_to_register_.insert(application); - LOG4CXX_DEBUG(logger_, - "apps_to_register_ size after: " << apps_to_register_.size()); + SDL_LOG_DEBUG("apps_to_register_ size after: " << apps_to_register_.size()); SendUpdateAppList(); } void ApplicationManagerImpl::RemovePendingApplication( const std::string& policy_app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_); PolicyAppIdPredicate finder(policy_app_id); auto app_it = std::find_if(apps_to_register_.begin(), apps_to_register_.end(), finder); if (apps_to_register_.end() == app_it) { - LOG4CXX_WARN( - logger_, - "Unable to find app to remove (" << policy_app_id << "), skipping"); + SDL_LOG_WARN("Unable to find app to remove (" << policy_app_id + << "), skipping"); return; } apps_to_register_.erase(app_it); - LOG4CXX_DEBUG(logger_, - "Remove " << policy_app_id + SDL_LOG_DEBUG("Remove " << policy_app_id << " from apps_to_register_. new size = " << apps_to_register_.size()); } @@ -1268,8 +1254,7 @@ void ApplicationManagerImpl::CreatePendingLocalApplication( policy_app_id, &nicknames, &app_hmi_types); if (nicknames.empty()) { - LOG4CXX_ERROR(logger_, - "Cloud/Web App " << policy_app_id << "missing nickname"); + SDL_LOG_ERROR("Cloud/Web App " << policy_app_id << " missing nickname"); return; } @@ -1301,9 +1286,8 @@ void ApplicationManagerImpl::CreatePendingLocalApplication( &hybrid_app_preference_enum); if (!app_properties.hybrid_app_preference.empty() && !convert_result) { - LOG4CXX_ERROR(logger_, - "Could not convert string to enum: " - << app_properties.hybrid_app_preference); + SDL_LOG_ERROR("Could not convert string to enum: " + << app_properties.hybrid_app_preference); return; } @@ -1316,18 +1300,17 @@ void ApplicationManagerImpl::CreatePendingLocalApplication( sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_); apps_to_register_.insert(application); - LOG4CXX_DEBUG(logger_, - "Insert " << application->name().c_str() + SDL_LOG_DEBUG("Insert " << application->name().c_str() << " to apps_to_register_. new size = " << apps_to_register_.size()); } void ApplicationManagerImpl::OnWebEngineDeviceCreated() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps(); if (enabled_local_apps.empty()) { - LOG4CXX_DEBUG(logger_, "No enabled local apps present"); + SDL_LOG_DEBUG("No enabled local apps present"); return; } @@ -1355,8 +1338,7 @@ void ApplicationManagerImpl::SetPendingApplicationState( if (!app) { return; } - LOG4CXX_DEBUG(logger_, - "Unregister application and move into apps_to_register"); + SDL_LOG_DEBUG("Unregister application and move into apps_to_register"); UnregisterApplication( app->app_id(), mobile_apis::Result::INVALID_ENUM, true, true); @@ -1472,8 +1454,8 @@ void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key, int32_t sampling_rate, int32_t bits_per_sample, int32_t audio_type) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_INFO(logger_, "START MICROPHONE RECORDER"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_INFO("START MICROPHONE RECORDER"); DCHECK_OR_RETURN_VOID(media_manager_); media_manager_->StartMicrophoneRecording( session_key, @@ -1485,7 +1467,7 @@ void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key, } void ApplicationManagerImpl::StopAudioPassThru(int32_t application_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(audio_pass_thru_lock_); DCHECK_OR_RETURN_VOID(media_manager_); media_manager_->StopMicrophoneRecording(application_key); @@ -1497,9 +1479,9 @@ std::string ApplicationManagerImpl::GetDeviceName( std::string device_name = ""; if (connection_handler().get_session_observer().GetDataOnDeviceID( handle, &device_name, NULL, NULL, NULL) == -1) { - LOG4CXX_ERROR(logger_, "Failed to extract device name for id " << handle); + SDL_LOG_ERROR("Failed to extract device name for id " << handle); } else { - LOG4CXX_DEBUG(logger_, "\t\t\t\t\tDevice name is " << device_name); + SDL_LOG_DEBUG("\t\t\t\t\tDevice name is " << device_name); } return device_name; @@ -1515,7 +1497,7 @@ ApplicationManagerImpl::GetDeviceTransportType( if (it != devicesType.end()) { return devicesType[transport_type]; } else { - LOG4CXX_ERROR(logger_, "Unknown transport type " << transport_type); + SDL_LOG_ERROR("Unknown transport type " << transport_type); } return result; @@ -1565,7 +1547,7 @@ std::string ApplicationManagerImpl::GetCorrectMobileIDFromMessage( if ((*message)[strings::msg_params].keyExists(strings::full_app_id)) { return (*message)[strings::msg_params][strings::full_app_id].asString(); } else { - LOG4CXX_DEBUG(logger_, "UseFullAppID is on but only short ID given!"); + SDL_LOG_DEBUG("UseFullAppID is on but only short ID given!"); } } // If core isn't using full or no full given, use regular appID @@ -1586,7 +1568,7 @@ void application_manager::ApplicationManagerImpl::MarkAppsGreyOut( void ApplicationManagerImpl::OnDeviceListUpdated( const connection_handler::DeviceMap& device_list) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // add device to policy DB connection_handler::DeviceMap::const_iterator it = device_list.begin(); @@ -1610,7 +1592,7 @@ void ApplicationManagerImpl::OnDeviceListUpdated( smart_objects::SmartObjectSPtr msg_params = MessageHelper::CreateDeviceListSO(device_list, GetPolicyHandler(), *this); if (!msg_params) { - LOG4CXX_WARN(logger_, "Failed to create sub-smart object."); + SDL_LOG_WARN("Failed to create sub-smart object."); return; } @@ -1631,7 +1613,7 @@ void ApplicationManagerImpl::OnDeviceListUpdated( void ApplicationManagerImpl::OnFindNewApplicationsRequest() { connection_handler().ConnectToAllDevices(); - LOG4CXX_DEBUG(logger_, "Starting application list update timer"); + SDL_LOG_DEBUG("Starting application list update timer"); uint32_t timeout = get_settings().application_list_update_timeout(); application_list_update_timer_.Start(timeout, timer::kSingleShot); GetPolicyHandler().OnAppsSearchStarted(); @@ -1639,13 +1621,13 @@ void ApplicationManagerImpl::OnFindNewApplicationsRequest() { void ApplicationManagerImpl::OnQueryAppsRequest( const connection_handler::DeviceHandle device) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(query_apps_devices_lock_); query_apps_devices_.insert(device); } void ApplicationManagerImpl::SendUpdateAppList() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace smart_objects; using namespace hmi_apis; @@ -1667,7 +1649,7 @@ void ApplicationManagerImpl::SendUpdateAppList() { void ApplicationManagerImpl::RemoveDevice( const connection_handler::DeviceHandle& device_handle) { - LOG4CXX_DEBUG(logger_, "device_handle " << device_handle); + SDL_LOG_DEBUG("device_handle " << device_handle); sync_primitives::AutoLock lock(query_apps_devices_lock_); query_apps_devices_.erase(device_handle); } @@ -1675,7 +1657,7 @@ void ApplicationManagerImpl::RemoveDevice( void ApplicationManagerImpl::OnDeviceSwitchingStart( const connection_handler::Device& device_from, const connection_handler::Device& device_to) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ReregisterWaitList wait_list; { auto apps_data_accessor = applications(); @@ -1707,7 +1689,7 @@ void ApplicationManagerImpl::OnDeviceSwitchingStart( void ApplicationManagerImpl::OnDeviceSwitchingFinish( const std::string& device_uid) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); UNUSED(device_uid); ReregisterWaitList wait_list; @@ -1731,15 +1713,13 @@ void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app, const uint32_t connection_key, const size_t device_id, const std::string& mac_address) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); sync_primitives::AutoLock lock(applications_list_lock_ptr_); DCHECK_OR_RETURN_VOID(1 == applications_.erase(app)); - LOG4CXX_DEBUG(logger_, - "Changing app id to " << connection_key - << ". Changing device id to " - << device_id); + SDL_LOG_DEBUG("Changing app id to " + << connection_key << ". Changing device id to " << device_id); bool is_subscribed_to_way_points = IsAppSubscribedForWayPoints(app); if (is_subscribed_to_way_points) { @@ -1763,7 +1743,7 @@ void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app, mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel( ApplicationConstSharedPtr application) const { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); HMILevel::eType default_hmi = HMILevel::HMI_NONE; if (GetPolicyHandler().PolicyEnabled()) { @@ -1780,13 +1760,11 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel( } else if ("NONE" == default_hmi_string) { default_hmi = HMILevel::HMI_NONE; } else { - LOG4CXX_ERROR( - logger_, - "Unable to convert " + default_hmi_string + " to HMILevel"); + SDL_LOG_ERROR("Unable to convert " + default_hmi_string + + " to HMILevel"); } } else { - LOG4CXX_ERROR(logger_, - "Unable to get default hmi_level for " << policy_app_id); + SDL_LOG_ERROR("Unable to get default hmi_level for " << policy_app_id); } } return default_hmi; @@ -1795,7 +1773,7 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel( bool ApplicationManagerImpl::CheckResumptionRequiredTransportAvailable( ApplicationConstSharedPtr application) const { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::map<std::string, std::vector<std::string> >& transport_map = get_settings().transport_required_for_resumption_map(); @@ -1870,14 +1848,14 @@ uint32_t ApplicationManagerImpl::GenerateGrammarID() { } uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t hmi_app_id = get_rand_from_range(1); - LOG4CXX_DEBUG(logger_, "GenerateNewHMIAppID value is: " << hmi_app_id); + SDL_LOG_DEBUG("GenerateNewHMIAppID value is: " << hmi_app_id); while (resume_controller().IsHMIApplicationIdExist(hmi_app_id)) { - LOG4CXX_DEBUG(logger_, "HMI appID " << hmi_app_id << " is exists."); + SDL_LOG_DEBUG("HMI appID " << hmi_app_id << " is exists."); hmi_app_id = get_rand_from_range(1); - LOG4CXX_DEBUG(logger_, "Trying new value: " << hmi_app_id); + SDL_LOG_DEBUG("Trying new value: " << hmi_app_id); } return hmi_app_id; @@ -1888,7 +1866,7 @@ bool ApplicationManagerImpl::StartNaviService( protocol_handler::ServiceType service_type, const BsonObject* params) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (HMIStateAllowsStreaming(app_id, service_type)) { { @@ -1901,7 +1879,7 @@ bool ApplicationManagerImpl::StartNaviService( std::pair<uint32_t, std::pair<bool, bool> >( app_id, std::make_pair(false, false))); if (!res.second) { - LOG4CXX_WARN(logger_, "Navi service refused"); + SDL_LOG_WARN("Navi service refused"); return false; } it = res.first; @@ -1915,14 +1893,11 @@ bool ApplicationManagerImpl::StartNaviService( sync_primitives::AutoLock lock(applications_list_lock_ptr_); for (auto app : applications_) { if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - LOG4CXX_DEBUG(logger_, - "Continue, Not Navi App Id: " << app->app_id()); + SDL_LOG_DEBUG("Continue, Not Navi App Id: " << app->app_id()); continue; } - LOG4CXX_DEBUG(logger_, - "Abort Stream Service of other NaviAppId: " - << app->app_id() - << " Service_type: " << service_type); + SDL_LOG_DEBUG("Abort Stream Service of other NaviAppId: " + << app->app_id() << " Service_type: " << service_type); StopNaviService(app->app_id(), service_type); } } @@ -1946,7 +1921,7 @@ bool ApplicationManagerImpl::StartNaviService( OnStreamingConfigured(app_id, service_type, false, rejected_params); return false; } else if (!converted_params.empty()) { - LOG4CXX_INFO(logger_, "Sending video configuration params"); + SDL_LOG_INFO("Sending video configuration params"); MessageHelper::PrintSmartObject(converted_params); bool request_sent = application(app_id)->SetVideoConfig(service_type, converted_params); @@ -1961,7 +1936,7 @@ bool ApplicationManagerImpl::StartNaviService( return true; } else { - LOG4CXX_WARN(logger_, "Refused navi service by HMI level"); + SDL_LOG_WARN("Refused navi service by HMI level"); } std::vector<std::string> empty; OnStreamingConfigured(app_id, service_type, false, empty); @@ -1974,11 +1949,10 @@ void ApplicationManagerImpl::OnStreamingConfigured( bool result, std::vector<std::string>& rejected_params) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); - LOG4CXX_INFO(logger_, - "OnStreamingConfigured called for service " - << service_type << ", result=" << result); + SDL_LOG_INFO("OnStreamingConfigured called for service " + << service_type << ", result=" << result); if (result) { std::vector<std::string> empty; @@ -1987,7 +1961,7 @@ void ApplicationManagerImpl::OnStreamingConfigured( NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); if (navi_service_status_.end() == it) { - LOG4CXX_WARN(logger_, "Application not found in navi status map"); + SDL_LOG_WARN("Application not found in navi status map"); connection_handler().NotifyServiceStartedResult(app_id, false, empty); return; } @@ -2032,35 +2006,33 @@ void ApplicationManagerImpl::OnStreamingConfigured( void ApplicationManagerImpl::StopNaviService( uint32_t app_id, protocol_handler::ServiceType service_type) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock lock(navi_service_status_lock_); NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); if (navi_service_status_.end() == it) { - LOG4CXX_WARN(logger_, - "No Information about navi service " << service_type); + SDL_LOG_WARN("No Information about navi service " << service_type); // Fix: Need return for Not navi service at now return; } else { // Fix: Repeated tests are not executed after they have stopped for Navi if (false == it->second.first && ServiceType::kMobileNav == service_type) { - LOG4CXX_DEBUG(logger_, "appId: " << app_id << "Navi had stopped"); + SDL_LOG_DEBUG("appId: " << app_id << "Navi had stopped"); return; } // Fix: Repeated tests are not executed after they have stopped for Audio if (false == it->second.second && ServiceType::kAudio == service_type) { - LOG4CXX_DEBUG(logger_, "appId: " << app_id << "Audio had stopped"); + SDL_LOG_DEBUG("appId: " << app_id << "Audio had stopped"); return; } // Fill NaviServices map. Set false to first value of pair if // we've stopped video service or to second value if we've // stopped audio service - LOG4CXX_DEBUG(logger_, - "appId: " << app_id << " service_type: " << service_type + SDL_LOG_DEBUG("appId: " << app_id << " service_type: " << service_type << " to stopped"); service_type == ServiceType::kMobileNav ? it->second.first = false : it->second.second = false; @@ -2070,7 +2042,7 @@ void ApplicationManagerImpl::StopNaviService( // because Not set Allowstream flag ApplicationSharedPtr app = application(app_id); if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - LOG4CXX_ERROR(logger_, "Navi/Projection application not found"); + SDL_LOG_ERROR("Navi/Projection application not found"); return; } if (service_type == ServiceType::kMobileNav) { @@ -2085,7 +2057,7 @@ void ApplicationManagerImpl::StopNaviService( ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_WARN(logger_, "An application is not registered."); + SDL_LOG_WARN("An application is not registered."); return; } @@ -2099,22 +2071,20 @@ void ApplicationManagerImpl::OnServiceStartedCallback( const BsonObject* params) { using namespace helpers; using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG( - logger_, - "ServiceType = " << type << ". Session = " << std::hex << session_key); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("ServiceType = " << type << ". Session = " << std::hex + << session_key); std::vector<std::string> empty; if (kRpc == type) { - LOG4CXX_DEBUG(logger_, "RPC service is about to be started."); + SDL_LOG_DEBUG("RPC service is about to be started."); connection_handler().NotifyServiceStartedResult(session_key, true, empty); return; } ApplicationSharedPtr app = application(session_key); if (!app) { - LOG4CXX_WARN( - logger_, - "The application with id:" << session_key << " doesn't exists."); + SDL_LOG_WARN("The application with id:" << session_key + << " doesn't exists."); connection_handler().NotifyServiceStartedResult(session_key, false, empty); return; } @@ -2123,14 +2093,14 @@ void ApplicationManagerImpl::OnServiceStartedCallback( type, ServiceType::kMobileNav, ServiceType::kAudio)) { if (app->is_navi() || app->mobile_projection_enabled()) { if (!StartNaviService(session_key, type, params)) { - LOG4CXX_WARN(logger_, "Starting Navigation service failed"); + SDL_LOG_WARN("Starting Navigation service failed"); } return; } else { - LOG4CXX_WARN(logger_, "Refuse not navi/projection application"); + SDL_LOG_WARN("Refuse not navi/projection application"); } } else { - LOG4CXX_WARN(logger_, "Refuse unknown service"); + SDL_LOG_WARN("Refuse unknown service"); } connection_handler().NotifyServiceStartedResult(session_key, false, empty); @@ -2145,10 +2115,9 @@ void ApplicationManagerImpl::OnServiceEndedCallback( using namespace connection_handler; using namespace mobile_apis; - LOG4CXX_DEBUG(logger_, - "OnServiceEndedCallback for service " - << type << " with reason " << close_reason - << " in session 0x" << std::hex << session_key); + SDL_LOG_DEBUG("OnServiceEndedCallback for service " + << type << " with reason " << close_reason << " in session 0x" + << std::hex << session_key); auto app = application(static_cast<uint32_t>(session_key)); if (!app) { @@ -2156,13 +2125,12 @@ void ApplicationManagerImpl::OnServiceEndedCallback( } if (IsAppInReconnectMode(app->device(), app->policy_app_id())) { - LOG4CXX_DEBUG(logger_, - "Application is in reconnection list and won't be closed."); + SDL_LOG_DEBUG("Application is in reconnection list and won't be closed."); return; } if (type == kRpc) { - LOG4CXX_INFO(logger_, "Remove application."); + SDL_LOG_INFO("Remove application."); /* In case it was unexpected disconnect or some special case (malformed message, flood) application will be removed and we will unregister application correctly, but in case it was @@ -2221,13 +2189,12 @@ void ApplicationManagerImpl::ProcessServiceStatusUpdate( hmi_apis::Common_ServiceEvent::eType service_event, utils::Optional<hmi_apis::Common_ServiceStatusUpdateReason::eType> service_update_reason) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); - LOG4CXX_DEBUG(logger_, - "Processing status update with connection key: " - << connection_key << " service type: " << service_type - << " service_event " << service_event - << " service_update_reason " << service_update_reason); + SDL_LOG_DEBUG("Processing status update with connection key: " + << connection_key << " service type: " << service_type + << " service_event " << service_event + << " service_update_reason " << service_update_reason); const auto app = application(connection_key); @@ -2254,9 +2221,9 @@ void ApplicationManagerImpl::ProcessServiceStatusUpdate( bool ApplicationManagerImpl::HandleRejectedServiceStatus( ApplicationSharedPtr app, const hmi_apis::Common_ServiceType::eType service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app) { - LOG4CXX_WARN(logger_, "Received invalid app"); + SDL_LOG_WARN("Received invalid app"); return false; } @@ -2270,20 +2237,19 @@ bool ApplicationManagerImpl::HandleRejectedServiceStatus( navi_service_status_.erase(app_services); } } - LOG4CXX_DEBUG(logger_, - "The start of service" - << service_type << " for appID: " << app - << " is failed. Service info has been removed"); + SDL_LOG_DEBUG("The start of service" + << service_type << " for appID: " << app + << " is failed. Service info has been removed"); return true; } case hmi_apis::Common_ServiceType::RPC: { connection_handler().SendEndService(app->app_id(), protocol_handler::ServiceType::kRpc); - LOG4CXX_DEBUG(logger_, "RPC service for appID: " << app << " is stopped"); + SDL_LOG_DEBUG("RPC service for appID: " << app << " is stopped"); return true; } default: - LOG4CXX_DEBUG(logger_, "Unknown service type: " << service_type); + SDL_LOG_DEBUG("Unknown service type: " << service_type); return false; } } @@ -2291,12 +2257,11 @@ bool ApplicationManagerImpl::HandleRejectedServiceStatus( void ApplicationManagerImpl::OnSecondaryTransportStartedCallback( const connection_handler::DeviceHandle device_handle, const int32_t session_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (device_handle == 0) { - LOG4CXX_WARN(logger_, - "Invalid device handle passed for secondary transport of app " - << session_key); + SDL_LOG_WARN("Invalid device handle passed for secondary transport of app " + << session_key); return; } @@ -2309,8 +2274,7 @@ void ApplicationManagerImpl::OnSecondaryTransportStartedCallback( // It is possible that secondary transport is established prior to // RegisterAppInterface request being processed. In this case, we will // update the app's information during RegisterApplication(). - LOG4CXX_DEBUG(logger_, - "Application with id: " << session_key << " is not found"); + SDL_LOG_DEBUG("Application with id: " << session_key << " is not found"); return; } app->set_secondary_device(device_handle); @@ -2325,14 +2289,13 @@ void ApplicationManagerImpl::OnSecondaryTransportStartedCallback( void ApplicationManagerImpl::OnSecondaryTransportEndedCallback( const int32_t session_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeviceMap::iterator it = secondary_transport_devices_cache_.find(session_key); if (it == secondary_transport_devices_cache_.end()) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Unknown session_key specified while removing secondary transport: " - << session_key); + << session_key); } else { secondary_transport_devices_cache_.erase(it); } @@ -2341,16 +2304,14 @@ void ApplicationManagerImpl::OnSecondaryTransportEndedCallback( sync_primitives::AutoLock auto_lock(applications_list_lock_ptr_); ApplicationSharedPtr app = application(session_key); if (!app) { - LOG4CXX_DEBUG(logger_, - "Application with id: " << session_key << " is not found"); + SDL_LOG_DEBUG("Application with id: " << session_key << " is not found"); return; } connection_handler::DeviceHandle device_handle = app->secondary_device(); if (device_handle == 0) { - LOG4CXX_WARN( - logger_, - "Secondary transport of app " << session_key << " is not found"); + SDL_LOG_WARN("Secondary transport of app " << session_key + << " is not found"); return; } @@ -2362,7 +2323,7 @@ void ApplicationManagerImpl::OnSecondaryTransportEndedCallback( } bool ApplicationManagerImpl::CheckAppIsNavi(const uint32_t app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (app) { return app->is_navi(); @@ -2374,15 +2335,14 @@ bool ApplicationManagerImpl::CheckAppIsNavi(const uint32_t app_id) const { bool ApplicationManagerImpl::OnHandshakeDone( uint32_t connection_key, security_manager::SSLContext::HandshakeResult result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using security_manager::SSLContext; using namespace helpers; ApplicationSharedPtr app = application(connection_key); if (!app) { - LOG4CXX_WARN(logger_, - "Application for connection key: " << connection_key + SDL_LOG_WARN("Application for connection key: " << connection_key << " was not found"); return false; } @@ -2399,30 +2359,30 @@ bool ApplicationManagerImpl::OnHandshakeDone( } #ifdef ENABLE_SECURITY bool ApplicationManagerImpl::OnPTUFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return false; } #endif // ENABLE_SECURITY bool ApplicationManagerImpl::OnGetSystemTimeFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return false; } void ApplicationManagerImpl::OnCertificateUpdateRequired() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GetPolicyHandler().OnPTExchangeNeeded(); } bool ApplicationManagerImpl::GetPolicyCertificateData(std::string& data) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); data = GetPolicyHandler().RetrieveCertificate(); return true; } security_manager::SSLContext::HandshakeContext ApplicationManagerImpl::GetHandshakeContext(uint32_t key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using security_manager::SSLContext; ApplicationConstSharedPtr app = application(key); if (app) { @@ -2473,11 +2433,10 @@ void ApplicationManagerImpl::TerminateRequest(const uint32_t connection_key, void ApplicationManagerImpl::RemoveHMIFakeParameters( application_manager::commands::MessageSharedPtr& message, const hmi_apis::FunctionID::eType& function_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_apis::HMI_API factory; if (!(*message)[jhs::S_PARAMS].keyExists(jhs::S_FUNCTION_ID)) { - LOG4CXX_ERROR(logger_, - "RemoveHMIFakeParameters message missing function id"); + SDL_LOG_ERROR("RemoveHMIFakeParameters message missing function id"); return; } mobile_apis::FunctionID::eType mobile_function_id = @@ -2496,7 +2455,7 @@ bool ApplicationManagerImpl::Init(resumption::LastState&, bool ApplicationManagerImpl::Init( resumption::LastStateWrapperPtr last_state_wrapper, media_manager::MediaManager* media_manager) { - LOG4CXX_TRACE(logger_, "Init application manager"); + SDL_LOG_TRACE("Init application manager"); plugin_manager_.reset( new plugin_manager::RPCPluginManagerImpl(*this, *rpc_service_, @@ -2504,7 +2463,7 @@ bool ApplicationManagerImpl::Init( *policy_handler_, last_state_wrapper)); if (!plugin_manager_->LoadPlugins(get_settings().plugins_folder())) { - LOG4CXX_ERROR(logger_, "Plugins are not loaded"); + SDL_LOG_ERROR("Plugins are not loaded"); return false; } const std::string app_storage_folder = get_settings().app_storage_folder(); @@ -2513,15 +2472,14 @@ bool ApplicationManagerImpl::Init( return false; } if (!resume_controller().Init(last_state_wrapper)) { - LOG4CXX_ERROR(logger_, "Problem with initialization of resume controller"); + SDL_LOG_ERROR("Problem with initialization of resume controller"); return false; } hmi_capabilities_->Init(last_state_wrapper); if (!(file_system::IsWritingAllowed(app_storage_folder) && file_system::IsReadingAllowed(app_storage_folder))) { - LOG4CXX_ERROR(logger_, - "Storage directory doesn't have read/write permissions"); + SDL_LOG_ERROR("Storage directory doesn't have read/write permissions"); return false; } @@ -2539,18 +2497,16 @@ bool ApplicationManagerImpl::Init( IsReadWriteAllowed(app_icons_folder, TYPE_ICONS); if (GetPolicyHandler().PolicyEnabled()) { if (!GetPolicyHandler().LoadPolicyLibrary()) { - LOG4CXX_ERROR(logger_, - "Policy library is not loaded. Check LD_LIBRARY_PATH"); + SDL_LOG_ERROR("Policy library is not loaded. Check LD_LIBRARY_PATH"); return false; } - LOG4CXX_INFO(logger_, "Policy library is loaded, now initing PT"); + SDL_LOG_INFO("Policy library is loaded, now initing PT"); if (!GetPolicyHandler().InitPolicyTable()) { - LOG4CXX_ERROR(logger_, "Policy table is not initialized."); + SDL_LOG_ERROR("Policy table is not initialized."); return false; } } else { - LOG4CXX_WARN(logger_, - "System is configured to work without policy functionality."); + SDL_LOG_WARN("System is configured to work without policy functionality."); } media_manager_ = media_manager; @@ -2576,7 +2532,7 @@ bool ApplicationManagerImpl::Init( } bool ApplicationManagerImpl::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); stopping_application_mng_lock_.Acquire(); is_stopping_ = true; stopping_application_mng_lock_.Release(); @@ -2590,13 +2546,12 @@ bool ApplicationManagerImpl::Stop() { UnregisterAllApplications(); } catch (...) { - LOG4CXX_ERROR(logger_, - "An error occurred during unregistering applications."); + SDL_LOG_ERROR("An error occurred during unregistering applications."); } request_ctrl_.DestroyThreadpool(); // for PASA customer policy backup should happen :AllApp(SUSPEND) - LOG4CXX_DEBUG(logger_, "Unloading policy library."); + SDL_LOG_DEBUG("Unloading policy library."); GetPolicyHandler().UnloadPolicyLibrary(); rpc_service_->Stop(); @@ -2608,16 +2563,15 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( const smart_objects::SmartObject& message, Message& output, const bool allow_unknown_parameters) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (smart_objects::SmartType_Null == message.getType() || smart_objects::SmartType_Invalid == message.getType()) { - LOG4CXX_WARN(logger_, "Invalid smart object received."); + SDL_LOG_WARN("Invalid smart object received."); return false; } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Message with protocol: " << message.getElement(jhs::S_PARAMS) .getElement(jhs::S_PROTOCOL_TYPE) .asInt()); @@ -2634,7 +2588,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( if (protocol_version == 1) { if (!formatters::CFormatterJsonSDLRPCv1::toString( message, output_string, !allow_unknown_parameters)) { - LOG4CXX_WARN(logger_, "Failed to serialize smart object"); + SDL_LOG_WARN("Failed to serialize smart object"); return false; } output.set_protocol_version( @@ -2642,7 +2596,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( } else { if (!formatters::CFormatterJsonSDLRPCv2::toString( message, output_string, !allow_unknown_parameters)) { - LOG4CXX_WARN(logger_, "Failed to serialize smart object"); + SDL_LOG_WARN("Failed to serialize smart object"); return false; } output.set_protocol_version( @@ -2655,7 +2609,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( case 1: { if (!formatters::FormatterJsonRpc::ToString( message, output_string, !allow_unknown_parameters)) { - LOG4CXX_WARN(logger_, "Failed to serialize smart object"); + SDL_LOG_WARN("Failed to serialize smart object"); return false; } output.set_protocol_version( @@ -2667,7 +2621,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( return false; } - LOG4CXX_DEBUG(logger_, "Convertion result: " << output_string); + SDL_LOG_DEBUG("Convertion result: " << output_string); output.set_connection_key(message.getElement(jhs::S_PARAMS) .getElement(strings::connection_key) @@ -2702,7 +2656,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( output.set_binary_data(&binaryData); } - LOG4CXX_DEBUG(logger_, "Successfully parsed smart object into message"); + SDL_LOG_DEBUG("Successfully parsed smart object into message"); return true; } @@ -2710,7 +2664,7 @@ hmi_apis::HMI_API& ApplicationManagerImpl::hmi_so_factory() { if (!hmi_so_factory_) { hmi_so_factory_ = new hmi_apis::HMI_API; if (!hmi_so_factory_) { - LOG4CXX_ERROR(logger_, "Out of memory"); + SDL_LOG_ERROR("Out of memory"); NOTREACHED(); } } @@ -2721,7 +2675,7 @@ mobile_apis::MOBILE_API& ApplicationManagerImpl::mobile_so_factory() { if (!mobile_so_factory_) { mobile_so_factory_ = new mobile_apis::MOBILE_API; if (!mobile_so_factory_) { - LOG4CXX_ERROR(logger_, "Out of memory."); + SDL_LOG_ERROR("Out of memory"); NOTREACHED(); } } @@ -2739,9 +2693,9 @@ const HMICapabilities& ApplicationManagerImpl::hmi_capabilities() const { void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data, SmartObject& ttsName, SmartObject& vrSynonym) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app_data.keyExists(json::languages)) { - LOG4CXX_WARN(logger_, "\"languages\" not exists"); + SDL_LOG_WARN("\"languages\" not exists"); return; } @@ -2759,44 +2713,41 @@ void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data, const size_t size = languages.length(); for (size_t idx = 0; idx < size; ++idx) { if (languages[idx].keyExists(cur_vr_lang)) { - LOG4CXX_DEBUG(logger_, "Found active HMI language " << cur_vr_lang); + SDL_LOG_DEBUG("Found active HMI language " << cur_vr_lang); specific_idx = idx; } else if (languages[idx].keyExists(json::default_)) { - LOG4CXX_DEBUG(logger_, "Found default language"); + SDL_LOG_DEBUG("Found default language"); default_idx = idx; } } if ((-1 == specific_idx) && (-1 == default_idx)) { - LOG4CXX_DEBUG(logger_, "No suitable language found"); + SDL_LOG_DEBUG("No suitable language found"); return; } if (app_data[json::languages][specific_idx][cur_vr_lang].keyExists( json::ttsName)) { - LOG4CXX_DEBUG(logger_, "Get ttsName from " << cur_vr_lang << " language"); + SDL_LOG_DEBUG("Get ttsName from " << cur_vr_lang << " language"); ttsName = app_data[json::languages][specific_idx][cur_vr_lang][json::ttsName]; } else { - LOG4CXX_DEBUG(logger_, - "No data for ttsName for " << cur_vr_lang << " language"); + SDL_LOG_DEBUG("No data for ttsName for " << cur_vr_lang << " language"); } if (app_data[json::languages][specific_idx][cur_vr_lang].keyExists( json::vrSynonyms)) { - LOG4CXX_DEBUG(logger_, - "Get vrSynonyms from " << cur_vr_lang << " language"); + SDL_LOG_DEBUG("Get vrSynonyms from " << cur_vr_lang << " language"); vrSynonym = app_data[json::languages][specific_idx][cur_vr_lang][json::vrSynonyms]; } else { - LOG4CXX_DEBUG(logger_, - "No data for vrSynonyms for " << cur_vr_lang << " language"); + SDL_LOG_DEBUG("No data for vrSynonyms for " << cur_vr_lang << " language"); } } void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, const uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace policy; const std::size_t arr_size(obj_array.size()); @@ -2804,7 +2755,7 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, const SmartObject& app_data = obj_array[idx]; if (!(app_data.keyExists(json::name) && app_data.keyExists(json::appId))) { - LOG4CXX_DEBUG(logger_, "The entry in query apps json is not valid"); + SDL_LOG_DEBUG("The entry in query apps json is not valid"); continue; } @@ -2813,24 +2764,21 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, connection_handler::DeviceHandle device_handle; if (-1 == connection_handler().get_session_observer().GetDataOnSessionKey( connection_key, nullptr, nullptr, &device_handle)) { - LOG4CXX_ERROR(logger_, - "Failed to create application: no connection info."); + SDL_LOG_ERROR("Failed to create application: no connection info."); continue; } std::string device_id; if (-1 == connection_handler().get_session_observer().GetDataOnDeviceID( device_handle, nullptr, nullptr, &device_id)) { - LOG4CXX_ERROR(logger_, - "Failed to create application: no connection info."); + SDL_LOG_ERROR("Failed to create application: no connection info."); continue; } ApplicationSharedPtr registered_app = application(device_id, policy_app_id); if (registered_app) { - LOG4CXX_DEBUG(logger_, - "Application with the same id: " - << policy_app_id << " is registered already."); + SDL_LOG_DEBUG("Application with the same id: " + << policy_app_id << " is registered already."); continue; } @@ -2890,22 +2838,21 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, app->set_tts_name(ttsName); sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_); - LOG4CXX_DEBUG( - logger_, "apps_to_register_ size before: " << apps_to_register_.size()); + SDL_LOG_DEBUG( + "apps_to_register_ size before: " << apps_to_register_.size()); apps_to_register_.insert(app); - LOG4CXX_DEBUG(logger_, - "apps_to_register_ size after: " << apps_to_register_.size()); + SDL_LOG_DEBUG("apps_to_register_ size after: " << apps_to_register_.size()); } } void ApplicationManagerImpl::ProcessQueryApp( const smart_objects::SmartObject& sm_object, const uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace policy; if (!sm_object.keyExists(json::response)) { - LOG4CXX_DEBUG(logger_, "The response key is not exists."); + SDL_LOG_DEBUG("The response key is not exists."); return; } @@ -2950,16 +2897,15 @@ void ApplicationManagerImpl::updateRequestTimeout( uint32_t connection_key, uint32_t mobile_correlation_id, uint32_t new_timeout_value) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); request_ctrl_.updateRequestTimeout( connection_key, mobile_correlation_id, new_timeout_value); } void ApplicationManagerImpl::IncreaseForwardedRequestTimeout( uint32_t connection_key, uint32_t mobile_correlation_id) { - LOG4CXX_DEBUG(logger_, - "Increasing Request Timeout by " - << get_settings().rpc_pass_through_timeout()); + SDL_LOG_DEBUG("Increasing Request Timeout by " + << get_settings().rpc_pass_through_timeout()); uint32_t new_timeout_value = get_settings().default_timeout() + get_settings().rpc_pass_through_timeout(); request_ctrl_.updateRequestTimeout( @@ -3005,27 +2951,27 @@ void ApplicationManagerImpl::RemovePolicyObserver( void ApplicationManagerImpl::SetUnregisterAllApplicationsReason( mobile_api::AppInterfaceUnregisteredReason::eType reason) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_TRACE(logger_, "reason = " << reason); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_TRACE("reason = " << reason); unregister_reason_ = reason; } void ApplicationManagerImpl::HeadUnitReset( mobile_api::AppInterfaceUnregisteredReason::eType reason) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); stopping_application_mng_lock_.Acquire(); is_stopping_ = true; stopping_application_mng_lock_.Release(); switch (reason) { case mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET: { - LOG4CXX_TRACE(logger_, "Performing MASTER_RESET"); + SDL_LOG_TRACE("Performing MASTER_RESET"); UnregisterAllApplications(); GetPolicyHandler().ResetPolicyTable(); GetPolicyHandler().UnloadPolicyLibrary(); resume_controller().StopSavePersistentDataTimer(); if (!hmi_capabilities_->DeleteCachedCapabilitiesFile()) { - LOG4CXX_ERROR(logger_, "Failed to remove HMI capabilities cache file"); + SDL_LOG_ERROR("Failed to remove HMI capabilities cache file"); } const std::string storage_folder = get_settings().app_storage_folder(); file_system::RemoveDirectory(storage_folder, true); @@ -3033,25 +2979,25 @@ void ApplicationManagerImpl::HeadUnitReset( break; } case mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS: { - LOG4CXX_TRACE(logger_, "Performing FACTORY_DEFAULTS"); + SDL_LOG_TRACE("Performing FACTORY_DEFAULTS"); GetPolicyHandler().ClearUserConsent(); resume_controller().StopSavePersistentDataTimer(); if (!hmi_capabilities_->DeleteCachedCapabilitiesFile()) { - LOG4CXX_ERROR(logger_, "Failed to remove HMI capabilities cache file"); + SDL_LOG_ERROR("Failed to remove HMI capabilities cache file"); } ClearAppsPersistentData(); break; } default: { - LOG4CXX_ERROR(logger_, "Bad AppInterfaceUnregisteredReason"); + SDL_LOG_ERROR("Bad AppInterfaceUnregisteredReason"); return; } } } void ApplicationManagerImpl::ClearAppsPersistentData() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); typedef std::vector<std::string> FilesList; const std::string apps_info_storage_file = get_settings().app_info_storage(); file_system::DeleteFile(apps_info_storage_file); @@ -3069,14 +3015,12 @@ void ApplicationManagerImpl::ClearAppsPersistentData() { for (; it != files.end(); ++it) { const std::string path_to_item = storage_folder + "/"; const std::string item_to_remove = path_to_item + (*it); - LOG4CXX_TRACE(logger_, "Removing : " << item_to_remove); + SDL_LOG_TRACE("Removing : " << item_to_remove); if (file_system::IsDirectory(item_to_remove)) { - LOG4CXX_TRACE(logger_, - "Removal result : " << file_system::RemoveDirectory( + SDL_LOG_TRACE("Removal result : " << file_system::RemoveDirectory( item_to_remove, true)); } else { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( "Removal result : " << file_system::DeleteFile(item_to_remove)); } } @@ -3088,9 +3032,9 @@ void ApplicationManagerImpl::ClearAppsPersistentData() { } void ApplicationManagerImpl::SendOnSDLClose() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (IsLowVoltage()) { - LOG4CXX_TRACE(logger_, "SDL is in Low Voltage State"); + SDL_LOG_TRACE("SDL is in Low Voltage State"); return; } // must be sent to PASA HMI on shutdown synchronously @@ -3107,7 +3051,7 @@ void ApplicationManagerImpl::SendOnSDLClose() { commands::CommandImpl::protocol_version_; if (!msg) { - LOG4CXX_WARN(logger_, "Null-pointer message received."); + SDL_LOG_WARN("Null-pointer message received."); NOTREACHED(); return; } @@ -3117,18 +3061,16 @@ void ApplicationManagerImpl::SendOnSDLClose() { new Message(protocol_handler::MessagePriority::kDefault)); hmi_so_factory().attachSchema(*msg, false); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Attached schema to message, result if valid: " << msg->isValid()); if (!ConvertSOtoMessage(*msg, *message_to_send)) { - LOG4CXX_WARN(logger_, - "Cannot send message to HMI: failed to create string"); + SDL_LOG_WARN("Cannot send message to HMI: failed to create string"); return; } if (!hmi_handler_) { - LOG4CXX_WARN(logger_, "No HMI Handler set"); + SDL_LOG_WARN("No HMI Handler set"); return; } @@ -3136,7 +3078,7 @@ void ApplicationManagerImpl::SendOnSDLClose() { } void ApplicationManagerImpl::UnregisterAllApplications() { - LOG4CXX_DEBUG(logger_, "Unregister reason " << unregister_reason_); + SDL_LOG_DEBUG("Unregister reason " << unregister_reason_); SetHMICooperating(false); bool is_ignition_off = false; @@ -3192,7 +3134,7 @@ void ApplicationManagerImpl::UnregisterAllApplications() { void ApplicationManagerImpl::RemoveAppsWaitingForRegistration( const connection_handler::DeviceHandle handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DevicePredicate device_finder(handle); apps_to_register_list_lock_ptr_->Acquire(); std::vector<ApplicationSharedPtr> apps_to_remove; @@ -3206,8 +3148,7 @@ void ApplicationManagerImpl::RemoveAppsWaitingForRegistration( const bool is_app_enabled = helpers::in_range(enabled_local_apps, app->policy_app_id()); if (!is_app_enabled) { - LOG4CXX_DEBUG(logger_, - "Waiting app: " << app->name().c_str() << " is removed."); + SDL_LOG_DEBUG("Waiting app: " << app->name().c_str() << " is removed."); apps_to_register_.erase(app); } } @@ -3220,8 +3161,7 @@ void ApplicationManagerImpl::UnregisterApplication( mobile_apis::Result::eType reason, bool is_resuming, bool is_unexpected_disconnect) { - LOG4CXX_DEBUG(logger_, - "app_id = " << app_id << "; reason = " << reason + SDL_LOG_DEBUG("app_id = " << app_id << "; reason = " << reason << "; is_resuming = " << is_resuming << "; is_unexpected_disconnect = " << is_unexpected_disconnect); @@ -3231,7 +3171,7 @@ void ApplicationManagerImpl::UnregisterApplication( if (IsAppSubscribedForWayPoints(app_id)) { UnsubscribeAppFromWayPoints(app_id); if (!IsAnyAppSubscribedForWayPoints()) { - LOG4CXX_ERROR(logger_, "Send UnsubscribeWayPoints"); + SDL_LOG_ERROR("Send UnsubscribeWayPoints"); MessageHelper::SendUnsubscribedWayPoints(*this); } } @@ -3265,8 +3205,7 @@ void ApplicationManagerImpl::UnregisterApplication( if (app_ptr) { app_ptr->usage_report().RecordRemovalsForBadBehavior(); if (reason == mobile_apis::Result::TOO_MANY_PENDING_REQUESTS) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "INSERT: " << GetHashedAppID(app_id, app_ptr->policy_app_id())); forbidden_applications.insert( GetHashedAppID(app_id, app_ptr->policy_app_id())); @@ -3275,7 +3214,7 @@ void ApplicationManagerImpl::UnregisterApplication( break; } default: { - LOG4CXX_ERROR(logger_, "Unknown unregister reason " << reason); + SDL_LOG_ERROR("Unknown unregister reason " << reason); break; } } @@ -3294,11 +3233,11 @@ void ApplicationManagerImpl::UnregisterApplication( } } if (!app_to_remove) { - LOG4CXX_ERROR(logger_, "Cant find application with app_id = " << app_id); + SDL_LOG_ERROR("Cant find application with app_id = " << app_id); // Just to terminate RAI in case of connection is dropped (rare case) // App won't be unregistered since RAI has not been started yet - LOG4CXX_DEBUG(logger_, "Trying to terminate possible RAI request."); + SDL_LOG_DEBUG("Trying to terminate possible RAI request."); request_ctrl_.terminateAppRequests(app_id); return; @@ -3318,8 +3257,7 @@ void ApplicationManagerImpl::UnregisterApplication( AppV4DevicePredicate finder(handle); ApplicationSharedPtr app = FindApp(applications(), finder); if (!app) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "There is no more SDL4 apps with device handle: " << handle); RemoveAppsWaitingForRegistration(handle); @@ -3332,9 +3270,9 @@ void ApplicationManagerImpl::UnregisterApplication( const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps(); if (helpers::in_range(enabled_local_apps, app_to_remove->policy_app_id())) { - LOG4CXX_DEBUG(logger_, - "Enabled local app has been unregistered. Re-create " - "pending application"); + SDL_LOG_DEBUG( + "Enabled local app has been unregistered. Re-create " + "pending application"); CreatePendingLocalApplication(app_to_remove->policy_app_id()); } @@ -3373,7 +3311,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( const std::string& function_id, const RPCParams& rpc_params, CommandParametersPermissions* params_permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO(AOleynik): Remove check of policy_enable, when this flag will be // unused in config file if (!GetPolicyHandler().PolicyEnabled()) { @@ -3408,7 +3346,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( MessageHelper::StringifiedHMILevel(app->hmi_level(window_id)); #endif // ENABLE_LOG if (result.hmi_level_permitted != policy::kRpcAllowed) { - LOG4CXX_WARN(logger_, "Request is blocked by policies. " << log_msg); + SDL_LOG_WARN("Request is blocked by policies. " << log_msg); app->usage_report().RecordPolicyRejectedRpcCall(); @@ -3421,7 +3359,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions( return mobile_apis::Result::INVALID_ENUM; } } - LOG4CXX_DEBUG(logger_, "Request is allowed by policies. " << log_msg); + SDL_LOG_DEBUG("Request is allowed by policies. " << log_msg); return mobile_api::Result::SUCCESS; } @@ -3435,7 +3373,7 @@ bool ApplicationManagerImpl::is_audio_pass_thru_active() const { } void ApplicationManagerImpl::OnLowVoltage() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_low_voltage_ = true; resume_ctrl_->SaveLowVoltageTime(); resume_ctrl_->StopSavePersistentDataTimer(); @@ -3443,12 +3381,12 @@ void ApplicationManagerImpl::OnLowVoltage() { } bool ApplicationManagerImpl::IsLowVoltage() const { - LOG4CXX_TRACE(logger_, "Result: " << is_low_voltage_); + SDL_LOG_TRACE("Result: " << is_low_voltage_); return is_low_voltage_; } void ApplicationManagerImpl::OnWakeUp() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resume_ctrl_->SaveWakeUpTime(); resume_ctrl_->StartSavePersistentDataTimer(); request_ctrl_.OnWakeUp(); @@ -3469,7 +3407,7 @@ std::string ApplicationManagerImpl::GetHashedAppID( bool ApplicationManagerImpl::HMIStateAllowsStreaming( uint32_t app_id, protocol_handler::ServiceType service_type) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis::HMILevel; using namespace mobile_apis::PredefinedWindows; using namespace mobile_apis::VideoStreamingState; @@ -3477,7 +3415,7 @@ bool ApplicationManagerImpl::HMIStateAllowsStreaming( ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_WARN(logger_, "An application is not registered."); + SDL_LOG_WARN("An application is not registered."); return false; } @@ -3494,11 +3432,11 @@ bool ApplicationManagerImpl::HMIStateAllowsStreaming( bool ApplicationManagerImpl::CanAppStream( uint32_t app_id, protocol_handler::ServiceType service_type) const { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_WARN(logger_, "An application is not registered."); + SDL_LOG_WARN("An application is not registered."); return false; } @@ -3508,7 +3446,7 @@ bool ApplicationManagerImpl::CanAppStream( } else if (ServiceType::kAudio == service_type) { is_allowed = app->audio_streaming_allowed(); } else { - LOG4CXX_WARN(logger_, "Unsupported service_type " << service_type); + SDL_LOG_WARN("Unsupported service_type " << service_type); } return HMIStateAllowsStreaming(app_id, service_type) && is_allowed; @@ -3518,12 +3456,11 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) { using namespace mobile_apis::AppInterfaceUnregisteredReason; using namespace mobile_apis::Result; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "There is no navi or projection application with id: " << app_id); return; } @@ -3568,12 +3505,11 @@ void ApplicationManagerImpl::ForbidStreaming( using namespace mobile_apis::Result; using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "There is no navi or projection application with id: " << app_id); return; } @@ -3613,12 +3549,12 @@ void ApplicationManagerImpl::ForbidStreaming( if (ServiceType::kMobileNav == service_type && app->video_streaming_allowed()) { - LOG4CXX_DEBUG(logger_, "Video streaming is still allowed"); + SDL_LOG_DEBUG("Video streaming is still allowed"); return; } if (ServiceType::kAudio == service_type && app->audio_streaming_allowed()) { - LOG4CXX_DEBUG(logger_, "Audio streaming is still allowed"); + SDL_LOG_DEBUG("Audio streaming is still allowed"); return; } @@ -3627,12 +3563,11 @@ void ApplicationManagerImpl::ForbidStreaming( void ApplicationManagerImpl::OnAppStreaming( uint32_t app_id, protocol_handler::ServiceType service_type, bool state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( " There is no navi or projection application with id: " << app_id); return; } @@ -3649,12 +3584,11 @@ void ApplicationManagerImpl::OnAppStreaming( void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "There is no navi or projection application with id: " << app_id); return; } @@ -3666,7 +3600,7 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); if (navi_service_status_.end() == it) { - LOG4CXX_ERROR(logger_, "No info about navi servicies for app"); + SDL_LOG_ERROR("No info about navi servicies for app"); return; } end_video = it->second.first; @@ -3675,12 +3609,12 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { if (connection_handler_) { if (end_video) { - LOG4CXX_DEBUG(logger_, "Going to end video service"); + SDL_LOG_DEBUG("Going to end video service"); connection_handler().SendEndService(app_id, ServiceType::kMobileNav); app->StopStreamingForce(ServiceType::kMobileNav); } if (end_audio) { - LOG4CXX_DEBUG(logger_, "Going to end audio service"); + SDL_LOG_DEBUG("Going to end audio service"); connection_handler().SendEndService(app_id, ServiceType::kAudio); app->StopStreamingForce(ServiceType::kAudio); } @@ -3706,17 +3640,17 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { void ApplicationManagerImpl::OnHMIStateChanged(const uint32_t app_id, const HmiStatePtr from, const HmiStatePtr to) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessPostponedMessages(app_id); ProcessApp(app_id, from, to); } void ApplicationManagerImpl::ProcessPostponedMessages(const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_WARN(logger_, "The app with id: " << app_id << " does not exist"); + SDL_LOG_WARN("The app with id: " << app_id << " does not exist"); return; } MobileMessageQueue messages; @@ -3744,7 +3678,7 @@ void ApplicationManagerImpl::ProcessOnDataStreamingNotification( const protocol_handler::ServiceType service_type, const uint32_t app_id, const bool streaming_data_available) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool should_send_notification = false; @@ -3754,23 +3688,21 @@ void ApplicationManagerImpl::ProcessOnDataStreamingNotification( should_send_notification = active_services.empty(); if (streaming_data_available) { active_services.insert(app_id); - LOG4CXX_DEBUG(logger_, - "Streaming session with id " - << app_id << " for service " - << static_cast<uint32_t>(service_type) - << " was added. Currently streaming sessions count: " - << active_services.size()); + SDL_LOG_DEBUG("Streaming session with id " + << app_id << " for service " + << static_cast<uint32_t>(service_type) + << " was added. Currently streaming sessions count: " + << active_services.size()); } else { active_services.erase(app_id); should_send_notification = !should_send_notification && active_services.empty(); - LOG4CXX_DEBUG(logger_, - "Streaming session with id " - << app_id << " for service " - << static_cast<uint32_t>(service_type) - << " was removed. Currently streaming sessions count: " - << active_services.size()); + SDL_LOG_DEBUG("Streaming session with id " + << app_id << " for service " + << static_cast<uint32_t>(service_type) + << " was removed. Currently streaming sessions count: " + << active_services.size()); } } @@ -3789,7 +3721,7 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, ApplicationSharedPtr app = application(app_id); if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - LOG4CXX_ERROR(logger_, "Navi/Projection application not found"); + SDL_LOG_ERROR("Navi/Projection application not found"); return; } @@ -3800,7 +3732,7 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, if (hmi_level_from == hmi_level_to && streaming_state_from == streaming_state_to) { - LOG4CXX_TRACE(logger_, "HMILevel && streaming state were not changed"); + SDL_LOG_TRACE("HMILevel && streaming state were not changed"); return; } @@ -3817,11 +3749,10 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, full_or_limited_hmi_level(hmi_level_to) && STREAMABLE == streaming_state_to; if (allow_streaming_by_streaming_state || allow_streaming_by_hmi_level) { - LOG4CXX_TRACE(logger_, - "Allow streaming by streaming state: " - << std::boolalpha << allow_streaming_by_streaming_state - << "; by hmi level: " << std::boolalpha - << allow_streaming_by_hmi_level); + SDL_LOG_TRACE("Allow streaming by streaming state: " + << std::boolalpha << allow_streaming_by_streaming_state + << "; by hmi level: " << std::boolalpha + << allow_streaming_by_hmi_level); AllowStreaming(app_id); return; } @@ -3834,11 +3765,10 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, full_or_limited_hmi_level(hmi_level_from) && HMI_BACKGROUND == hmi_level_to; if (end_streaming_by_streaming_state || start_timer_by_hmi_level) { - LOG4CXX_TRACE(logger_, - "Start EndStream timer by streaming state: " - << std::boolalpha << end_streaming_by_streaming_state - << "; by hmi level: " << std::boolalpha - << start_timer_by_hmi_level); + SDL_LOG_TRACE("Start EndStream timer by streaming state: " + << std::boolalpha << end_streaming_by_streaming_state + << "; by hmi level: " << std::boolalpha + << start_timer_by_hmi_level); StartEndStreamTimer(app_id); return; } @@ -3846,18 +3776,17 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, const bool end_streaming_by_hmi_level = full_or_limited_hmi_level(hmi_level_from) && HMI_NONE == hmi_level_to; if (end_streaming_by_hmi_level) { - LOG4CXX_TRACE(logger_, - "End streaming services by hmi level: " - << std::boolalpha << end_streaming_by_hmi_level); + SDL_LOG_TRACE("End streaming services by hmi level: " + << std::boolalpha << end_streaming_by_hmi_level); EndNaviServices(app_id); return; } - LOG4CXX_TRACE(logger_, "No actions required for app " << app_id); + SDL_LOG_TRACE("No actions required for app " << app_id); } void ApplicationManagerImpl::StartEndStreamTimer(const uint32_t app_id) { - LOG4CXX_DEBUG(logger_, "Start end stream timer for app " << app_id); + SDL_LOG_DEBUG("Start end stream timer for app " << app_id); navi_app_to_end_stream_.push_back(app_id); TimerSPtr end_stream_timer(std::make_shared<timer::Timer>( "DisallowAppStreamTimer", @@ -3870,7 +3799,7 @@ void ApplicationManagerImpl::StartEndStreamTimer(const uint32_t app_id) { } void ApplicationManagerImpl::ClearTimerPool() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock lock(close_app_timer_pool_lock_); @@ -3892,7 +3821,7 @@ void ApplicationManagerImpl::ClearTimerPool() { } void ApplicationManagerImpl::CloseNaviApp() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis::AppInterfaceUnregisteredReason; using namespace mobile_apis::Result; uint32_t app_id; @@ -3917,8 +3846,7 @@ void ApplicationManagerImpl::CloseNaviApp() { } } if (unregister) { - LOG4CXX_INFO(logger_, - "App haven't answered for EndService. Unregister it."); + SDL_LOG_INFO("App haven't answered for EndService. Unregister it."); rpc_service_->ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( app_id, PROTOCOL_VIOLATION), @@ -3928,7 +3856,7 @@ void ApplicationManagerImpl::CloseNaviApp() { } void ApplicationManagerImpl::EndNaviStreaming() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis::AppInterfaceUnregisteredReason; using namespace mobile_apis::Result; @@ -3949,11 +3877,11 @@ void ApplicationManagerImpl::EndNaviStreaming() { void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - LOG4CXX_ERROR(logger_, "Navi/Projection application not found"); + SDL_LOG_ERROR("Navi/Projection application not found"); return; } @@ -3974,11 +3902,11 @@ void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) { void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application(app_id); if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - LOG4CXX_ERROR(logger_, "Navi/Projection application not found"); + SDL_LOG_ERROR("Navi/Projection application not found"); return; } @@ -4006,7 +3934,7 @@ bool ApplicationManagerImpl::IsApplicationForbidden( bool ApplicationManagerImpl::IsAppInReconnectMode( const connection_handler::DeviceHandle& device_id, const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(reregister_wait_list_lock_ptr_); return reregister_wait_list_.end() != std::find_if(reregister_wait_list_.begin(), @@ -4024,12 +3952,11 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( const std::string& file_path, const std::string& file_name, const uint64_t offset) { - LOG4CXX_DEBUG(logger_, - "SaveBinaryWithOffset binary_size = " - << binary_data.size() << " offset = " << offset); + SDL_LOG_DEBUG("SaveBinaryWithOffset binary_size = " + << binary_data.size() << " offset = " << offset); if (binary_data.size() > file_system::GetAvailableDiskSpace(file_path)) { - LOG4CXX_ERROR(logger_, "Out of free disc space."); + SDL_LOG_ERROR("Out of free disc space."); return mobile_apis::Result::OUT_OF_MEMORY; } @@ -4038,15 +3965,13 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( std::ofstream* file_stream; if (offset != 0) { if (file_size != offset) { - LOG4CXX_DEBUG(logger_, - "ApplicationManagerImpl::SaveBinaryWithOffset offset" - << " does'n match existing file size"); + SDL_LOG_DEBUG("ApplicationManagerImpl::SaveBinaryWithOffset offset" + << " does'n match existing file size"); return mobile_apis::Result::INVALID_DATA; } file_stream = file_system::Open(full_file_path, std::ios_base::app); } else { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "ApplicationManagerImpl::SaveBinaryWithOffset offset is 0, rewrite"); // if offset == 0: rewrite file file_stream = file_system::Open(full_file_path, std::ios_base::out); @@ -4063,7 +3988,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary( file_system::Close(file_stream); delete file_stream; file_stream = NULL; - LOG4CXX_INFO(logger_, "Successfully write data to file"); + SDL_LOG_INFO("Successfully write data to file"); return mobile_apis::Result::SUCCESS; } @@ -4104,7 +4029,7 @@ void ApplicationManagerImpl::SetHMICooperating(const bool hmi_cooperating) { } void ApplicationManagerImpl::OnApplicationListUpdateTimer() { - LOG4CXX_DEBUG(logger_, "Application list update timer finished"); + SDL_LOG_DEBUG("Application list update timer finished"); const bool is_new_app_registered = registered_during_timer_execution_; registered_during_timer_execution_ = false; @@ -4138,8 +4063,7 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() { } if (!app_list.empty()) { for (uint32_t i = 0; i < app_list.size(); ++i) { - LOG4CXX_INFO(logger_, - "Send TTS GlobalProperties to HMI with default helpPrompt"); + SDL_LOG_INFO("Send TTS GlobalProperties to HMI with default helpPrompt"); MessageHelper::SendTTSGlobalProperties( application(app_list[i]), true, *this); RemoveAppFromTTSGlobalPropertiesList(app_list[i]); @@ -4149,7 +4073,7 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() { void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList( const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint16_t timeout = get_settings().tts_global_properties_timeout(); date_time::TimeDuration current_time = date_time::getCurrentTime(); current_time += date_time::seconds(timeout); @@ -4161,7 +4085,7 @@ void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList( } // if add first item need to start timer on one second if (1 == tts_global_properties_app_list_.size()) { - LOG4CXX_INFO(logger_, "Start tts_global_properties_timer_"); + SDL_LOG_INFO("Start tts_global_properties_timer_"); tts_global_properties_app_list_lock_.Release(); const uint32_t timeout_ms = 1000; tts_global_properties_timer_.Start(timeout_ms, timer::kSingleShot); @@ -4172,7 +4096,7 @@ void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList( void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList( const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // please avoid AutoLock usage to avoid deadlock tts_global_properties_app_list_lock_.Acquire(); std::map<uint32_t, date_time::TimeDuration>::iterator it = @@ -4180,7 +4104,7 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList( if (tts_global_properties_app_list_.end() != it) { tts_global_properties_app_list_.erase(it); if (tts_global_properties_app_list_.empty()) { - LOG4CXX_DEBUG(logger_, "Stop tts_global_properties_timer_"); + SDL_LOG_DEBUG("Stop tts_global_properties_timer_"); // if container is empty need to stop timer tts_global_properties_app_list_lock_.Release(); tts_global_properties_timer_.Stop(); @@ -4192,7 +4116,7 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList( mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType( std::string str) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if ("DEFAULT" == str) { return mobile_apis::AppHMIType::DEFAULT; } else if ("COMMUNICATION" == str) { @@ -4222,7 +4146,7 @@ mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType( const std::string ApplicationManagerImpl::AppHMITypeToString( mobile_apis::AppHMIType::eType type) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); switch (type) { case mobile_apis::AppHMIType::DEFAULT: return "DEFAULT"; @@ -4256,7 +4180,7 @@ const std::string ApplicationManagerImpl::AppHMITypeToString( bool ApplicationManagerImpl::CompareAppHMIType( const smart_objects::SmartObject& from_policy, const smart_objects::SmartObject& from_application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool equal = false; uint32_t lenght_policy_app_types = from_policy.length(); uint32_t lenght_application_app_types = from_application.length(); @@ -4278,7 +4202,7 @@ bool ApplicationManagerImpl::CompareAppHMIType( void ApplicationManagerImpl::OnUpdateHMIAppType( std::map<std::string, std::vector<std::string> > app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::map<std::string, std::vector<std::string> >::iterator it_app_hmi_types_from_policy; @@ -4343,9 +4267,9 @@ void ApplicationManagerImpl::OnUpdateHMIAppType( void ApplicationManagerImpl::EraseAppFromReconnectionList( const ApplicationSharedPtr& app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app) { - LOG4CXX_WARN(logger_, "Application is not valid."); + SDL_LOG_WARN("Application is not valid."); return; } @@ -4362,7 +4286,7 @@ void ApplicationManagerImpl::EraseAppFromReconnectionList( void ApplicationManagerImpl::ProcessReconnection( ApplicationSharedPtr application, const uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); connection_handler::DeviceHandle new_device_id = 0; @@ -4384,7 +4308,7 @@ void ApplicationManagerImpl::ProcessReconnection( } void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ptu_result) { protocol_handler_->ProcessFailedPTU(); return; @@ -4407,29 +4331,29 @@ void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) { #if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) void ApplicationManagerImpl::OnCertDecryptFinished(const bool decrypt_result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!decrypt_result) { protocol_handler_->ProcessFailedCertDecrypt(); } } bool ApplicationManagerImpl::OnCertDecryptFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return false; } #endif void ApplicationManagerImpl::OnPTUTimeoutExceeded() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); protocol_handler_->ProcessFailedPTU(); } void ApplicationManagerImpl::SendDriverDistractionState( ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (hmi_apis::Common_DriverDistractionState::INVALID_ENUM == driver_distraction_state()) { - LOG4CXX_WARN(logger_, "DriverDistractionState is INVALID_ENUM"); + SDL_LOG_WARN("DriverDistractionState is INVALID_ENUM"); return; } @@ -4503,7 +4427,7 @@ void ApplicationManagerImpl::SendDriverDistractionState( void ApplicationManagerImpl::SendGetIconUrlNotifications( const uint32_t connection_key, ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<std::string> enabled_apps; GetPolicyHandler().GetEnabledCloudApps(enabled_apps); std::vector<std::string>::iterator enabled_it = enabled_apps.begin(); @@ -4512,7 +4436,7 @@ void ApplicationManagerImpl::SendGetIconUrlNotifications( for (; enabled_it != enabled_end; ++enabled_it) { auto app_icon_it = app_icon_map_.find(*enabled_it); if (app_icon_it == app_icon_map_.end()) { - LOG4CXX_WARN(logger_, "Could not find cloud app in icon map"); + SDL_LOG_WARN("Could not find cloud app in icon map"); continue; } @@ -4520,18 +4444,18 @@ void ApplicationManagerImpl::SendGetIconUrlNotifications( bool pending_request = app_icon_it->second.pending_request; if (pending_request) { - LOG4CXX_DEBUG(logger_, "Cloud app has already sent request"); + SDL_LOG_DEBUG("Cloud app has already sent request"); continue; } std::string url = GetPolicyHandler().GetIconUrl(*enabled_it); if (url.empty()) { - LOG4CXX_DEBUG(logger_, "No Icon Url for cloud app"); + SDL_LOG_DEBUG("No Icon Url for cloud app"); continue; } - LOG4CXX_DEBUG(logger_, "Creating Get Icon Request"); + SDL_LOG_DEBUG("Creating Get Icon Request"); smart_objects::SmartObjectSPtr message = std::make_shared<smart_objects::SmartObject>( @@ -4555,24 +4479,23 @@ void ApplicationManagerImpl::SendGetIconUrlNotifications( protocol_handler::MajorProtocolVersion ApplicationManagerImpl::SupportedSDLVersion() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return static_cast<protocol_handler::MajorProtocolVersion>( get_settings().max_supported_protocol_version()); } void ApplicationManagerImpl::AddAppToRegisteredAppList( const ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); sync_primitives::AutoLock lock(applications_list_lock_ptr_); // Add application to registered app list and set appropriate mark. application->MarkRegistered(); applications_.insert(application); - LOG4CXX_DEBUG( - logger_, - "App with app_id: " << application->app_id() - << " has been added to registered applications list"); + SDL_LOG_DEBUG("App with app_id: " + << application->app_id() + << " has been added to registered applications list"); if (application_list_update_timer_.is_running() && !registered_during_timer_execution_) { GetPolicyHandler().OnAddedNewApplicationToAppList( @@ -4584,7 +4507,7 @@ void ApplicationManagerImpl::AddAppToRegisteredAppList( void ApplicationManagerImpl::ApplyFunctorForEachPlugin( std::function<void(plugin_manager::RPCPlugin&)> functor) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); plugin_manager_->ForEachPlugin(functor); } @@ -4609,16 +4532,14 @@ bool ApplicationManagerImpl::InitDirectory( const std::string& path, ApplicationManagerImpl::DirectoryType type) const { const std::string directory_type = DirectoryTypeToString(type); if (!file_system::DirectoryExists(path)) { - LOG4CXX_WARN(logger_, directory_type << " directory doesn't exist."); + SDL_LOG_WARN(directory_type << " directory doesn't exist."); // if storage directory doesn't exist try to create it if (!file_system::CreateDirectoryRecursively(path)) { - LOG4CXX_ERROR( - logger_, - "Unable to create " << directory_type << " directory " << path); + SDL_LOG_ERROR("Unable to create " << directory_type << " directory " + << path); return false; } - LOG4CXX_DEBUG(logger_, - directory_type << " directory has been created: " << path); + SDL_LOG_DEBUG(directory_type << " directory has been created: " << path); } return true; @@ -4629,31 +4550,28 @@ bool ApplicationManagerImpl::IsReadWriteAllowed(const std::string& path, const std::string directory_type = DirectoryTypeToString(type); if (!(file_system::IsWritingAllowed(path) && file_system::IsReadingAllowed(path))) { - LOG4CXX_ERROR( - logger_, - directory_type << " directory doesn't have read/write permissions."); + SDL_LOG_ERROR(directory_type + << " directory doesn't have read/write permissions."); return false; } - LOG4CXX_DEBUG(logger_, - directory_type << " directory has read/write permissions."); + SDL_LOG_DEBUG(directory_type << " directory has read/write permissions."); return true; } void ApplicationManagerImpl::ClearTTSGlobalPropertiesList() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_); tts_global_properties_app_list_.clear(); } bool ApplicationManagerImpl::IsAppSubscribedForWayPoints( uint32_t app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - LOG4CXX_DEBUG(logger_, - "There are applications subscribed: " - << subscribed_way_points_apps_list_.size()); + SDL_LOG_DEBUG("There are applications subscribed: " + << subscribed_way_points_apps_list_.size()); if (subscribed_way_points_apps_list_.find(app_id) == subscribed_way_points_apps_list_.end()) { return false; @@ -4667,13 +4585,12 @@ bool ApplicationManagerImpl::IsAppSubscribedForWayPoints( } void ApplicationManagerImpl::SubscribeAppForWayPoints(uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - LOG4CXX_DEBUG(logger_, "Subscribing " << app_id); + SDL_LOG_DEBUG("Subscribing " << app_id); subscribed_way_points_apps_list_.insert(app_id); - LOG4CXX_DEBUG(logger_, - "There are applications subscribed: " - << subscribed_way_points_apps_list_.size()); + SDL_LOG_DEBUG("There are applications subscribed: " + << subscribed_way_points_apps_list_.size()); if (way_points_data_) { smart_objects::SmartObjectSPtr way_point_notification_ = std::make_shared<smart_objects::SmartObject>(*way_points_data_); @@ -4689,13 +4606,12 @@ void ApplicationManagerImpl::SubscribeAppForWayPoints( } void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - LOG4CXX_DEBUG(logger_, "Unsubscribing " << app_id); + SDL_LOG_DEBUG("Unsubscribing " << app_id); subscribed_way_points_apps_list_.erase(app_id); - LOG4CXX_DEBUG(logger_, - "There are applications subscribed: " - << subscribed_way_points_apps_list_.size()); + SDL_LOG_DEBUG("There are applications subscribed: " + << subscribed_way_points_apps_list_.size()); if (subscribed_way_points_apps_list_.empty()) { way_points_data_.reset(); } @@ -4707,11 +4623,10 @@ void ApplicationManagerImpl::UnsubscribeAppFromWayPoints( } bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - LOG4CXX_DEBUG(logger_, - "There are applications subscribed: " - << subscribed_way_points_apps_list_.size()); + SDL_LOG_DEBUG("There are applications subscribed: " + << subscribed_way_points_apps_list_.size()); return !subscribed_way_points_apps_list_.empty(); } @@ -4723,7 +4638,7 @@ void ApplicationManagerImpl::SaveWayPointsMessage( const std::set<uint32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); return subscribed_way_points_apps_list_; } @@ -4731,7 +4646,7 @@ const std::set<uint32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints() // retrieve transport type string used in .ini file, e.g. "TCP_WIFI" const std::string ApplicationManagerImpl::GetTransportTypeProfileString( connection_handler::DeviceHandle device_handle) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return connection_handler() .get_session_observer() @@ -4830,7 +4745,7 @@ bool ApplicationManagerImpl::IsSOStructValid( return display_capabilities_so.isValid(); } - LOG4CXX_ERROR(logger_, "Could not find struct id: " << struct_id); + SDL_LOG_ERROR("Could not find struct id: " << struct_id); return false; } @@ -4880,7 +4795,7 @@ ApplicationSharedPtr ApplicationManagerImpl::application( const std::string& device_id, const std::string& policy_app_id) const { connection_handler::DeviceHandle device_handle; if (!connection_handler().GetDeviceID(device_id, &device_handle)) { - LOG4CXX_DEBUG(logger_, "No such device : " << device_id); + SDL_LOG_DEBUG("No such device : " << device_id); return ApplicationSharedPtr(); } @@ -4888,8 +4803,7 @@ ApplicationSharedPtr ApplicationManagerImpl::application( ApplicationSharedPtr app = FindApp(accessor, IsApplication(device_handle, policy_app_id)); - LOG4CXX_DEBUG(logger_, - " policy_app_id << " << policy_app_id << "Found = " << app); + SDL_LOG_DEBUG(" policy_app_id << " << policy_app_id << "Found = " << app); return app; } @@ -4907,11 +4821,11 @@ std::vector<std::string> ApplicationManagerImpl::devices( void ApplicationManagerImpl::ChangeAppsHMILevel( uint32_t app_id, mobile_apis::HMILevel::eType level) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "AppID to change: " << app_id << " -> " << level); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("AppID to change: " << app_id << " -> " << level); ApplicationSharedPtr app = application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "There is no app with id: " << app_id); + SDL_LOG_ERROR("There is no app with id: " << app_id); return; } @@ -4928,7 +4842,7 @@ void ApplicationManagerImpl::ChangeAppsHMILevel( old_hmi_state->system_context()); OnHMIStateChanged(app_id, old_hmi_state, new_hmi_state); } else { - LOG4CXX_WARN(logger_, "Redundant changing HMI level: " << level); + SDL_LOG_WARN("Redundant changing HMI level: " << level); } } diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc index 6ed784424a..6b440fad89 100644 --- a/src/components/application_manager/src/application_state.cc +++ b/src/components/application_manager/src/application_state.cc @@ -52,17 +52,16 @@ struct StateIDComparator { namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("ApplicationManager") ApplicationState::ApplicationState() {} void ApplicationState::InitState(const WindowID window_id, const std::string& window_name, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); - LOG4CXX_DEBUG(logger_, - "Initing state " << state << " for window " << window_id + SDL_LOG_DEBUG("Initing state " << state << " for window " << window_id << " with name " << window_name); { sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); @@ -72,7 +71,7 @@ void ApplicationState::InitState(const WindowID window_id, } void ApplicationState::AddState(const WindowID window_id, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); switch (state->state_id()) { case HmiState::StateID::STATE_ID_REGULAR: @@ -82,8 +81,7 @@ void ApplicationState::AddState(const WindowID window_id, HmiStatePtr state) { SetPostponedState(window_id, state); return; case HmiState::StateID::STATE_ID_CURRENT: - LOG4CXX_ERROR(logger_, - "State of type '" << state << "' can't be added for window " + SDL_LOG_ERROR("State of type '" << state << "' can't be added for window " << window_id); return; default: @@ -96,14 +94,13 @@ void ApplicationState::AddState(const WindowID window_id, HmiStatePtr state) { void ApplicationState::RemoveState(const WindowID window_id, HmiState::StateID state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); switch (state) { case HmiState::StateID::STATE_ID_CURRENT: case HmiState::StateID::STATE_ID_REGULAR: if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) { - LOG4CXX_ERROR(logger_, - "State of type '" << state + SDL_LOG_ERROR("State of type '" << state << "' can't be removed for window " << window_id); return; @@ -124,20 +121,19 @@ HmiStatePtr ApplicationState::GetState(const WindowID window_id, HmiState::StateID state_id) const { switch (state_id) { case HmiState::StateID::STATE_ID_REGULAR: - LOG4CXX_DEBUG(logger_, "Getting regular state for window " << window_id); + SDL_LOG_DEBUG("Getting regular state for window " << window_id); return RegularHmiState(window_id); case HmiState::StateID::STATE_ID_POSTPONED: - LOG4CXX_DEBUG(logger_, - "Getting postponed state for window " << window_id); + SDL_LOG_DEBUG("Getting postponed state for window " << window_id); return PostponedHmiState(window_id); default: - LOG4CXX_DEBUG(logger_, "Getting current state for window " << window_id); + SDL_LOG_DEBUG("Getting current state for window " << window_id); return CurrentHmiState(window_id); } } HmiStates ApplicationState::GetStates(const HmiState::StateID state_id) const { - LOG4CXX_DEBUG(logger_, "Collecting all states of type " << state_id); + SDL_LOG_DEBUG("Collecting all states of type " << state_id); HmiStates hmi_states; sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); @@ -149,7 +145,7 @@ HmiStates ApplicationState::GetStates(const HmiState::StateID state_id) const { } WindowIds ApplicationState::GetWindowIds() const { - LOG4CXX_DEBUG(logger_, "Collecting available window ID's"); + SDL_LOG_DEBUG("Collecting available window ID's"); WindowIds window_ids; std::string stringified_window_ids; @@ -161,14 +157,13 @@ WindowIds ApplicationState::GetWindowIds() const { std::to_string(hmi_state_pair.first); } - LOG4CXX_DEBUG(logger_, - "Existing window IDs: [" + stringified_window_ids + "]"); + SDL_LOG_DEBUG("Existing window IDs: [" + stringified_window_ids + "]"); return window_ids; } void ApplicationState::AddHMIState(const WindowID window_id, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); HmiStates& hmi_states = hmi_states_map_[window_id]; @@ -176,11 +171,9 @@ void ApplicationState::AddHMIState(const WindowID window_id, hmi_states.end(), StateIDComparator(state->state_id())); if (hmi_states.end() != it) { - LOG4CXX_WARN(logger_, - "Hmi state with ID " << state->state_id() - << "has been already applied for window " - << window_id - << " of this application. Ignoring"); + SDL_LOG_WARN("Hmi state with ID " + << state->state_id() << "has been already applied for window " + << window_id << " of this application. Ignoring"); return; } @@ -189,14 +182,13 @@ void ApplicationState::AddHMIState(const WindowID window_id, void ApplicationState::RemoveHMIState(const WindowID window_id, HmiState::StateID state_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); HmiStates& hmi_states = hmi_states_map_[window_id]; HmiStates::iterator it = std::find_if( hmi_states.begin(), hmi_states.end(), StateIDComparator(state_id)); if (hmi_states.end() == it) { - LOG4CXX_ERROR(logger_, - "Unsuccesful remove HmiState: " << state_id << " for window " + SDL_LOG_ERROR("Unsuccesful remove HmiState: " << state_id << " for window " << window_id); return; } @@ -218,12 +210,11 @@ void ApplicationState::RemoveHMIState(const WindowID window_id, } void ApplicationState::RemoveWindowHMIStates(const WindowID window_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id); - LOG4CXX_DEBUG(logger_, - "Removing HMI states for window with id #" << window_id); + SDL_LOG_DEBUG("Removing HMI states for window with id #" << window_id); { sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); hmi_states_map_.erase(window_id); @@ -231,7 +222,7 @@ void ApplicationState::RemoveWindowHMIStates(const WindowID window_id) { } void ApplicationState::RemovePostponedState(const WindowID window_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(hmi_states_map_lock_); HmiStates& hmi_states = hmi_states_map_[window_id]; DCHECK_OR_RETURN_VOID(!hmi_states.empty()); @@ -242,8 +233,7 @@ void ApplicationState::RemovePostponedState(const WindowID window_id) { std::find_if(hmi_states.begin(), hmi_states.end(), finder); if (hmi_states.end() == postponed_state) { - LOG4CXX_ERROR(logger_, - "No postponed state is set for window " << window_id); + SDL_LOG_ERROR("No postponed state is set for window " << window_id); return; } @@ -252,7 +242,7 @@ void ApplicationState::RemovePostponedState(const WindowID window_id) { void ApplicationState::SetRegularState(const WindowID window_id, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::StateID::STATE_ID_REGULAR); @@ -285,7 +275,7 @@ void ApplicationState::SetRegularState(const WindowID window_id, void ApplicationState::SetPostponedState(const WindowID window_id, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::StateID::STATE_ID_POSTPONED); diff --git a/src/components/application_manager/src/command_holder_impl.cc b/src/components/application_manager/src/command_holder_impl.cc index 1c336ac64f..cfd782a80b 100644 --- a/src/components/application_manager/src/command_holder_impl.cc +++ b/src/components/application_manager/src/command_holder_impl.cc @@ -35,7 +35,7 @@ #include "application_manager/commands/command.h" namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("ApplicationManager") CommandHolderImpl::CommandHolderImpl(ApplicationManager& app_manager) : app_manager_(app_manager) {} @@ -45,33 +45,29 @@ void CommandHolderImpl::Suspend( CommandType type, commands::Command::CommandSource source, std::shared_ptr<smart_objects::SmartObject> command) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); - LOG4CXX_DEBUG(logger_, - "Suspending command(s) for application: " - << application->policy_app_id()); + SDL_LOG_DEBUG("Suspending command(s) for application: " + << application->policy_app_id()); AppCommandInfo info = {command, source}; sync_primitives::AutoLock lock(commands_lock_); if (CommandType::kHmiCommand == type) { app_hmi_commands_[application].push_back(info); - LOG4CXX_DEBUG(logger_, - "Suspended HMI command(s): " << app_hmi_commands_.size()); + SDL_LOG_DEBUG("Suspended HMI command(s): " << app_hmi_commands_.size()); } else { app_mobile_commands_[application].push_back(info); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Suspended mobile command(s): " << app_mobile_commands_.size()); } } void CommandHolderImpl::Resume(ApplicationSharedPtr application, CommandType type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Resuming command(s) for application: " << application->policy_app_id()); if (CommandType::kHmiCommand == type) { ResumeHmiCommand(application); @@ -81,24 +77,21 @@ void CommandHolderImpl::Resume(ApplicationSharedPtr application, } void CommandHolderImpl::Clear(ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Clearing command(s) for application: " << application->policy_app_id()); sync_primitives::AutoLock lock(commands_lock_); auto app_hmi_commands = app_hmi_commands_.find(application); if (app_hmi_commands_.end() != app_hmi_commands) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Clearing HMI command(s): " << app_hmi_commands->second.size()); app_hmi_commands_.erase(app_hmi_commands); } auto app_mobile_commands = app_mobile_commands_.find(application); if (app_mobile_commands_.end() != app_mobile_commands) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Clearing mobile command(s): " << app_mobile_commands->second.size()); app_mobile_commands_.erase(app_mobile_commands); } @@ -112,8 +105,7 @@ void CommandHolderImpl::ResumeHmiCommand(ApplicationSharedPtr application) { return; } - LOG4CXX_DEBUG(logger_, - "Resuming HMI command(s): " << app_hmi_commands_.size()); + SDL_LOG_DEBUG("Resuming HMI command(s): " << app_hmi_commands_.size()); for (auto cmd : app_commands->second) { (*cmd.command_ptr_)[strings::msg_params][strings::app_id] = @@ -133,8 +125,7 @@ void CommandHolderImpl::ResumeMobileCommand(ApplicationSharedPtr application) { return; } - LOG4CXX_DEBUG(logger_, - "Resuming mobile command(s): " << app_mobile_commands_.size()); + SDL_LOG_DEBUG("Resuming mobile command(s): " << app_mobile_commands_.size()); for (auto cmd : app_commands->second) { (*cmd.command_ptr_)[strings::params][strings::connection_key] = diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index 3872ae45ab..47659e52ca 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -49,7 +49,7 @@ struct AppExtensionPredicate { namespace commands { -CREATE_LOGGERPTR_LOCAL(CommandImpl::logger_, "Commands") +SDL_CREATE_LOG_VARIABLE("Commands") const int32_t CommandImpl::hmi_protocol_type_ = 1; const int32_t CommandImpl::mobile_protocol_type_ = 0; @@ -130,15 +130,15 @@ void CommandImpl::SetAllowedToTerminate(const bool allowed) { } bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "There is no registered application with " - "connection key '" - << connection_key() << "'"); + SDL_LOG_ERROR( + "There is no registered application with " + "connection key '" + << connection_key() << "'"); return false; } @@ -149,7 +149,7 @@ bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) { smart_objects::SmartMap::const_iterator iter_end = s_map.map_end(); for (; iter != iter_end; ++iter) { - LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first); + SDL_LOG_DEBUG("Request's param: " << iter->first); params.insert(iter->first); } @@ -199,7 +199,7 @@ bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) { } void CommandImpl::RemoveDisallowedParameters() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& params = (*message_)[strings::msg_params]; @@ -209,8 +209,7 @@ void CommandImpl::RemoveDisallowedParameters() { // Remove from request all disallowed parameters params.erase(key); removed_parameters_permissions_.disallowed_params.insert(key); - LOG4CXX_INFO(logger_, - "Following parameter is disallowed by user: " << key); + SDL_LOG_INFO("Following parameter is disallowed by user: " << key); } else if (removed_parameters_permissions_.undefined_params.end() != @@ -218,8 +217,7 @@ void CommandImpl::RemoveDisallowedParameters() { // Remove from request all undefined yet parameters params.erase(key); removed_parameters_permissions_.undefined_params.insert(key); - LOG4CXX_INFO(logger_, - "Following parameter is disallowed by policy: " << key); + SDL_LOG_INFO("Following parameter is disallowed by policy: " << key); } else if (parameters_permissions_.allowed_params.end() == @@ -227,27 +225,25 @@ void CommandImpl::RemoveDisallowedParameters() { // Remove from request all parameters missed in allowed params.erase(key); removed_parameters_permissions_.undefined_params.insert(key); - LOG4CXX_INFO(logger_, - "Following parameter is not found among allowed parameters '" - << key << "' and will be treated as disallowed."); + SDL_LOG_INFO("Following parameter is not found among allowed parameters '" + << key << "' and will be treated as disallowed."); } } } bool CommandImpl::ReplaceMobileWithHMIAppId( ns_smart_device_link::ns_smart_objects::SmartObject& message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (message.keyExists(strings::app_id)) { ApplicationSharedPtr application = application_manager_.application(message[strings::app_id].asUInt()); if (!application) { - LOG4CXX_ERROR(logger_, "Substitution mobile --> HMI id is failed."); + SDL_LOG_ERROR("Substitution mobile --> HMI id is failed."); return false; } - LOG4CXX_DEBUG(logger_, - "ReplaceMobileWithHMIAppId from " - << message[strings::app_id].asInt() << " to " - << application->hmi_app_id()); + SDL_LOG_DEBUG("ReplaceMobileWithHMIAppId from " + << message[strings::app_id].asInt() << " to " + << application->hmi_app_id()); message[strings::app_id] = application->hmi_app_id(); } else { switch (message.getType()) { @@ -287,13 +283,12 @@ bool CommandImpl::ReplaceHMIWithMobileAppId( message[strings::app_id].asUInt()); if (!application) { - LOG4CXX_ERROR(logger_, "Substitution HMI --> mobile id is failed."); + SDL_LOG_ERROR("Substitution HMI --> mobile id is failed."); return false; } - LOG4CXX_DEBUG(logger_, - "ReplaceHMIWithMobileAppId from " - << message[strings::app_id].asInt() << " to " - << application->app_id()); + SDL_LOG_DEBUG("ReplaceHMIWithMobileAppId from " + << message[strings::app_id].asInt() << " to " + << application->app_id()); message[strings::app_id] = application->app_id(); } else { switch (message.getType()) { @@ -326,7 +321,7 @@ bool CommandImpl::ReplaceHMIWithMobileAppId( uint32_t CommandImpl::CalcCommandInternalConsecutiveNumber( ApplicationConstSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const DataAccessor<CommandsMap> accessor = app->commands_map(); const CommandsMap& commands = accessor.GetData(); @@ -341,12 +336,12 @@ uint32_t CommandImpl::CalcCommandInternalConsecutiveNumber( bool CommandImpl::CheckSyntax(const std::string& str, bool allow_empty_line) const { if (std::string::npos != str.find_first_of("\t\n")) { - LOG4CXX_ERROR(logger_, "CheckSyntax failed! :" << str); + SDL_LOG_ERROR("CheckSyntax failed! :" << str); return false; } if (std::string::npos != str.find("\\n") || std::string::npos != str.find("\\t")) { - LOG4CXX_ERROR(logger_, "CheckSyntax failed! :" << str); + SDL_LOG_ERROR("CheckSyntax failed! :" << str); return false; } if (!allow_empty_line) { diff --git a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc index 46c1c87699..e978a49635 100644 --- a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc +++ b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc @@ -39,6 +39,8 @@ namespace application_manager { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + CommandNotificationFromMobileImpl::CommandNotificationFromMobileImpl( const MessageSharedPtr& message, ApplicationManager& application_manager, @@ -73,7 +75,7 @@ void CommandNotificationFromMobileImpl::SendNotification() { (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); - LOG4CXX_INFO(logger_, "SendNotification"); + SDL_LOG_INFO("SendNotification"); MessageHelper::PrintSmartObject(*message_); rpc_service_.SendMessageToMobile(message_); diff --git a/src/components/application_manager/src/commands/command_notification_impl.cc b/src/components/application_manager/src/commands/command_notification_impl.cc index 31bea114ec..13020828b1 100644 --- a/src/components/application_manager/src/commands/command_notification_impl.cc +++ b/src/components/application_manager/src/commands/command_notification_impl.cc @@ -39,6 +39,8 @@ namespace application_manager { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + CommandNotificationImpl::CommandNotificationImpl( const MessageSharedPtr& message, ApplicationManager& application_manager, @@ -69,9 +71,8 @@ void CommandNotificationImpl::SendNotification(const bool final_message) { (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); - LOG4CXX_INFO( - logger_, - "SendNotification: final_message = " << std::boolalpha << final_message); + SDL_LOG_INFO("SendNotification: final_message = " << std::boolalpha + << final_message); MessageHelper::PrintSmartObject(*message_); rpc_service_.SendMessageToMobile(message_, final_message); diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index e770a4e07f..938b7afc99 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -49,6 +49,8 @@ namespace application_manager { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands"); + std::string MergeInfos(const ResponseInfo& first_info, const std::string& first_str, const ResponseInfo& second_info, @@ -101,13 +103,10 @@ const std::string CreateInfoForUnsupportedResult( return "RC is not supported by system"; } default: -#ifdef ENABLE_LOG - CREATE_LOGGERPTR_LOCAL(logger, "Commands"); - LOG4CXX_WARN(logger, - "Could not create info because" - " interface isn't valid. Interface is:" - << static_cast<int32_t>(interface)); -#endif // ENABLE_LOG + SDL_LOG_WARN( + "Could not create info because" + " interface isn't valid. Interface is:" + << static_cast<int32_t>(interface)); return ""; } } @@ -232,7 +231,7 @@ bool CommandRequestImpl::CleanUp() { void CommandRequestImpl::Run() {} void CommandRequestImpl::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); unsubscribe_from_all_hmi_events(); unsubscribe_from_all_mobile_events(); @@ -240,7 +239,7 @@ void CommandRequestImpl::onTimeOut() { // FIXME (dchmerev@luxoft.com): atomic_xchg fits better sync_primitives::AutoLock auto_lock(state_lock_); if (kCompleted == current_state_) { - LOG4CXX_DEBUG(logger_, "current_state_ = kCompleted"); + SDL_LOG_DEBUG("current_state_ = kCompleted"); // don't send timeout if request completed return; } @@ -267,7 +266,7 @@ void CommandRequestImpl::SendResponse( const char* info, const smart_objects::SmartObject* response_params, const std::vector<uint8_t> binary_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock auto_lock(state_lock_); if (kTimedOut == current_state_) { @@ -355,7 +354,7 @@ smart_objects::SmartObject CreateUnsupportedResourceResponse( bool CommandRequestImpl::ProcessHMIInterfacesAvailability( const uint32_t hmi_correlation_id, const hmi_apis::FunctionID::eType& function_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); HmiInterfaces::InterfaceID interface = hmi_interfaces.GetInterfaceFromFunction(function_id); @@ -373,41 +372,38 @@ bool CommandRequestImpl::ProcessHMIInterfacesAvailability( } void CommandRequestImpl::UpdateHash() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (hash_update_mode_ == kSkipHashUpdate) { - LOG4CXX_DEBUG(logger_, "Hash update is disabled for " << function_id()); + SDL_LOG_DEBUG("Hash update is disabled for " << function_id()); return; } if (HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE == application_manager_.hmi_interfaces().GetInterfaceState( HmiInterfaces::InterfaceID::HMI_INTERFACE_UI)) { - LOG4CXX_ERROR(logger_, - "UI interface has not responded. Hash won't be updated."); + SDL_LOG_ERROR("UI interface has not responded. Hash won't be updated."); return; } if (!is_success_result_) { - LOG4CXX_WARN(logger_, "Command is not succeeded. Hash won't be updated."); + SDL_LOG_WARN("Command is not succeeded. Hash won't be updated."); return; } ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, - "Application with connection key " - << connection_key() - << " not found. Not able to update hash."); + SDL_LOG_ERROR("Application with connection key " + << connection_key() + << " not found. Not able to update hash."); return; } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Updating hash for application with connection key " - << connection_key() << " while processing function id " - << MessageHelper::StringifiedFunctionID( - static_cast<mobile_api::FunctionID::eType>(function_id()))); + << connection_key() << " while processing function id " + << MessageHelper::StringifiedFunctionID( + static_cast<mobile_api::FunctionID::eType>(function_id()))); application->UpdateHash(); } @@ -417,7 +413,7 @@ void CommandRequestImpl::SendProviderRequest( const hmi_apis::FunctionID::eType& hmi_function_id, const smart_objects::SmartObject* msg, bool use_events) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool hmi_destination = false; ApplicationSharedPtr app; // Default error code and error message @@ -444,7 +440,7 @@ void CommandRequestImpl::SendProviderRequest( } if (hmi_destination) { - LOG4CXX_DEBUG(logger_, "Sending Request to HMI Provider"); + SDL_LOG_DEBUG("Sending Request to HMI Provider"); application_manager_.IncreaseForwardedRequestTimeout(connection_key(), correlation_id()); SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events); @@ -452,7 +448,7 @@ void CommandRequestImpl::SendProviderRequest( } if (!app) { - LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer"); + SDL_LOG_DEBUG("Invalid App Provider pointer"); SendResponse(false, error_code, error_msg.c_str()); return; } @@ -489,14 +485,13 @@ void CommandRequestImpl::SendMobileRequest( request[strings::params][strings::correlation_id] = mobile_correlation_id; request[strings::params][strings::message_type] = MessageType::kRequest; if (use_events) { - LOG4CXX_DEBUG(logger_, - "SendMobileRequest subscribe_on_event " - << function_id << " " << mobile_correlation_id); + SDL_LOG_DEBUG("SendMobileRequest subscribe_on_event " + << function_id << " " << mobile_correlation_id); subscribe_on_event(function_id, mobile_correlation_id); } if (!rpc_service_.ManageMobileCommand(msg, SOURCE_SDL)) { - LOG4CXX_ERROR(logger_, "Unable to send request to mobile"); + SDL_LOG_ERROR("Unable to send request to mobile"); } } @@ -524,18 +519,17 @@ uint32_t CommandRequestImpl::SendHMIRequest( } if (use_events) { - LOG4CXX_DEBUG(logger_, - "SendHMIRequest subscribe_on_event " << function_id << " " + SDL_LOG_DEBUG("SendHMIRequest subscribe_on_event " << function_id << " " << hmi_correlation_id); subscribe_on_event(function_id, hmi_correlation_id); } if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) { if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { - LOG4CXX_ERROR(logger_, "Unable to send request"); + SDL_LOG_ERROR("Unable to send request"); SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY); } } else { - LOG4CXX_DEBUG(logger_, "Interface is not available"); + SDL_LOG_DEBUG("Interface is not available"); } return hmi_correlation_id; } @@ -546,7 +540,7 @@ void CommandRequestImpl::CreateHMINotification( smart_objects::SmartObjectSPtr result = std::make_shared<smart_objects::SmartObject>(); if (!result) { - LOG4CXX_ERROR(logger_, "Memory allocation failed."); + SDL_LOG_ERROR("Memory allocation failed."); return; } smart_objects::SmartObject& notify = *result; @@ -561,7 +555,7 @@ void CommandRequestImpl::CreateHMINotification( notify[strings::msg_params] = msg_params; if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { - LOG4CXX_ERROR(logger_, "Unable to send HMI notification"); + SDL_LOG_ERROR("Unable to send HMI notification"); } } @@ -674,7 +668,7 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode( break; } default: { - LOG4CXX_ERROR(logger_, "Unknown HMI result code " << hmi_code); + SDL_LOG_ERROR("Unknown HMI result code " << hmi_code); break; } } @@ -684,7 +678,7 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode( bool CommandRequestImpl::CheckAllowedParameters( const Command::CommandSource source) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // RegisterAppInterface should always be allowed if (mobile_apis::FunctionID::RegisterAppInterfaceID == @@ -697,19 +691,19 @@ bool CommandRequestImpl::CheckAllowedParameters( bool CommandRequestImpl::CheckHMICapabilities( const mobile_apis::ButtonName::eType button) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace smart_objects; using namespace mobile_apis; if (!hmi_capabilities_.is_ui_cooperating()) { - LOG4CXX_ERROR(logger_, "UI is not supported by HMI"); + SDL_LOG_ERROR("UI is not supported by HMI"); return false; } auto button_capabilities = hmi_capabilities_.button_capabilities(); if (!button_capabilities) { - LOG4CXX_ERROR(logger_, "Invalid button capabilities object"); + SDL_LOG_ERROR("Invalid button capabilities object"); return false; } @@ -718,14 +712,12 @@ bool CommandRequestImpl::CheckHMICapabilities( const ButtonName::eType current_button = static_cast<ButtonName::eType>( capabilities.getElement(hmi_response::button_name).asInt()); if (current_button == button) { - LOG4CXX_DEBUG(logger_, - "Button capabilities for " << button << " was found"); + SDL_LOG_DEBUG("Button capabilities for " << button << " was found"); return true; } } - LOG4CXX_DEBUG(logger_, - "Button capabilities for " << button << " was not found"); + SDL_LOG_DEBUG("Button capabilities for " << button << " was not found"); return false; } @@ -789,7 +781,7 @@ bool CommandRequestImpl::HasDisallowedParams() const { bool CommandRequestImpl::IsMobileResultSuccess( const mobile_apis::Result::eType result_code) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; return Compare<mobile_apis::Result::eType, EQ, ONE>( result_code, @@ -803,7 +795,7 @@ bool CommandRequestImpl::IsMobileResultSuccess( bool CommandRequestImpl::IsHMIResultSuccess( const hmi_apis::Common_Result::eType result_code) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; return Compare<hmi_apis::Common_Result::eType, EQ, ONE>( result_code, @@ -818,7 +810,7 @@ bool CommandRequestImpl::IsHMIResultSuccess( bool CommandRequestImpl::PrepareResultForMobileResponse( hmi_apis::Common_Result::eType result_code, HmiInterfaces::InterfaceID interface) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (IsHMIResultSuccess(result_code)) { return true; } @@ -834,7 +826,7 @@ bool CommandRequestImpl::PrepareResultForMobileResponse( bool CommandRequestImpl::PrepareResultForMobileResponse( ResponseInfo& out_first, ResponseInfo& out_second) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool result = CheckResult(out_first, out_second) || CheckResult(out_second, out_first); return result; @@ -853,7 +845,7 @@ void CommandRequestImpl::GetInfo( mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse( const ResponseInfo& first, const ResponseInfo& second) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; if (IsResultCodeUnsupported(first, second) || IsResultCodeUnsupported(second, first)) { @@ -907,10 +899,10 @@ void CommandRequestImpl::EndAwaitForInterface( if (it != awaiting_response_interfaces_.end()) { awaiting_response_interfaces_.erase(it); } else { - LOG4CXX_WARN(logger_, - "EndAwaitForInterface called on interface \ + SDL_LOG_WARN( + "EndAwaitForInterface called on interface \ which was not put into await state: " - << interface_id); + << interface_id); } } @@ -961,10 +953,10 @@ const std::string InfoInterfaceSeparator( void CommandRequestImpl::AddTimeOutComponentInfoToMessage( smart_objects::SmartObject& response) const { using ns_smart_device_link::ns_smart_objects::SmartObject; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); if (awaiting_response_interfaces_.empty()) { - LOG4CXX_ERROR(logger_, "No interfaces awaiting, info param is empty"); + SDL_LOG_ERROR("No interfaces awaiting, info param is empty"); return; } @@ -973,8 +965,7 @@ void CommandRequestImpl::AddTimeOutComponentInfoToMessage( awaiting_response_interfaces_.end(), std::string(""), InfoInterfaceSeparator); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Not responding interfaces string: " << not_responding_interfaces_string); if (!not_responding_interfaces_string.empty()) { const std::string component_info = diff --git a/src/components/application_manager/src/commands/command_response_impl.cc b/src/components/application_manager/src/commands/command_response_impl.cc index b956a4c7a5..b86a719aae 100644 --- a/src/components/application_manager/src/commands/command_response_impl.cc +++ b/src/components/application_manager/src/commands/command_response_impl.cc @@ -38,6 +38,8 @@ namespace application_manager { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands"); + CommandResponseImpl::CommandResponseImpl( const MessageSharedPtr& message, ApplicationManager& application_manager, @@ -66,7 +68,7 @@ void CommandResponseImpl::SendResponse( bool success, const mobile_apis::Result::eType& result_code, bool final_message) { - LOG4CXX_INFO(logger_, "Trying to send response"); + SDL_LOG_INFO("Trying to send response"); (*message_)[strings::params][strings::protocol_type] = mobile_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/src/commands/notification_from_hmi.cc b/src/components/application_manager/src/commands/notification_from_hmi.cc index 5e1314bad3..ef3755ebfd 100644 --- a/src/components/application_manager/src/commands/notification_from_hmi.cc +++ b/src/components/application_manager/src/commands/notification_from_hmi.cc @@ -39,6 +39,8 @@ namespace application_manager { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NotificationFromHMI::NotificationFromHMI( const MessageSharedPtr& message, ApplicationManager& application_manager, @@ -93,7 +95,7 @@ void NotificationFromHMI::CreateHMIRequest( smart_objects::SmartObjectSPtr result = std::make_shared<smart_objects::SmartObject>(); if (!result) { - LOG4CXX_ERROR(logger_, "Memory allocation failed."); + SDL_LOG_ERROR("Memory allocation failed."); return; } @@ -115,7 +117,7 @@ void NotificationFromHMI::CreateHMIRequest( request[strings::msg_params] = msg_params; if (!rpc_service_.ManageHMICommand(result)) { - LOG4CXX_ERROR(logger_, "Unable to send request"); + SDL_LOG_ERROR("Unable to send request"); return; } } diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc index eb9d914f00..835df70202 100644 --- a/src/components/application_manager/src/commands/request_from_hmi.cc +++ b/src/components/application_manager/src/commands/request_from_hmi.cc @@ -46,6 +46,8 @@ namespace application_manager { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message, ApplicationManager& application_manager, rpc_service::RPCService& rpc_service, @@ -143,7 +145,7 @@ void RequestFromHMI::FillCommonParametersOfSO( bool RequestFromHMI::IsMobileResultSuccess( mobile_apis::Result::eType result_code) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; return Compare<mobile_apis::Result::eType, EQ, ONE>( result_code, @@ -157,7 +159,7 @@ bool RequestFromHMI::IsMobileResultSuccess( bool RequestFromHMI::IsHMIResultSuccess( hmi_apis::Common_Result::eType result_code, HmiInterfaces::InterfaceID interface) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; if (Compare<hmi_apis::Common_Result::eType, EQ, ONE>( result_code, @@ -183,7 +185,7 @@ void RequestFromHMI::SendProviderRequest( const hmi_apis::FunctionID::eType& hmi_function_id, const smart_objects::SmartObject* msg, bool use_events) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool hmi_destination = false; ApplicationSharedPtr app; // Default error code and error message @@ -210,7 +212,7 @@ void RequestFromHMI::SendProviderRequest( } if (hmi_destination) { - LOG4CXX_DEBUG(logger_, "Sending Request to HMI Provider"); + SDL_LOG_DEBUG("Sending Request to HMI Provider"); application_manager_.IncreaseForwardedRequestTimeout( application_manager::request_controller::RequestInfo::HmiConnectionKey, correlation_id()); @@ -219,7 +221,7 @@ void RequestFromHMI::SendProviderRequest( } if (!app) { - LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer"); + SDL_LOG_DEBUG("Invalid App Provider pointer"); SendErrorResponse(correlation_id(), static_cast<hmi_apis::FunctionID::eType>(function_id()), error_code, @@ -228,7 +230,7 @@ void RequestFromHMI::SendProviderRequest( return; } - LOG4CXX_DEBUG(logger_, "Sending Request to Mobile Provider"); + SDL_LOG_DEBUG("Sending Request to Mobile Provider"); application_manager_.IncreaseForwardedRequestTimeout( application_manager::request_controller::RequestInfo::HmiConnectionKey, correlation_id()); @@ -263,14 +265,13 @@ void RequestFromHMI::SendMobileRequest( } if (use_events) { - LOG4CXX_DEBUG(logger_, - "RequestFromHMI subscribe_on_event " - << function_id << " " << mobile_correlation_id); + SDL_LOG_DEBUG("RequestFromHMI subscribe_on_event " + << function_id << " " << mobile_correlation_id); subscribe_on_event(function_id, mobile_correlation_id); } if (!rpc_service_.ManageMobileCommand( result, commands::Command::CommandSource::SOURCE_SDL)) { - LOG4CXX_ERROR(logger_, "Unable to send request to mobile"); + SDL_LOG_ERROR("Unable to send request to mobile"); } } @@ -296,25 +297,24 @@ void RequestFromHMI::SendHMIRequest( } if (use_events) { - LOG4CXX_DEBUG(logger_, - "RequestFromHMI subscribe_on_event " << function_id << " " + SDL_LOG_DEBUG("RequestFromHMI subscribe_on_event " << function_id << " " << hmi_correlation_id); subscribe_on_event(function_id, hmi_correlation_id); } if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) { if (!rpc_service_.ManageHMICommand( result, commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) { - LOG4CXX_ERROR(logger_, "Unable to send request"); + SDL_LOG_ERROR("Unable to send request"); } } else { - LOG4CXX_DEBUG(logger_, "Interface is not available"); + SDL_LOG_DEBUG("Interface is not available"); } } bool RequestFromHMI::ProcessHMIInterfacesAvailability( const uint32_t hmi_correlation_id, const hmi_apis::FunctionID::eType& function_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); HmiInterfaces::InterfaceID interface = hmi_interfaces.GetInterfaceFromFunction(function_id); diff --git a/src/components/application_manager/src/commands/request_to_hmi.cc b/src/components/application_manager/src/commands/request_to_hmi.cc index db191eadb3..35ac71c8bd 100644 --- a/src/components/application_manager/src/commands/request_to_hmi.cc +++ b/src/components/application_manager/src/commands/request_to_hmi.cc @@ -71,6 +71,8 @@ static std::map<std::string, std::set<hmi_apis::FunctionID::eType> > namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + bool CheckAvailabilityHMIInterfaces(ApplicationManager& application_manager, HmiInterfaces::InterfaceID interface) { const HmiInterfaces::InterfaceState state = @@ -167,9 +169,8 @@ void RequestToHMI::SendRequest() { } void RequestToHMI::RequestInterfaceCapabilities(const char* interface_name) { - LOG4CXX_DEBUG( - logger_, - "Request capabilities for the " << interface_name << " interface"); + SDL_LOG_DEBUG("Request capabilities for the " << interface_name + << " interface"); const auto& request_ids = interface_requests[std::string(interface_name)]; RequestCapabilities(request_ids); @@ -184,9 +185,8 @@ void RequestToHMI::UpdateRequestsRequiredForCapabilities( void RequestToHMI::UpdateRequiredInterfaceCapabilitiesRequests( const std::string& interface_name) { - LOG4CXX_DEBUG( - logger_, - "Update requests required for the " << interface_name << " interface"); + SDL_LOG_DEBUG("Update requests required for the " << interface_name + << " interface"); const auto& request_ids = interface_requests[std::string(interface_name)]; UpdateRequestsRequiredForCapabilities(request_ids); @@ -194,8 +194,7 @@ void RequestToHMI::UpdateRequiredInterfaceCapabilitiesRequests( void RequestToHMI::RequestCapabilities( const std::set<hmi_apis::FunctionID::eType>& requests_to_send_to_hmi) { - LOG4CXX_DEBUG(logger_, - "There are " << requests_to_send_to_hmi.size() + SDL_LOG_DEBUG("There are " << requests_to_send_to_hmi.size() << " requests to send to the HMI"); for (const auto& function_id : requests_to_send_to_hmi) { diff --git a/src/components/application_manager/src/commands/response_from_hmi.cc b/src/components/application_manager/src/commands/response_from_hmi.cc index c88b14bf9c..f37028d53e 100644 --- a/src/components/application_manager/src/commands/response_from_hmi.cc +++ b/src/components/application_manager/src/commands/response_from_hmi.cc @@ -38,6 +38,8 @@ namespace application_manager { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ResponseFromHMI::ResponseFromHMI(const MessageSharedPtr& message, ApplicationManager& application_manager, rpc_service::RPCService& rpc_service, @@ -84,7 +86,7 @@ void ResponseFromHMI::CreateHMIRequest( std::make_shared<smart_objects::SmartObject>(); if (!result) { - LOG4CXX_ERROR(logger_, "Memory allocation failed."); + SDL_LOG_ERROR("Memory allocation failed."); return; } @@ -104,7 +106,7 @@ void ResponseFromHMI::CreateHMIRequest( request[strings::msg_params] = msg_params; if (!rpc_service_.ManageHMICommand(result)) { - LOG4CXX_ERROR(logger_, "Unable to send request"); + SDL_LOG_ERROR("Unable to send request"); return; } } diff --git a/src/components/application_manager/src/display_capabilities_builder.cc b/src/components/application_manager/src/display_capabilities_builder.cc index 8234128280..65198655a8 100644 --- a/src/components/application_manager/src/display_capabilities_builder.cc +++ b/src/components/application_manager/src/display_capabilities_builder.cc @@ -35,33 +35,32 @@ #include "application_manager/smart_object_keys.h" namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "DisplayCapabilitiesBuilder") +SDL_CREATE_LOG_VARIABLE("DisplayCapabilitiesBuilder") const WindowID kDefaultWindowID = 0; DisplayCapabilitiesBuilder::DisplayCapabilitiesBuilder(Application& application) : owner_(application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void DisplayCapabilitiesBuilder::InitBuilder( DisplayCapabilitiesBuilder::ResumeCallback resume_callback, const smart_objects::SmartObject& windows_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(display_capabilities_lock_); resume_callback_ = resume_callback; window_ids_to_resume_.insert(kDefaultWindowID); for (size_t i = 0; i < windows_info.length(); ++i) { auto window_id = windows_info[i][strings::window_id].asInt(); - LOG4CXX_DEBUG(logger_, - "Inserting " << window_id << " to waiting container"); + SDL_LOG_DEBUG("Inserting " << window_id << " to waiting container"); window_ids_to_resume_.insert(window_id); } } void DisplayCapabilitiesBuilder::UpdateDisplayCapabilities( const smart_objects::SmartObject& incoming_display_capabilities) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace smart_objects; sync_primitives::AutoLock lock(display_capabilities_lock_); @@ -83,7 +82,7 @@ void DisplayCapabilitiesBuilder::UpdateDisplayCapabilities( : kDefaultWindowID; if (window_ids_to_resume_.end() != window_ids_to_resume_.find(window_id)) { cur_window_caps[cur_window_caps.length()] = inc_window_caps[i]; - LOG4CXX_DEBUG(logger_, "Stop waiting for: " << window_id); + SDL_LOG_DEBUG("Stop waiting for: " << window_id); window_ids_to_resume_.erase(window_id); } } @@ -92,7 +91,7 @@ void DisplayCapabilitiesBuilder::UpdateDisplayCapabilities( (*display_capabilities_)[0][strings::window_capabilities] = cur_window_caps; if (window_ids_to_resume_.empty()) { - LOG4CXX_TRACE(logger_, "Invoking resume callback"); + SDL_LOG_TRACE("Invoking resume callback"); resume_callback_(owner_, *display_capabilities_); display_capabilities_.reset(); } @@ -100,26 +99,24 @@ void DisplayCapabilitiesBuilder::UpdateDisplayCapabilities( const smart_objects::SmartObjectSPtr DisplayCapabilitiesBuilder::display_capabilities() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return display_capabilities_; } void DisplayCapabilitiesBuilder::ResetDisplayCapabilities() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(display_capabilities_lock_); display_capabilities_.reset(); } void DisplayCapabilitiesBuilder::StopWaitingForWindow( const WindowID window_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(display_capabilities_lock_); - LOG4CXX_DEBUG(logger_, - "Window id " << window_id << " will be erased due to failure"); + SDL_LOG_DEBUG("Window id " << window_id << " will be erased due to failure"); window_ids_to_resume_.erase(window_id); if (window_ids_to_resume_.empty()) { - LOG4CXX_TRACE(logger_, - window_id << " was the last window pending resumption. " + SDL_LOG_TRACE(window_id << " was the last window pending resumption. " "Invoking resume callback"); resume_callback_(owner_, *display_capabilities_); display_capabilities_.reset(); diff --git a/src/components/application_manager/src/help_prompt_manager_impl.cc b/src/components/application_manager/src/help_prompt_manager_impl.cc index ec883e5fc2..8d43ff2d9f 100644 --- a/src/components/application_manager/src/help_prompt_manager_impl.cc +++ b/src/components/application_manager/src/help_prompt_manager_impl.cc @@ -43,7 +43,7 @@ #include "smart_objects/smart_object.h" #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "HelpPromptManagerImpl") +SDL_CREATE_LOG_VARIABLE("HelpPromptManagerImpl") namespace { const size_t kLimitCommand = 30; @@ -60,19 +60,19 @@ HelpPromptManagerImpl::HelpPromptManagerImpl(Application& app, , is_ui_send_(false) {} HelpPromptManagerImpl::~HelpPromptManagerImpl() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } bool HelpPromptManagerImpl::AddCommand( const uint32_t cmd_id, const smart_objects::SmartObject& command) { if (!command.keyExists(strings::vr_commands)) { - LOG4CXX_DEBUG(logger_, "vr_commands does`t present"); + SDL_LOG_DEBUG("vr_commands does`t present"); return false; } const smart_objects::SmartObject& commands = command[strings::vr_commands]; if (commands.empty()) { - LOG4CXX_DEBUG(logger_, "vr_commands array is empty"); + SDL_LOG_DEBUG("vr_commands array is empty"); return false; } @@ -83,23 +83,21 @@ bool HelpPromptManagerImpl::AddCommand( [cmd_id](const VRCommandPair& pair) { return pair.first == cmd_id; }); if (vr_commands_.end() != it) { - LOG4CXX_DEBUG(logger_, "Command with id:" << cmd_id << " already exists"); + SDL_LOG_DEBUG("Command with id:" << cmd_id << " already exists"); return false; } const bool limit_exceeded = kLimitCommand <= GetCommandsCount(vr_commands_.end()); - LOG4CXX_DEBUG( - logger_, - "Will be added first command from array " << strings::vr_commands); + SDL_LOG_DEBUG("Will be added first command from array " + << strings::vr_commands); smart_objects::SmartObjectSPtr vr_item = std::make_shared<smart_objects::SmartObject>(commands.asArray()->front()); vr_commands_.push_back(std::make_pair(cmd_id, vr_item)); - LOG4CXX_DEBUG(logger_, - "VR command with id: " << cmd_id << " added for appID: " + SDL_LOG_DEBUG("VR command with id: " << cmd_id << " added for appID: " << app_.app_id() << ". Total " << vr_commands_.size() << " in cache"); @@ -107,7 +105,7 @@ bool HelpPromptManagerImpl::AddCommand( } bool HelpPromptManagerImpl::DeleteCommand(const uint32_t cmd_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(vr_commands_lock_); @@ -117,17 +115,16 @@ bool HelpPromptManagerImpl::DeleteCommand(const uint32_t cmd_id) { [cmd_id](const VRCommandPair& pair) { return pair.first == cmd_id; }); if (vr_commands_.end() == it) { - LOG4CXX_WARN(logger_, "VR command with id: " << cmd_id << " not found"); + SDL_LOG_WARN("VR command with id: " << cmd_id << " not found"); return false; } const size_t commands_before_current = GetCommandsCount(it); vr_commands_.erase(it); - LOG4CXX_DEBUG(logger_, - "VR command with id: " - << cmd_id << " found after " << commands_before_current - << " commands was deleted for appID: " << app_.app_id() - << " Cache size after deleting: " << vr_commands_.size()); + SDL_LOG_DEBUG("VR command with id: " + << cmd_id << " found after " << commands_before_current + << " commands was deleted for appID: " << app_.app_id() + << " Cache size after deleting: " << vr_commands_.size()); return commands_before_current < kLimitCommand; } @@ -136,12 +133,10 @@ void HelpPromptManagerImpl::OnVrCommandAdded( const uint32_t cmd_id, const smart_objects::SmartObject& command, const bool is_resumption) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (SendingType::kNoneSend == sending_type_) { - LOG4CXX_DEBUG(logger_, - "SendingType::kNoneSend" - << " commands with id:" << cmd_id - << " will not be added"); + SDL_LOG_DEBUG("SendingType::kNoneSend" + << " commands with id:" << cmd_id << " will not be added"); return; } if (AddCommand(cmd_id, command) && !is_resumption) { @@ -151,12 +146,10 @@ void HelpPromptManagerImpl::OnVrCommandAdded( void HelpPromptManagerImpl::OnVrCommandDeleted(const uint32_t cmd_id, const bool is_resumption) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (SendingType::kNoneSend == sending_type_) { - LOG4CXX_DEBUG(logger_, - "SendingType::kNoneSend" - << " commands with id:" << cmd_id - << " will not be deleted"); + SDL_LOG_DEBUG("SendingType::kNoneSend" + << " commands with id:" << cmd_id << " will not be deleted"); return; } if (DeleteCommand(cmd_id) && !is_resumption) { @@ -166,11 +159,11 @@ void HelpPromptManagerImpl::OnVrCommandDeleted(const uint32_t cmd_id, void HelpPromptManagerImpl::OnSetGlobalPropertiesReceived( const smart_objects::SmartObject& msg, const bool is_response) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (SendingType::kNoneSend == sending_type_) { - LOG4CXX_DEBUG(logger_, - "SendingType::kNoneSend" - " do not track SetGlobalProperties"); + SDL_LOG_DEBUG( + "SendingType::kNoneSend" + " do not track SetGlobalProperties"); return; } @@ -182,8 +175,8 @@ void HelpPromptManagerImpl::OnSetGlobalPropertiesReceived( is_ui_send_ = true; } - LOG4CXX_DEBUG(logger_, "is_tts_send_:" << is_tts_send_); - LOG4CXX_DEBUG(logger_, "is_ui_send_:" << is_ui_send_); + SDL_LOG_DEBUG("is_tts_send_:" << is_tts_send_); + SDL_LOG_DEBUG("is_ui_send_:" << is_ui_send_); return; } @@ -222,8 +215,8 @@ void HelpPromptManagerImpl::GenerateVrItems( } void HelpPromptManagerImpl::SendTTSRequest() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "TTS request for appID:" << app_.app_id()); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("TTS request for appID:" << app_.app_id()); smart_objects::SmartObjectSPtr tts_global_properties = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -256,8 +249,8 @@ void HelpPromptManagerImpl::SendTTSRequest() { } void HelpPromptManagerImpl::SendUIRequest() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "UI request for appID:" << app_.app_id()); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("UI request for appID:" << app_.app_id()); smart_objects::SmartObjectSPtr ui_global_properties = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -290,13 +283,13 @@ void HelpPromptManagerImpl::SendUIRequest() { } void HelpPromptManagerImpl::SendBothRequests() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendTTSRequest(); SendUIRequest(); } void HelpPromptManagerImpl::SendRequests() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(vr_commands_lock_); switch (sending_type_) { @@ -312,21 +305,20 @@ void HelpPromptManagerImpl::SendRequests() { case SendingType::kNoneSend: break; } - LOG4CXX_DEBUG(logger_, - "SendingType:" << static_cast<uint32_t>(sending_type_) + SDL_LOG_DEBUG("SendingType:" << static_cast<uint32_t>(sending_type_) << " request not sending"); } void HelpPromptManagerImpl::CreatePromptMsg( smart_objects::SmartObject& out_msg_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GenerateVrItems(out_msg_params, strings::help_prompt); app_.set_help_prompt(out_msg_params[strings::help_prompt]); } void HelpPromptManagerImpl::CreateVRMsg( smart_objects::SmartObject& out_msg_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (false == out_msg_params.keyExists(strings::vr_help_title)) { if (app_.vr_help_title()) { out_msg_params[strings::vr_help_title] = (*app_.vr_help_title()); @@ -347,17 +339,17 @@ void HelpPromptManagerImpl::CreateVRMsg( void HelpPromptManagerImpl::SetSendingType( const smart_objects::SmartObject& msg) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_apis::Common_Result::eType result = static_cast<hmi_apis::Common_Result::eType>( msg[strings::params][hmi_response::code].asInt()); - LOG4CXX_DEBUG(logger_, "HMI response result:" << result); + SDL_LOG_DEBUG("HMI response result:" << result); if (hmi_apis::Common_Result::eType::SUCCESS == result) { hmi_apis::FunctionID::eType function_id = static_cast<hmi_apis::FunctionID::eType>( msg[strings::params][strings::function_id].asUInt()); - LOG4CXX_DEBUG(logger_, "Function id:" << function_id); + SDL_LOG_DEBUG("Function id:" << function_id); switch (function_id) { case hmi_apis::FunctionID::TTS_SetGlobalProperties: { if (is_tts_send_) { @@ -379,8 +371,7 @@ void HelpPromptManagerImpl::SetSendingType( } default: { break; } } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Sending type set to:" << static_cast<uint32_t>(sending_type_)); } } diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc index fc86eb5e62..533a61029e 100644 --- a/src/components/application_manager/src/helpers/application_helper.cc +++ b/src/components/application_manager/src/helpers/application_helper.cc @@ -105,11 +105,11 @@ void CleanupAppFiles(ApplicationSharedPtr app) { namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("ApplicationManager") void DeleteApplicationData(ApplicationSharedPtr app, ApplicationManager& app_manager) { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); DeleteWayPoints(app, app_manager); diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc index 3e22880222..924c603792 100644 --- a/src/components/application_manager/src/hmi_capabilities_impl.cc +++ b/src/components/application_manager/src/hmi_capabilities_impl.cc @@ -51,7 +51,7 @@ namespace application_manager { namespace formatters = ns_smart_device_link::ns_json_handler::formatters; -CREATE_LOGGERPTR_GLOBAL(logger_, "HMICapabilities") +SDL_CREATE_LOG_VARIABLE("HMICapabilities") namespace { std::map<std::string, hmi_apis::Common_VrCapabilities::eType> @@ -799,9 +799,9 @@ void HMICapabilitiesImpl::Init( resumption::LastStateWrapperPtr last_state_wrapper) { hmi_language_handler_.Init(last_state_wrapper); if (!LoadCapabilitiesFromFile()) { - LOG4CXX_ERROR(logger_, "file hmi_capabilities.json was not loaded"); + SDL_LOG_ERROR("file hmi_capabilities.json was not loaded"); } else { - LOG4CXX_INFO(logger_, "file hmi_capabilities.json was loaded"); + SDL_LOG_INFO("file hmi_capabilities.json was loaded"); } hmi_language_handler_.set_default_capabilities_languages( ui_language_, vr_language_, tts_language_); @@ -1044,8 +1044,7 @@ struct JsonCapabilitiesGetter { return GetCachedJsonMember(member_name); } - LOG4CXX_DEBUG(logger_, - "Add request ID: " << request_id + SDL_LOG_DEBUG("Add request ID: " << request_id << " for the interface: " << member_name); default_initialized_capabilities.insert(request_id); @@ -1118,13 +1117,11 @@ bool HMICapabilitiesImpl::LoadCapabilitiesFromFile() { Json::Value root_json_override; if (file_system::FileExists(cache_file_name)) { - LOG4CXX_DEBUG(logger_, - "HMI capabilities cache was found: " << cache_file_name); + SDL_LOG_DEBUG("HMI capabilities cache was found: " << cache_file_name); std::string cache_json_string; if (!file_system::ReadFile(cache_file_name, cache_json_string)) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Failed to read data from cache file. Cache will be ignored"); } @@ -1132,8 +1129,7 @@ bool HMICapabilitiesImpl::LoadCapabilitiesFromFile() { utils::JsonReader reader; std::string json(cache_json_string.begin(), cache_json_string.end()); if (!reader.parse(json, &root_json_override)) { - LOG4CXX_ERROR(logger_, - "Cached JSON file is invalid. Deleting the file"); + SDL_LOG_ERROR("Cached JSON file is invalid. Deleting the file"); file_system::DeleteFile(cache_file_name); root_json_override = Json::Value::null; // Just to clear intermediate state of value @@ -1148,7 +1144,7 @@ bool HMICapabilitiesImpl::LoadCapabilitiesFromFile() { utils::JsonReader reader; std::string json(json_string.begin(), json_string.end()); if (!reader.parse(json, &root_json)) { - LOG4CXX_DEBUG(logger_, "Default JSON parsing fails"); + SDL_LOG_DEBUG("Default JSON parsing fails"); return false; } @@ -1699,7 +1695,7 @@ bool HMICapabilitiesImpl::LoadCapabilitiesFromFile() { hmi_apis::Common_Language::eType HMICapabilitiesImpl::GetActiveLanguageForInterface( const std::string& interface_name) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (hmi_interface::ui == interface_name) { return active_ui_language(); } @@ -1714,11 +1710,11 @@ HMICapabilitiesImpl::GetActiveLanguageForInterface( void HMICapabilitiesImpl::UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::eType requested_interface) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app_mngr_.IsHMICooperating()) { - LOG4CXX_DEBUG(logger_, - "Remove from default initialized capabilities skipped, " - "because hmi_cooperating equal true already"); + SDL_LOG_DEBUG( + "Remove from default initialized capabilities skipped, " + "because hmi_cooperating equal true already"); return; } @@ -1730,10 +1726,10 @@ void HMICapabilitiesImpl::UpdateRequestsRequiredForCapabilities( void HMICapabilitiesImpl::OnSoftwareVersionReceived( const std::string& ccpu_version) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (ccpu_version == ccpu_version_) { - LOG4CXX_DEBUG(logger_, "Software version not changed"); + SDL_LOG_DEBUG("Software version not changed"); if (requests_required_for_capabilities_.empty()) { app_mngr_.SetHMICooperating(true); } @@ -1741,18 +1737,18 @@ void HMICapabilitiesImpl::OnSoftwareVersionReceived( return; } - LOG4CXX_DEBUG(logger_, "Software version changed"); + SDL_LOG_DEBUG("Software version changed"); set_ccpu_version(ccpu_version); UpdateCachedCapabilities(); } void HMICapabilitiesImpl::UpdateCachedCapabilities() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeleteCachedCapabilitiesFile(); if (!LoadCapabilitiesFromFile()) { - LOG4CXX_ERROR(logger_, "file hmi_capabilities.json was not loaded"); + SDL_LOG_ERROR("file hmi_capabilities.json was not loaded"); } app_mngr_.RequestForInterfacesAvailability(); @@ -1762,11 +1758,10 @@ bool HMICapabilitiesImpl::AllFieldsSaved( const Json::Value& root_node, const std::string& interface_name, const std::vector<std::string>& sections_to_check) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!JsonIsMemberSafe(root_node, interface_name.c_str())) { - LOG4CXX_DEBUG(logger_, - interface_name - << " interface is not found. All fields should be saved"); + SDL_LOG_DEBUG(interface_name + << " interface is not found. All fields should be saved"); return false; } @@ -1775,8 +1770,7 @@ bool HMICapabilitiesImpl::AllFieldsSaved( ++it) { const std::string section = (*it).c_str(); if (!JsonIsMemberSafe(interface_node, section.c_str())) { - LOG4CXX_DEBUG(logger_, - "Field " << *it << " should be saved into the file"); + SDL_LOG_DEBUG("Field " << *it << " should be saved into the file"); return false; } @@ -1787,8 +1781,7 @@ bool HMICapabilitiesImpl::AllFieldsSaved( if (active_language != MessageHelper::CommonLanguageFromString(json_language.asString())) { - LOG4CXX_DEBUG(logger_, - "Active " << interface_name + SDL_LOG_DEBUG("Active " << interface_name << " language is not the same as the persisted " "one. Field should be overwritten"); return false; @@ -1801,15 +1794,14 @@ bool HMICapabilitiesImpl::AllFieldsSaved( void HMICapabilitiesImpl::RemoveFromRequestsRequiredForCapabilities( hmi_apis::FunctionID::eType requested_interface) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto it = find(requests_required_for_capabilities_.begin(), requests_required_for_capabilities_.end(), requested_interface); if (it != requests_required_for_capabilities_.end()) { requests_required_for_capabilities_.erase(it); - LOG4CXX_DEBUG(logger_, - "Wait for " << requests_required_for_capabilities_.size() + SDL_LOG_DEBUG("Wait for " << requests_required_for_capabilities_.size() << " responses"); } } @@ -1818,7 +1810,7 @@ void HMICapabilitiesImpl::PrepareUiJsonValueForSaving( const std::vector<std::string>& sections_to_update, const smart_objects::CSmartSchema& schema, Json::Value& out_node) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject capability(smart_objects::SmartType_Map); auto system_capabilities = std::make_shared<smart_objects::SmartObject>( @@ -1947,7 +1939,7 @@ void HMICapabilitiesImpl::PrepareVrJsonValueForSaving( const std::vector<std::string>& sections_to_update, const smart_objects::CSmartSchema& schema, Json::Value& out_node) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (const auto& section_to_update : sections_to_update) { if (section_to_update == hmi_response::language) { @@ -1971,7 +1963,7 @@ void HMICapabilitiesImpl::PrepareTtsJsonValueForSaving( const std::vector<std::string>& sections_to_update, const smart_objects::CSmartSchema& schema, Json::Value& out_node) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (const auto& section_to_update : sections_to_update) { if (section_to_update == hmi_response::language) { @@ -2005,7 +1997,7 @@ void HMICapabilitiesImpl::PrepareButtonsJsonValueForSaving( const std::vector<std::string>& sections_to_update, const smart_objects::CSmartSchema& schema, Json::Value& out_node) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (const auto& section_to_update : sections_to_update) { if (section_to_update == hmi_response::button_capabilities) { @@ -2026,7 +2018,7 @@ void HMICapabilitiesImpl::PrepareVehicleInfoJsonValueForSaving( const std::vector<std::string>& sections_to_update, const smart_objects::CSmartSchema& schema, Json::Value& out_node) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (helpers::in_range(sections_to_update, hmi_response::vehicle_type)) { save_hmi_capability_field_to_json( hmi_response::vehicle_type, schema, vehicle_type(), out_node); @@ -2037,7 +2029,7 @@ void HMICapabilitiesImpl::PrepareRCJsonValueForSaving( const std::vector<std::string>& sections_to_update, const smart_objects::CSmartSchema& schema, Json::Value& out_node) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (const auto& section_to_update : sections_to_update) { if (section_to_update == strings::rc_capability) { @@ -2056,7 +2048,7 @@ void HMICapabilitiesImpl::PrepareRCJsonValueForSaving( void HMICapabilitiesImpl::AddRequiredRequestsForCapabilities( const std::string& interface_name) { - LOG4CXX_DEBUG(logger_, "Add request IDs for interface: " << interface_name); + SDL_LOG_DEBUG("Add request IDs for interface: " << interface_name); if (interface_name == hmi_interface::ui) { requests_required_for_capabilities_.insert( @@ -2106,8 +2098,7 @@ void HMICapabilitiesImpl::PrepareJsonValueForSaving( const std::vector<std::string>& sections_to_update, const smart_objects::CSmartSchema& schema, Json::Value& out_root_node) const { - LOG4CXX_DEBUG(logger_, - "Prepare " << interface_name << " sections for saving"); + SDL_LOG_DEBUG("Prepare " << interface_name << " sections for saving"); if (out_root_node.isNull()) { out_root_node = Json::Value(Json::objectValue); @@ -2149,29 +2140,27 @@ bool HMICapabilitiesImpl::SaveCachedCapabilitiesToFile( const std::string& interface_name, const std::vector<std::string>& sections_to_update, const smart_objects::CSmartSchema& schema) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (sections_to_update.empty()) { - LOG4CXX_DEBUG(logger_, - "There is no one section to update in the cache file"); + SDL_LOG_DEBUG("There is no one section to update in the cache file"); return true; } const std::string cache_file_name = app_mngr_.get_settings().hmi_capabilities_cache_file_name(); if (cache_file_name.empty()) { - LOG4CXX_DEBUG(logger_, - "Cache file name is not specified. No need to save cache"); + SDL_LOG_DEBUG("Cache file name is not specified. No need to save cache"); return true; } Json::Value root_node; if (file_system::FileExists(cache_file_name)) { - LOG4CXX_DEBUG(logger_, "Cache file exists. Check for it's content"); + SDL_LOG_DEBUG("Cache file exists. Check for it's content"); std::string file_content; if (!file_system::ReadFile(cache_file_name, file_content)) { - LOG4CXX_ERROR(logger_, "Failed to read file content"); + SDL_LOG_ERROR("Failed to read file content"); return false; } @@ -2181,25 +2170,24 @@ bool HMICapabilitiesImpl::SaveCachedCapabilitiesToFile( file_content.c_str() + file_content.length(), &root_node, NULL)) { - LOG4CXX_ERROR(logger_, "Can't parse the file. Skipping"); + SDL_LOG_ERROR("Can't parse the file. Skipping"); return false; } if (AllFieldsSaved(root_node, interface_name, sections_to_update)) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "All " << interface_name << " fields are present in the file. No need to update"); return true; } - LOG4CXX_DEBUG(logger_, "Some fields in the cache file should be updated"); + SDL_LOG_DEBUG("Some fields in the cache file should be updated"); } PrepareJsonValueForSaving( interface_name.c_str(), sections_to_update, schema, root_node); - LOG4CXX_DEBUG(logger_, "Saving cache to file: " << cache_file_name); + SDL_LOG_DEBUG("Saving cache to file: " << cache_file_name); const std::string content_to_save = root_node.toStyledString(); const std::vector<uint8_t> binary_data_to_save(content_to_save.begin(), content_to_save.end()); @@ -2208,22 +2196,21 @@ bool HMICapabilitiesImpl::SaveCachedCapabilitiesToFile( } bool HMICapabilitiesImpl::DeleteCachedCapabilitiesFile() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string cache_file_name = app_mngr_.get_settings().hmi_capabilities_cache_file_name(); if (cache_file_name.empty()) { - LOG4CXX_DEBUG(logger_, - "Cache file name is not specified. Nothing to delete"); + SDL_LOG_DEBUG("Cache file name is not specified. Nothing to delete"); return false; } if (!file_system::FileExists(cache_file_name)) { - LOG4CXX_DEBUG(logger_, "Cache file does not exist"); + SDL_LOG_DEBUG("Cache file does not exist"); return false; } if (!file_system::DeleteFile(cache_file_name)) { - LOG4CXX_ERROR(logger_, "Failed to delete cache file"); + SDL_LOG_ERROR("Failed to delete cache file"); return false; } return true; diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc index 46231c4596..750755478e 100644 --- a/src/components/application_manager/src/hmi_language_handler.cc +++ b/src/components/application_manager/src/hmi_language_handler.cc @@ -44,7 +44,7 @@ static const std::string UIKey = "UI"; static const std::string VRKey = "VR"; static const std::string TTSKey = "TTS"; -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("ApplicationManager") namespace application_manager { HMILanguageHandler::HMILanguageHandler(ApplicationManager& application_manager) @@ -62,7 +62,7 @@ HMILanguageHandler::HMILanguageHandler(ApplicationManager& application_manager) void HMILanguageHandler::set_language_for( HMILanguageHandler::Interface interface, hmi_apis::Common_Language::eType language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string key = "UNKNOWN"; switch (interface) { case INTERFACE_UI: @@ -75,12 +75,11 @@ void HMILanguageHandler::set_language_for( key = TTSKey; break; default: - LOG4CXX_WARN(logger_, "Unknown interface has been passed " << interface); + SDL_LOG_WARN("Unknown interface has been passed " << interface); return; } - LOG4CXX_DEBUG( - logger_, - "Setting language " << language << " for interface " << interface); + SDL_LOG_DEBUG("Setting language " << language << " for interface " + << interface); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); dictionary[LanguagesKey][key] = static_cast<int32_t>(language); @@ -89,7 +88,7 @@ void HMILanguageHandler::set_language_for( hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for( HMILanguageHandler::Interface interface) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace resumption; using namespace hmi_apis; std::string key = "UNKNOWN"; @@ -104,7 +103,7 @@ hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for( key = TTSKey; break; default: - LOG4CXX_WARN(logger_, "Unknown interfcase has been passed " << interface); + SDL_LOG_WARN("Unknown interfcase has been passed " << interface); return Common_Language::INVALID_ENUM; } @@ -121,24 +120,24 @@ hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for( } void HMILanguageHandler::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject msg = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_GetLanguage: - LOG4CXX_DEBUG(logger_, "Got UI language response."); + SDL_LOG_DEBUG("Got UI language response."); is_ui_language_received_ = true; break; case hmi_apis::FunctionID::VR_GetLanguage: - LOG4CXX_DEBUG(logger_, "Got VR language response."); + SDL_LOG_DEBUG("Got VR language response."); is_vr_language_received_ = true; break; case hmi_apis::FunctionID::TTS_GetLanguage: - LOG4CXX_DEBUG(logger_, "Got TTS language response."); + SDL_LOG_DEBUG("Got TTS language response."); is_tts_language_received_ = true; break; case hmi_apis::FunctionID::BasicCommunication_OnAppRegistered: if (!(msg[strings::params].keyExists(strings::app_id))) { - LOG4CXX_ERROR(logger_, "Message doesn't contain parameter app_id"); + SDL_LOG_ERROR("Message doesn't contain parameter app_id"); return; } CheckApplication( @@ -150,30 +149,28 @@ void HMILanguageHandler::on_event(const event_engine::Event& event) { if (is_ui_language_received_ && is_vr_language_received_ && is_tts_language_received_) { - LOG4CXX_DEBUG(logger_, "All GetLanguages responses gotten."); + SDL_LOG_DEBUG("All GetLanguages responses gotten."); VerifyWithPersistedLanguages(); } } void HMILanguageHandler::set_handle_response_for( const smart_objects::SmartObject& request) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; if (!request.keyExists(strings::params)) { - LOG4CXX_ERROR(logger_, - "Object does not have " << strings::params << " key."); + SDL_LOG_ERROR("Object does not have " << strings::params << " key."); return; } if (!request[strings::params].keyExists(strings::function_id)) { - LOG4CXX_ERROR(logger_, - "Object does not have " << strings::function_id << " key."); + SDL_LOG_ERROR("Object does not have " << strings::function_id << " key."); return; } if (!request[strings::params].keyExists(strings::correlation_id)) { - LOG4CXX_ERROR( - logger_, "Object does not have " << strings::correlation_id << " key."); + SDL_LOG_ERROR("Object does not have " << strings::correlation_id + << " key."); return; } @@ -186,8 +183,7 @@ void HMILanguageHandler::set_handle_response_for( hmi_apis::FunctionID::UI_GetLanguage, hmi_apis::FunctionID::VR_GetLanguage, hmi_apis::FunctionID::TTS_GetLanguage)) { - LOG4CXX_ERROR(logger_, - "Only *GetLanguage request are allowed to be subscribed."); + SDL_LOG_ERROR("Only *GetLanguage request are allowed to be subscribed."); return; } @@ -196,9 +192,8 @@ void HMILanguageHandler::set_handle_response_for( subscribe_on_event(function_id, correlation_id); - LOG4CXX_DEBUG(logger_, - "Subscribed for function_id " - << function_id << " and correlation_id " << correlation_id); + SDL_LOG_DEBUG("Subscribed for function_id " + << function_id << " and correlation_id " << correlation_id); } void HMILanguageHandler::set_default_capabilities_languages( @@ -223,7 +218,7 @@ void HMILanguageHandler::set_default_capabilities_languages( void HMILanguageHandler::SendOnLanguageChangeToMobile( const uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr notification = std::make_shared<smart_objects::SmartObject>(); @@ -242,14 +237,14 @@ void HMILanguageHandler::SendOnLanguageChangeToMobile( hmi_capabilities.active_vr_language(); if (application_manager_.GetRPCService().ManageMobileCommand( notification, commands::Command::SOURCE_SDL)) { - LOG4CXX_INFO(logger_, "Mobile command sent"); + SDL_LOG_INFO("Mobile command sent"); } else { - LOG4CXX_WARN(logger_, "Cannot send mobile command"); + SDL_LOG_WARN("Cannot send mobile command"); } } void HMILanguageHandler::VerifyWithPersistedLanguages() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; const HMICapabilities& hmi_capabilities = application_manager_.hmi_capabilities(); @@ -258,14 +253,13 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() { if (hmi_capabilities.active_ui_language() == persisted_ui_language_ && hmi_capabilities.active_vr_language() == persisted_vr_language_ && hmi_capabilities.active_tts_language() == persisted_tts_language_) { - LOG4CXX_INFO(logger_, - "All languages gotten from HMI match to persisted values."); + SDL_LOG_INFO("All languages gotten from HMI match to persisted values."); return; } - LOG4CXX_INFO(logger_, - "Some languages gotten from HMI have " - "mismatch with persisted values."); + SDL_LOG_INFO( + "Some languages gotten from HMI have " + "mismatch with persisted values."); const ApplicationSet& accessor = application_manager_.applications().GetData(); @@ -273,40 +267,37 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() { for (; accessor.end() != it;) { ApplicationConstSharedPtr app = *it++; - LOG4CXX_INFO(logger_, - "Application with app_id " - << app->app_id() - << " will be unregistered because of " - "HMI language(s) mismatch."); + SDL_LOG_INFO("Application with app_id " + << app->app_id() + << " will be unregistered because of " + "HMI language(s) mismatch."); CheckApplication(std::make_pair(app->app_id(), false)); } sync_primitives::AutoLock lock(apps_lock_); if (0 == apps_.size()) { - LOG4CXX_DEBUG(logger_, - "No registered apps found. HMILanguageHandler unsubscribed " - "from all events."); + SDL_LOG_DEBUG( + "No registered apps found. HMILanguageHandler unsubscribed " + "from all events."); unsubscribe_from_all_hmi_events(); } } void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock lock(apps_lock_); Apps::iterator it = apps_.find(app.first); if (apps_.end() == it) { - LOG4CXX_DEBUG(logger_, - "Application id " - << app.first - << " is not found within apps with wrong language."); + SDL_LOG_DEBUG("Application id " + << app.first + << " is not found within apps with wrong language."); return; } apps_.erase(it); if (0 == apps_.size()) { - LOG4CXX_DEBUG(logger_, - "HMILanguageHandler unsubscribed from all events."); + SDL_LOG_DEBUG("HMILanguageHandler unsubscribed from all events."); unsubscribe_from_all_hmi_events(); } } @@ -318,22 +309,19 @@ void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) { commands::Command::SOURCE_SDL); application_manager_.UnregisterApplication( app.first, mobile_apis::Result::SUCCESS, false); - LOG4CXX_INFO(logger_, - "Unregistering application with app_id " - << app.first << " because of HMI language(s) mismatch."); + SDL_LOG_INFO("Unregistering application with app_id " + << app.first << " because of HMI language(s) mismatch."); } void HMILanguageHandler::CheckApplication(const Apps::value_type app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool is_need_handle_wrong_language = false; { sync_primitives::AutoLock lock(apps_lock_); Apps::iterator it = apps_.find(app.first); if (apps_.end() == it) { - LOG4CXX_INFO(logger_, - "Adding application id " - << app.first - << " Application registered: " << app.second); + SDL_LOG_INFO("Adding application id " + << app.first << " Application registered: " << app.second); apps_.insert(app); return; } @@ -352,7 +340,7 @@ void HMILanguageHandler::Init(resumption::LastStateWrapperPtr value) { } void HMILanguageHandler::OnUnregisterApplication(uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_lock_); apps_.erase(app_id); } diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index 844d0254cf..d9ae6631a3 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -40,7 +40,7 @@ namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "HmiState") +SDL_CREATE_LOG_VARIABLE("HmiState") HmiState::HmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr, @@ -53,7 +53,7 @@ HmiState::HmiState(std::shared_ptr<Application> app, , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) , video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM) , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { - LOG4CXX_DEBUG(logger_, *this); + SDL_LOG_DEBUG(*this); } HmiState::HmiState(std::shared_ptr<Application> app, @@ -66,7 +66,7 @@ HmiState::HmiState(std::shared_ptr<Application> app, , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) , video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM) , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { - LOG4CXX_DEBUG(logger_, *this); + SDL_LOG_DEBUG(*this); } void HmiState::set_parent(HmiStatePtr parent) { diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index d351ea91b8..e9578b9fa1 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -68,7 +68,7 @@ #include "formatters/formatter_json_rpc.h" #include "json/json.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("ApplicationManager") namespace application_manager { @@ -257,7 +257,7 @@ const VehicleData MessageHelper::vehicle_data_( smart_objects::SmartObjectSPtr MessageHelper::CreateNotification( mobile_apis::FunctionID::eType function_id, uint32_t app_id) { using smart_objects::SmartObject; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr object( new SmartObject(smart_objects::SmartType_Map)); (*object)[strings::params][strings::message_type] = @@ -278,7 +278,7 @@ MessageHelper::CreateHMINotification(hmi_apis::FunctionID::eType function_id) { using smart_objects::SmartObject; using smart_objects::SmartObjectSPtr; using smart_objects::SmartType_Map; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SmartObjectSPtr notification_ptr = std::make_shared<SmartObject>(SmartType_Map); SmartObject& notification = *notification_ptr; @@ -329,7 +329,7 @@ std::string MessageHelper::GetDeviceMacAddressForHandle( std::string device_mac_address = ""; app_mngr.connection_handler().get_session_observer().GetDataOnDeviceID( device_handle, NULL, NULL, &device_mac_address); - LOG4CXX_DEBUG(logger_, "result : " << device_handle); + SDL_LOG_DEBUG("result : " << device_handle); return device_mac_address; } @@ -372,7 +372,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI( smart_objects::SmartObjectSPtr MessageHelper::CreateDisplayCapabilityUpdateToMobile( const smart_objects::SmartObject& display_capabilities, Application& app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto message = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -398,7 +398,7 @@ MessageHelper::CreateDisplayCapabilityUpdateToMobile( void MessageHelper::BroadcastCapabilityUpdate( smart_objects::SmartObject& msg_params, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject message(smart_objects::SmartType_Map); message[strings::params][strings::message_type] = MessageType::kNotification; @@ -444,7 +444,7 @@ smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities( smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification( const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr message = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -491,17 +491,17 @@ void MessageHelper::SendGetSystemTimeRequest(const uint32_t correlation_id, void MessageHelper::SendHashUpdateNotification(const uint32_t app_id, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = app_mngr.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application not found by appID"); + SDL_LOG_ERROR("Application not found by appID"); return; } smart_objects::SmartObjectSPtr so = CreateHashUpdateNotification(app_id); PrintSmartObject(*so); if (!app_mngr.GetRPCService().ManageMobileCommand( so, commands::Command::SOURCE_SDL)) { - LOG4CXX_ERROR(logger_, "Failed to send HashUpdate notification."); + SDL_LOG_ERROR("Failed to send HashUpdate notification."); return; } app_mngr.resume_controller().ApplicationsDataUpdated(); @@ -511,7 +511,7 @@ smart_objects::SmartObjectSPtr MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( int32_t connection_key, mobile_api::AppInterfaceUnregisteredReason::eType reason) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr notification = std::make_shared<smart_objects::SmartObject>(); @@ -533,7 +533,7 @@ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( void MessageHelper::SendDeleteCommandRequest(smart_objects::SmartObject* cmd, ApplicationSharedPtr application, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(cmd); using namespace smart_objects; SmartObject msg_params = SmartObject(smart_objects::SmartType_Map); @@ -576,7 +576,7 @@ void MessageHelper::SendDeleteCommandRequest(smart_objects::SmartObject* cmd, void MessageHelper::SendDeleteSubmenuRequest(smart_objects::SmartObject* cmd, ApplicationSharedPtr application, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(cmd); using namespace smart_objects; @@ -632,7 +632,7 @@ void MessageHelper::SendDeleteSubmenuRequest(smart_objects::SmartObject* cmd, void MessageHelper::SendDeleteChoiceSetRequest(smart_objects::SmartObject* cmd, ApplicationSharedPtr application, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(cmd); using namespace smart_objects; @@ -663,7 +663,7 @@ void MessageHelper::SendDeleteChoiceSetRequest(smart_objects::SmartObject* cmd, void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace smart_objects; { @@ -814,11 +814,11 @@ void MessageHelper::SendHMIStatusNotification( ApplicationSharedPtr application, const WindowID window_id, ApplicationManager& application_manager) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr notification = std::make_shared<smart_objects::SmartObject>(); if (!notification) { - LOG4CXX_ERROR(logger_, "Failed to create smart object"); + SDL_LOG_ERROR("Failed to create smart object"); return; } smart_objects::SmartObject& message = *notification; @@ -858,7 +858,7 @@ void MessageHelper::SendActivateAppToHMI( application_manager::ApplicationConstSharedPtr app = application_manager.application(app_id); if (!app) { - LOG4CXX_WARN(logger_, "Invalid app_id: " << app_id); + SDL_LOG_WARN("Invalid app_id: " << app_id); return; } @@ -929,7 +929,7 @@ std::string MessageHelper::StringifiedHMILevel( std::string MessageHelper::StringifiedFunctionID( mobile_apis::FunctionID::eType function_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace ns_smart_device_link::ns_smart_objects; const char* str = 0; if (EnumConversionHelper<mobile_apis::FunctionID::eType>::EnumToCString( @@ -947,7 +947,7 @@ void MessageHelper::CreateGetVehicleDataRequest( const uint32_t correlation_id, const std::vector<std::string>& params, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr request = std::make_shared<smart_objects::SmartObject>(); @@ -975,7 +975,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse( mobile_apis::Result::eType result, const uint32_t correlation_id, uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr response = std::make_shared<smart_objects::SmartObject>(); @@ -999,7 +999,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO( const connection_handler::DeviceMap& devices, const policy::PolicyHandlerInterface& policy_handler, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr device_list_so = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -1033,7 +1033,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO( smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO( uint32_t function_id, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr module_info = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -1049,7 +1049,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO( smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon( const std::string& path_to_icon, uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr set_icon = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -1075,12 +1075,12 @@ void MessageHelper::SendOnButtonSubscriptionNotification( ApplicationManager& app_mngr) { using namespace smart_objects; using namespace hmi_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SmartObjectSPtr notification_ptr = std::make_shared<SmartObject>(SmartType_Map); if (!notification_ptr) { - LOG4CXX_ERROR(logger_, "Memory allocation failed."); + SDL_LOG_ERROR("Memory allocation failed."); return; } SmartObject& notification = *notification_ptr; @@ -1101,7 +1101,7 @@ void MessageHelper::SendOnButtonSubscriptionNotification( notification[strings::msg_params] = msg_params; if (!app_mngr.GetRPCService().ManageHMICommand(notification_ptr)) { - LOG4CXX_ERROR(logger_, "Unable to send HMI notification"); + SDL_LOG_ERROR("Unable to send HMI notification"); } } @@ -1110,10 +1110,10 @@ void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp( using namespace smart_objects; using namespace hmi_apis; using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app.use_count() == 0) { - LOG4CXX_ERROR(logger_, "Invalid application pointer "); + SDL_LOG_ERROR("Invalid application pointer "); return; } @@ -1157,7 +1157,7 @@ void MessageHelper::SendSetAppIcon( void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_man) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app) { SendSetAppIcon(app->app_id(), app->app_icon_path(), app_man); SendGlobalPropertiesToHMI(app, app_man); @@ -1168,7 +1168,7 @@ void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app, void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { if (app.use_count() == 0) { - LOG4CXX_ERROR(logger_, "Invalid application"); + SDL_LOG_ERROR("Invalid application"); return; } @@ -1184,11 +1184,11 @@ void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app, smart_objects::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHMI( ApplicationConstSharedPtr app, const uint32_t correlation_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectList requests; if (app.use_count() == 0) { - LOG4CXX_ERROR(logger_, "Invalid application"); + SDL_LOG_ERROR("Invalid application"); return requests; } @@ -1274,7 +1274,7 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI( void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app, bool default_help_prompt, ApplicationManager& app_man) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app) { return; } @@ -1361,7 +1361,7 @@ smart_objects::SmartObjectList MessageHelper::CreateShowRequestToHMI( ApplicationConstSharedPtr app, const uint32_t correlation_id) { smart_objects::SmartObjectList requests; if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application"); + SDL_LOG_ERROR("Invalid application"); return requests; } @@ -1430,7 +1430,7 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI( ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { smart_objects::SmartObjectList requests; if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application"); + SDL_LOG_ERROR("Invalid application"); return requests; } @@ -1455,7 +1455,7 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI( if ((*i->second).keyExists(strings::cmd_id)) { msg_params[strings::cmd_id] = (*i->second)[strings::cmd_id].asUInt(); } else { - LOG4CXX_ERROR(logger_, "Command ID is missing."); + SDL_LOG_ERROR("Command ID is missing."); continue; } msg_params[strings::menu_params] = (*i->second)[strings::menu_params]; @@ -1488,7 +1488,7 @@ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI( ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { smart_objects::SmartObjectList requests; if (!app) { - LOG4CXX_ERROR(logger_, "Invalid application"); + SDL_LOG_ERROR("Invalid application"); return requests; } @@ -1558,7 +1558,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateChangeRegistration( void MessageHelper::SendUIChangeRegistrationRequestToHMI( ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { if (app.use_count() == 0) { - LOG4CXX_ERROR(logger_, "Application is not valid"); + SDL_LOG_ERROR("Application is not valid"); return; } @@ -1622,7 +1622,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateUICreateWindowRequestToHMI( ApplicationSharedPtr application, ApplicationManager& app_mngr, const smart_objects::SmartObject& window_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto ui_request = CreateMessageForHMI(hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); @@ -1693,8 +1693,7 @@ bool MessageHelper::CreateDeviceInfo( if (-1 == session_observer.GetDataOnDeviceID( device_handle, &device_name, NULL, &mac_address, &transport_type)) { - LOG4CXX_ERROR(logger_, - "Failed to extract information for device " << device_handle); + SDL_LOG_ERROR("Failed to extract information for device " << device_handle); } smart_objects::SmartObject& device_info_map = *output; @@ -1724,7 +1723,7 @@ bool MessageHelper::CreateHMIApplicationStruct( SmartObject& message = *output; if (!app) { - LOG4CXX_WARN(logger_, "Application is not valid"); + SDL_LOG_WARN("Application is not valid"); return false; } @@ -1848,7 +1847,7 @@ bool MessageHelper::CreateHMIApplicationStruct( void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { if (app.use_count() == 0) { - LOG4CXX_ERROR(logger_, "Invalid application"); + SDL_LOG_ERROR("Invalid application"); return; } @@ -1929,7 +1928,7 @@ void MessageHelper::SendOnAppUnregNotificationToHMI( smart_objects::SmartObjectSPtr MessageHelper::CreateOnAppPropertiesChangeNotification( const std::string& policy_app_id, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr notification = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -1985,8 +1984,7 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI( ApplicationManager& app_mngr) { DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr()); if (hmi_apis::Common_HMILevel::NONE == level) { - LOG4CXX_WARN(logger_, - "BC.ActivateApp cannot be used to deactivate an application"); + SDL_LOG_WARN("BC.ActivateApp cannot be used to deactivate an application"); return NULL; } @@ -2044,11 +2042,11 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCCloseApplicationRequestToHMI( void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id, ApplicationManager& app_mngr) { - LOG4CXX_WARN(logger_, "SendOnResumeAudioSourceToHMI app_id: " << app_id); + SDL_LOG_WARN("SendOnResumeAudioSourceToHMI app_id: " << app_id); application_manager::ApplicationConstSharedPtr app = app_mngr.application(app_id); if (!app) { - LOG4CXX_WARN(logger_, "Invalid app_id: " << app_id); + SDL_LOG_WARN("Invalid app_id: " << app_id); return; } @@ -2159,7 +2157,7 @@ void MessageHelper::SendGetUserFriendlyMessageResponse( const std::vector<policy::UserFriendlyMessage>& msg, const uint32_t correlation_id, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr message = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -2324,7 +2322,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateOnServiceUpdateNotification( const hmi_apis::Common_ServiceStatusUpdateReason::eType service_update_reason, const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto notification = MessageHelper::CreateHMINotification( hmi_apis::FunctionID::BasicCommunication_OnServiceUpdate); @@ -2350,7 +2348,7 @@ void MessageHelper::SendNaviSetVideoConfig( int32_t app_id, ApplicationManager& app_mngr, const smart_objects::SmartObject& video_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr request = CreateMessageForHMI( hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!request) { @@ -2368,7 +2366,7 @@ void MessageHelper::SendNaviSetVideoConfig( void MessageHelper::SendNaviStartStream(const int32_t app_id, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr start_stream = CreateMessageForHMI( hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!start_stream) { @@ -2402,7 +2400,7 @@ void MessageHelper::SendNaviStartStream(const int32_t app_id, void MessageHelper::SendNaviStopStream(const int32_t app_id, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr stop_stream = CreateMessageForHMI( hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!stop_stream) { @@ -2419,7 +2417,7 @@ void MessageHelper::SendNaviStopStream(const int32_t app_id, void MessageHelper::SendAudioStartStream(const int32_t app_id, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr start_stream = CreateMessageForHMI( hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); @@ -2454,7 +2452,7 @@ void MessageHelper::SendAudioStartStream(const int32_t app_id, void MessageHelper::SendAudioStopStream(const int32_t app_id, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr stop_stream = CreateMessageForHMI( hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); @@ -2503,7 +2501,7 @@ void MessageHelper::SendOnDataStreaming( } bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) { - LOG4CXX_INFO(logger_, "MessageHelper::SendAudioStopAudioPathThru"); + SDL_LOG_INFO("MessageHelper::SendAudioStopAudioPathThru"); smart_objects::SmartObjectSPtr result = CreateMessageForHMI( hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); @@ -2515,7 +2513,7 @@ bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) { } bool MessageHelper::SendUnsubscribedWayPoints(ApplicationManager& app_mngr) { - LOG4CXX_INFO(logger_, "MessageHelper::SendUnsubscribedWayPoints"); + SDL_LOG_INFO("MessageHelper::SendUnsubscribedWayPoints"); smart_objects::SmartObjectSPtr result = CreateMessageForHMI( hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); @@ -2531,7 +2529,7 @@ void MessageHelper::SendPolicySnapshotNotification( const std::string& snapshot_file_path, const std::string& url, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject content(smart_objects::SmartType_Map); const auto request_type = #if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE) @@ -2545,7 +2543,7 @@ void MessageHelper::SendPolicySnapshotNotification( if (!url.empty()) { content[strings::msg_params][strings::url] = url; } else { - LOG4CXX_WARN(logger_, "No service URLs"); + SDL_LOG_WARN("No service URLs"); } content[strings::msg_params][strings::file_name] = snapshot_file_path; @@ -2572,7 +2570,7 @@ void MessageHelper::SendPolicySnapshotNotification( content[strings::msg_params][strings::url] = url; // Doesn't work with mobile_notification::syncp_url ("URL") } else { - LOG4CXX_WARN(logger_, "No service URLs"); + SDL_LOG_WARN("No service URLs"); } content[strings::params][strings::binary_data] = @@ -2660,7 +2658,7 @@ void MessageHelper::SendOnPermissionsChangeNotification( const policy::Permissions& permissions, ApplicationManager& app_mngr, const policy::EncryptionRequired encryprion_required) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject content(smart_objects::SmartType_Map); content[strings::params][strings::function_id] = @@ -2938,7 +2936,7 @@ void MessageHelper::SendUpdateSDLResponse(const std::string& result, void MessageHelper::SendOnStatusUpdate(const std::string& status, ApplicationManager& app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr message = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); @@ -2951,7 +2949,7 @@ void MessageHelper::SendOnStatusUpdate(const std::string& status, (*message)[strings::params][strings::message_type] = MessageType::kNotification; - LOG4CXX_DEBUG(logger_, "Sending new status:" << status); + SDL_LOG_DEBUG("Sending new status:" << status); (*message)[strings::msg_params]["status"] = status; app_mngr.GetRPCService().ManageHMICommand(message); @@ -2980,7 +2978,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles( mobile_apis::Result::eType res = VerifyImageFiles(message[i], app, app_mngr); if (mobile_apis::Result::SUCCESS != res) { - LOG4CXX_DEBUG(logger_, "VerifyImageFiles result:" << res); + SDL_LOG_DEBUG("VerifyImageFiles result:" << res); return res; } } @@ -2991,8 +2989,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles( VerifyImage(message, app, app_mngr); if (mobile_apis::Result::SUCCESS != verification_result) { - LOG4CXX_DEBUG(logger_, - "VerifyImageFiles result:" << verification_result); + SDL_LOG_DEBUG("VerifyImageFiles result:" << verification_result); return verification_result; // exit point } } else { @@ -3005,7 +3002,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles( mobile_apis::Result::eType res = VerifyImageFiles(message[*key], app, app_mngr); if (mobile_apis::Result::SUCCESS != res) { - LOG4CXX_DEBUG(logger_, "VerifyImageFiles result:" << res); + SDL_LOG_DEBUG("VerifyImageFiles result:" << res); return res; } } @@ -3165,9 +3162,9 @@ bool MessageHelper::VerifyString(const std::string& str) { (std::string::npos != str.find("\\n")) || (std::string::npos != str.find("\\t")) || (std::string::npos == str.find_first_not_of(' '))) { - LOG4CXX_ERROR(logger_, - "MessageHelper::VerifyString" - "string contains incorrect character"); + SDL_LOG_ERROR( + "MessageHelper::VerifyString" + "string contains incorrect character"); return false; } return true; @@ -3297,7 +3294,7 @@ void MessageHelper::SubscribeApplicationToSoftButton( smart_objects::SmartObject& message_params, ApplicationSharedPtr app, int32_t function_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SubscribeApplicationToSoftButton( message_params, app, @@ -3310,7 +3307,7 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) { Json::Value tmp; namespace Formatters = ns_smart_device_link::ns_json_handler::formatters; Formatters::CFormatterJsonBase::objToJsonValue(object, tmp); - LOG4CXX_DEBUG(logger_, "SMART OBJECT: " << tmp.toStyledString()); + SDL_LOG_DEBUG("SMART OBJECT: " << tmp.toStyledString()); #endif return true; } diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc index d3e7c782f7..a9c0a362be 100644 --- a/src/components/application_manager/src/mobile_message_handler.cc +++ b/src/components/application_manager/src/mobile_message_handler.cc @@ -59,7 +59,7 @@ MessageTypeMap message_types = {std::make_pair(kRequest, "Request"), std::make_pair(kResponse, "Response"), std::make_pair(kNotification, "Notification")}; } // namespace -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("ApplicationManager") application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocol( @@ -68,41 +68,40 @@ MobileMessageHandler::HandleIncomingMessageProtocol( application_manager::Message* out_message = NULL; switch (message->protocol_version()) { case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1: - LOG4CXX_DEBUG(logger_, "Protocol version - V1"); + SDL_LOG_DEBUG("Protocol version - V1"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV1(message); break; case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2: - LOG4CXX_DEBUG(logger_, "Protocol version - V2"); + SDL_LOG_DEBUG("Protocol version - V2"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); break; case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3: - LOG4CXX_DEBUG(logger_, "Protocol version - V3"); + SDL_LOG_DEBUG("Protocol version - V3"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); break; case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4: - LOG4CXX_DEBUG(logger_, "Protocol version - V4"); + SDL_LOG_DEBUG("Protocol version - V4"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); break; case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5: - LOG4CXX_DEBUG(logger_, "Protocol version - V5"); + SDL_LOG_DEBUG("Protocol version - V5"); out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); break; default: - LOG4CXX_WARN(logger_, "Can't recognise protocol version"); + SDL_LOG_WARN("Can't recognise protocol version"); out_message = NULL; break; } if (out_message == NULL) { - LOG4CXX_WARN(logger_, "Message is NULL"); + SDL_LOG_WARN("Message is NULL"); return NULL; } - LOG4CXX_DEBUG(logger_, - "Incoming RPC_INFO: " << (out_message->connection_key() >> 16) + SDL_LOG_DEBUG("Incoming RPC_INFO: " << (out_message->connection_key() >> 16) << ", " << message_types[out_message->type()] << ", " << out_message->function_id() @@ -114,8 +113,7 @@ MobileMessageHandler::HandleIncomingMessageProtocol( protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocol( const MobileMessage& message) { - LOG4CXX_DEBUG(logger_, - "Outgoing RPC_INFO: " << (message->connection_key() >> 16) + SDL_LOG_DEBUG("Outgoing RPC_INFO: " << (message->connection_key() >> 16) << ", " << message_types[message->type()] << ", " << message->function_id() << ", " << message->correlation_id() << ", " @@ -136,7 +134,7 @@ MobileMessageHandler::HandleOutgoingMessageProtocol( application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocolV1( const ::protocol_handler::RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager::Message* outgoing_message = new application_manager::Message( protocol_handler::MessagePriority::FromServiceType( @@ -165,7 +163,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1( application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocolV2( const ::protocol_handler::RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::BitStream message_bytestream(message->data(), message->data_size()); protocol_handler::ProtocolPayloadV2 payload; protocol_handler::Extract( @@ -173,8 +171,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2( // Silently drop message if it wasn't parsed correctly if (message_bytestream.IsBad()) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Drop ill-formed message from mobile, partially parsed: " << payload); return NULL; } @@ -207,10 +204,10 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2( protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocolV1( const MobileMessage& message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string message_string = message->json_message(); if (message_string.length() == 0) { - LOG4CXX_WARN(logger_, "Drop ill-formed message from mobile"); + SDL_LOG_WARN("Drop ill-formed message from mobile"); return NULL; } @@ -230,9 +227,9 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV1( protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocolV2( const MobileMessage& message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (message->json_message().length() == 0) { - LOG4CXX_ERROR(logger_, "json string is empty."); + SDL_LOG_ERROR("json string is empty."); } uint32_t json_size = message->json_message().length(); uint32_t binary_size = 0; diff --git a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc index 9214a30513..0276e59b7d 100644 --- a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc +++ b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc @@ -2,11 +2,12 @@ #include "application_manager/plugin_manager/rpc_plugin_manager_impl.h" #include "utils/file_system.h" +#include "utils/ilogger.h" namespace application_manager { namespace plugin_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "PluginManager") +SDL_CREATE_LOG_VARIABLE("PluginManager") RPCPluginManagerImpl::RPCPluginManagerImpl( ApplicationManager& app_manager, @@ -37,7 +38,7 @@ T GetFuncFromLib(void* dl_handle, const std::string& function_name) { reinterpret_cast<T>(dlsym(dl_handle, function_name.c_str())); char* error_string = dlerror(); if (nullptr != error_string) { - LOG4CXX_ERROR(logger_, "Failed to export symbols : " << error_string); + SDL_LOG_ERROR("Failed to export symbols : " << error_string); return nullptr; } return exported_func; @@ -46,22 +47,21 @@ T GetFuncFromLib(void* dl_handle, const std::string& function_name) { RPCPluginManagerImpl::RPCPluginPtr RPCPluginManagerImpl::LoadPlugin( const std::string& full_plugin_path) const { if (!IsLibraryFile(full_plugin_path)) { - LOG4CXX_DEBUG(logger_, "Skip loading " << full_plugin_path); + SDL_LOG_DEBUG("Skip loading " << full_plugin_path); return RPCPluginPtr(nullptr, [](RPCPlugin*) {}); } void* plugin_dll = dlopen(full_plugin_path.c_str(), RTLD_LAZY); if (nullptr == plugin_dll) { - LOG4CXX_ERROR( - logger_, - "Failed to open dll " << full_plugin_path << " : " << dlerror()); + SDL_LOG_ERROR("Failed to open dll " << full_plugin_path << " : " + << dlerror()); return RPCPluginPtr(nullptr, [](RPCPlugin*) {}); } - typedef RPCPlugin* (*Create)(); + typedef RPCPlugin* (*Create)(logger::Logger*); Create create_plugin = GetFuncFromLib<Create>(plugin_dll, "Create"); if (!create_plugin) { - LOG4CXX_ERROR(logger_, "No Create function in " << full_plugin_path); + SDL_LOG_ERROR("No Create function in " << full_plugin_path); dlclose(plugin_dll); return RPCPluginPtr(nullptr, [](RPCPlugin*) {}); } @@ -69,23 +69,23 @@ RPCPluginManagerImpl::RPCPluginPtr RPCPluginManagerImpl::LoadPlugin( typedef void (*Delete)(RPCPlugin*); Delete delete_plugin = GetFuncFromLib<Delete>(plugin_dll, "Delete"); if (!delete_plugin) { - LOG4CXX_ERROR(logger_, "No Delete function in " << full_plugin_path); + SDL_LOG_ERROR("No Delete function in " << full_plugin_path); dlclose(plugin_dll); return RPCPluginPtr(nullptr, [](RPCPlugin*) {}); } auto plugin_destroyer = [delete_plugin, plugin_dll](RPCPlugin* plugin) { - LOG4CXX_DEBUG(logger_, "Delete plugin " << plugin->PluginName()); + SDL_LOG_DEBUG("Delete plugin " << plugin->PluginName()); delete_plugin(plugin); dlclose(plugin_dll); return RPCPluginPtr(nullptr, [](RPCPlugin*) {}); }; - RPCPlugin* plugin = create_plugin(); + RPCPlugin* plugin = create_plugin(&logger::Logger::instance()); return RPCPluginPtr(plugin, plugin_destroyer); } uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) { - LOG4CXX_INFO(logger_, "Loading plugins from " << plugins_path); + SDL_LOG_INFO("Loading plugins from " << plugins_path); std::vector<std::string> plugin_files = file_system::ListFiles(plugins_path); for (auto& plugin_file : plugin_files) { std::string full_name = plugins_path + '/' + plugin_file; @@ -93,9 +93,8 @@ uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) { if (!plugin) { continue; } - LOG4CXX_DEBUG( - logger_, - "Loaded " << plugin->PluginName() << " plugin from " << full_name); + SDL_LOG_DEBUG("Loaded " << plugin->PluginName() << " plugin from " + << full_name); if (plugin->Init(app_manager_, rpc_service_, hmi_capabilities_, @@ -103,8 +102,7 @@ uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) { last_state_)) { loaded_plugins_.push_back(std::move(plugin)); } else { - LOG4CXX_ERROR(logger_, - "Initialisation of " << plugin->PluginName() + SDL_LOG_ERROR("Initialisation of " << plugin->PluginName() << " plugin from " << full_name << " failed"); } diff --git a/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc b/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc index 871e96442a..b5c329fdd2 100644 --- a/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc +++ b/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc @@ -34,7 +34,7 @@ #include "application_manager/application_manager.h" namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") +SDL_CREATE_LOG_VARIABLE("PolicyHandler") #ifdef EXTERNAL_PROPRIETARY_MODE AppPermissionDelegate::AppPermissionDelegate( @@ -57,7 +57,7 @@ AppPermissionDelegate::AppPermissionDelegate( #endif void AppPermissionDelegate::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef EXTERNAL_PROPRIETARY_MODE policy_handler_.OnAppPermissionConsentInternal( diff --git a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc index e668be4ed1..3b662ed201 100644 --- a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc +++ b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc @@ -33,7 +33,7 @@ #include "application_manager/policies/delegates/statistics_delegate.h" #include "application_manager/policies/policy_handler.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") +SDL_CREATE_LOG_VARIABLE("PolicyHandler") namespace policy { StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler, usage_statistics::GlobalCounterId type) @@ -89,7 +89,7 @@ StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler, , policy_handler_(policy_handler) {} void StatisticsDelegate::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); switch (type_) { case INCREMENT_GLOBAL: policy_handler_.Increment(global_counter_); @@ -104,7 +104,7 @@ void StatisticsDelegate::threadMain() { policy_handler_.Add(app_id_, stop_watch_, timespan_seconds_); break; default: - LOG4CXX_ERROR(logger_, "Unknown statistics operator"); + SDL_LOG_ERROR("Unknown statistics operator"); break; } } diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc index 7ca4d7b5b8..af44fd033f 100644 --- a/src/components/application_manager/src/policies/policy_event_observer.cc +++ b/src/components/application_manager/src/policies/policy_event_observer.cc @@ -40,7 +40,7 @@ namespace policy { using namespace application_manager; class PolicyHandler; -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") +SDL_CREATE_LOG_VARIABLE("PolicyHandler") PolicyEventObserver::PolicyEventObserver( policy::PolicyHandlerInterface* const policy_handler, @@ -49,9 +49,9 @@ PolicyEventObserver::PolicyEventObserver( void PolicyEventObserver::set_policy_handler( PolicyHandlerInterface* const policy_handler) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(policy_handler_lock_); - LOG4CXX_DEBUG(logger_, "Set policy handler " << policy_handler); + SDL_LOG_DEBUG("Set policy handler " << policy_handler); policy_handler_ = policy_handler; } diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index cf7735956a..0323e82e45 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -66,7 +66,7 @@ namespace policy { using namespace application_manager; -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") +SDL_CREATE_LOG_VARIABLE("PolicyHandler") namespace { using namespace mobile_apis; @@ -108,7 +108,6 @@ const std::string RequestTypeToString(mobile_apis::RequestType::eType type) { const policy::DeviceParams GetDeviceParams( connection_handler::DeviceHandle device_handle, const protocol_handler::SessionObserver& session_observer) { - CREATE_LOGGERPTR_LOCAL(logger_, "PolicyHandler"); policy::DeviceParams device_params; if (-1 == session_observer.GetDataOnDeviceID( device_handle, @@ -116,8 +115,7 @@ const policy::DeviceParams GetDeviceParams( NULL, &device_params.device_mac_address, &device_params.device_connection_type)) { - LOG4CXX_ERROR(logger_, - "Failed to extract information for device " << device_handle); + SDL_LOG_ERROR("Failed to extract information for device " << device_handle); } device_params.device_handle = device_handle; return device_params; @@ -141,22 +139,22 @@ struct HMILevelPredicate } // namespace -#define POLICY_LIB_CHECK_OR_RETURN(return_value) \ - { \ - sync_primitives::AutoReadLock lock(policy_manager_lock_); \ - if (!policy_manager_) { \ - LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded"); \ - return return_value; \ - } \ +#define POLICY_LIB_CHECK_OR_RETURN(return_value) \ + { \ + sync_primitives::AutoReadLock lock(policy_manager_lock_); \ + if (!policy_manager_) { \ + SDL_LOG_DEBUG("The shared library of policy is not loaded"); \ + return return_value; \ + } \ } -#define POLICY_LIB_CHECK_VOID() \ - { \ - sync_primitives::AutoReadLock lock(policy_manager_lock_); \ - if (!policy_manager_) { \ - LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded"); \ - return; \ - } \ +#define POLICY_LIB_CHECK_VOID() \ + { \ + sync_primitives::AutoReadLock lock(policy_manager_lock_); \ + if (!policy_manager_) { \ + SDL_LOG_DEBUG("The shared library of policy is not loaded"); \ + return; \ + } \ } static const std::string kCerficateFileName = "certificate"; @@ -198,9 +196,9 @@ struct LinksCollector { void operator()(const ApplicationSharedPtr& app) { if (app.use_count() == 0) { - LOG4CXX_WARN(logger_, - "Invalid pointer to application was passed." - "Skip current application."); + SDL_LOG_WARN( + "Invalid pointer to application was passed." + "Skip current application."); return; } DeviceParams device_params = GetDeviceParams( @@ -208,8 +206,7 @@ struct LinksCollector { application_manager_.connection_handler().get_session_observer()); const std::string app_id = app->policy_app_id(); if (device_params.device_mac_address.empty()) { - LOG4CXX_WARN(logger_, - "Couldn't find device, which hosts application " << app_id); + SDL_LOG_WARN("Couldn't find device, which hosts application " << app_id); return; } out_app_to_device_link_.insert( @@ -232,9 +229,9 @@ struct LinkAppToDevice { void operator()(const ApplicationSharedPtr& app) { if (app.use_count() == 0) { - LOG4CXX_WARN(logger_, - "Invalid pointer to application was passed." - "Skip current application."); + SDL_LOG_WARN( + "Invalid pointer to application was passed." + "Skip current application."); return; } DeviceParams device_params = GetDeviceParams( @@ -242,8 +239,7 @@ struct LinkAppToDevice { application_manager_.connection_handler().get_session_observer()); const std::string app_id = app->policy_app_id(); if (device_params.device_mac_address.empty()) { - LOG4CXX_WARN(logger_, - "Couldn't find device, which hosts application " << app_id); + SDL_LOG_WARN("Couldn't find device, which hosts application " << app_id); return; } app_to_device_link_[app_id] = device_params.device_mac_address; @@ -320,12 +316,12 @@ bool PolicyHandler::PolicyEnabled() const { } bool PolicyHandler::LoadPolicyLibrary() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoWriteLock lock(policy_manager_lock_); if (!PolicyEnabled()) { - LOG4CXX_WARN(logger_, - "System is configured to work without policy " - "functionality."); + SDL_LOG_WARN( + "System is configured to work without policy " + "functionality."); policy_manager_.reset(); return false; } @@ -343,14 +339,13 @@ bool PolicyHandler::CreateManager() { void* policy_handle = dlopen(kLibrary.c_str(), RTLD_LAZY); const char* error = dlerror(); if (!policy_handle) { - LOG4CXX_ERROR( - logger_, - (error == NULL ? "Unknown error in dlopen while loading policy table" + SDL_LOG_ERROR((error == NULL + ? "Unknown error in dlopen while loading policy table" : error)); return false; } - typedef PolicyManager* (*CreateManager)(); + typedef PolicyManager* (*CreateManager)(logger::Logger*); typedef void (*DeleteManager)(PolicyManager*); CreateManager create_manager = reinterpret_cast<CreateManager>(dlsym(policy_handle, "CreateManager")); @@ -358,16 +353,16 @@ bool PolicyHandler::CreateManager() { reinterpret_cast<DeleteManager>(dlsym(policy_handle, "DeleteManager")); auto policy_destroyer = [delete_manager, policy_handle](PolicyManager* policy_manager) { - LOG4CXX_DEBUG(logger_, "Delete Policy Manager"); + SDL_LOG_DEBUG("Delete Policy Manager"); delete_manager(policy_manager); dlclose(policy_handle); }; char* error_string = dlerror(); if (NULL == error_string) { - policy_manager_ = - std::shared_ptr<PolicyManager>(create_manager(), policy_destroyer); + policy_manager_ = std::shared_ptr<PolicyManager>( + create_manager(&logger::Logger::instance()), policy_destroyer); } else { - LOG4CXX_WARN(logger_, error_string); + SDL_LOG_WARN(error_string); dlclose(policy_handle); } return (policy_manager_.use_count() != 0); @@ -378,7 +373,7 @@ const PolicySettings& PolicyHandler::get_settings() const { } bool PolicyHandler::InitPolicyTable() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(false); std::string preloaded_file = get_settings().preloaded_pt_file(); if (file_system::FileExists(preloaded_file)) { @@ -387,12 +382,12 @@ bool PolicyHandler::InitPolicyTable() { OnPTInited(); return pt_inited; } - LOG4CXX_FATAL(logger_, "The file which contains preloaded PT is not exist"); + SDL_LOG_FATAL("The file which contains preloaded PT is not exist"); return false; } void PolicyHandler::OnPTInited() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(listeners_lock_); @@ -402,7 +397,7 @@ void PolicyHandler::OnPTInited() { } void PolicyHandler::StopRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); #ifndef EXTERNAL_PROPRIETARY_MODE // Clear cached PTU app @@ -412,18 +407,18 @@ void PolicyHandler::StopRetrySequence() { } bool PolicyHandler::ResetPolicyTable() { - LOG4CXX_TRACE(logger_, "Reset policy table."); + SDL_LOG_TRACE("Reset policy table."); POLICY_LIB_CHECK_OR_RETURN(false); std::string preloaded_file = get_settings().preloaded_pt_file(); if (file_system::FileExists(preloaded_file)) { return policy_manager_->ResetPT(preloaded_file); } - LOG4CXX_WARN(logger_, "The file which contains preloaded PT is not exist"); + SDL_LOG_WARN("The file which contains preloaded PT is not exist"); return false; } bool PolicyHandler::ClearUserConsent() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(false); return policy_manager_->ResetUserConsent(); } @@ -431,7 +426,7 @@ bool PolicyHandler::ClearUserConsent() { #ifndef EXTERNAL_PROPRIETARY_MODE uint32_t PolicyHandler::ChoosePTUApplication( const PTUIterationType iteration_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Return the previous app chosen if this is a retry for a PTU in progress if (iteration_type == PTUIterationType::RetryIteration && @@ -439,7 +434,7 @@ uint32_t PolicyHandler::ChoosePTUApplication( ApplicationSharedPtr app = application_manager_.application(last_ptu_app_id_); if (app && app->IsRegistered()) { - LOG4CXX_INFO(logger_, "Previously chosen application exists, returning"); + SDL_LOG_INFO("Previously chosen application exists, returning"); return last_ptu_app_id_; } } @@ -458,7 +453,7 @@ void PolicyHandler::CacheRetryInfo(const uint32_t app_id, #endif // EXTERNAL_PROPRIETARY_MODE uint32_t PolicyHandler::GetAppIdForSending() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(0); // fix ApplicationSet access crash @@ -471,9 +466,8 @@ uint32_t PolicyHandler::GetAppIdForSending() const { std::back_inserter(apps_without_none_level), std::not1(has_none_level)); - LOG4CXX_DEBUG(logger_, - "Number of apps with different from NONE level: " - << apps_without_none_level.size()); + SDL_LOG_DEBUG("Number of apps with different from NONE level: " + << apps_without_none_level.size()); uint32_t app_id = ChooseRandomAppForPolicyUpdate(apps_without_none_level); @@ -487,12 +481,11 @@ uint32_t PolicyHandler::GetAppIdForSending() const { std::back_inserter(apps_with_none_level), has_none_level); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Number of apps with NONE level: " << apps_with_none_level.size()); if (apps_with_none_level.empty()) { - LOG4CXX_WARN(logger_, "There is no registered application"); + SDL_LOG_WARN("There is no registered application"); return 0; } @@ -500,7 +493,7 @@ uint32_t PolicyHandler::GetAppIdForSending() const { } void PolicyHandler::PushAppIdToPTUQueue(const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); sync_primitives::AutoLock lock(app_id_queue_lock_); const auto result = applications_ptu_queue_.insert(app_id); @@ -510,7 +503,7 @@ void PolicyHandler::PushAppIdToPTUQueue(const uint32_t app_id) { } void PolicyHandler::PopAppIdFromPTUQueue() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); sync_primitives::AutoLock lock(app_id_queue_lock_); if (applications_ptu_queue_.size() > 0) { @@ -521,7 +514,7 @@ void PolicyHandler::PopAppIdFromPTUQueue() { #ifdef EXTERNAL_PROPRIETARY_MODE PTURetryHandler& PolicyHandler::ptu_retry_handler() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return *policy_manager_; } @@ -529,14 +522,14 @@ void PolicyHandler::OnAppPermissionConsent( const uint32_t connection_key, const PermissionConsent& permissions, const ExternalConsentStatus& external_consent_status) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); AsyncRun(new AppPermissionDelegate( connection_key, permissions, external_consent_status, *this)); } #else void PolicyHandler::OnAppPermissionConsent( const uint32_t connection_key, const PermissionConsent& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); AsyncRun(new AppPermissionDelegate(connection_key, permissions, *this)); } @@ -544,13 +537,12 @@ void PolicyHandler::OnAppPermissionConsent( void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id, const bool is_allowed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); connection_handler::DeviceHandle device_handle; if (!application_manager_.connection_handler().GetDeviceID(device_id, &device_handle)) { - LOG4CXX_ERROR(logger_, - "Unable to get device handle for device_id: " << device_id); + SDL_LOG_ERROR("Unable to get device handle for device_id: " << device_id); return; } // In case of changed consent for device, related applications will be @@ -588,14 +580,13 @@ void PolicyHandler::SendOnAppPermissionsChanged( const AppPermissions& permissions, const std::string& device_id, const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG( - logger_, - "PolicyHandler::SendOnAppPermissionsChanged for " << policy_app_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("PolicyHandler::SendOnAppPermissionsChanged for " + << policy_app_id); ApplicationSharedPtr app = application_manager_.application(device_id, policy_app_id); if (app.use_count() == 0) { - LOG4CXX_WARN(logger_, "No app found for policy app id = " << policy_app_id); + SDL_LOG_WARN("No app found for policy app id = " << policy_app_id); return; } MessageHelper::SendOnAppPermissionsChangedNotification( @@ -604,7 +595,7 @@ void PolicyHandler::SendOnAppPermissionsChanged( void PolicyHandler::SendOnAppPropertiesChangeNotification( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto notification = MessageHelper::CreateOnAppPropertiesChangeNotification( policy_app_id, application_manager_); @@ -612,19 +603,19 @@ void PolicyHandler::SendOnAppPropertiesChangeNotification( } void PolicyHandler::OnPTExchangeNeeded() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->ForcePTExchange(); } void PolicyHandler::GetAvailableApps(std::queue<std::string>& apps) { - LOG4CXX_INFO(logger_, "GetAvailable apps"); + SDL_LOG_INFO("GetAvailable apps"); const ApplicationSet& app_list = application_manager_.applications().GetData(); ApplicationSetConstIt iter = app_list.begin(); for (; app_list.end() != iter; ++iter) { - LOG4CXX_INFO(logger_, "one more app"); + SDL_LOG_INFO("one more app"); apps.push((*iter)->policy_app_id()); } } @@ -645,14 +636,14 @@ StatusNotifier PolicyHandler::AddApplication( void PolicyHandler::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->AddDevice(device_id, connection_type); } void PolicyHandler::SetDeviceInfo(const std::string& device_id, const DeviceInfo& device_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->SetDeviceInfo(device_id, device_info); } @@ -662,7 +653,7 @@ void PolicyHandler::OnAppPermissionConsentInternal( const uint32_t connection_key, const ExternalConsentStatus& external_consent_status, PermissionConsent& out_permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const PolicyManager::NotificationMode mode = external_consent_status.empty() ? PolicyManager::kNotifyApplicationMode : PolicyManager::kSilentMode; @@ -699,15 +690,14 @@ void PolicyHandler::OnAppPermissionConsentInternal( // current, // permissions should be set only for coincident to registered apps if (app.use_count() == 0) { - LOG4CXX_WARN(logger_, - "Invalid pointer to application was passed." - "Permissions setting skipped."); + SDL_LOG_WARN( + "Invalid pointer to application was passed. " + "Permissions setting skipped."); continue; } if (!app->IsRegistered()) { - LOG4CXX_DEBUG(logger_, - "Application " << app->policy_app_id() + SDL_LOG_DEBUG("Application " << app->policy_app_id() << " is not marked as registered."); continue; } @@ -717,9 +707,9 @@ void PolicyHandler::OnAppPermissionConsentInternal( application_manager_.connection_handler().get_session_observer()); if (device_params.device_mac_address != app->mac_address()) { - LOG4CXX_WARN(logger_, - "Device_id of application is changed." - "Permissions setting skipped."); + SDL_LOG_WARN( + "Device_id of application is changed. " + "Permissions setting skipped."); continue; } @@ -732,14 +722,13 @@ void PolicyHandler::OnAppPermissionConsentInternal( #endif } } else { - LOG4CXX_WARN(logger_, - "There are no applications previously stored for " - "setting common permissions."); + SDL_LOG_WARN( + "There are no applications previously stored for " + "setting common permissions."); } #ifdef EXTERNAL_PROPRIETARY_MODE if (!policy_manager_->SetExternalConsentStatus(external_consent_status)) { - LOG4CXX_WARN(logger_, - "External User Consent Settings status has not been set!"); + SDL_LOG_WARN("External User Consent Settings status has not been set!"); } #endif } @@ -763,7 +752,7 @@ void PolicyHandler::OnGetUserFriendlyMessage( const std::vector<std::string>& message_codes, const std::string& language, uint32_t correlation_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); #ifdef EXTERNAL_PROPRIETARY_MODE @@ -807,7 +796,7 @@ void PolicyHandler::GetRegisteredLinks( std::vector<policy::FunctionalGroupPermission> PolicyHandler::CollectRegisteredAppsPermissions() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(std::vector<policy::FunctionalGroupPermission>()); // If no specific app was passed, get permissions for all currently registered // applications @@ -836,11 +825,10 @@ std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions( ApplicationSharedPtr app = application_manager_.application(connection_key); if (NULL == app.get() || app.use_count() == 0) { - LOG4CXX_WARN(logger_, - "Connection key '" - << connection_key - << "' " - "not found within registered applications."); + SDL_LOG_WARN("Connection key '" + << connection_key + << "' " + "not found within registered applications."); return group_permissions; } @@ -850,7 +838,7 @@ std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions( application_manager_.connection_handler().get_session_observer()); if (device_params.device_mac_address.empty()) { - LOG4CXX_WARN(logger_, "Couldn't find device, which hosts application."); + SDL_LOG_WARN("Couldn't find device, which hosts application."); return group_permissions; } @@ -863,7 +851,7 @@ std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions( void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, const uint32_t correlation_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); application_manager::ApplicationSharedPtr app = @@ -876,9 +864,8 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, : CollectRegisteredAppsPermissions(); if (permissions.empty() && is_connection_key_valid) { - LOG4CXX_ERROR(logger_, - "No permissions found for application with connection key:" - << connection_key); + SDL_LOG_ERROR("No permissions found for application with connection key:" + << connection_key); return; } @@ -894,13 +881,12 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, void PolicyHandler::LinkAppsToDevice() { sync_primitives::AutoLock lock(app_to_device_link_lock_); LinkAppToDevice linker(app_to_device_link_, application_manager_); - LOG4CXX_DEBUG(logger_, "add links to app. no specific app was passed"); + SDL_LOG_DEBUG("add links to app. no specific app was passed"); { const ApplicationSet& accessor = application_manager_.applications().GetData(); if (accessor.empty()) { - LOG4CXX_WARN(logger_, - "application_manager doesn't have any applications"); + SDL_LOG_WARN("application_manager doesn't have any applications"); } else { // Add all currently registered applications std::for_each(accessor.begin(), accessor.end(), linker); @@ -910,18 +896,16 @@ void PolicyHandler::LinkAppsToDevice() { bool PolicyHandler::IsAppSuitableForPolicyUpdate( const Applications::value_type value) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(false); if (!value->IsRegistered()) { - LOG4CXX_DEBUG( - logger_, - "Application " << value->app_id() << " is not marked as registered."); + SDL_LOG_DEBUG("Application " << value->app_id() + << " is not marked as registered."); return false; } - LOG4CXX_DEBUG(logger_, - "Application " << value->app_id() + SDL_LOG_DEBUG("Application " << value->app_id() << " marked as registered." "Checking its parameters."); @@ -933,15 +917,14 @@ bool PolicyHandler::IsAppSuitableForPolicyUpdate( (kDeviceAllowed == policy_manager_->GetUserConsentForDevice( device_params.device_mac_address)); - LOG4CXX_DEBUG(logger_, - "Is device " << device_params.device_mac_address << " allowed " + SDL_LOG_DEBUG("Is device " << device_params.device_mac_address << " allowed " << std::boolalpha << is_device_allowed); return is_device_allowed; } uint32_t PolicyHandler::ChooseRandomAppForPolicyUpdate( Applications& app_list) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::random_shuffle(app_list.begin(), app_list.end()); Applications::const_iterator choosen_app = std::find_if( @@ -959,13 +942,13 @@ uint32_t PolicyHandler::ChooseRandomAppForPolicyUpdate( void PolicyHandler::OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->OnDeviceSwitching(device_id_from, device_id_to); } void PolicyHandler::OnLockScreenDismissalStateChanged() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto accessor = application_manager_.applications(); const auto apps = accessor.GetData(); for (auto& app : apps) { @@ -974,7 +957,7 @@ void PolicyHandler::OnLockScreenDismissalStateChanged() { } void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); MessageHelper::SendGetStatusUpdateResponse( policy_manager_->GetPolicyTableStatus(), @@ -983,7 +966,7 @@ void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) { } void PolicyHandler::OnUpdateStatusChanged(const std::string& status) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->SaveUpdateStatusRequired(policy::kUpToDate != status); MessageHelper::SendOnStatusUpdate(status, application_manager_); @@ -992,7 +975,7 @@ void PolicyHandler::OnUpdateStatusChanged(const std::string& status) { std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired( const transport_manager::DeviceHandle& device_handle, const std::string& policy_app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeviceParams device_params = GetDeviceParams( device_handle, application_manager_.connection_handler().get_session_observer()); @@ -1001,11 +984,10 @@ std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired( device_params.device_mac_address, policy_app_id); if (app.use_count() == 0) { - LOG4CXX_WARN(logger_, - "Application with id '" - << policy_app_id - << "' " - "not found within registered applications."); + SDL_LOG_WARN("Application with id '" + << policy_app_id + << "' " + "not found within registered applications."); return std::string(); } @@ -1013,31 +995,31 @@ std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired( } void PolicyHandler::OnSystemInfoChanged(const std::string& language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->SetSystemLanguage(language); } void PolicyHandler::SetPreloadedPtFlag(const bool is_preloaded) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_manager_->SetPreloadedPtFlag(is_preloaded); } void PolicyHandler::OnGetSystemInfo(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->SetSystemInfo(ccpu_version, wers_country_code, language); } std::string PolicyHandler::GetCCPUVersionFromPT() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return policy_manager_->GetCCPUVersionFromPT(); } void PolicyHandler::OnVIIsReady() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint32_t correlation_id = application_manager_.GetNextHMICorrelationID(); @@ -1053,9 +1035,8 @@ void PolicyHandler::OnVehicleDataUpdated( POLICY_LIB_CHECK_VOID(); #ifdef EXTERNAL_PROPRIETARY_MODE if (!message.keyExists(strings::msg_params)) { - LOG4CXX_ERROR( - logger_, - "Message does not contains mandatory section " << strings::msg_params); + SDL_LOG_ERROR("Message does not contains mandatory section " + << strings::msg_params); return; } if (message[strings::msg_params].keyExists(strings::vin)) { @@ -1063,23 +1044,20 @@ void PolicyHandler::OnVehicleDataUpdated( message[strings::msg_params][strings::vin].asString()); } #else - LOG4CXX_DEBUG(logger_, - "This functionality is not available for not external policy"); + SDL_LOG_DEBUG("This functionality is not available for not external policy"); #endif } void PolicyHandler::OnPendingPermissionChange( const std::string& device_id, const std::string& policy_app_id) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG( - logger_, - "PolicyHandler::OnPendingPermissionChange for " << policy_app_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("PolicyHandler::OnPendingPermissionChange for " + << policy_app_id); POLICY_LIB_CHECK_VOID(); ApplicationSharedPtr app = application_manager_.application(device_id, policy_app_id); if (app.use_count() == 0) { - LOG4CXX_WARN(logger_, - "No app found for " << policy_app_id << " policy app id."); + SDL_LOG_WARN("No app found for " << policy_app_id << " policy app id."); return; } @@ -1159,31 +1137,29 @@ bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string, bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string, const std::string& url, const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(false); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOG4CXX_WARN(logger_, - "There is no registered application with " - "connection key '" - << app_id << "'"); + SDL_LOG_WARN( + "There is no registered application with " + "connection key '" + << app_id << "'"); return false; } const std::string& mobile_app_id = app->policy_app_id(); if (mobile_app_id.empty()) { - LOG4CXX_WARN(logger_, - "Application with connection key '" - << app_id - << "'" - " has no application id."); + SDL_LOG_WARN("Application with connection key '" + << app_id + << "'" + " has no application id."); return false; } - LOG4CXX_DEBUG(logger_, - "Update url is " << url + SDL_LOG_DEBUG("Update url is " << url << " for application " "with connection key " << app_id); @@ -1200,14 +1176,14 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file, const auto load_pt_result = policy_manager_->LoadPT(file, pt_string); - LOG4CXX_INFO(logger_, "Load policy table result code: " << load_pt_result); + SDL_LOG_INFO("Load policy table result code: " << load_pt_result); const bool is_ptu_successful = load_pt_result == PolicyManager::PtProcessingResult::kSuccess; OnPTUFinished(is_ptu_successful); if (is_ptu_successful) { - LOG4CXX_INFO(logger_, "PTU was successful."); + SDL_LOG_INFO("PTU was successful."); policy_manager_->CleanupUnpairedDevices(); SetDaysAfterEpoch(); policy_manager_->OnPTUFinished(load_pt_result); @@ -1224,7 +1200,7 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file, MessageHelper::CreateGetVehicleDataRequest( correlation_id, vehicle_data_args, application_manager_); } else { - LOG4CXX_WARN(logger_, "Exchange wasn't successful"); + SDL_LOG_WARN("Exchange wasn't successful"); policy_manager_->OnPTUFinished(load_pt_result); } @@ -1232,15 +1208,15 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file, } bool PolicyHandler::UnloadPolicyLibrary() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "policy_manager_ = " << policy_manager_); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("policy_manager_ = " << policy_manager_); bool ret = true; AsyncRunner::Stop(); sync_primitives::AutoWriteLock lock(policy_manager_lock_); if (policy_manager_) { policy_manager_.reset(); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); return ret; } @@ -1288,7 +1264,7 @@ struct SDLAlowedNotification { void PolicyHandler::OnAllowSDLFunctionalityNotification( bool is_allowed, const std::string& device_mac) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); using namespace mobile_apis; const bool device_specific = !device_mac.empty(); @@ -1306,16 +1282,14 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( const std::string device_id = *it_ids; if (kDefaultDeviceMacAddress == device_id) { - LOG4CXX_WARN(logger_, - "Device with id " << device_id << " wasn't found."); + SDL_LOG_WARN("Device with id " << device_id << " wasn't found."); continue; } policy_manager_->SetUserConsentForDevice(device_id, is_allowed); connection_handler::DeviceHandle device_handle = 0; if (!connection_handler.GetDeviceID(device_id, &device_handle)) { - LOG4CXX_WARN( - logger_, - "Device handle with mac " << device_id << " wasn't found."); + SDL_LOG_WARN("Device handle with mac " << device_id + << " wasn't found."); } #ifdef EXTERNAL_PROPRIETARY_MODE @@ -1349,15 +1323,14 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( if (device_specific) { policy_manager_->SetUserConsentForDevice(device_mac, is_allowed); if (!connection_handler.GetDeviceID(device_mac, &device_handle)) { - LOG4CXX_WARN(logger_, - "Device hadle with mac " << device_mac << " wasn't found."); + SDL_LOG_WARN("Device hadle with mac " << device_mac << " wasn't found."); } DeviceHandles::iterator it = std::find(pending_device_handles_.begin(), pending_device_handles_.end(), device_handle); // If consent done from HMI menu if (it == pending_device_handles_.end()) { - LOG4CXX_WARN(logger_, "No pendining application activation"); + SDL_LOG_WARN("No pendining application activation"); return; } @@ -1371,10 +1344,9 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( application_manager_.application(last_activated_app_id_); if (!app) { - LOG4CXX_WARN(logger_, - "Application with id '" - << last_activated_app_id_ - << "' not found among registered applications."); + SDL_LOG_WARN("Application with id '" + << last_activated_app_id_ + << "' not found among registered applications."); return; } if (is_allowed) { @@ -1405,17 +1377,17 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( } void PolicyHandler::OnIgnitionCycleOver() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->IncrementIgnitionCycles(); } void PolicyHandler::OnActivateApp(uint32_t connection_key, uint32_t correlation_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key); if (app.use_count() == 0) { - LOG4CXX_WARN(logger_, "Activated App failed: no app found."); + SDL_LOG_WARN("Activated App failed: no app found."); return; } std::string policy_app_id = app->policy_app_id(); @@ -1424,7 +1396,7 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key, sync_primitives::AutoReadLock lock(policy_manager_lock_); if (!policy_manager_) { - LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded"); + SDL_LOG_DEBUG("The shared library of policy is not loaded"); if (!PolicyEnabled()) { permissions.isSDLAllowed = true; } @@ -1474,12 +1446,12 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key, // If application is revoked it should not be activated // In this case we need to activate application if (false == permissions.appRevoked && true == permissions.isSDLAllowed) { - LOG4CXX_INFO(logger_, "Application will be activated"); + SDL_LOG_INFO("Application will be activated"); if (application_manager_.ActivateApplication(app)) { last_activated_app_id_ = 0; } } else { - LOG4CXX_WARN(logger_, "Application should not be activated"); + SDL_LOG_WARN("Application should not be activated"); } MessageHelper::SendSDLActivateAppResponse( @@ -1487,14 +1459,13 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key, } void PolicyHandler::KmsChanged(int kilometers) { - LOG4CXX_DEBUG(logger_, - "PolicyHandler::KmsChanged " << kilometers << " kilometers"); + SDL_LOG_DEBUG("PolicyHandler::KmsChanged " << kilometers << " kilometers"); POLICY_LIB_CHECK_VOID(); policy_manager_->KmsChanged(kilometers); } void PolicyHandler::PTExchangeAtUserRequest(uint32_t correlation_id) { - LOG4CXX_TRACE(logger_, "PT exchange at user request"); + SDL_LOG_TRACE("PT exchange at user request"); POLICY_LIB_CHECK_VOID(); std::string update_status = policy_manager_->ForcePTExchangeAtUserRequest(); MessageHelper::SendUpdateSDLResponse( @@ -1505,14 +1476,13 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id, const std::string& policy_app_id, const Permissions& permissions, const HMILevel& default_hmi) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); OnPermissionsUpdated(device_id, policy_app_id, permissions); ApplicationSharedPtr app = application_manager_.application(device_id, policy_app_id); if (app.use_count() == 0) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Connection_key not found for application_id: " << policy_app_id); return; } @@ -1525,21 +1495,18 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id, MessageHelper::StringToHMILevel(default_hmi); if (mobile_apis::HMILevel::INVALID_ENUM == hmi_level) { - LOG4CXX_WARN( - logger_, - "Couldn't convert default hmi level " << default_hmi << " to enum."); + SDL_LOG_WARN("Couldn't convert default hmi level " << default_hmi + << " to enum."); return; } if (current_hmi_level == hmi_level) { - LOG4CXX_DEBUG(logger_, "Application already in default hmi state."); + SDL_LOG_DEBUG("Application already in default hmi state."); return; } switch (current_hmi_level) { case mobile_apis::HMILevel::HMI_NONE: { - LOG4CXX_INFO(logger_, - "Changing hmi level of application " - << policy_app_id << " to default hmi level " - << default_hmi); + SDL_LOG_INFO("Changing hmi level of application " + << policy_app_id << " to default hmi level " << default_hmi); if (hmi_level == mobile_apis::HMILevel::HMI_FULL) { application_manager_.state_controller().SetRegularState( @@ -1557,8 +1524,7 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id, break; } default: - LOG4CXX_WARN(logger_, - "Application " << policy_app_id + SDL_LOG_WARN("Application " << policy_app_id << " is running." "HMI level won't be changed."); break; @@ -1568,14 +1534,13 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id, void PolicyHandler::OnPermissionsUpdated(const std::string& device_id, const std::string& policy_app_id, const Permissions& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); ApplicationSharedPtr app = application_manager_.application(device_id, policy_app_id); if (app.use_count() == 0) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Connection_key not found for application_id: " << policy_app_id); return; } @@ -1586,10 +1551,8 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id, MessageHelper::SendOnPermissionsChangeNotification( app->app_id(), permissions, application_manager_, require_encryption); - LOG4CXX_DEBUG(logger_, - "Notification sent for application_id: " - << policy_app_id << " and connection_key " - << app->app_id()); + SDL_LOG_DEBUG("Notification sent for application_id: " + << policy_app_id << " and connection_key " << app->app_id()); } void PolicyHandler::OnPTUTimeOut() { @@ -1612,7 +1575,7 @@ bool PolicyHandler::SaveSnapshot(const BinaryMessage& pt_string, } if (!result) { - LOG4CXX_ERROR(logger_, "Failed to write snapshot file to " << snap_path); + SDL_LOG_ERROR("Failed to write snapshot file to " << snap_path); } return result; @@ -1636,7 +1599,7 @@ void PolicyHandler::OnSnapshotCreated( #else // EXTERNAL_PROPRIETARY_MODE void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string, const PTUIterationType iteration_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); #ifdef PROPRIETARY_MODE if (PTUIterationType::RetryIteration == iteration_type) { @@ -1650,7 +1613,7 @@ void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string, } else { std::string policy_snapshot_full_path; if (!SaveSnapshot(pt_string, policy_snapshot_full_path)) { - LOG4CXX_ERROR(logger_, "Snapshot processing skipped."); + SDL_LOG_ERROR("Snapshot processing skipped."); return; } @@ -1661,7 +1624,7 @@ void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string, application_manager_); } #else // PROPRIETARY_MODE - LOG4CXX_INFO(logger_, "HTTP policy"); + SDL_LOG_INFO("HTTP policy"); uint32_t app_id_for_sending = 0; const std::string& url = GetNextUpdateUrl(iteration_type, app_id_for_sending); @@ -1673,7 +1636,7 @@ void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string, std::string PolicyHandler::GetNextUpdateUrl( const PTUIterationType iteration_type, uint32_t& app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(std::string()); app_id = ChoosePTUApplication(iteration_type); @@ -1691,7 +1654,7 @@ std::string PolicyHandler::GetNextUpdateUrl( policy_manager_->GetUpdateUrls("0x07", endpoint_urls); if (endpoint_urls.empty()) { - LOG4CXX_ERROR(logger_, "Service URLs are empty!"); + SDL_LOG_ERROR("Service URLs are empty!"); return std::string(); } @@ -1709,7 +1672,7 @@ std::string PolicyHandler::GetNextUpdateUrl( AppIdURL app_url = policy_manager_->GetNextUpdateUrl(endpoint_urls); ApplicationSharedPtr app = get_ptu_app(app_url, app_id); if (!app) { - LOG4CXX_ERROR(logger_, "No available applications for PTU!"); + SDL_LOG_ERROR("No available applications for PTU!"); return std::string(); } EndpointData& data = endpoint_urls[app_url.first]; @@ -1717,7 +1680,7 @@ std::string PolicyHandler::GetNextUpdateUrl( app_url = policy_manager_->GetNextUpdateUrl(endpoint_urls); app = get_ptu_app(app_url, app_id); if (!app) { - LOG4CXX_ERROR(logger_, "No available applications for PTU!"); + SDL_LOG_ERROR("No available applications for PTU!"); return std::string(); } data = endpoint_urls[app_url.first]; @@ -1743,16 +1706,14 @@ void PolicyHandler::CheckPermissions( const std::string hmi_level = MessageHelper::StringifiedHMILevel(app->hmi_level(window_id)); if (hmi_level.empty()) { - LOG4CXX_WARN(logger_, - "HMI level for " << app->policy_app_id() << " is invalid, rpc " + SDL_LOG_WARN("HMI level for " << app->policy_app_id() << " is invalid, rpc " << rpc << " is not allowed."); result.hmi_level_permitted = policy::kRpcDisallowed; return; } const std::string device_id = MessageHelper::GetDeviceMacAddressForHandle( app->device(), application_manager_); - LOG4CXX_INFO(logger_, - "Checking permissions for " << app->policy_app_id() << " in " + SDL_LOG_INFO("Checking permissions for " << app->policy_app_id() << " in " << hmi_level << " on device " << device_id << " rpc " << rpc); policy_manager_->CheckPermissions( @@ -1819,8 +1780,7 @@ std::string PolicyHandler::GetLockScreenIconUrl( }); if (endpoints.end() != it_specific && !it_specific->url.empty()) { - LOG4CXX_DEBUG(logger_, - "Specific app URL will be used for " << policy_app_id); + SDL_LOG_DEBUG("Specific app URL will be used for " << policy_app_id); return it_specific->url.front(); } @@ -1830,11 +1790,11 @@ std::string PolicyHandler::GetLockScreenIconUrl( }); if (endpoints.end() != it_default && !it_default->url.empty()) { - LOG4CXX_DEBUG(logger_, "Default URL will be used for " << policy_app_id); + SDL_LOG_DEBUG("Default URL will be used for " << policy_app_id); return it_default->url.front(); } - LOG4CXX_ERROR(logger_, "Can't find URL for " << policy_app_id); + SDL_LOG_ERROR("Can't find URL for " << policy_app_id); return std::string(); } @@ -1845,7 +1805,7 @@ std::string PolicyHandler::GetIconUrl(const std::string& policy_app_id) const { uint32_t PolicyHandler::NextRetryTimeout() { POLICY_LIB_CHECK_OR_RETURN(0); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return policy_manager_->NextRetryTimeout(); } @@ -1859,7 +1819,7 @@ uint32_t PolicyHandler::TimeoutExchangeMSec() const { } void PolicyHandler::OnExceededTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); std::for_each(listeners_.begin(), @@ -1917,7 +1877,7 @@ void PolicyHandler::AddStatisticsInfo(int type) { ++count_of_iap_buffer_full; break; } - default: { LOG4CXX_WARN(logger_, "Type of statistics is unknown"); } + default: { SDL_LOG_WARN("Type of statistics is unknown"); } } } @@ -1936,7 +1896,7 @@ void PolicyHandler::OnSystemError(int code) { ++count_sync_out_of_memory; break; } - default: { LOG4CXX_WARN(logger_, "System error is unknown"); } + default: { SDL_LOG_WARN("System error is unknown"); } } } @@ -1946,8 +1906,7 @@ custom_str::CustomString PolicyHandler::GetAppName( application_manager_.application_by_policy_id(policy_app_id); if (app.use_count() == 0) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Connection_key not found for application_id: " << policy_app_id); return custom_str::CustomString(""); } @@ -1956,7 +1915,7 @@ custom_str::CustomString PolicyHandler::GetAppName( void PolicyHandler::OnUpdateHMIAppType( std::map<std::string, StringArray> app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(listeners_lock_); HandlersCollection::const_iterator it = listeners_.begin(); for (; it != listeners_.end(); ++it) { @@ -1966,7 +1925,7 @@ void PolicyHandler::OnUpdateHMIAppType( #ifdef EXTERNAL_PROPRIETARY_MODE void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (certificate_data.empty()) { OnEmptyCertificateArrived(); return; @@ -1978,21 +1937,19 @@ void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) { const bool is_written = file_system::Write( file_name, std::vector<uint8_t>(certificate_data.begin(), certificate_data.end())); - LOG4CXX_DEBUG( - logger_, - "Saving encrypted certificate data: \"" << certificate_data << '"'); + SDL_LOG_DEBUG("Saving encrypted certificate data: \"" << certificate_data + << '"'); if (!is_written) { - LOG4CXX_ERROR(logger_, - "Unable to save encrypted certificate to file " << file_name); + SDL_LOG_ERROR("Unable to save encrypted certificate to file " << file_name); return; } - LOG4CXX_DEBUG(logger_, "Saved encrypted certificate data" << file_name); + SDL_LOG_DEBUG("Saved encrypted certificate data" << file_name); MessageHelper::SendDecryptCertificateToHMI(file_name, application_manager_); } void PolicyHandler::OnEmptyCertificateArrived() const { - LOG4CXX_DEBUG(logger_, "Empty certificate arrived"); + SDL_LOG_DEBUG("Empty certificate arrived"); const std::string empty_certificate; sync_primitives::AutoLock lock(listeners_lock_); std::for_each( @@ -2003,34 +1960,32 @@ void PolicyHandler::OnEmptyCertificateArrived() const { } void PolicyHandler::OnCertificateDecrypted(bool is_succeeded) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); const std::string file_name = file_system::GetAbsolutePath(get_settings().app_storage_folder()) + +"/" + kCerficateFileName; - LOG4CXX_DEBUG(logger_, "Loading certificate data from file " << file_name); + SDL_LOG_DEBUG("Loading certificate data from file " << file_name); utils::ScopeGuard file_deleter = utils::MakeGuard(file_system::DeleteFile, file_name); UNUSED(file_deleter); if (!is_succeeded) { - LOG4CXX_ERROR(logger_, "Couldn't delete file " << file_name); + SDL_LOG_ERROR("Couldn't delete file " << file_name); ProcessCertDecryptFailed(); return; } std::string certificate_data; if (!file_system::ReadFile(file_name, certificate_data)) { - LOG4CXX_ERROR(logger_, - "Unable to read certificate from file " << file_name); + SDL_LOG_ERROR("Unable to read certificate from file " << file_name); return; } - LOG4CXX_DEBUG( - logger_, - "Loaded decrypted certificate data: \"" << certificate_data << '"'); + SDL_LOG_DEBUG("Loaded decrypted certificate data: \"" << certificate_data + << '"'); policy_manager_->SetDecryptedCertificate(certificate_data); @@ -2043,7 +1998,7 @@ void PolicyHandler::OnCertificateDecrypted(bool is_succeeded) { } void PolicyHandler::ProcessCertDecryptFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(listeners_lock_); std::for_each( @@ -2055,7 +2010,7 @@ void PolicyHandler::ProcessCertDecryptFailed() { #else // EXTERNAL_PROPRIETARY_MODE void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(listeners_lock_); HandlersCollection::const_iterator it = listeners_.begin(); for (; it != listeners_.end(); ++it) { @@ -2067,7 +2022,7 @@ void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) { void PolicyHandler::OnAuthTokenUpdated(const std::string& policy_app_id, const std::string& auth_token) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(listeners_lock_); HandlersCollection::const_iterator it = listeners_.begin(); for (; it != listeners_.end(); ++it) { @@ -2077,7 +2032,7 @@ void PolicyHandler::OnAuthTokenUpdated(const std::string& policy_app_id, } void PolicyHandler::OnPTUFinished(const bool ptu_result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(listeners_lock_); PopAppIdFromPTUQueue(); @@ -2094,7 +2049,7 @@ bool PolicyHandler::CanUpdate() { } void PolicyHandler::RemoveDevice(const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->MarkUnpairedDevice(device_id); @@ -2112,14 +2067,14 @@ void PolicyHandler::RemoveDevice(const std::string& device_id) { } bool PolicyHandler::IsApplicationRevoked(const std::string& app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(false); return policy_manager_->IsApplicationRevoked(app_id); } void PolicyHandler::OnUpdateRequestSentToMobile() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); policy_manager_->OnUpdateStarted(); } @@ -2138,7 +2093,7 @@ bool PolicyHandler::CheckSystemAction( mobile_apis::SystemAction::eType system_action, const std::string& policy_app_id) const { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); switch (system_action) { case SystemAction::STEAL_FOCUS: return CheckStealFocus(policy_app_id); @@ -2149,7 +2104,7 @@ bool PolicyHandler::CheckSystemAction( default: break; } - LOG4CXX_DEBUG(logger_, "Unknown system action"); + SDL_LOG_DEBUG("Unknown system action"); return false; } @@ -2198,7 +2153,7 @@ const bool PolicyHandler::CheckCloudAppEnabled( PolicyHandler::AppPropertiesState PolicyHandler::GetAppPropertiesStatus( const smart_objects::SmartObject& properties, const std::string& app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(AppPropertiesState::NO_CHANGES); AppProperties app_properties; @@ -2210,46 +2165,41 @@ PolicyHandler::AppPropertiesState PolicyHandler::GetAppPropertiesStatus( if (properties.keyExists(strings::enabled) && app_properties.enabled != properties[strings::enabled].asBool()) { - LOG4CXX_DEBUG(logger_, - "\"enabled\" was changed from: " - << app_properties.enabled - << " to: " << properties[strings::enabled].asBool()); + SDL_LOG_DEBUG("\"enabled\" was changed from: " + << app_properties.enabled + << " to: " << properties[strings::enabled].asBool()); return AppPropertiesState::ENABLED_FLAG_SWITCH; } if (properties.keyExists(strings::auth_token) && app_properties.auth_token != properties[strings::auth_token].asString()) { - LOG4CXX_DEBUG(logger_, - "\"auth_token\" was changed from: " - << app_properties.auth_token - << " to: " << properties[strings::auth_token].asString()); + SDL_LOG_DEBUG("\"auth_token\" was changed from: " + << app_properties.auth_token + << " to: " << properties[strings::auth_token].asString()); return AppPropertiesState::AUTH_TOKEN_CHANGED; } if (properties.keyExists(strings::transport_type) && app_properties.transport_type != properties[strings::transport_type].asString()) { - LOG4CXX_DEBUG(logger_, - "\"transport_type\" was changed from: " - << app_properties.transport_type << " to: " - << properties[strings::transport_type].asString()); + SDL_LOG_DEBUG("\"transport_type\" was changed from: " + << app_properties.transport_type + << " to: " << properties[strings::transport_type].asString()); return AppPropertiesState::TRANSPORT_TYPE_CHANGED; } if (properties.keyExists(strings::cloud_transport_type) && app_properties.transport_type != properties[strings::cloud_transport_type].asString()) { - LOG4CXX_DEBUG(logger_, - "\"transport_type\" was changed from: " - << app_properties.transport_type << " to: " - << properties[strings::cloud_transport_type].asString()); + SDL_LOG_DEBUG("\"transport_type\" was changed from: " + << app_properties.transport_type << " to: " + << properties[strings::cloud_transport_type].asString()); return AppPropertiesState::TRANSPORT_TYPE_CHANGED; } if (properties.keyExists(strings::endpoint) && app_properties.endpoint != properties[strings::endpoint].asString()) { - LOG4CXX_DEBUG(logger_, - "\"endpoint\" was changed from: " - << app_properties.endpoint - << " to: " << properties[strings::endpoint].asString()); + SDL_LOG_DEBUG("\"endpoint\" was changed from: " + << app_properties.endpoint + << " to: " << properties[strings::endpoint].asString()); return AppPropertiesState::ENDPOINT_CHANGED; } if (properties.keyExists(strings::nicknames)) { @@ -2267,9 +2217,8 @@ PolicyHandler::AppPropertiesState PolicyHandler::GetAppPropertiesStatus( const auto result = std::find(nicknames.begin(), nicknames.end(), (*it_begin).asString()); if (nicknames.end() == result) { - LOG4CXX_DEBUG(logger_, - "\"nicknames\" were changed, new value: " - << (*it_begin).asString()); + SDL_LOG_DEBUG("\"nicknames\" were changed, new value: " + << (*it_begin).asString()); return AppPropertiesState::NICKNAMES_CHANGED; } } @@ -2282,11 +2231,9 @@ PolicyHandler::AppPropertiesState PolicyHandler::GetAppPropertiesStatus( mobile_apis::HybridAppPreference::eType>:: EnumToString(value, &hybrid_app_preference_str); if (app_properties.hybrid_app_preference != hybrid_app_preference_str) { - LOG4CXX_DEBUG( - logger_, - "\"hybrid_app_preference\" was changed from: " - << app_properties.hybrid_app_preference << " to: " - << properties[strings::hybrid_app_preference].asString()); + SDL_LOG_DEBUG("\"hybrid_app_preference\" was changed from: " + << app_properties.hybrid_app_preference << " to: " + << properties[strings::hybrid_app_preference].asString()); return AppPropertiesState::HYBRYD_APP_PROPERTIES_CHANGED; } } @@ -2361,24 +2308,21 @@ void PolicyHandler::OnSetCloudAppProperties( const smart_objects::SmartObject& message) { POLICY_LIB_CHECK_VOID(); if (!message.keyExists(strings::msg_params)) { - LOG4CXX_ERROR( - logger_, - "Message does not contain mandatory section " << strings::msg_params); + SDL_LOG_ERROR("Message does not contain mandatory section " + << strings::msg_params); return; } if (!message[strings::msg_params].keyExists(strings::properties)) { - LOG4CXX_ERROR( - logger_, - "Message does not contain app properties " << strings::msg_params); + SDL_LOG_ERROR("Message does not contain app properties " + << strings::msg_params); return; } const smart_objects::SmartObject& properties = message[strings::msg_params][strings::properties]; if (!properties.keyExists(strings::app_id)) { - LOG4CXX_ERROR( - logger_, - "Message does not contain mandatory parameter " << strings::app_id); + SDL_LOG_ERROR("Message does not contain mandatory parameter " + << strings::app_id); return; } std::string policy_app_id(properties[strings::app_id].asString()); @@ -2457,24 +2401,21 @@ bool PolicyHandler::CheckAppServiceParameters( if (app_service_parameters.find(requested_service_type) == app_service_parameters.end()) { - LOG4CXX_DEBUG(logger_, - "Disallowed service type: " << requested_service_type); + SDL_LOG_DEBUG("Disallowed service type: " << requested_service_type); return false; } auto service_names = *(app_service_parameters[requested_service_type].service_names); if (!service_names.is_initialized()) { - LOG4CXX_DEBUG(logger_, - "Pt Service Name is Null, All service names accepted"); + SDL_LOG_DEBUG("Pt Service Name is Null, All service names accepted"); } else if (!requested_service_name.empty()) { auto find_name_result = std::find(service_names.begin(), service_names.end(), rpc::String<0, 255>(requested_service_name)); if (find_name_result == service_names.end()) { - LOG4CXX_DEBUG(logger_, - "Disallowed service name: " << requested_service_name); + SDL_LOG_DEBUG("Disallowed service name: " << requested_service_name); return false; } } @@ -2493,8 +2434,7 @@ bool PolicyHandler::CheckAppServiceParameters( auto find_result = std::find( handled_rpcs.begin(), handled_rpcs.end(), requested_it->asInt()); if (find_result == handled_rpcs.end()) { - LOG4CXX_DEBUG(logger_, - "Disallowed by handled rpc: " << requested_it->asInt()); + SDL_LOG_DEBUG("Disallowed by handled rpc: " << requested_it->asInt()); return false; } } @@ -2504,7 +2444,7 @@ bool PolicyHandler::CheckAppServiceParameters( bool PolicyHandler::UnknownRPCPassthroughAllowed( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(false); return policy_manager_->UnknownRPCPassthroughAllowed(policy_app_id); } @@ -2538,7 +2478,7 @@ void PolicyHandler::OnAppsSearchCompleted(const bool trigger_ptu) { void PolicyHandler::OnAddedNewApplicationToAppList( const uint32_t new_app_id, const std::string& policy_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (policy_id == last_registered_policy_app_id_) { return; } @@ -2573,7 +2513,7 @@ bool PolicyHandler::IsRequestTypeAllowed( const std::string stringified_type = RequestTypeToString(type); if (stringified_type.empty()) { - LOG4CXX_ERROR(logger_, "Unknown request type."); + SDL_LOG_ERROR("Unknown request type."); return false; } @@ -2583,12 +2523,12 @@ bool PolicyHandler::IsRequestTypeAllowed( switch (request_type_state) { case RequestType::State::EMPTY: { // If empty array of request types is assigned to app - any is allowed - LOG4CXX_TRACE(logger_, "Any Request Type is allowed by policies."); + SDL_LOG_TRACE("Any Request Type is allowed by policies."); return true; } case RequestType::State::OMITTED: { // If RequestType parameter omitted for app - any is disallowed - LOG4CXX_TRACE(logger_, "All Request Types are disallowed by policies."); + SDL_LOG_TRACE("All Request Types are disallowed by policies."); return false; } case RequestType::State::AVAILABLE: { @@ -2613,7 +2553,7 @@ bool PolicyHandler::IsRequestSubTypeAllowed( using namespace mobile_apis; if (request_subtype.empty()) { - LOG4CXX_ERROR(logger_, "Request subtype to check is empty."); + SDL_LOG_ERROR("Request subtype to check is empty."); return false; } @@ -2622,13 +2562,12 @@ bool PolicyHandler::IsRequestSubTypeAllowed( switch (request_subtype_state) { case RequestSubType::State::EMPTY: { // If empty array of request subtypes is assigned to app - any is allowed - LOG4CXX_TRACE(logger_, "Any Request SubType is allowed by policies."); + SDL_LOG_TRACE("Any Request SubType is allowed by policies."); return true; } case RequestSubType::State::OMITTED: { // If RequestSubType parameter omitted for app - any is disallowed - LOG4CXX_TRACE(logger_, - "All Request SubTypes are disallowed by policies."); + SDL_LOG_TRACE("All Request SubTypes are disallowed by policies."); return false; } case RequestSubType::State::AVAILABLE: { @@ -2716,9 +2655,8 @@ bool PolicyHandler::IsUrlAppIdValid(const std::string app_id, } const auto devices_ids = GetDevicesIds(app_id); - LOG4CXX_TRACE( - logger_, - "Count devices: " << devices_ids.size() << " for app_id: " << app_id); + SDL_LOG_TRACE("Count devices: " << devices_ids.size() + << " for app_id: " << app_id); for (const auto& device_id : devices_ids) { const ApplicationSharedPtr app = application_manager_.application(device_id, app_id); @@ -2737,7 +2675,7 @@ std::vector<std::string> PolicyHandler::GetDevicesIds( void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app, mobile_apis::HMILevel::eType level) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) == mobile_apis::HMILevel::HMI_NONE) { @@ -2746,9 +2684,8 @@ void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app, if (mobile_apis::HMILevel::HMI_FULL == level) { MessageHelper::SendActivateAppToHMI(app->app_id(), application_manager_); } else { - LOG4CXX_INFO(logger_, - "Changing hmi level of application " - << app->app_id() << " to default hmi level " << level); + SDL_LOG_INFO("Changing hmi level of application " + << app->app_id() << " to default hmi level " << level); // Set application hmi level application_manager_.ChangeAppsHMILevel(app->app_id(), level); // If hmi Level is full, it will be seted after ActivateApp response @@ -2775,27 +2712,24 @@ void PolicyHandler::OnRemoteAppPermissionsChanged( void PolicyHandler::OnUpdateHMIStatus(const std::string& device_id, const std::string& policy_app_id, const std::string& hmi_level) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(device_id, policy_app_id); if (!app) { - LOG4CXX_WARN( - logger_, - "Could not find application: " << device_id << " - " << policy_app_id); + SDL_LOG_WARN("Could not find application: " << device_id << " - " + << policy_app_id); return; } mobile_apis::HMILevel::eType level = MessageHelper::StringToHMILevel(hmi_level); if (mobile_apis::HMILevel::INVALID_ENUM == level) { - LOG4CXX_WARN( - logger_, - "Couldn't convert default hmi level " << hmi_level << " to enum."); + SDL_LOG_WARN("Couldn't convert default hmi level " << hmi_level + << " to enum."); return; } - LOG4CXX_INFO(logger_, - "Changing hmi level of application " - << app->app_id() << " to default hmi level " << level); + SDL_LOG_INFO("Changing hmi level of application " + << app->app_id() << " to default hmi level " << level); // Set application hmi level application_manager_.ChangeAppsHMILevel(app->app_id(), level); MessageHelper::SendHMIStatusNotification( @@ -2806,7 +2740,7 @@ void PolicyHandler::OnUpdateHMIStatus(const std::string& device_id, bool PolicyHandler::GetModuleTypes(const std::string& policy_app_id, std::vector<std::string>* modules) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(false); return policy_manager_->GetModuleTypes(policy_app_id, modules); } @@ -2815,7 +2749,7 @@ void PolicyHandler::SetDefaultHmiTypes( const transport_manager::DeviceHandle& device_handle, const std::string& application_id, const smart_objects::SmartObject* app_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_VOID(); std::vector<int> hmi_types; if (app_types && app_types->asArray()) { @@ -2831,7 +2765,7 @@ void PolicyHandler::SetDefaultHmiTypes( bool PolicyHandler::CheckHMIType(const std::string& application_id, mobile_apis::AppHMIType::eType hmi, const smart_objects::SmartObject* app_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); POLICY_LIB_CHECK_OR_RETURN(false); std::vector<int> policy_hmi_types; bool ret = policy_manager_->GetHMITypes(application_id, &policy_hmi_types); @@ -2852,21 +2786,19 @@ bool PolicyHandler::CheckHMIType(const std::string& application_id, void PolicyHandler::OnUpdateHMILevel(const std::string& device_id, const std::string& policy_app_id, const std::string& hmi_level) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(device_id, policy_app_id); if (!app) { - LOG4CXX_WARN( - logger_, - "Could not find application: " << device_id << " - " << policy_app_id); + SDL_LOG_WARN("Could not find application: " << device_id << " - " + << policy_app_id); return; } mobile_apis::HMILevel::eType level = MessageHelper::StringToHMILevel(hmi_level); if (mobile_apis::HMILevel::INVALID_ENUM == level) { - LOG4CXX_WARN( - logger_, - "Couldn't convert default hmi level " << hmi_level << " to enum."); + SDL_LOG_WARN("Couldn't convert default hmi level " << hmi_level + << " to enum."); return; } UpdateHMILevel(app, level); diff --git a/src/components/application_manager/src/policies/policy_retry_sequence.cc b/src/components/application_manager/src/policies/policy_retry_sequence.cc index 7d24d0b35c..abb2926c9e 100644 --- a/src/components/application_manager/src/policies/policy_retry_sequence.cc +++ b/src/components/application_manager/src/policies/policy_retry_sequence.cc @@ -38,7 +38,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") +SDL_CREATE_LOG_VARIABLE("PolicyHandler") RetrySequence::RetrySequence(PolicyHandler* const policy_handler) // TODO (Risk copy of PolicyHandler Pointer) @@ -49,7 +49,7 @@ void RetrySequence::threadMain() { } void RetrySequence::StartNextRetry() { - LOG4CXX_TRACE(logger_, "Start next retry of exchanging PT"); + SDL_LOG_TRACE("Start next retry of exchanging PT"); DCHECK(policy_handler_); // TODO(Ezamakhov): inverstigate StartNextRetry on unload policy lib @@ -59,8 +59,7 @@ void RetrySequence::StartNextRetry() { const uint32_t timeout = policy_handler_->TimeoutExchangeSec(); const int seconds = policy_handler_->NextRetryTimeout(); - LOG4CXX_DEBUG(logger_, - "Timeout response: " << timeout << " Next try: " << seconds); + SDL_LOG_DEBUG("Timeout response: " << timeout << " Next try: " << seconds); if (timeout > 0) { sleep(timeout); policy_handler_->OnExceededTimeout(); @@ -69,7 +68,7 @@ void RetrySequence::StartNextRetry() { sleep(seconds); StartNextRetry(); } else { - LOG4CXX_INFO(logger_, "End retry sequence. Update PT was not received"); + SDL_LOG_INFO("End retry sequence. Update PT was not received"); policy_handler_->OnPTUFinished(false); } } diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc index 1273abe513..d2db9fced2 100644 --- a/src/components/application_manager/src/request_controller.cc +++ b/src/components/application_manager/src/request_controller.cc @@ -44,7 +44,7 @@ namespace request_controller { using namespace sync_primitives; -CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController") +SDL_CREATE_LOG_VARIABLE("RequestController") RequestController::RequestController(const RequestControlerSettings& settings) : pool_state_(UNDEFINED) @@ -57,13 +57,13 @@ RequestController::RequestController(const RequestControlerSettings& settings) , timer_stop_flag_(false) , is_low_voltage_(false) , settings_(settings) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); InitializeThreadpool(); timer_.Start(0, timer::kSingleShot); } RequestController::~RequestController() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock auto_lock(timer_lock); timer_stop_flag_ = true; @@ -76,7 +76,7 @@ RequestController::~RequestController() { } void RequestController::InitializeThreadpool() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO(DK): Consider lazy loading threads instead of creating all at once pool_state_ = TPoolState::STARTED; char name[50]; @@ -84,16 +84,16 @@ void RequestController::InitializeThreadpool() { snprintf(name, sizeof(name) / sizeof(name[0]), "AM Pool %d", i); pool_.push_back(threads::CreateThread(name, new Worker(this))); pool_[i]->Start(); - LOG4CXX_DEBUG(logger_, "Request thread initialized: " << name); + SDL_LOG_DEBUG("Request thread initialized: " << name); } } void RequestController::DestroyThreadpool() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { AutoLock auto_lock(mobile_request_list_lock_); pool_state_ = TPoolState::STOPPED; - LOG4CXX_DEBUG(logger_, "Broadcasting STOP signal to all threads..."); + SDL_LOG_DEBUG("Broadcasting STOP signal to all threads..."); cond_var_.Broadcast(); // notify all threads we are shutting down } for (size_t i = 0; i < pool_.size(); i++) { @@ -107,9 +107,9 @@ void RequestController::DestroyThreadpool() { RequestController::TResult RequestController::CheckPosibilitytoAdd( const RequestPtr request, const mobile_apis::HMILevel::eType level) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!CheckPendingRequestsAmount(settings_.pending_requests_amount())) { - LOG4CXX_ERROR(logger_, "Too many pending request"); + SDL_LOG_ERROR("Too many pending request"); return RequestController::TOO_MANY_PENDING_REQUESTS; } @@ -117,18 +117,17 @@ RequestController::TResult RequestController::CheckPosibilitytoAdd( request_tracker_.Track(request->connection_key(), level); if (TrackResult::kNoneLevelMaxRequestsExceeded == track_result) { - LOG4CXX_ERROR(logger_, "Too many application requests in hmi level NONE"); + SDL_LOG_ERROR("Too many application requests in hmi level NONE"); return RequestController::NONE_HMI_LEVEL_MANY_REQUESTS; } if (TrackResult::kMaxRequestsExceeded == track_result) { - LOG4CXX_ERROR(logger_, "Too many application requests"); + SDL_LOG_ERROR("Too many application requests"); return RequestController::TOO_MANY_REQUESTS; } if (IsLowVoltage()) { - LOG4CXX_ERROR(logger_, - "Impossible to add request due to Low Voltage is active"); + SDL_LOG_ERROR("Impossible to add request due to Low Voltage is active"); return RequestController::INVALID_DATA; } @@ -137,41 +136,38 @@ RequestController::TResult RequestController::CheckPosibilitytoAdd( bool RequestController::CheckPendingRequestsAmount( const uint32_t& pending_requests_amount) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (pending_requests_amount > 0) { const size_t pending_requests_size = mobile_request_list_.size(); const bool available_to_add = pending_requests_amount > pending_requests_size; if (!available_to_add) { - LOG4CXX_WARN(logger_, - "Pending requests count " << pending_requests_size + SDL_LOG_WARN("Pending requests count " << pending_requests_size << " exceed application limit " << pending_requests_amount); } return available_to_add; } - LOG4CXX_DEBUG(logger_, "CheckPendingRequestsAmount disabled"); + SDL_LOG_DEBUG("CheckPendingRequestsAmount disabled"); return true; } RequestController::TResult RequestController::addMobileRequest( const RequestPtr request, const mobile_apis::HMILevel::eType& hmi_level) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!request) { - LOG4CXX_ERROR(logger_, "Null Pointer request"); + SDL_LOG_ERROR("Null Pointer request"); cond_var_.NotifyOne(); return INVALID_DATA; } - LOG4CXX_DEBUG( - logger_, - "correlation_id : " << request->correlation_id() - << "connection_key : " << request->connection_key()); + SDL_LOG_DEBUG("correlation_id : " << request->correlation_id() + << "connection_key : " + << request->connection_key()); RequestController::TResult result = CheckPosibilitytoAdd(request, hmi_level); if (SUCCESS == result) { AutoLock auto_lock_list(mobile_request_list_lock_); mobile_request_list_.push_back(request); - LOG4CXX_DEBUG(logger_, - "Waiting for execution: " << mobile_request_list_.size()); + SDL_LOG_DEBUG("Waiting for execution: " << mobile_request_list_.size()); // wake up one thread that is waiting for a task to be available } cond_var_.NotifyOne(); @@ -180,13 +176,13 @@ RequestController::TResult RequestController::addMobileRequest( RequestController::TResult RequestController::addHMIRequest( const RequestPtr request) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (request.use_count() == 0) { - LOG4CXX_ERROR(logger_, "HMI request pointer is invalid"); + SDL_LOG_ERROR("HMI request pointer is invalid"); return RequestController::INVALID_DATA; } - LOG4CXX_DEBUG(logger_, " correlation_id : " << request->correlation_id()); + SDL_LOG_DEBUG(" correlation_id : " << request->correlation_id()); const uint64_t timeout_in_mseconds = static_cast<uint64_t>(request->default_timeout()); @@ -194,30 +190,28 @@ RequestController::TResult RequestController::addHMIRequest( std::make_shared<HMIRequestInfo>(request, timeout_in_mseconds); if (0 == timeout_in_mseconds) { - LOG4CXX_DEBUG(logger_, - "Default timeout was set to 0." - "RequestController will not track timeout of this request."); + SDL_LOG_DEBUG( + "Default timeout was set to 0." + "RequestController will not track timeout of this request."); } if (IsLowVoltage()) { - LOG4CXX_ERROR(logger_, - "Impossible to add request due to Low Voltage is active"); + SDL_LOG_ERROR("Impossible to add request due to Low Voltage is active"); return RequestController::INVALID_DATA; } waiting_for_response_.Add(request_info_ptr); - LOG4CXX_DEBUG(logger_, - "Waiting for response count:" << waiting_for_response_.Size()); + SDL_LOG_DEBUG("Waiting for response count:" << waiting_for_response_.Size()); NotifyTimer(); return RequestController::SUCCESS; } void RequestController::addNotification(const RequestPtr ptr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (IsLowVoltage()) { - LOG4CXX_ERROR( - logger_, "Impossible to add notification due to Low Voltage is active"); + SDL_LOG_ERROR( + "Impossible to add notification due to Low Voltage is active"); return; } notification_list_.push_back(ptr); @@ -225,30 +219,29 @@ void RequestController::addNotification(const RequestPtr ptr) { void RequestController::removeNotification( const commands::Command* notification) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::list<RequestPtr>::iterator it = notification_list_.begin(); for (; notification_list_.end() != it;) { if (it->get() == notification) { notification_list_.erase(it++); - LOG4CXX_DEBUG(logger_, "Notification removed"); + SDL_LOG_DEBUG("Notification removed"); return; } else { ++it; } } - LOG4CXX_DEBUG(logger_, "Cannot find notification"); + SDL_LOG_DEBUG("Cannot find notification"); } void RequestController::TerminateRequest(const uint32_t correlation_id, const uint32_t connection_key, const int32_t function_id, bool force_terminate) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "correlation_id = " - << correlation_id << " connection_key = " << connection_key - << " function_id = " << function_id - << " force_terminate = " << force_terminate); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("correlation_id = " + << correlation_id << " connection_key = " << connection_key + << " function_id = " << function_id + << " force_terminate = " << force_terminate); { AutoLock auto_lock(duplicate_message_count_lock_); auto dup_it = duplicate_message_count_.find(correlation_id); @@ -257,9 +250,9 @@ void RequestController::TerminateRequest(const uint32_t correlation_id, if (0 == duplicate_message_count_[correlation_id]) { duplicate_message_count_.erase(dup_it); } - LOG4CXX_DEBUG(logger_, - "Ignoring termination request due to duplicate correlation " - "ID being sent"); + SDL_LOG_DEBUG( + "Ignoring termination request due to duplicate correlation " + "ID being sent"); return; } } @@ -267,17 +260,17 @@ void RequestController::TerminateRequest(const uint32_t correlation_id, RequestInfoPtr request = waiting_for_response_.Find(connection_key, correlation_id); if (!request) { - LOG4CXX_WARN(logger_, "Request was not found in waiting_for_response"); + SDL_LOG_WARN("Request was not found in waiting_for_response"); return; } if (request->request()->function_id() != function_id) { - LOG4CXX_ERROR(logger_, "Request and response function_id's don't match"); + SDL_LOG_ERROR("Request and response function_id's don't match"); return; } if (force_terminate || request->request()->AllowedToTerminate()) { waiting_for_response_.RemoveRequest(request); } else { - LOG4CXX_WARN(logger_, "Request was not terminated"); + SDL_LOG_WARN("Request was not terminated"); } NotifyTimer(); } @@ -285,21 +278,20 @@ void RequestController::TerminateRequest(const uint32_t correlation_id, void RequestController::OnMobileResponse(const uint32_t mobile_correlation_id, const uint32_t connection_key, const int32_t function_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); TerminateRequest(mobile_correlation_id, connection_key, function_id); } void RequestController::OnHMIResponse(const uint32_t correlation_id, const int32_t function_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); TerminateRequest(correlation_id, RequestInfo::HmiConnectionKey, function_id); } void RequestController::terminateWaitingForExecutionAppRequests( const uint32_t& app_id) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "app_id: " << app_id << "Waiting for execution" + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("app_id: " << app_id << "Waiting for execution" << mobile_request_list_.size()); AutoLock auto_lock(mobile_request_list_lock_); std::list<RequestPtr>::iterator request_it = mobile_request_list_.begin(); @@ -311,22 +303,20 @@ void RequestController::terminateWaitingForExecutionAppRequests( ++request_it; } } - LOG4CXX_DEBUG(logger_, - "Waiting for execution " << mobile_request_list_.size()); + SDL_LOG_DEBUG("Waiting for execution " << mobile_request_list_.size()); } void RequestController::terminateWaitingForResponseAppRequests( const uint32_t& app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); waiting_for_response_.RemoveByConnectionKey(app_id); - LOG4CXX_DEBUG( - logger_, "Waiting for response count : " << waiting_for_response_.Size()); + SDL_LOG_DEBUG( + "Waiting for response count : " << waiting_for_response_.Size()); } void RequestController::terminateAppRequests(const uint32_t& app_id) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "app_id : " << app_id + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("app_id : " << app_id << "Requests waiting for execution count : " << mobile_request_list_.size() << "Requests waiting for response count : " @@ -338,32 +328,31 @@ void RequestController::terminateAppRequests(const uint32_t& app_id) { } void RequestController::terminateAllHMIRequests() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); terminateWaitingForResponseAppRequests(RequestInfo::HmiConnectionKey); } void RequestController::terminateAllMobileRequests() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); waiting_for_response_.RemoveMobileRequests(); - LOG4CXX_DEBUG(logger_, "Mobile Requests waiting for response cleared"); + SDL_LOG_DEBUG("Mobile Requests waiting for response cleared"); AutoLock waiting_execution_auto_lock(mobile_request_list_lock_); mobile_request_list_.clear(); - LOG4CXX_DEBUG(logger_, "Mobile Requests waiting for execution cleared"); + SDL_LOG_DEBUG("Mobile Requests waiting for execution cleared"); NotifyTimer(); } void RequestController::updateRequestTimeout(const uint32_t& app_id, const uint32_t& correlation_id, const uint32_t& new_timeout) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); - LOG4CXX_DEBUG(logger_, - "app_id : " << app_id + SDL_LOG_DEBUG("app_id : " << app_id << " mobile_correlation_id : " << correlation_id << " new_timeout : " << new_timeout); - LOG4CXX_DEBUG(logger_, - "New_timeout is NULL. RequestCtrl will " - "not manage this request any more"); + SDL_LOG_DEBUG( + "New_timeout is NULL. RequestCtrl will " + "not manage this request any more"); RequestInfoPtr request_info = waiting_for_response_.Find(app_id, correlation_id); @@ -372,40 +361,37 @@ void RequestController::updateRequestTimeout(const uint32_t& app_id, request_info->updateTimeOut(new_timeout); waiting_for_response_.Add(request_info); NotifyTimer(); - LOG4CXX_INFO(logger_, - "Timeout updated for " - << " app_id: " << app_id << " correlation_id: " - << correlation_id << " new_timeout (ms): " << new_timeout); + SDL_LOG_INFO("Timeout updated for " + << " app_id: " << app_id << " correlation_id: " + << correlation_id << " new_timeout (ms): " << new_timeout); } else { - LOG4CXX_ERROR(logger_, - "Can't find request with " - << " app_id: " << app_id - << " correlation_id: " << correlation_id); + SDL_LOG_ERROR("Can't find request with " + << " app_id: " << app_id + << " correlation_id: " << correlation_id); } } void RequestController::OnLowVoltage() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_low_voltage_ = true; } void RequestController::OnWakeUp() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); terminateAllHMIRequests(); terminateAllMobileRequests(); is_low_voltage_ = false; - LOG4CXX_DEBUG(logger_, "Terminate old requests done"); + SDL_LOG_DEBUG("Terminate old requests done"); } bool RequestController::IsLowVoltage() { - LOG4CXX_TRACE(logger_, "result: " << is_low_voltage_); + SDL_LOG_TRACE("result: " << is_low_voltage_); return is_low_voltage_; } void RequestController::TimeoutThread() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG( "ENTER Waiting fore response count: " << waiting_for_response_.Size()); sync_primitives::AutoLock auto_lock(timer_lock); while (!timer_stop_flag_) { @@ -416,54 +402,49 @@ void RequestController::TimeoutThread() { continue; } if (!probably_expired->isExpired()) { - LOG4CXX_DEBUG(logger_, - "Timeout for " - << (RequestInfo::HMIRequest == - probably_expired->request_type() - ? "HMI" - : "Mobile") - << " request id: " << probably_expired->requestId() - << " connection_key: " << probably_expired->app_id() - << " NOT expired"); + SDL_LOG_DEBUG("Timeout for " + << (RequestInfo::HMIRequest == + probably_expired->request_type() + ? "HMI" + : "Mobile") + << " request id: " << probably_expired->requestId() + << " connection_key: " << probably_expired->app_id() + << " NOT expired"); const date_time::TimeDuration current_time = date_time::getCurrentTime(); const date_time::TimeDuration end_time = probably_expired->end_time(); if (current_time < end_time) { const uint32_t msecs = static_cast<uint32_t>(date_time::getmSecs(end_time - current_time)); - LOG4CXX_DEBUG(logger_, "Sleep for " << msecs << " millisecs"); + SDL_LOG_DEBUG("Sleep for " << msecs << " millisecs"); timer_condition_.WaitFor(auto_lock, msecs); } continue; } - LOG4CXX_INFO(logger_, - "Timeout for " - << (RequestInfo::HMIRequest == - probably_expired->request_type() - ? "HMI" - : "Mobile") - << " request id: " << probably_expired->requestId() - << " connection_key: " << probably_expired->app_id() - << " is expired"); + SDL_LOG_INFO("Timeout for " + << (RequestInfo::HMIRequest == probably_expired->request_type() + ? "HMI" + : "Mobile") + << " request id: " << probably_expired->requestId() + << " connection_key: " << probably_expired->app_id() + << " is expired"); const uint32_t experied_request_id = probably_expired->requestId(); const uint32_t experied_app_id = probably_expired->app_id(); probably_expired->request()->onTimeOut(); if (RequestInfo::HmiConnectionKey == probably_expired->app_id()) { - LOG4CXX_DEBUG(logger_, - "Erase HMI request: " << probably_expired->requestId()); + SDL_LOG_DEBUG("Erase HMI request: " << probably_expired->requestId()); waiting_for_response_.RemoveRequest(probably_expired); } probably_expired = waiting_for_response_.FrontWithNotNullTimeout(); if (probably_expired) { if (experied_request_id == probably_expired->requestId() && experied_app_id == probably_expired->app_id()) { - LOG4CXX_DEBUG(logger_, "Expired request wasn't removed"); + SDL_LOG_DEBUG("Expired request wasn't removed"); break; } } } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "EXIT Waiting for response count : " << waiting_for_response_.Size()); } @@ -473,7 +454,7 @@ RequestController::Worker::Worker(RequestController* requestController) RequestController::Worker::~Worker() {} void RequestController::Worker::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); AutoLock auto_lock(thread_lock_); while (!stop_flag_) { // Try to pick a request @@ -483,9 +464,9 @@ void RequestController::Worker::threadMain() { (request_controller_->mobile_request_list_.empty())) { // Wait until there is a task in the queue // Unlock mutex while wait, then lock it back when signaled - LOG4CXX_INFO(logger_, "Unlocking and waiting"); + SDL_LOG_INFO("Unlocking and waiting"); request_controller_->cond_var_.Wait(auto_lock); - LOG4CXX_INFO(logger_, "Signaled and locking"); + SDL_LOG_INFO("Signaled and locking"); } // If the thread was shutdown, return from here @@ -494,7 +475,7 @@ void RequestController::Worker::threadMain() { } if (request_controller_->mobile_request_list_.empty()) { - LOG4CXX_WARN(logger_, "Mobile request list is empty"); + SDL_LOG_WARN("Mobile request list is empty"); break; } @@ -526,15 +507,15 @@ void RequestController::Worker::threadMain() { } continue; } - LOG4CXX_DEBUG(logger_, "timeout_in_mseconds " << timeout_in_mseconds); + SDL_LOG_DEBUG("timeout_in_mseconds " << timeout_in_mseconds); if (0 != timeout_in_mseconds) { request_controller_->NotifyTimer(); } else { - LOG4CXX_DEBUG(logger_, - "Default timeout was set to 0. " - "RequestController will not track timeout " - "of this request."); + SDL_LOG_DEBUG( + "Default timeout was set to 0. " + "RequestController will not track timeout " + "of this request."); } AutoUnlock unlock(auto_lock); @@ -542,10 +523,9 @@ void RequestController::Worker::threadMain() { // execute if ((false == request_controller_->IsLowVoltage()) && request_ptr->CheckPermissions() && init_res) { - LOG4CXX_DEBUG(logger_, - "Execute MobileRequest corr_id = " - << request_info_ptr->requestId() - << " with timeout: " << timeout_in_mseconds); + SDL_LOG_DEBUG("Execute MobileRequest corr_id = " + << request_info_ptr->requestId() + << " with timeout: " << timeout_in_mseconds); request_ptr->Run(); } } @@ -558,7 +538,7 @@ void RequestController::Worker::exitThreadMain() { } void RequestController::NotifyTimer() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); timer_condition_.NotifyOne(); } diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index b6f53b6085..1149c9aaf9 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -40,7 +40,7 @@ namespace application_manager { namespace request_controller { -CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController") +SDL_CREATE_LOG_VARIABLE("RequestController") uint32_t RequestInfo::HmiConnectionKey = 0; @@ -127,10 +127,9 @@ RequestInfoSet::~RequestInfoSet() { bool RequestInfoSet::Add(RequestInfoPtr request_info) { DCHECK_OR_RETURN(request_info, false); - LOG4CXX_DEBUG( - logger_, - "Add request app_id = " << request_info->app_id() - << "; corr_id = " << request_info->requestId()); + SDL_LOG_DEBUG("Add request app_id = " << request_info->app_id() + << "; corr_id = " + << request_info->requestId()); sync_primitives::AutoLock lock(pending_requests_lock_); CheckSetSizes(); const std::pair<HashSortedRequestInfoSet::iterator, bool>& insert_resilt = @@ -145,10 +144,9 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) { CheckSetSizes(); return true; } else { - LOG4CXX_ERROR(logger_, - "Request with app_id = " - << request_info->app_id() << "; corr_id " - << request_info->requestId() << " Already exist "); + SDL_LOG_ERROR("Request with app_id = " + << request_info->app_id() << "; corr_id " + << request_info->requestId() << " Already exist "); } CheckSetSizes(); return false; @@ -183,7 +181,7 @@ RequestInfoPtr RequestInfoSet::Front() { } RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(pending_requests_lock_); RequestInfoPtr result; TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin(); @@ -202,7 +200,7 @@ RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() { bool RequestInfoSet::Erase(const RequestInfoPtr request_info) { DCHECK(request_info); if (!request_info) { - LOG4CXX_ERROR(logger_, "NULL ponter request_info"); + SDL_LOG_ERROR("NULL ponter request_info"); return false; } CheckSetSizes(); @@ -214,7 +212,7 @@ bool RequestInfoSet::Erase(const RequestInfoPtr request_info) { time_sorted_pending_requests_.find(request_info); DCHECK(it != time_sorted_pending_requests_.end()); if (it == time_sorted_pending_requests_.end()) { - LOG4CXX_ERROR(logger_, "Can't find request in time_sorted_requests_"); + SDL_LOG_ERROR("Can't find request in time_sorted_requests_"); return false; } const RequestInfoPtr found = *it; @@ -234,7 +232,7 @@ bool RequestInfoSet::RemoveRequest(const RequestInfoPtr request_info) { uint32_t RequestInfoSet::RemoveRequests( const RequestInfoSet::AppIdCompararator& filter) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t erased = 0; sync_primitives::AutoLock lock(pending_requests_lock_); @@ -253,13 +251,13 @@ uint32_t RequestInfoSet::RemoveRequests( } uint32_t RequestInfoSet::RemoveByConnectionKey(uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return RemoveRequests( AppIdCompararator(AppIdCompararator::Equal, connection_key)); } uint32_t RequestInfoSet::RemoveMobileRequests() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual, RequestInfo::HmiConnectionKey)); } diff --git a/src/components/application_manager/src/request_tracker.cc b/src/components/application_manager/src/request_tracker.cc index 052667dc3f..5f92a107b5 100644 --- a/src/components/application_manager/src/request_tracker.cc +++ b/src/components/application_manager/src/request_tracker.cc @@ -39,19 +39,18 @@ namespace application_manager { namespace request_controller { -CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController") +SDL_CREATE_LOG_VARIABLE("RequestController") RequestTracker::RequestTracker(const RequestControlerSettings& settings) : settings_(settings) {} TrackResult RequestTracker::Track(const ApplicationID& app_id, const mobile_apis::HMILevel::eType level) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool track_result = false; - LOG4CXX_DEBUG(logger_, - "Tracking request for level: " - << MessageHelper::StringifiedHMILevel(level)); + SDL_LOG_DEBUG("Tracking request for level: " + << MessageHelper::StringifiedHMILevel(level)); if (mobile_apis::HMILevel::HMI_NONE == level) { track_result = Track(app_id, @@ -76,44 +75,41 @@ bool RequestTracker::Track(const ApplicationID& app_id, const uint32_t time_scale, const uint32_t max_requests, ApplicationsRequestsTracker& tracker) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace date_time; if (!time_scale || !max_requests) { - LOG4CXX_INFO(logger_, "Time scale request tracking is disabled."); + SDL_LOG_INFO("Time scale request tracking is disabled."); return true; } - LOG4CXX_DEBUG(logger_, - "Time scale is: " << time_scale << ". Max requests number is: " + SDL_LOG_DEBUG("Time scale is: " << time_scale << ". Max requests number is: " << max_requests); - LOG4CXX_DEBUG(logger_, "Tracking app id: " << app_id); + SDL_LOG_DEBUG("Tracking app id: " << app_id); ApplicationsRequestsTracker::iterator it_app = tracker.find(app_id); if (tracker.end() == it_app) { - LOG4CXX_DEBUG(logger_, "Adding new application into tracking."); + SDL_LOG_DEBUG("Adding new application into tracking."); tracker[app_id].push_back(getCurrentTime()); return true; } - LOG4CXX_DEBUG(logger_, - "Amount of known requests is: " << it_app->second.size()); + SDL_LOG_DEBUG("Amount of known requests is: " << it_app->second.size()); if (it_app->second.size() < max_requests) { - LOG4CXX_DEBUG(logger_, "Adding new request into tracking."); + SDL_LOG_DEBUG("Adding new request into tracking."); tracker[app_id].push_back(getCurrentTime()); return true; } - LOG4CXX_DEBUG(logger_, - "Oldest request is added at: " - << getmSecs(it_app->second.front()) - << ". Current time is: " << getmSecs(getCurrentTime()) - << ". Time scale is: " << time_scale); + SDL_LOG_DEBUG("Oldest request is added at: " + << getmSecs(it_app->second.front()) + << ". Current time is: " << getmSecs(getCurrentTime()) + << ". Time scale is: " << time_scale); if (calculateTimeSpan(it_app->second.front()) > time_scale) { - LOG4CXX_DEBUG(logger_, "Dropping oldest request, adding new one."); + SDL_LOG_DEBUG("Dropping oldest request, adding new one."); ApplicationsRequestsTracker::mapped_type& times = tracker[app_id]; DCHECK_OR_RETURN(!times.empty(), false); @@ -123,7 +119,7 @@ bool RequestTracker::Track(const ApplicationID& app_id, return true; } - LOG4CXX_DEBUG(logger_, "Requests amount per time scale is exceeded."); + SDL_LOG_DEBUG("Requests amount per time scale is exceeded."); return false; } diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc index 2d5f1b6638..82dfbc457a 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc @@ -61,7 +61,7 @@ static mobile_api::HMILevel::eType PickLowerHmiLevel( mobile_api::HMILevel::eType val1, mobile_api::HMILevel::eType val2); static mobile_api::HMILevel::eType ConvertHmiLevelString(const std::string str); -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOG_VARIABLE("Resumption") ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager) : event_engine::EventObserver(application_manager.event_dispatcher()) @@ -104,9 +104,9 @@ bool ResumeCtrlImpl::Init(resumption::LastStateWrapperPtr last_state_wrapper) { dynamic_cast<ResumptionDataDB*>(resumption_storage_.get()); if (!db->IsDBVersionActual()) { - LOG4CXX_INFO(logger_, - "DB version had been changed. " - "Rebuilding resumption DB."); + SDL_LOG_INFO( + "DB version had been changed. " + "Rebuilding resumption DB."); smart_objects::SmartObject data; db->GetAllData(data); @@ -122,7 +122,7 @@ bool ResumeCtrlImpl::Init(resumption::LastStateWrapperPtr last_state_wrapper) { resumption_storage_.reset( new ResumptionDataJson(last_state_wrapper, application_manager_)); if (!resumption_storage_->Init()) { - LOG4CXX_DEBUG(logger_, "Resumption storage initialisation failed"); + SDL_LOG_DEBUG("Resumption storage initialisation failed"); return false; } } @@ -147,23 +147,22 @@ void ResumeCtrlImpl::SaveAllApplications() { } void ResumeCtrlImpl::SaveApplication(ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); if (application_manager_.IsLowVoltage()) { - LOG4CXX_DEBUG(logger_, "Low Voltage state is active"); + SDL_LOG_DEBUG("Low Voltage state is active"); return; } - LOG4CXX_DEBUG( - logger_, - "application with appID " << application->app_id() << " will be saved"); + SDL_LOG_DEBUG("application with appID " << application->app_id() + << " will be saved"); resumption_storage_->SaveApplication(application); } void ResumeCtrlImpl::on_event(const event_engine::Event& event) { - LOG4CXX_DEBUG(logger_, "Event received: " << event.id()); + SDL_LOG_DEBUG("Event received: " << event.id()); if (hmi_apis::FunctionID::UI_CreateWindow == event.id()) { - LOG4CXX_INFO(logger_, "Received UI_CreateWindow event"); + SDL_LOG_INFO("Received UI_CreateWindow event"); const auto& response_message = event.smart_object(); RestoreWidgetsHMIState(response_message); } @@ -171,10 +170,9 @@ void ResumeCtrlImpl::on_event(const event_engine::Event& event) { bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOG4CXX_DEBUG(logger_, - "app_id : " << application->app_id() << "; policy_app_id : " + SDL_LOG_DEBUG("app_id : " << application->app_id() << "; policy_app_id : " << application->policy_app_id()); const std::string& device_mac = application->mac_address(); smart_objects::SmartObject saved_app(smart_objects::SmartType_Map); @@ -187,14 +185,13 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) { if (HMILevel::eType::INVALID_ENUM != application->deferred_resumption_hmi_level()) { saved_hmi_level = application->deferred_resumption_hmi_level(); - LOG4CXX_INFO(logger_, - "Retry resuming into HMI level : " << saved_hmi_level); + SDL_LOG_INFO("Retry resuming into HMI level : " << saved_hmi_level); application->set_deferred_resumption_hmi_level( HMILevel::eType::INVALID_ENUM); } else { saved_hmi_level = static_cast<mobile_apis::HMILevel::eType>( saved_app[strings::hmi_level].asInt()); - LOG4CXX_DEBUG(logger_, "Saved HMI Level is : " << saved_hmi_level); + SDL_LOG_DEBUG("Saved HMI Level is : " << saved_hmi_level); } // Check one of the high-bandwidth transports (configured through @@ -209,10 +206,9 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) { saved_hmi_level = PickLowerHmiLevel(saved_hmi_level, low_bandwidth_level); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "High-bandwidth transport not available, app will resume into : " - << saved_hmi_level); + << saved_hmi_level); } const bool app_exists_in_full_or_limited = application_manager_.get_full_or_limited_application().use_count() != @@ -225,29 +221,28 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) { restored_widgets = RestoreAppWidgets(application, saved_app); } if (0 == restored_widgets && app_exists_in_full_or_limited) { - LOG4CXX_DEBUG(logger_, "App exists in full or limited. Do not resume"); + SDL_LOG_DEBUG("App exists in full or limited. Do not resume"); return false; } } else { result = false; - LOG4CXX_ERROR(logger_, "saved app data corrupted"); + SDL_LOG_ERROR("saved app data corrupted"); } } else { - LOG4CXX_ERROR(logger_, "Application not saved"); + SDL_LOG_ERROR("Application not saved"); } return result; } void ResumeCtrlImpl::RestoreWidgetsHMIState( const smart_objects::SmartObject& response_message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto correlation_id = response_message[strings::params][strings::correlation_id].asInt(); const auto& request = requests_msg_.find(correlation_id); if (requests_msg_.end() == request) { - LOG4CXX_ERROR(logger_, - "Request UI_CreateWindow for correlation id: " - << correlation_id << " not found"); + SDL_LOG_ERROR("Request UI_CreateWindow for correlation id: " + << correlation_id << " not found"); return; } @@ -255,8 +250,7 @@ void ResumeCtrlImpl::RestoreWidgetsHMIState( const auto hmi_app_id = msg_params[strings::app_id].asInt(); auto application = application_manager_.application_by_hmi_app(hmi_app_id); if (!application) { - LOG4CXX_ERROR(logger_, - "Application is not registered by hmi id: " << hmi_app_id); + SDL_LOG_ERROR("Application is not registered by hmi id: " << hmi_app_id); requests_msg_.erase(request); return; } @@ -265,10 +259,8 @@ void ResumeCtrlImpl::RestoreWidgetsHMIState( const auto result_code = static_cast<hmi_apis::Common_Result::eType>( response_message[strings::params][hmi_response::code].asInt()); if (hmi_apis::Common_Result::SUCCESS != result_code) { - LOG4CXX_ERROR(logger_, - "UI_CreateWindow for correlation id: " - << correlation_id - << " failed with code: " << result_code); + SDL_LOG_ERROR("UI_CreateWindow for correlation id: " + << correlation_id << " failed with code: " << result_code); requests_msg_.erase(request); auto& builder = application->display_capabilities_builder(); builder.StopWaitingForWindow(window_id); @@ -311,7 +303,7 @@ void ResumeCtrlImpl::RestoreWidgetsHMIState( void ResumeCtrlImpl::ProcessSystemCapabilityUpdated( Application& app, const smart_objects::SmartObject& display_capabilities) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto notification = MessageHelper::CreateDisplayCapabilityUpdateToMobile( display_capabilities, app); @@ -322,7 +314,7 @@ void ResumeCtrlImpl::ProcessSystemCapabilityUpdated( } bool ResumeCtrlImpl::SetupDefaultHMILevel(ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); mobile_apis::HMILevel::eType hmi_level = application_manager_.GetDefaultHmiLevel(application); @@ -335,23 +327,22 @@ bool ResumeCtrlImpl::SetupDefaultHMILevel(ApplicationSharedPtr application) { mobile_apis::HMILevel::eType low_bandwidth_level = GetHmiLevelOnLowBandwidthTransport(application); hmi_level = PickLowerHmiLevel(hmi_level, low_bandwidth_level); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "High-bandwidth transport not available, default HMI level is set to : " - << hmi_level); + << hmi_level); } return SetAppHMIState(application, hmi_level, false); } void ResumeCtrlImpl::ApplicationResumptiOnTimer() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(queue_lock_); WaitingForTimerList::iterator it = waiting_for_timer_.begin(); for (; it != waiting_for_timer_.end(); ++it) { ApplicationSharedPtr app = application_manager_.application(*it); if (!app) { - LOG4CXX_ERROR(logger_, "Invalid app_id = " << *it); + SDL_LOG_ERROR("Invalid app_id = " << *it); continue; } if (!StartAppHmiStateResumption(app)) { @@ -371,7 +362,7 @@ void ResumeCtrlImpl::OnAppActivated(ApplicationSharedPtr application) { } void ResumeCtrlImpl::RemoveFromResumption(uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); queue_lock_.Acquire(); waiting_for_timer_.remove(app_id); queue_lock_.Release(); @@ -386,25 +377,23 @@ bool ResumeCtrlImpl::SetAppHMIState( const mobile_apis::HMILevel::eType hmi_level, bool check_policy) { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOG4CXX_TRACE(logger_, - " app_id : " << application->app_id() + SDL_LOG_TRACE(" app_id : " << application->app_id() << ", hmi_level : " << hmi_level << ", check_policy : " << check_policy); const std::string& device_mac = application->mac_address(); if (check_policy && application_manager_.GetUserConsentForDevice(device_mac) != policy::DeviceConsent::kDeviceAllowed) { - LOG4CXX_ERROR(logger_, "Resumption abort. Data consent wasn't allowed."); + SDL_LOG_ERROR("Resumption abort. Data consent wasn't allowed."); SetupDefaultHMILevel(application); return false; } application_manager_.state_controller().SetRegularState( application, mobile_apis::PredefinedWindows::DEFAULT_WINDOW, hmi_level); - LOG4CXX_INFO(logger_, - "Application with policy id " << application->policy_app_id() + SDL_LOG_INFO("Application with policy id " << application->policy_app_id() << " got HMI level " << hmi_level); return true; @@ -414,10 +403,10 @@ size_t ResumeCtrlImpl::RestoreAppWidgets( application_manager::ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(application); if (!saved_app.keyExists(strings::windows_info)) { - LOG4CXX_ERROR(logger_, "windows_info section does not exist"); + SDL_LOG_ERROR("windows_info section does not exist"); return 0; } const auto& windows_info = saved_app[strings::windows_info]; @@ -434,7 +423,7 @@ size_t ResumeCtrlImpl::RestoreAppWidgets( } bool ResumeCtrlImpl::IsHMIApplicationIdExist(uint32_t hmi_app_id) { - LOG4CXX_DEBUG(logger_, "hmi_app_id :" << hmi_app_id); + SDL_LOG_DEBUG("hmi_app_id :" << hmi_app_id); return resumption_storage_->IsHMIApplicationIdExist(hmi_app_id); } @@ -452,7 +441,7 @@ uint32_t ResumeCtrlImpl::GetHMIApplicationID( bool ResumeCtrlImpl::RemoveApplicationFromSaved( ApplicationConstSharedPtr application) { if (application_manager_.IsLowVoltage()) { - LOG4CXX_DEBUG(logger_, "Low Voltage state is active"); + SDL_LOG_DEBUG("Low Voltage state is active"); return false; } const std::string& device_mac = application->mac_address(); @@ -461,13 +450,13 @@ bool ResumeCtrlImpl::RemoveApplicationFromSaved( } void ResumeCtrlImpl::OnSuspend() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_suspended_ = true; FinalPersistData(); } void ResumeCtrlImpl::OnIgnitionOff() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(resumption_storage_); if (!application_manager_.IsLowVoltage()) { resumption_storage_->IncrementIgnOffCount(); @@ -477,7 +466,7 @@ void ResumeCtrlImpl::OnIgnitionOff() { } void ResumeCtrlImpl::OnAwake() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_suspended_ = false; ResetLaunchTime(); StartSavePersistentDataTimer(); @@ -485,13 +474,12 @@ void ResumeCtrlImpl::OnAwake() { void ResumeCtrlImpl::SaveLowVoltageTime() { low_voltage_time_ = time(nullptr); - LOG4CXX_DEBUG(logger_, - "Low Voltage timestamp : " << low_voltage_time_ << " saved"); + SDL_LOG_DEBUG("Low Voltage timestamp : " << low_voltage_time_ << " saved"); } void ResumeCtrlImpl::SaveWakeUpTime() { wake_up_time_ = std::time(nullptr); - LOG4CXX_DEBUG(logger_, "Wake Up timestamp : " << wake_up_time_ << " saved"); + SDL_LOG_DEBUG("Wake Up timestamp : " << wake_up_time_ << " saved"); } time_t ResumeCtrlImpl::LowVoltageTime() const { @@ -507,7 +495,7 @@ bool ResumeCtrlImpl::is_suspended() const { } void ResumeCtrlImpl::StartSavePersistentDataTimer() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!save_persistent_data_timer_.is_running()) { save_persistent_data_timer_.Start( application_manager_.get_settings() @@ -517,7 +505,7 @@ void ResumeCtrlImpl::StartSavePersistentDataTimer() { } void ResumeCtrlImpl::StopSavePersistentDataTimer() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (save_persistent_data_timer_.is_running()) { save_persistent_data_timer_.Stop(); } @@ -525,14 +513,13 @@ void ResumeCtrlImpl::StopSavePersistentDataTimer() { bool ResumeCtrlImpl::StartResumption(ApplicationSharedPtr application, const std::string& hash) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOG4CXX_DEBUG( - logger_, - " Resume app_id = " << application->app_id() - << " hmi_app_id = " << application->hmi_app_id() - << " policy_id = " << application->policy_app_id() - << " received hash = " << hash); + SDL_LOG_DEBUG(" Resume app_id = " + << application->app_id() + << " hmi_app_id = " << application->hmi_app_id() + << " policy_id = " << application->policy_app_id() + << " received hash = " << hash); application->set_is_resuming(true); if (!application->is_cloud_app()) { @@ -557,18 +544,17 @@ bool ResumeCtrlImpl::StartResumption(ApplicationSharedPtr application, bool ResumeCtrlImpl::StartResumptionOnlyHMILevel( ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!application) { - LOG4CXX_WARN(logger_, "Application does not exist."); + SDL_LOG_WARN("Application does not exist."); return false; } application->set_is_resuming(true); - LOG4CXX_DEBUG(logger_, - "HMI level resumption requested for application id: " - << application->app_id() - << " with hmi_app_id: " << application->hmi_app_id() - << ", policy_app_id " << application->policy_app_id()); + SDL_LOG_DEBUG("HMI level resumption requested for application id: " + << application->app_id() + << " with hmi_app_id: " << application->hmi_app_id() + << ", policy_app_id " << application->policy_app_id()); if (!application->is_cloud_app()) { // Default HMI Level is already set before resumption in // ApplicationManager::OnApplicationRegistered, and handling low bandwidth @@ -583,16 +569,16 @@ bool ResumeCtrlImpl::StartResumptionOnlyHMILevel( if (result) { AddToResumptionTimerQueue(application->app_id()); } - LOG4CXX_INFO(logger_, "StartResumptionOnlyHMILevel::Result = " << result); + SDL_LOG_INFO("StartResumptionOnlyHMILevel::Result = " << result); return result; } void ResumeCtrlImpl::RetryResumption(const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOG4CXX_WARN(logger_, "Invalid app_id = " << app_id); + SDL_LOG_WARN("Invalid app_id = " << app_id); return; } @@ -601,7 +587,7 @@ void ResumeCtrlImpl::RetryResumption(const uint32_t app_id) { // check and update resumption deferred flag in queue_lock_ if (mobile_api::HMILevel::eType::INVALID_ENUM == app->deferred_resumption_hmi_level()) { - LOG4CXX_DEBUG(logger_, "No need to retry resumption for app: " << app_id); + SDL_LOG_DEBUG("No need to retry resumption for app: " << app_id); return; } } @@ -612,14 +598,14 @@ void ResumeCtrlImpl::RetryResumption(const uint32_t app_id) { bool ResumeCtrlImpl::StartAppHmiStateResumption( ApplicationSharedPtr application) { using namespace date_time; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); const bool get_saved_app_result = resumption_storage_->GetSavedApplication( application->policy_app_id(), device_mac, saved_app); if (!get_saved_app_result) { - LOG4CXX_ERROR(logger_, "Application was not saved"); + SDL_LOG_ERROR("Application was not saved"); return false; } @@ -627,7 +613,7 @@ bool ResumeCtrlImpl::StartAppHmiStateResumption( CheckAppRestrictions(application, saved_app); if (!is_hmi_level_applicable_to_resume) { - LOG4CXX_DEBUG(logger_, "No applicable HMI level found for resuming"); + SDL_LOG_DEBUG("No applicable HMI level found for resuming"); return false; } const bool is_resume_allowed_by_low_voltage = @@ -645,8 +631,7 @@ bool ResumeCtrlImpl::StartAppHmiStateResumption( !is_app_revoked; if (restore_hmi_level_allowed) { - LOG4CXX_INFO(logger_, - "Resume application " << application->policy_app_id()); + SDL_LOG_INFO("Resume application " << application->policy_app_id()); const bool hmi_state_restore_result = RestoreAppHMIState(application); if (mobile_apis::HMILevel::eType::INVALID_ENUM != application->deferred_resumption_hmi_level()) { @@ -656,24 +641,22 @@ bool ResumeCtrlImpl::StartAppHmiStateResumption( RemoveApplicationFromSaved(application); return hmi_state_restore_result; } else { - LOG4CXX_INFO( - logger_, - "Do not need to resume application " << application->policy_app_id()); + SDL_LOG_INFO("Do not need to resume application " + << application->policy_app_id()); } return true; } void ResumeCtrlImpl::ResetLaunchTime() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); launch_time_ = time(NULL); } bool ResumeCtrlImpl::CheckPersistenceFilesForResumption( ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOG4CXX_DEBUG(logger_, - " Resume app_id = " << application->app_id() << " policy_id = " + SDL_LOG_DEBUG(" Resume app_id = " << application->app_id() << " policy_id = " << application->policy_app_id()); smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); @@ -697,10 +680,9 @@ bool ResumeCtrlImpl::CheckPersistenceFilesForResumption( bool ResumeCtrlImpl::CheckApplicationHash(ApplicationSharedPtr application, const std::string& hash) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOG4CXX_DEBUG(logger_, - "app_id : " << application->app_id() << " hash : " << hash); + SDL_LOG_DEBUG("app_id : " << application->app_id() << " hash : " << hash); smart_objects::SmartObject saved_app; const std::string& device_mac = application->mac_address(); const bool get_app_result = resumption_storage_->GetSavedApplication( @@ -714,9 +696,9 @@ bool ResumeCtrlImpl::CheckApplicationHash(ApplicationSharedPtr application, } void ResumeCtrlImpl::SaveDataOnTimer() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_resumption_active_) { - LOG4CXX_WARN(logger_, "Resumption timer is active skip saving"); + SDL_LOG_WARN("Resumption timer is active skip saving"); return; } @@ -730,7 +712,7 @@ void ResumeCtrlImpl::SaveDataOnTimer() { } void ResumeCtrlImpl::FinalPersistData() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(resumption_storage_); StopSavePersistentDataTimer(); SaveAllApplications(); @@ -739,15 +721,15 @@ void ResumeCtrlImpl::FinalPersistData() { bool ResumeCtrlImpl::IsDeviceMacAddressEqual( ApplicationSharedPtr application, const std::string& saved_device_mac) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string device_mac = application->mac_address(); return device_mac == saved_device_mac; } bool ResumeCtrlImpl::RestoreApplicationData(ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(application, false); - LOG4CXX_DEBUG(logger_, "app_id : " << application->app_id()); + SDL_LOG_DEBUG("app_id : " << application->app_id()); smart_objects::SmartObject saved_app(smart_objects::SmartType_Map); const std::string& device_mac = application->mac_address(); @@ -766,26 +748,25 @@ bool ResumeCtrlImpl::RestoreApplicationData(ApplicationSharedPtr application) { AddWayPointsSubscription(application, saved_app); result = true; } else { - LOG4CXX_WARN(logger_, - "Saved data of application does not contain grammar_id"); + SDL_LOG_WARN("Saved data of application does not contain grammar_id"); result = false; } } else { - LOG4CXX_WARN(logger_, "Application not saved"); + SDL_LOG_WARN("Application not saved"); } return result; } void ResumeCtrlImpl::StartWaitingForDisplayCapabilitiesUpdate( app_mngr::ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject saved_app(smart_objects::SmartType_Map); resumption_storage_->GetSavedApplication( application->policy_app_id(), application->mac_address(), saved_app); auto resume_callback = [this](Application& app, const smart_objects::SmartObject& display_capabilities) -> void { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessSystemCapabilityUpdated(app, display_capabilities); }; auto& builder = application->display_capabilities_builder(); @@ -799,7 +780,7 @@ void ResumeCtrlImpl::StartWaitingForDisplayCapabilitiesUpdate( void ResumeCtrlImpl::AddFiles(ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (saved_app.keyExists(strings::application_files)) { const smart_objects::SmartObject& application_files = @@ -821,13 +802,13 @@ void ResumeCtrlImpl::AddFiles(ApplicationSharedPtr application, } } } else { - LOG4CXX_FATAL(logger_, "application_files section is not exists"); + SDL_LOG_FATAL("application_files section is not exists"); } } void ResumeCtrlImpl::AddSubmenues(ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (saved_app.keyExists(strings::application_submenus)) { const smart_objects::SmartObject& app_submenus = @@ -839,13 +820,13 @@ void ResumeCtrlImpl::AddSubmenues(ApplicationSharedPtr application, ProcessHMIRequests(MessageHelper::CreateAddSubMenuRequestToHMI( application, application_manager_.GetNextHMICorrelationID())); } else { - LOG4CXX_FATAL(logger_, "application_submenus section is not exists"); + SDL_LOG_FATAL("application_submenus section is not exists"); } } void ResumeCtrlImpl::AddCommands(ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (saved_app.keyExists(strings::application_commands)) { const smart_objects::SmartObject& app_commands = @@ -866,14 +847,14 @@ void ResumeCtrlImpl::AddCommands(ApplicationSharedPtr application, ProcessHMIRequests(MessageHelper::CreateAddCommandRequestToHMI( application, application_manager_)); } else { - LOG4CXX_FATAL(logger_, "application_commands section is not exists"); + SDL_LOG_FATAL("application_commands section is not exists"); } } void ResumeCtrlImpl::AddChoicesets( ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (saved_app.keyExists(strings::application_choice_sets)) { const smart_objects::SmartObject& app_choice_sets = @@ -887,14 +868,14 @@ void ResumeCtrlImpl::AddChoicesets( ProcessHMIRequests(MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI( application, application_manager_)); } else { - LOG4CXX_FATAL(logger_, "There is no any choicesets"); + SDL_LOG_FATAL("There is no any choicesets"); } } void ResumeCtrlImpl::SetGlobalProperties( ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (saved_app.keyExists(strings::application_global_properties)) { const smart_objects::SmartObject& properties_so = @@ -907,7 +888,7 @@ void ResumeCtrlImpl::SetGlobalProperties( void ResumeCtrlImpl::AddWayPointsSubscription( app_mngr::ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (saved_app.keyExists(strings::subscribed_for_way_points)) { const smart_objects::SmartObject& subscribed_for_way_points_so = @@ -921,7 +902,7 @@ void ResumeCtrlImpl::AddWayPointsSubscription( void ResumeCtrlImpl::AddSubscriptions( ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (saved_app.keyExists(strings::application_subscriptions)) { const smart_objects::SmartObject& subscriptions = saved_app[strings::application_subscriptions]; @@ -947,15 +928,15 @@ void ResumeCtrlImpl::AddSubscriptions( bool ResumeCtrlImpl::CheckIgnCycleRestrictions( const smart_objects::SmartObject& saved_app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!CheckDelayAfterIgnOn()) { - LOG4CXX_DEBUG(logger_, "Application was connected long after ign on"); + SDL_LOG_DEBUG("Application was connected long after ign on"); return false; } if (!CheckDelayBeforeIgnOff(saved_app)) { - LOG4CXX_DEBUG(logger_, "Application was disconnected long before ign off"); + SDL_LOG_DEBUG("Application was disconnected long before ign off"); return false; } return true; @@ -963,27 +944,26 @@ bool ResumeCtrlImpl::CheckIgnCycleRestrictions( bool ResumeCtrlImpl::CheckLowVoltageRestrictions( const smart_objects::SmartObject& saved_app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!CheckDelayBeforeLowVoltage(saved_app)) { - LOG4CXX_DEBUG(logger_, - "Application was disconnected long before low voltage"); + SDL_LOG_DEBUG("Application was disconnected long before low voltage"); return false; } if (!CheckDelayAfterWakeUp()) { - LOG4CXX_DEBUG(logger_, "Application was connected long after wake up"); + SDL_LOG_DEBUG("Application was connected long after wake up"); return false; } - LOG4CXX_DEBUG(logger_, "HMI Level resuming in not restricted by Low Voltage"); + SDL_LOG_DEBUG("HMI Level resuming in not restricted by Low Voltage"); return true; } bool ResumeCtrlImpl::CheckDelayBeforeIgnOff( const smart_objects::SmartObject& saved_app) const { using namespace date_time; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false); const time_t time_stamp = @@ -992,26 +972,25 @@ bool ResumeCtrlImpl::CheckDelayBeforeIgnOff( static_cast<time_t>(resumption_storage_->GetIgnOffTime()); if (CheckIgnCyclesData() && 0 == ign_off_time) { - LOG4CXX_DEBUG( - logger_, "No IGNITION OFF records found: This is first Ignition cycle"); + SDL_LOG_DEBUG( + "No IGNITION OFF records found: This is first Ignition cycle"); return true; } // This means that ignition off timestamp was not saved // Possible reasons: Low Voltage event, core crash etc. if (ign_off_time < time_stamp) { - LOG4CXX_DEBUG(logger_, "Last IGNITION OFF record missed"); + SDL_LOG_DEBUG("Last IGNITION OFF record missed"); return true; } const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "ign_off_time " - << ign_off_time << "; app_disconnect_time " << time_stamp - << "; sec_spent_before_ign " << sec_spent_before_ign - << "; resumption_delay_before_ign " - << application_manager_.get_settings().resumption_delay_before_ign()); + << ign_off_time << "; app_disconnect_time " << time_stamp + << "; sec_spent_before_ign " << sec_spent_before_ign + << "; resumption_delay_before_ign " + << application_manager_.get_settings().resumption_delay_before_ign()); return sec_spent_before_ign <= application_manager_.get_settings().resumption_delay_before_ign(); } @@ -1019,11 +998,11 @@ bool ResumeCtrlImpl::CheckDelayBeforeIgnOff( bool ResumeCtrlImpl::CheckDelayBeforeLowVoltage( const smart_objects::SmartObject& saved_app) const { using namespace date_time; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false); if (0 == LowVoltageTime()) { - LOG4CXX_DEBUG(logger_, "No Low Voltage signal timestamp saved"); + SDL_LOG_DEBUG("No Low Voltage signal timestamp saved"); return true; } @@ -1033,12 +1012,11 @@ bool ResumeCtrlImpl::CheckDelayBeforeLowVoltage( const int32_t sec_spent_before_low_voltage = (low_voltage_timestamp - unregistration_time_stamp); if (0 > sec_spent_before_low_voltage) { - LOG4CXX_DEBUG(logger_, - "Low Voltage time: " - << low_voltage_timestamp - << "; App disconnect time: " << unregistration_time_stamp - << "; Secs between app disconnect and low voltage event " - << sec_spent_before_low_voltage); + SDL_LOG_DEBUG("Low Voltage time: " + << low_voltage_timestamp + << "; App disconnect time: " << unregistration_time_stamp + << "; Secs between app disconnect and low voltage event " + << sec_spent_before_low_voltage); return true; } @@ -1046,22 +1024,21 @@ bool ResumeCtrlImpl::CheckDelayBeforeLowVoltage( static_cast<uint32_t>(sec_spent_before_low_voltage); const uint32_t wait_time = application_manager_.get_settings().resumption_delay_before_ign(); - LOG4CXX_DEBUG(logger_, - "Low Voltage time: " - << low_voltage_timestamp - << "; App disconnect time: " << unregistration_time_stamp - << "; Secs between app disconnect and low voltage event " - << secs_between_app_disconnect_and_low_voltage - << "; Timeout for HMI level resuming: " << wait_time); + SDL_LOG_DEBUG("Low Voltage time: " + << low_voltage_timestamp + << "; App disconnect time: " << unregistration_time_stamp + << "; Secs between app disconnect and low voltage event " + << secs_between_app_disconnect_and_low_voltage + << "; Timeout for HMI level resuming: " << wait_time); return secs_between_app_disconnect_and_low_voltage <= wait_time; } bool ResumeCtrlImpl::CheckDelayAfterWakeUp() const { using namespace date_time; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (0 == WakeUpTime()) { - LOG4CXX_DEBUG(logger_, "No WakeUp signal timestamp saved"); + SDL_LOG_DEBUG("No WakeUp signal timestamp saved"); return true; } @@ -1072,12 +1049,11 @@ bool ResumeCtrlImpl::CheckDelayAfterWakeUp() const { labs(current_time - wake_up_timestamp); const uint32_t wait_time = application_manager_.get_settings().resumption_delay_after_ign(); - LOG4CXX_DEBUG( - logger_, - "Current time: " << current_time << "; WakeUp Signal time: " - << wake_up_timestamp << "; Seconds passed from wake up: " - << seconds_from_wake_up_signal - << "; Timeout for HMI level resuming: " << wait_time); + SDL_LOG_DEBUG("Current time: " + << current_time << "; WakeUp Signal time: " << wake_up_timestamp + << "; Seconds passed from wake up: " + << seconds_from_wake_up_signal + << "; Timeout for HMI level resuming: " << wait_time); return seconds_from_wake_up_signal <= wait_time; } @@ -1086,7 +1062,7 @@ bool ResumeCtrlImpl::CheckAppRestrictions( const smart_objects::SmartObject& saved_app) { using namespace mobile_apis; using namespace helpers; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(saved_app.keyExists(strings::hmi_level), false); HMILevel::eType hmi_level; @@ -1101,8 +1077,7 @@ bool ResumeCtrlImpl::CheckAppRestrictions( hmi_level, HMILevel::HMI_FULL, HMILevel::HMI_LIMITED) ? true : false; - LOG4CXX_DEBUG(logger_, - "is_media_app: " << application->is_media_application() + SDL_LOG_DEBUG("is_media_app: " << application->is_media_application() << "; hmi_level: " << hmi_level << "; result: " << (result ? "Applicable for resume" : "Non-applicable for resume")); @@ -1112,14 +1087,14 @@ bool ResumeCtrlImpl::CheckAppRestrictions( bool ResumeCtrlImpl::CheckIcons(ApplicationSharedPtr application, smart_objects::SmartObject& obj) { using namespace smart_objects; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const mobile_apis::Result::eType verify_images = MessageHelper::VerifyImageFiles(obj, application, application_manager_); return mobile_apis::Result::INVALID_DATA != verify_images; } bool ResumeCtrlImpl::CheckIgnCyclesData() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint32_t global_ign_on_count = resumption_storage_->GetGlobalIgnOnCounter(); const uint32_t the_first_ignition = 1; @@ -1129,8 +1104,7 @@ bool ResumeCtrlImpl::CheckIgnCyclesData() const { // global_ign_on_count is incrementing at ignition on // global_ign_on_count > 1 means that correct ignition off was not present. if (is_emergency_ign_off_occurred) { - LOG4CXX_WARN(logger_, - "Emergency IGN OFF occurred. Possibly after Low Voltage"); + SDL_LOG_WARN("Emergency IGN OFF occurred. Possibly after Low Voltage"); return false; } return true; @@ -1138,11 +1112,11 @@ bool ResumeCtrlImpl::CheckIgnCyclesData() const { bool ResumeCtrlImpl::CheckDelayAfterIgnOn() const { using namespace date_time; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const time_t ign_off_time = GetIgnOffTime(); if (CheckIgnCyclesData() && 0 == ign_off_time) { - LOG4CXX_DEBUG(logger_, "This is first Ignition cycle"); + SDL_LOG_DEBUG("This is first Ignition cycle"); return true; } const time_t curr_time = time(nullptr); @@ -1151,8 +1125,7 @@ bool ResumeCtrlImpl::CheckDelayAfterIgnOn() const { const uint32_t seconds_from_sdl_start = labs(curr_time - sdl_launch_time); const uint32_t wait_time = application_manager_.get_settings().resumption_delay_after_ign(); - LOG4CXX_DEBUG(logger_, - "curr_time " << curr_time << "; sdl_launch_time " + SDL_LOG_DEBUG("curr_time " << curr_time << "; sdl_launch_time " << sdl_launch_time << "; seconds_from_sdl_start " << seconds_from_sdl_start << "; wait_time " << wait_time); @@ -1169,7 +1142,7 @@ time_t ResumeCtrlImpl::GetIgnOffTime() const { bool ResumeCtrlImpl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request, bool use_events) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (use_events) { const hmi_apis::FunctionID::eType function_id = static_cast<hmi_apis::FunctionID::eType>( @@ -1181,7 +1154,7 @@ bool ResumeCtrlImpl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request, } if (!application_manager_.GetRPCService().ManageHMICommand( request, commands::Command::SOURCE_SDL_TO_HMI)) { - LOG4CXX_ERROR(logger_, "Unable to send request"); + SDL_LOG_ERROR("Unable to send request"); return false; } return true; @@ -1198,7 +1171,7 @@ void ResumeCtrlImpl::ProcessHMIRequests( } void ResumeCtrlImpl::AddToResumptionTimerQueue(const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool run_resumption = false; queue_lock_.Acquire(); waiting_for_timer_.push_back(app_id); @@ -1208,13 +1181,11 @@ void ResumeCtrlImpl::AddToResumptionTimerQueue(const uint32_t app_id) { run_resumption = true; } queue_lock_.Release(); - LOG4CXX_DEBUG(logger_, - "Application ID " << app_id + SDL_LOG_DEBUG("Application ID " << app_id << " have been added" " to resumption queue."); if (run_resumption) { - LOG4CXX_DEBUG(logger_, - "Application ID " << app_id << " will be restored by timer"); + SDL_LOG_DEBUG("Application ID " << app_id << " will be restored by timer"); restore_hmi_level_timer_.Start( application_manager_.get_settings().app_resuming_timeout(), timer::kSingleShot); @@ -1222,7 +1193,7 @@ void ResumeCtrlImpl::AddToResumptionTimerQueue(const uint32_t app_id) { } void ResumeCtrlImpl::LoadResumeData() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject so_applications_data; resumption_storage_->GetDataForLoadResumeData(so_applications_data); size_t length = so_applications_data.length(); @@ -1231,11 +1202,10 @@ void ResumeCtrlImpl::LoadResumeData() { if (IsAppDataResumptionExpired(application)) { const std::string device_id = application[strings::device_id].asString(); const std::string app_id = application[strings::app_id].asString(); - LOG4CXX_INFO(logger_, "Data resumption is expired."); - LOG4CXX_DEBUG(logger_, - "Resumption data for application " - << app_id << " and device id " << device_id - << " will be dropped."); + SDL_LOG_INFO("Data resumption is expired."); + SDL_LOG_DEBUG("Resumption data for application " + << app_id << " and device id " << device_id + << " will be dropped."); resumption_storage_->RemoveApplicationFromSaved(app_id, device_id); continue; } @@ -1244,10 +1214,9 @@ void ResumeCtrlImpl::LoadResumeData() { void ResumeCtrlImpl::OnAppRegistrationStart(const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (IsApplicationSaved(policy_app_id, device_id)) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( "Application is found in resumption " "data and will try to resume. Stopping resume data persistent timer"); StopSavePersistentDataTimer(); @@ -1255,7 +1224,7 @@ void ResumeCtrlImpl::OnAppRegistrationStart(const std::string& policy_app_id, } void ResumeCtrlImpl::OnAppRegistrationEnd() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); StartSavePersistentDataTimer(); } @@ -1282,7 +1251,7 @@ bool ResumeCtrlImpl::IsAppDataResumptionExpired( mobile_apis::HMILevel::eType ResumeCtrlImpl::GetHmiLevelOnLowBandwidthTransport( ApplicationConstSharedPtr application) const { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const ApplicationManagerSettings& settings = application_manager_.get_settings(); @@ -1301,26 +1270,23 @@ mobile_apis::HMILevel::eType ResumeCtrlImpl::GetHmiLevelOnLowBandwidthTransport( // AppHMIType, then the highest level will be applied. if (application->is_navi()) { level = ConvertHmiLevelString(level_for_navi_app); - LOG4CXX_DEBUG(logger_, - "NAVIGATION apps may have level " - << level - << " while high-bandwidth transport is not available."); + SDL_LOG_DEBUG("NAVIGATION apps may have level " + << level + << " while high-bandwidth transport is not available."); result_level = PickHigherHmiLevel(level, result_level); } if (application->mobile_projection_enabled()) { level = ConvertHmiLevelString(level_for_projection_app); - LOG4CXX_DEBUG(logger_, - "PROJECTION apps may have level " - << level - << " while high-bandwidth transport is not available."); + SDL_LOG_DEBUG("PROJECTION apps may have level " + << level + << " while high-bandwidth transport is not available."); result_level = PickHigherHmiLevel(level, result_level); } if (application->is_media_application()) { level = ConvertHmiLevelString(level_for_media_app); - LOG4CXX_DEBUG(logger_, - "media apps may have level " - << level - << " while high-bandwidth transport is not available."); + SDL_LOG_DEBUG("media apps may have level " + << level + << " while high-bandwidth transport is not available."); result_level = PickHigherHmiLevel(level, result_level); } diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc index 0312975fec..558724ecdc 100644 --- a/src/components/application_manager/src/resumption/resumption_data.cc +++ b/src/components/application_manager/src/resumption/resumption_data.cc @@ -37,7 +37,7 @@ namespace resumption { -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOG_VARIABLE("Resumption") ResumptionData::ResumptionData( const application_manager::ApplicationManager& application_manager) @@ -46,11 +46,11 @@ ResumptionData::ResumptionData( smart_objects::SmartObject ResumptionData::GetApplicationCommands( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject commands_array(smart_objects::SmartType_Array); DCHECK_OR_RETURN(application, commands_array); if (!application) { - LOG4CXX_ERROR(logger_, "NULL Pointer App"); + SDL_LOG_ERROR("NULL Pointer App"); return commands_array; } const DataAccessor<CommandsMap> accessor = application->commands_map(); @@ -65,14 +65,14 @@ smart_objects::SmartObject ResumptionData::GetApplicationCommands( smart_objects::SmartObject ResumptionData::GetApplicationSubMenus( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(application.get()); smart_objects::SmartObject submenues_array = smart_objects::SmartObject(smart_objects::SmartType_Array); if (!application) { - LOG4CXX_ERROR(logger_, "NULL Pointer App"); + SDL_LOG_ERROR("NULL Pointer App"); return submenues_array; } const DataAccessor<SubMenuMap> accessor = application->sub_menu_map(); @@ -87,13 +87,13 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubMenus( smart_objects::SmartObject ResumptionData::GetApplicationInteractionChoiseSets( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(application.get()); smart_objects::SmartObject interaction_choice_set_array = smart_objects::SmartObject(smart_objects::SmartType_Array); if (!application) { - LOG4CXX_ERROR(logger_, "NULL Pointer App"); + SDL_LOG_ERROR("NULL Pointer App"); return interaction_choice_set_array; } const DataAccessor<ChoiceSetMap> accessor = application->choice_set_map(); @@ -108,13 +108,13 @@ smart_objects::SmartObject ResumptionData::GetApplicationInteractionChoiseSets( smart_objects::SmartObject ResumptionData::GetApplicationGlobalProperties( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(application.get()); smart_objects::SmartObject global_properties = smart_objects::SmartObject(smart_objects::SmartType_Map); if (!application) { - LOG4CXX_ERROR(logger_, "NULL Pointer App"); + SDL_LOG_ERROR("NULL Pointer App"); return global_properties; } @@ -138,15 +138,15 @@ smart_objects::SmartObject ResumptionData::GetApplicationGlobalProperties( smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(application.get()); smart_objects::SmartObject subscriptions = smart_objects::SmartObject(smart_objects::SmartType_Map); if (!application) { - LOG4CXX_ERROR(logger_, "NULL Pointer App"); + SDL_LOG_ERROR("NULL Pointer App"); return subscriptions; } - LOG4CXX_DEBUG(logger_, "app_id:" << application->app_id()); + SDL_LOG_DEBUG("app_id:" << application->app_id()); { DataAccessor<ButtonSubscriptions> button_accessor = @@ -154,7 +154,7 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions( const ButtonSubscriptions& button_subscriptions = button_accessor.GetData(); - LOG4CXX_DEBUG(logger_, "SubscribedButtons:" << button_subscriptions.size()); + SDL_LOG_DEBUG("SubscribedButtons:" << button_subscriptions.size()); Append(button_subscriptions.begin(), button_subscriptions.end(), strings::application_buttons, @@ -171,14 +171,14 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions( smart_objects::SmartObject ResumptionData::GetApplicationFiles( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(application.get()); - LOG4CXX_TRACE(logger_, "ENTER app_id:" << application->app_id()); + SDL_LOG_TRACE("ENTER app_id:" << application->app_id()); smart_objects::SmartObject files = smart_objects::SmartObject(smart_objects::SmartType_Array); if (!application) { - LOG4CXX_ERROR(logger_, "NULL Pointer App"); + SDL_LOG_ERROR("NULL Pointer App"); return files; } @@ -204,7 +204,7 @@ smart_objects::SmartObject ResumptionData::GetApplicationFiles( smart_objects::SmartObject ResumptionData::GetApplicationWidgetsInfo( app_mngr::ApplicationConstSharedPtr application) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject windows_info = smart_objects::SmartObject(smart_objects::SmartType_Array); DCHECK_OR_RETURN(application, windows_info); @@ -229,7 +229,7 @@ smart_objects::SmartObject ResumptionData::CreateWindowInfoSO( const mobile_apis::WindowType::eType window_type, const app_mngr::WindowParamsMap& window_optional_params_map) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto window_info = smart_objects::SmartObject(smart_objects::SmartType_Map); window_info[strings::window_id] = window_id; @@ -249,7 +249,7 @@ smart_objects::SmartObject ResumptionData::CreateWindowInfoSO( smart_objects::SmartObject ResumptionData::PointerToSmartObj( const smart_objects::SmartObject* ptr) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject temp; if (ptr != NULL) { temp = *ptr; diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc index 9188a47bf9..799fe246ac 100644 --- a/src/components/application_manager/src/resumption/resumption_data_db.cc +++ b/src/components/application_manager/src/resumption/resumption_data_db.cc @@ -47,7 +47,7 @@ const std::string kDatabaseName = "resumption"; } namespace resumption { -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOG_VARIABLE("Resumption") ResumptionDataDB::ResumptionDataDB( DbStorage db_storage, @@ -64,8 +64,8 @@ ResumptionDataDB::ResumptionDataDB( db_ = new utils::dbms::SQLDatabase(); #endif // __QNX__ } else { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_ERROR(logger_, "Get not existed type of database storage"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_ERROR("Get not existed type of database storage"); } } @@ -75,67 +75,61 @@ ResumptionDataDB::~ResumptionDataDB() { } bool ResumptionDataDB::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); 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 = application_manager_.get_settings().attempts_to_open_resumption_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 = application_manager_.get_settings() .open_attempt_timeout_ms_resumption_db(); 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); 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 false; } } #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 false; } #endif // __QNX__ utils::dbms::SQLQuery query(db()); if (!query.Exec(kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Failed creating schema of database: " << query.LastError().text()); return false; } utils::dbms::SQLQuery query_checks_resumption(db()); if (!query_checks_resumption.Prepare(kChecksResumptionData) || !query_checks_resumption.Exec()) { - LOG4CXX_ERROR(logger_, - "Failed verification or execution query kChecksResumptionData" - << query_checks_resumption.LastError().text()); + SDL_LOG_ERROR("Failed verification or execution query kChecksResumptionData" + << query_checks_resumption.LastError().text()); return false; } if (0 == query_checks_resumption.GetInteger(0)) { utils::dbms::SQLQuery query_insert_resumption(db()); if (!query_insert_resumption.Prepare(kInsertInitData) || !query_insert_resumption.Exec()) { - LOG4CXX_ERROR(logger_, - "Failed insert init data to database: " - << query_insert_resumption.LastError().text()); + SDL_LOG_ERROR("Failed insert init data to database: " + << query_insert_resumption.LastError().text()); return false; } } @@ -147,56 +141,55 @@ void ResumptionDataDB::SaveApplication( using namespace app_mngr; using namespace mobile_api; using namespace helpers; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); bool application_exist = false; const std::string& policy_app_id = application->policy_app_id(); const std::string& device_mac = application->mac_address(); - LOG4CXX_INFO(logger_, - "app_id : " << application->app_id() << " policy_app_id : " + SDL_LOG_INFO("app_id : " << application->app_id() << " policy_app_id : " << policy_app_id << " device_id : " << device_mac); if (!CheckExistenceApplication( policy_app_id, device_mac, application_exist)) { - LOG4CXX_ERROR(logger_, "Problem with access to DB"); + SDL_LOG_ERROR("Problem with access to DB"); return; } if (application->is_application_data_changed()) { if (application_exist && !DeleteSavedApplication(policy_app_id, device_mac)) { - LOG4CXX_ERROR(logger_, "Deleting of application data is not finished"); + SDL_LOG_ERROR("Deleting of application data is not finished"); return; } if (!SaveApplicationToDB(application, policy_app_id, device_mac)) { - LOG4CXX_ERROR(logger_, "Saving of application data is not finished"); + SDL_LOG_ERROR("Saving of application data is not finished"); return; } - LOG4CXX_INFO(logger_, "All data from application were saved successfully"); + SDL_LOG_INFO("All data from application were saved successfully"); application->set_is_application_data_changed(false); } else if (application_exist) { if (!UpdateApplicationData(application, policy_app_id, device_mac)) { - LOG4CXX_ERROR(logger_, "Updating application data is failed"); + SDL_LOG_ERROR("Updating application data is failed"); return; } - LOG4CXX_INFO(logger_, "Application data were updated successfully"); + SDL_LOG_INFO("Application data were updated successfully"); } else if (!InsertApplicationData(application, policy_app_id, device_mac)) { - LOG4CXX_ERROR(logger_, "Saving data of application is failed"); + SDL_LOG_ERROR("Saving data of application is failed"); return; } WriteDb(); } bool ResumptionDataDB::IsHMIApplicationIdExist(uint32_t hmi_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return CheckExistenceHMIId(hmi_app_id); } uint32_t ResumptionDataDB::GetHMIApplicationID( const std::string& policy_app_id, const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t hmi_app_id = 0; SelectHMIId(policy_app_id, device_id, hmi_app_id); @@ -204,7 +197,7 @@ uint32_t ResumptionDataDB::GetHMIApplicationID( } void ResumptionDataDB::IncrementIgnOffCount() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query_update_suspend_data(db()); utils::dbms::SQLQuery query_update_last_ign_off_time(db()); @@ -215,45 +208,43 @@ void ResumptionDataDB::IncrementIgnOffCount() { const int application_lifes = 3; if (DeleteAppWithIgnCount(application_lifes)) { - LOG4CXX_INFO(logger_, - "Saved application with ign_off_count = " << application_lifes + SDL_LOG_INFO("Saved application with ign_off_count = " << application_lifes << " was deleted"); } else { - LOG4CXX_WARN(logger_, "Problem with removing applications"); + SDL_LOG_WARN("Problem with removing applications"); } if (query_update_suspend_data.Prepare(kUpdateSuspendData)) { if (query_update_suspend_data.Exec()) { - LOG4CXX_INFO(logger_, - "Data ign_off_count and suspend_count were updated"); + SDL_LOG_INFO("Data ign_off_count and suspend_count were updated"); } } if (query_update_last_ign_off_time.Prepare(kUpdateLastIgnOffTime)) { query_update_last_ign_off_time.Bind(0, static_cast<int64_t>(time(NULL))); if (query_update_last_ign_off_time.Exec()) { - LOG4CXX_INFO(logger_, "Data last_ign_off_time was updated"); + SDL_LOG_INFO("Data last_ign_off_time was updated"); } } } bool ResumptionDataDB::DeleteAppWithIgnCount(const int application_lifes) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery select_apps_for_removing(db()); utils::dbms::SQLQuery count_app(db()); if (!select_apps_for_removing.Prepare(kSelectApplicationsIgnOffCount) || !count_app.Prepare(kCountApplicationsIgnOff)) { - LOG4CXX_WARN(logger_, - "Problem with verification query select_apps_for_removing or" - " query count_app"); + SDL_LOG_WARN( + "Problem with verification query select_apps_for_removing or" + " query count_app"); return false; } /* Positions of binding data for "query count_app" : field "ign_off_count" from table "application" = 0*/ count_app.Bind(0, application_lifes); if (!count_app.Exec() || !count_app.GetInteger(0)) { - LOG4CXX_WARN(logger_, "Problem with execution or count app=0"); + SDL_LOG_WARN("Problem with execution or count app=0"); return false; } std::string policy_app_id; @@ -265,11 +256,11 @@ bool ResumptionDataDB::DeleteAppWithIgnCount(const int application_lifes) { device_id = select_apps_for_removing.GetString(0); policy_app_id = select_apps_for_removing.GetString(1); if (!DeleteSavedApplication(policy_app_id, device_id)) { - LOG4CXX_WARN(logger_, "Problem with removing application data"); + SDL_LOG_WARN("Problem with removing application data"); return false; } } - LOG4CXX_WARN(logger_, "Applications data were removed successfully"); + SDL_LOG_WARN("Applications data were removed successfully"); WriteDb(); return true; } @@ -277,13 +268,13 @@ bool ResumptionDataDB::DeleteAppWithIgnCount(const int application_lifes) { bool ResumptionDataDB::GetHashId(const std::string& policy_app_id, const std::string& device_id, std::string& hash_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return SelectHashId(policy_app_id, device_id, hash_id); } void ResumptionDataDB::DecrementIgnOffCount() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); UpdateDataOnAwake(); } @@ -292,65 +283,62 @@ bool ResumptionDataDB::GetSavedApplication( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool application_exist = false; if (!CheckExistenceApplication(policy_app_id, device_id, application_exist) || !application_exist) { - LOG4CXX_ERROR(logger_, - "Problem with access to DB or application does not exists"); + SDL_LOG_ERROR("Problem with access to DB or application does not exists"); return false; } if (!SelectDataFromAppTable(policy_app_id, device_id, saved_app)) { - LOG4CXX_ERROR(logger_, - "Problem with restoring of data from application table"); + SDL_LOG_ERROR("Problem with restoring of data from application table"); return false; } if (!SelectFilesData(policy_app_id, device_id, saved_app)) { - LOG4CXX_ERROR(logger_, "Problem with restoring of files data"); + SDL_LOG_ERROR("Problem with restoring of files data"); return false; } if (!SelectSubmenuData(policy_app_id, device_id, saved_app)) { - LOG4CXX_ERROR(logger_, "Problem with restoring of submenu data"); + SDL_LOG_ERROR("Problem with restoring of submenu data"); return false; } if (!SelectCommandData(policy_app_id, device_id, saved_app)) { - LOG4CXX_ERROR(logger_, "Problem with restoring of command data"); + SDL_LOG_ERROR("Problem with restoring of command data"); return false; } if (!SelectSubscriptionsData(policy_app_id, device_id, saved_app)) { - LOG4CXX_ERROR(logger_, "Problem with restoring of subscriptions data"); + SDL_LOG_ERROR("Problem with restoring of subscriptions data"); return false; } if (!SelectChoiceSetData(policy_app_id, device_id, saved_app)) { - LOG4CXX_ERROR(logger_, "Problem with restoring of choice set data"); + SDL_LOG_ERROR("Problem with restoring of choice set data"); return false; } if (!SelectGlobalPropertiesData(policy_app_id, device_id, saved_app)) { - LOG4CXX_ERROR(logger_, "Problem with restoring of global properties data"); + SDL_LOG_ERROR("Problem with restoring of global properties data"); return false; } - LOG4CXX_INFO(logger_, - "Application data were successfully fetched from data base"); + SDL_LOG_INFO("Application data were successfully fetched from data base"); return true; } bool ResumptionDataDB::RemoveApplicationFromSaved( const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool application_exist = false; if (!CheckExistenceApplication(policy_app_id, device_id, application_exist) || !application_exist) { - LOG4CXX_ERROR(logger_, - "Problem with access to DB or application does not" - " exist"); + SDL_LOG_ERROR( + "Problem with access to DB or application does not" + " exist"); return false; } bool result = false; @@ -362,42 +350,39 @@ bool ResumptionDataDB::RemoveApplicationFromSaved( } uint32_t ResumptionDataDB::GetIgnOffTime() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return SelectIgnOffTime(); } uint32_t ResumptionDataDB::GetGlobalIgnOnCounter() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); utils::dbms::SQLQuery query(db()); if (!query.Prepare(kSelectGlobalIgnOnCounter)) { - LOG4CXX_ERROR(logger_, - "Problem with prepare query : " << kSelectGlobalIgnOnCounter); + SDL_LOG_ERROR("Problem with prepare query : " << kSelectGlobalIgnOnCounter); return 1; } if (!query.Exec()) { - LOG4CXX_ERROR(logger_, - "Problem with exec query : " << kSelectGlobalIgnOnCounter); + SDL_LOG_ERROR("Problem with exec query : " << kSelectGlobalIgnOnCounter); return 1; } const auto global_ign_on_counter = query.GetUInteger(0); - LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter); + SDL_LOG_DEBUG("Global Ign On Counter = " << global_ign_on_counter); return global_ign_on_counter; } void ResumptionDataDB::IncrementGlobalIgnOnCounter() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); db_->BeginTransaction(); utils::dbms::SQLQuery query_update_global_ign_on_count(db()); if (query_update_global_ign_on_count.Prepare(kUpdateGlobalIgnOnCount)) { if (query_update_global_ign_on_count.Exec()) { - LOG4CXX_DEBUG(logger_, - "Data query_update_global_ign_on_count was updated"); + SDL_LOG_DEBUG("Data query_update_global_ign_on_count was updated"); } } db_->CommitTransaction(); @@ -405,26 +390,26 @@ void ResumptionDataDB::IncrementGlobalIgnOnCounter() { } void ResumptionDataDB::ResetGlobalIgnOnCount() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(resumption_lock_); - LOG4CXX_DEBUG(logger_, "Global IGN ON counter resetting"); + SDL_LOG_DEBUG("Global IGN ON counter resetting"); utils::dbms::SQLQuery query_update_global_ign_on_count(db()); if (query_update_global_ign_on_count.Prepare(kResetGlobalIgnOnCount)) { if (query_update_global_ign_on_count.Exec()) { - LOG4CXX_DEBUG(logger_, "Data was updated"); + SDL_LOG_DEBUG("Data was updated"); } } } ssize_t ResumptionDataDB::IsApplicationSaved( const std::string& policy_app_id, const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool application_exist = false; if (CheckExistenceApplication(policy_app_id, device_id, application_exist) && application_exist) { - LOG4CXX_INFO(logger_, "Application exists in stored data"); + SDL_LOG_INFO("Application exists in stored data"); return 0; } return -1; @@ -432,14 +417,14 @@ ssize_t ResumptionDataDB::IsApplicationSaved( void ResumptionDataDB::GetDataForLoadResumeData( smart_objects::SmartObject& saved_data) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SelectDataForLoadResumeData(saved_data); } bool ResumptionDataDB::SelectHMILevel(const std::string& policy_app_id, const std::string& device_id, int& hmi_level) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query_count(db()); utils::dbms::SQLQuery query_select(db()); if (query_count.Prepare(kSelectCountHMILevel) && @@ -463,25 +448,24 @@ bool ResumptionDataDB::SelectHMILevel(const std::string& policy_app_id, } bool ResumptionDataDB::CheckExistenceHMIId(uint32_t hmi_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (query.Prepare(kCheckHMIId)) { query.Bind(0, static_cast<int64_t>(hmi_app_id)); if (query.Exec() && (query.GetInteger(0))) { - LOG4CXX_INFO(logger_, "Saved data has HMI appID = " << hmi_app_id); + SDL_LOG_INFO("Saved data has HMI appID = " << hmi_app_id); return true; } } - LOG4CXX_FATAL(logger_, - "HMI appID = " << hmi_app_id << " doesn't exist in saved data"); + SDL_LOG_FATAL("HMI appID = " << hmi_app_id << " doesn't exist in saved data"); return false; } void ResumptionDataDB::SelectHMIId(const std::string& policy_app_id, const std::string& device_id, uint32_t& hmi_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query_select(db()); utils::dbms::SQLQuery query_check(db()); @@ -499,26 +483,26 @@ void ResumptionDataDB::SelectHMIId(const std::string& policy_app_id, if (query_check.Exec() && query_check.GetInteger(0) && query_select.Exec()) { hmi_id = query_select.GetUInteger(0); - LOG4CXX_INFO(logger_, "HMI appID = " << hmi_id); + SDL_LOG_INFO("HMI appID = " << hmi_id); return; } } - LOG4CXX_FATAL(logger_, - "Saved data doesn't have application with " - "device id = " - << device_id << " and policy appID = " << policy_app_id); + SDL_LOG_FATAL( + "Saved data doesn't have application with " + "device id = " + << device_id << " and policy appID = " << policy_app_id); } bool ResumptionDataDB::SelectHashId(const std::string& policy_app_id, const std::string& device_id, std::string& hash_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery count(db()); utils::dbms::SQLQuery select_hash(db()); if (!select_hash.Prepare(kSelectHashId) || !count.Prepare(kCountHashId)) { - LOG4CXX_WARN(logger_, - "Problem with verification count query or" - " select_hash query"); + SDL_LOG_WARN( + "Problem with verification count query or" + " select_hash query"); return false; } /* Positions of binding data for "count" and "select_hash" : @@ -532,30 +516,29 @@ bool ResumptionDataDB::SelectHashId(const std::string& policy_app_id, field "hashID" from table "application" = 0 */ if (count.Exec() && count.GetInteger(0) && select_hash.Exec()) { hash_id = select_hash.GetString(0); - LOG4CXX_INFO(logger_, "Saved hash ID = " << hash_id); + SDL_LOG_INFO("Saved hash ID = " << hash_id); return true; } - LOG4CXX_WARN(logger_, - "Saved data doesn't have application with " - "device id = " - << device_id << " and policy appID = " << policy_app_id - << "or hashID"); + SDL_LOG_WARN( + "Saved data doesn't have application with " + "device id = " + << device_id << " and policy appID = " << policy_app_id << "or hashID"); return false; } uint32_t ResumptionDataDB::SelectIgnOffTime() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t ignOffTime = 0; utils::dbms::SQLQuery query(db()); if (query.Prepare(kSelectIgnOffTime)) { if (query.Exec()) { ignOffTime = query.GetUInteger(0); - LOG4CXX_INFO(logger_, "Last ign off time = " << ignOffTime); + SDL_LOG_INFO("Last ign off time = " << ignOffTime); return ignOffTime; } } - LOG4CXX_ERROR(logger_, "Problem with prepare query"); + SDL_LOG_ERROR("Problem with prepare query"); return ignOffTime; } @@ -563,7 +546,7 @@ bool ResumptionDataDB::CheckExistenceApplication( const std::string& policy_app_id, const std::string& device_id, bool& application_exist) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool result = false; utils::dbms::SQLQuery query(db()); /* Positions of binding data for "query": @@ -577,15 +560,14 @@ bool ResumptionDataDB::CheckExistenceApplication( /* Position of data in "query" : amount of application = 0 */ if (result && query.GetInteger(0)) { - LOG4CXX_INFO(logger_, - "Saved data has application with policy appID = " - << policy_app_id << " and deviceID = " << device_id); + SDL_LOG_INFO("Saved data has application with policy appID = " + << policy_app_id << " and deviceID = " << device_id); application_exist = true; } else if (result) { - LOG4CXX_INFO(logger_, "Saved data does not contain application"); + SDL_LOG_INFO("Saved data does not contain application"); application_exist = false; } else { - LOG4CXX_ERROR(logger_, "Problem with access DB"); + SDL_LOG_ERROR("Problem with access DB"); } return result; } @@ -594,21 +576,21 @@ void ResumptionDataDB::SelectDataForLoadResumeData( smart_objects::SmartObject& saved_data) const { using namespace app_mngr; using namespace smart_objects; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery select_data(db()); utils::dbms::SQLQuery count_application(db()); if (!select_data.Prepare(kSelectDataForLoadResumeData) || !count_application.Prepare(kCountApplications)) { - LOG4CXX_WARN(logger_, - "Problem with verification select_data query" - " or count application"); + SDL_LOG_WARN( + "Problem with verification select_data query" + " or count application"); return; } if (!count_application.Exec() || !count_application.GetInteger(0)) { - LOG4CXX_WARN(logger_, - "Problem with execution count_application query" - " or appliction table does not contain data"); + SDL_LOG_WARN( + "Problem with execution count_application query" + " or appliction table does not contain data"); return; } SmartObject so_array_data(SmartType_Array); @@ -634,7 +616,7 @@ void ResumptionDataDB::SelectDataForLoadResumeData( void ResumptionDataDB::UpdateHmiLevel(const std::string& policy_app_id, const std::string& device_id, mobile_apis::HMILevel::eType hmi_level) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); /* Positions of binding data for "query": @@ -646,10 +628,9 @@ void ResumptionDataDB::UpdateHmiLevel(const std::string& policy_app_id, query.Bind(1, device_id); query.Bind(2, policy_app_id); if (query.Exec()) { - LOG4CXX_INFO(logger_, - "Saved data has application with policy appID = " - << policy_app_id << " and deviceID = " << device_id - << " has new HMI level = " << hmi_level); + SDL_LOG_INFO("Saved data has application with policy appID = " + << policy_app_id << " and deviceID = " << device_id + << " has new HMI level = " << hmi_level); WriteDb(); } } @@ -662,19 +643,16 @@ void ResumptionDataDB::Persist() { bool ResumptionDataDB::RefreshDB() const { utils::dbms::SQLQuery query(db()); if (!query.Exec(resumption::kDropSchema)) { - LOG4CXX_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_LOG_WARN("Failed dropping database: " << query.LastError().text()); return false; } if (!query.Exec(resumption::kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Failed creating schema of database: " << query.LastError().text()); return false; } if (!query.Exec(resumption::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -682,10 +660,10 @@ bool ResumptionDataDB::RefreshDB() const { } bool ResumptionDataDB::GetAllData(smart_objects::SmartObject& data) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(resumption::kSelectAllApps)) { - LOG4CXX_ERROR(logger_, "Can't get applications data from DB."); + SDL_LOG_ERROR("Can't get applications data from DB."); return false; } @@ -705,9 +683,9 @@ bool ResumptionDataDB::GetAllData(smart_objects::SmartObject& data) const { } bool ResumptionDataDB::SaveAllData(const smart_objects::SmartObject& data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (smart_objects::SmartType_Array != data.getType()) { - LOG4CXX_ERROR(logger_, "Unexpected type for resumption data."); + SDL_LOG_ERROR("Unexpected type for resumption data."); return false; } const smart_objects::SmartArray* apps = data.asArray(); @@ -723,18 +701,16 @@ bool ResumptionDataDB::SaveAllData(const smart_objects::SmartObject& data) { } bool ResumptionDataDB::IsDBVersionActual() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(resumption::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); @@ -742,11 +718,10 @@ bool ResumptionDataDB::IsDBVersionActual() const { } bool ResumptionDataDB::UpdateDBVersion() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(resumption::kUpdateDBVersion)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Incorrect DB version update query: " << query.LastError().text()); return false; } @@ -754,8 +729,7 @@ bool ResumptionDataDB::UpdateDBVersion() const { query.Bind(0, GetDBVersion()); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, - "DB version update failed: " << query.LastError().text()); + SDL_LOG_ERROR("DB version update failed: " << query.LastError().text()); return false; } @@ -764,7 +738,7 @@ bool ResumptionDataDB::UpdateDBVersion() const { bool ResumptionDataDB::DropAppDataResumption(const std::string& device_id, const std::string& app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::ScopeGuard guard = utils::MakeObjGuard(*db_, &utils::dbms::SQLDatabase::RollbackTransaction); @@ -805,7 +779,7 @@ bool ResumptionDataDB::SelectFilesData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -817,13 +791,13 @@ bool ResumptionDataDB::SelectFilesData( saved_app[strings::application_files] = SmartObject(SmartType_Array); if (0 == count_item) { - LOG4CXX_INFO(logger_, "Application does not contain files data"); + SDL_LOG_INFO("Application does not contain files data"); return true; } utils::dbms::SQLQuery select_files(db()); if (!PrepareSelectQuery( select_files, policy_app_id, device_id, kSelectFiles)) { - LOG4CXX_WARN(logger_, "Problem with verification select_files"); + SDL_LOG_WARN("Problem with verification select_files"); return false; } saved_app[strings::application_files] = SmartObject(SmartType_Array); @@ -841,7 +815,7 @@ bool ResumptionDataDB::SelectFilesData( array_item[strings::sync_file_name] = select_files.GetString(3); saved_app[strings::application_files][i++] = array_item; } - LOG4CXX_INFO(logger_, "File data was restored successfully"); + SDL_LOG_INFO("File data was restored successfully"); return true; } @@ -849,7 +823,7 @@ bool ResumptionDataDB::SelectSubmenuData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -861,13 +835,13 @@ bool ResumptionDataDB::SelectSubmenuData( saved_app[strings::application_submenus] = SmartObject(SmartType_Array); if (0 == count_item) { - LOG4CXX_INFO(logger_, "Application does not contain submenu data"); + SDL_LOG_INFO("Application does not contain submenu data"); return true; } utils::dbms::SQLQuery select_sub_menu(db()); if (!PrepareSelectQuery( select_sub_menu, policy_app_id, device_id, kSelectSubMenu)) { - LOG4CXX_WARN(logger_, "Problem with verification select_sub_menu"); + SDL_LOG_WARN("Problem with verification select_sub_menu"); return false; } saved_app[strings::application_submenus] = SmartObject(SmartType_Array); @@ -885,7 +859,7 @@ bool ResumptionDataDB::SelectSubmenuData( } saved_app[strings::application_submenus][i++] = array_item; } - LOG4CXX_INFO(logger_, "Sub menu data was restored successfully"); + SDL_LOG_INFO("Sub menu data was restored successfully"); return true; } @@ -893,7 +867,7 @@ bool ResumptionDataDB::SelectCommandData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -905,7 +879,7 @@ bool ResumptionDataDB::SelectCommandData( saved_app[strings::application_commands] = SmartObject(SmartType_Array); if (0 == count_item) { - LOG4CXX_INFO(logger_, "Application does not contain commands data"); + SDL_LOG_INFO("Application does not contain commands data"); return true; } @@ -973,7 +947,7 @@ bool ResumptionDataDB::SelectCommandData( select_commands.GetString(7); } } - LOG4CXX_INFO(logger_, "Commands were restored from DB successfully"); + SDL_LOG_INFO("Commands were restored from DB successfully"); return true; } @@ -981,7 +955,7 @@ bool ResumptionDataDB::SelectSubscriptionsData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -993,7 +967,7 @@ bool ResumptionDataDB::SelectSubscriptionsData( saved_app[strings::application_subscriptions] = SmartObject(SmartType_Map); if (0 == count_item) { - LOG4CXX_INFO(logger_, "Application does not contain subscriptions data"); + SDL_LOG_INFO("Application does not contain subscriptions data"); return true; } utils::dbms::SQLQuery select_subscriptions(db()); @@ -1001,7 +975,7 @@ bool ResumptionDataDB::SelectSubscriptionsData( policy_app_id, device_id, kSelectSubscriptions)) { - LOG4CXX_WARN(logger_, "Problem with verification select_subscriptions"); + SDL_LOG_WARN("Problem with verification select_subscriptions"); return false; } SmartObject application_buttons(SmartType_Array); @@ -1028,7 +1002,7 @@ bool ResumptionDataDB::SelectSubscriptionsData( saved_app[strings::application_subscriptions] [strings::application_vehicle_info] = application_vehicle_info; } - LOG4CXX_INFO(logger_, "Subscriptions were restored from DB successfully"); + SDL_LOG_INFO("Subscriptions were restored from DB successfully"); return true; } @@ -1036,7 +1010,7 @@ bool ResumptionDataDB::SelectChoiceSetData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -1048,13 +1022,13 @@ bool ResumptionDataDB::SelectChoiceSetData( saved_app[strings::application_choice_sets] = SmartObject(SmartType_Array); if (0 == count_item) { - LOG4CXX_INFO(logger_, "Application does not contain choice set data"); + SDL_LOG_INFO("Application does not contain choice set data"); return true; } utils::dbms::SQLQuery select_choice_set(db()); if (!PrepareSelectQuery( select_choice_set, policy_app_id, device_id, kSelectChoiceSets)) { - LOG4CXX_WARN(logger_, "Problem with verification select_choice_set"); + SDL_LOG_WARN("Problem with verification select_choice_set"); return false; } @@ -1130,7 +1104,7 @@ bool ResumptionDataDB::SelectChoiceSetData( [vr_cmd_idx++] = select_choice_set.GetString(10); } - LOG4CXX_INFO(logger_, "Choice sets were restored from DB successfully"); + SDL_LOG_INFO("Choice sets were restored from DB successfully"); return true; } @@ -1138,7 +1112,7 @@ bool ResumptionDataDB::SelectGlobalPropertiesData( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; uint32_t count_item = 0; @@ -1151,8 +1125,7 @@ bool ResumptionDataDB::SelectGlobalPropertiesData( SmartObject(SmartType_Map); if (0 == count_item) { - LOG4CXX_INFO(logger_, - "Application does not contain global properties data"); + SDL_LOG_INFO("Application does not contain global properties data"); return true; } utils::dbms::SQLQuery select_globalproperties(db()); @@ -1160,7 +1133,7 @@ bool ResumptionDataDB::SelectGlobalPropertiesData( policy_app_id, device_id, kSelectGlobalProperties)) { - LOG4CXX_WARN(logger_, "Problem with verification select_globalproperties"); + SDL_LOG_WARN("Problem with verification select_globalproperties"); return false; } saved_app[strings::application_global_properties] = @@ -1259,26 +1232,26 @@ bool ResumptionDataDB::SelectGlobalPropertiesData( bool ResumptionDataDB::SelectVrHelpItemsData( int64_t global_properties_key, smart_objects::SmartObject& global_properties) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; utils::dbms::SQLQuery checks_vrhelp_item(db()); if (!checks_vrhelp_item.Prepare(kChecksVrHelpItem)) { - LOG4CXX_WARN(logger_, "Problem with verification checks_vrhelp_item query"); + SDL_LOG_WARN("Problem with verification checks_vrhelp_item query"); return false; } checks_vrhelp_item.Bind(0, global_properties_key); if (!checks_vrhelp_item.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution checks_vrhelp_item query"); + SDL_LOG_WARN("Problem with execution checks_vrhelp_item query"); return false; } if (0 == checks_vrhelp_item.GetInteger(0)) { - LOG4CXX_INFO(logger_, "Global properties doesn't contain vr help item"); + SDL_LOG_INFO("Global properties doesn't contain vr help item"); return true; } utils::dbms::SQLQuery select_vrhelp_item(db()); if (!select_vrhelp_item.Prepare(kSelectVrHelpItem)) { - LOG4CXX_WARN(logger_, "Problem with verification select_vrhelp_item query"); + SDL_LOG_WARN("Problem with verification select_vrhelp_item query"); return false; } global_properties[strings::vr_help] = SmartObject(SmartType_Array); @@ -1302,35 +1275,34 @@ bool ResumptionDataDB::SelectVrHelpItemsData( } vr_help_items[vr_help_item_idx++] = item; } - LOG4CXX_INFO(logger_, "VR Help items were restored successfully"); + SDL_LOG_INFO("VR Help items were restored successfully"); return true; } bool ResumptionDataDB::SelectCharactersData( int64_t global_properties_key, smart_objects::SmartObject& keyboard_properties) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; utils::dbms::SQLQuery checks_characters(db()); if (!checks_characters.Prepare(kChecksCharacter)) { - LOG4CXX_WARN(logger_, "Problem with verification checks_characters query"); + SDL_LOG_WARN("Problem with verification checks_characters query"); return false; } checks_characters.Bind(0, global_properties_key); if (!checks_characters.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution checks_characters query"); + SDL_LOG_WARN("Problem with execution checks_characters query"); return false; } if (0 == checks_characters.GetInteger(0)) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( "Keyboard properties doesn't contain table limited character list"); return true; } utils::dbms::SQLQuery select_characters(db()); if (!select_characters.Prepare(kSelectCharacter)) { - LOG4CXX_WARN(logger_, "Problem with verification select_characters query"); + SDL_LOG_WARN("Problem with verification select_characters query"); return false; } @@ -1350,17 +1322,17 @@ bool ResumptionDataDB::SelectCharactersData( bool ResumptionDataDB::SelectImageData( int64_t image_key, smart_objects::SmartObject& image) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery select_image(db()); if (!select_image.Prepare(kSelectImage)) { - LOG4CXX_WARN(logger_, "Problem with verification select_image query"); + SDL_LOG_WARN("Problem with verification select_image query"); return false; } select_image.Bind(0, image_key); if (!select_image.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution select_image query"); + SDL_LOG_WARN("Problem with execution select_image query"); return false; } /* Position of data in "select_image" : @@ -1373,17 +1345,17 @@ bool ResumptionDataDB::SelectImageData( bool ResumptionDataDB::SelectTTSChunkData( int64_t tts_chunk_key, smart_objects::SmartObject& tts_chunk) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery select_tts_chunk(db()); if (!select_tts_chunk.Prepare(kSelectTTSChunk)) { - LOG4CXX_WARN(logger_, "Problem with verification select_tts_chunk query"); + SDL_LOG_WARN("Problem with verification select_tts_chunk query"); return false; } select_tts_chunk.Bind(0, tts_chunk_key); if (!select_tts_chunk.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution select_tts_chunk query"); + SDL_LOG_WARN("Problem with execution select_tts_chunk query"); return false; } /* Position of data in "select_tts_chunk" : @@ -1398,17 +1370,17 @@ bool ResumptionDataDB::SelectDataFromAppTable( const std::string& policy_app_id, const std::string& device_id, smart_objects::SmartObject& saved_app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery query(db()); if (!query.Prepare(kSelectAppTable)) { - LOG4CXX_WARN(logger_, "Problem with verification kSelectAppTable query"); + SDL_LOG_WARN("Problem with verification kSelectAppTable query"); return false; } query.Bind(0, policy_app_id); query.Bind(1, device_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution kSelectAppTable query"); + SDL_LOG_WARN("Problem with execution kSelectAppTable query"); return false; } @@ -1441,8 +1413,7 @@ bool ResumptionDataDB::SelectDataFromAppTable( saved_app[strings::is_media_application] = query.GetBoolean(9); saved_app[strings::subscribed_for_way_points] = query.GetBoolean(10); - LOG4CXX_INFO(logger_, - "Data from application table was restored successfully"); + SDL_LOG_INFO("Data from application table was restored successfully"); return true; } @@ -1451,26 +1422,26 @@ bool ResumptionDataDB::SelectCountFromArray( const std::string& text_query, const std::string& policy_app_id, const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(text_query)) { - LOG4CXX_WARN(logger_, "Problem with verification query"); + SDL_LOG_WARN("Problem with verification query"); return false; } query.Bind(0, policy_app_id); query.Bind(1, device_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution query"); + SDL_LOG_WARN("Problem with execution query"); return false; } count_item = query.GetInteger(0); - LOG4CXX_INFO(logger_, "count_item=" << count_item); + SDL_LOG_INFO("count_item=" << count_item); return true; } bool ResumptionDataDB::DeleteSavedApplication(const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::ScopeGuard guard = utils::MakeObjGuard(*db_, &utils::dbms::SQLDatabase::RollbackTransaction); @@ -1505,15 +1476,15 @@ bool ResumptionDataDB::DeleteSavedApplication(const std::string& policy_app_id, bool ResumptionDataDB::DeleteSavedFiles(const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteFile)) { - LOG4CXX_WARN(logger_, "Incorrect delete from file."); + SDL_LOG_WARN("Incorrect delete from file."); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationFilesArray)) { - LOG4CXX_WARN(logger_, "Incorrect delete from applicationFilesArray."); + SDL_LOG_WARN("Incorrect delete from applicationFilesArray."); return false; } return true; @@ -1521,16 +1492,16 @@ bool ResumptionDataDB::DeleteSavedFiles(const std::string& policy_app_id, bool ResumptionDataDB::DeleteSavedSubMenu(const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteSubMenu)) { - LOG4CXX_WARN(logger_, "Incorrect delete from subMenu."); + SDL_LOG_WARN("Incorrect delete from subMenu."); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationSubMenuArray)) { - LOG4CXX_WARN(logger_, "Incorrect delete from applicationSubMenuArray."); + SDL_LOG_WARN("Incorrect delete from applicationSubMenuArray."); return false; } return true; @@ -1538,12 +1509,11 @@ bool ResumptionDataDB::DeleteSavedSubMenu(const std::string& policy_app_id, bool ResumptionDataDB::DeleteSavedSubscriptions( const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationSubscriptionsArray)) { - LOG4CXX_WARN(logger_, - "Incorrect delete from applicationSubscriptionsArray."); + SDL_LOG_WARN("Incorrect delete from applicationSubscriptionsArray."); return false; } return true; @@ -1551,27 +1521,27 @@ bool ResumptionDataDB::DeleteSavedSubscriptions( bool ResumptionDataDB::DeleteSavedCommands(const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteImageFromCommands)) { - LOG4CXX_WARN(logger_, "Incorrect delete image from commands."); + SDL_LOG_WARN("Incorrect delete image from commands."); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteVrCommands)) { - LOG4CXX_WARN(logger_, "Incorrect delete vrcommands from commands."); + SDL_LOG_WARN("Incorrect delete vrcommands from commands."); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteCommands)) { - LOG4CXX_WARN(logger_, "Incorrect delete commands."); + SDL_LOG_WARN("Incorrect delete commands."); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationCommandsArray)) { - LOG4CXX_WARN(logger_, "Incorrect delete applicationCommandsArray."); + SDL_LOG_WARN("Incorrect delete applicationCommandsArray."); return false; } @@ -1580,39 +1550,39 @@ bool ResumptionDataDB::DeleteSavedCommands(const std::string& policy_app_id, bool ResumptionDataDB::DeleteSavedChoiceSet(const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ExecUnionQueryToDeleteData( policy_app_id, device_id, kDeleteImageFromChoiceSet)) { - LOG4CXX_WARN(logger_, "Incorrect delete image from choice set"); + SDL_LOG_WARN("Incorrect delete image from choice set"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteVrCommandsFromChoiceSet)) { - LOG4CXX_WARN(logger_, "Incorrect delete vrCommands from choice set"); + SDL_LOG_WARN("Incorrect delete vrCommands from choice set"); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteChoice)) { - LOG4CXX_WARN(logger_, "Incorrect delete choiceSet"); + SDL_LOG_WARN("Incorrect delete choiceSet"); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteChoiceArray)) { - LOG4CXX_WARN(logger_, "Incorrect delete from choiceArray"); + SDL_LOG_WARN("Incorrect delete from choiceArray"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationChoiceSet)) { - LOG4CXX_WARN(logger_, "Incorrect delete applicationChoiceSet"); + SDL_LOG_WARN("Incorrect delete applicationChoiceSet"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteApplicationChoiceSetArray)) { - LOG4CXX_WARN(logger_, "Incorrect delete from ApplicationChoiceSetArray"); + SDL_LOG_WARN("Incorrect delete from ApplicationChoiceSetArray"); return false; } @@ -1621,50 +1591,50 @@ bool ResumptionDataDB::DeleteSavedChoiceSet(const std::string& policy_app_id, bool ResumptionDataDB::DeleteSavedGlobalProperties( const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ExecUnionQueryToDeleteData( policy_app_id, device_id, kDeleteImageFromGlobalProperties)) { - LOG4CXX_WARN(logger_, "Incorrect delete image from globalProperties"); + SDL_LOG_WARN("Incorrect delete image from globalProperties"); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeletevrHelpItem)) { - LOG4CXX_WARN(logger_, "Incorrect delete vrHelpItem"); + SDL_LOG_WARN("Incorrect delete vrHelpItem"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeletevrHelpItemArray)) { - LOG4CXX_WARN(logger_, "Incorrect delete vrHelpItemArray"); + SDL_LOG_WARN("Incorrect delete vrHelpItemArray"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteTableLimitedCharacterList)) { - LOG4CXX_WARN(logger_, "Incorrect delete from tableLimitedCharacterList"); + SDL_LOG_WARN("Incorrect delete from tableLimitedCharacterList"); return false; } if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteCharacterArray)) { - LOG4CXX_WARN(logger_, "Incorrect delete from characterArray"); + SDL_LOG_WARN("Incorrect delete from characterArray"); return false; } if (!ExecUnionQueryToDeleteData(policy_app_id, device_id, kDeleteTTSChunk)) { - LOG4CXX_WARN(logger_, "Incorrect delete from TTSChunk"); + SDL_LOG_WARN("Incorrect delete from TTSChunk"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteHelpTimeoutPromptArray)) { - LOG4CXX_WARN(logger_, "Incorrect delete from HelpTimeoutPromptArray"); + SDL_LOG_WARN("Incorrect delete from HelpTimeoutPromptArray"); return false; } if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteGlobalProperties)) { - LOG4CXX_WARN(logger_, "Incorrect delete from GlobalProperties"); + SDL_LOG_WARN("Incorrect delete from GlobalProperties"); return false; } @@ -1673,11 +1643,11 @@ bool ResumptionDataDB::DeleteSavedGlobalProperties( bool ResumptionDataDB::DeleteDataFromApplicationTable( const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ExecQueryToDeleteData( policy_app_id, device_id, kDeleteFromApplicationTable)) { - LOG4CXX_WARN(logger_, "Incorrect delete data from application table"); + SDL_LOG_WARN("Incorrect delete data from application table"); return false; } @@ -1687,7 +1657,7 @@ bool ResumptionDataDB::DeleteDataFromApplicationTable( bool ResumptionDataDB::ExecQueryToDeleteData(const std::string& policy_app_id, const std::string& device_id, const std::string& text_query) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); bool result = query.Prepare(text_query); if (result) { @@ -1702,7 +1672,7 @@ bool ResumptionDataDB::ExecUnionQueryToDeleteData( const std::string& policy_app_id, const std::string& device_id, const std::string& text_query) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); bool result = query.Prepare(text_query); if (result) { @@ -1717,7 +1687,7 @@ bool ResumptionDataDB::ExecUnionQueryToDeleteData( bool ResumptionDataDB::ExecInsertImage( int64_t& image_primary_key, const smart_objects::SmartObject& image) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery count_image_query(db()); utils::dbms::SQLQuery query(db()); @@ -1731,8 +1701,7 @@ bool ResumptionDataDB::ExecInsertImage( } } if (!result) { - LOG4CXX_WARN(logger_, - "Problem with preparing or execution count_image_query."); + SDL_LOG_WARN("Problem with preparing or execution count_image_query."); return false; } if (count_image) { @@ -1745,9 +1714,9 @@ bool ResumptionDataDB::ExecInsertImage( } } if (!result) { - LOG4CXX_WARN(logger_, - "Problem with preparing or execution " - "query for select primary key of image"); + SDL_LOG_WARN( + "Problem with preparing or execution " + "query for select primary key of image"); } } else { result = query.Prepare(kInsertImage); @@ -1760,9 +1729,9 @@ bool ResumptionDataDB::ExecInsertImage( } } if (!result) { - LOG4CXX_WARN(logger_, - "Problem with preparing or execution " - "query for insert image to image table"); + SDL_LOG_WARN( + "Problem with preparing or execution " + "query for insert image to image table"); } } return result; @@ -1771,12 +1740,12 @@ bool ResumptionDataDB::ExecInsertImage( bool ResumptionDataDB::ExecInsertChoice( int64_t choice_set_key, const smart_objects::SmartObject& choice_array) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery insert_choice(db()); if (!insert_choice.Prepare(kInsertChoice)) { - LOG4CXX_WARN(logger_, "Incorrect preparation insert_choice query"); + SDL_LOG_WARN("Incorrect preparation insert_choice query"); return false; } /* Positions of binding data for "insert_choice": @@ -1799,7 +1768,7 @@ bool ResumptionDataDB::ExecInsertChoice( if (choice_array[i].keyExists(strings::image)) { if (!ExecInsertImage(image_primary_key, choice_array[i][strings::image])) { - LOG4CXX_WARN(logger_, "Problem with insert image to choice"); + SDL_LOG_WARN("Problem with insert image to choice"); return false; } insert_choice.Bind(4, image_primary_key); @@ -1809,7 +1778,7 @@ bool ResumptionDataDB::ExecInsertChoice( if (choice_array[i].keyExists(strings::secondary_image)) { if (!ExecInsertImage(image_primary_key, choice_array[i][strings::secondary_image])) { - LOG4CXX_WARN(logger_, "Problem with insert secondary_image to choice"); + SDL_LOG_WARN("Problem with insert secondary_image to choice"); return false; } insert_choice.Bind(5, image_primary_key); @@ -1817,7 +1786,7 @@ bool ResumptionDataDB::ExecInsertChoice( insert_choice.Bind(5); } if (!insert_choice.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution insert_choice query"); + SDL_LOG_WARN("Problem with execution insert_choice query"); return false; } choice_primary_key = insert_choice.LastInsertId(); @@ -1826,17 +1795,17 @@ bool ResumptionDataDB::ExecInsertChoice( choice_array[i][strings::vr_commands], kVRCommandFromChoice)) || !insert_choice.Reset()) { - LOG4CXX_WARN(logger_, "problemm with add vr commands to choice"); + SDL_LOG_WARN("problemm with add vr commands to choice"); return false; } if (!ExecInsertDataToArray( choice_set_key, choice_primary_key, kInsertChoiceArray)) { - LOG4CXX_INFO(logger_, "Problem with insertion data to choiceArray table"); + SDL_LOG_INFO("Problem with insertion data to choiceArray table"); return false; } } - LOG4CXX_INFO(logger_, "Choice data were saved to DB successfully"); + SDL_LOG_INFO("Choice data were saved to DB successfully"); return true; } @@ -1844,11 +1813,11 @@ bool ResumptionDataDB::ExecInsertVrCommands( const int64_t primary_key, const smart_objects::SmartObject& vr_commands_array, AccessoryVRCommand value) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery insert_vr_command(db()); if (!insert_vr_command.Prepare(kInsertVrCommand)) { - LOG4CXX_WARN(logger_, "Incorrect preparation insert_vr_command query"); + SDL_LOG_WARN("Incorrect preparation insert_vr_command query"); return false; } size_t length_vr_commands = vr_commands_array.length(); @@ -1867,11 +1836,11 @@ bool ResumptionDataDB::ExecInsertVrCommands( insert_vr_command.Bind(2, primary_key); } if (!insert_vr_command.Exec() || !insert_vr_command.Reset()) { - LOG4CXX_WARN(logger_, "Problem with insert vr_command to DB"); + SDL_LOG_WARN("Problem with insert vr_command to DB"); return false; } } - LOG4CXX_INFO(logger_, "Insertion of Vr command were executed successfully"); + SDL_LOG_INFO("Insertion of Vr command were executed successfully"); return true; } @@ -1879,7 +1848,7 @@ bool ResumptionDataDB::ExecInsertDataToArray( int64_t first_primary_key, int64_t second_primary_key, const std::string& text_query) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool result; utils::dbms::SQLQuery query_insert_array(db()); result = query_insert_array.Prepare(text_query); @@ -1895,13 +1864,13 @@ bool ResumptionDataDB::SaveApplicationToDB( app_mngr::ApplicationSharedPtr application, const std::string& policy_app_id, const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); int64_t application_primary_key = 0; int64_t global_properties_key = 0; db_->BeginTransaction(); if (!InsertGlobalPropertiesData(GetApplicationGlobalProperties(application), global_properties_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert globalProperties data to DB."); + SDL_LOG_WARN("Incorrect insert globalProperties data to DB."); db_->RollbackTransaction(); return false; } @@ -1911,38 +1880,38 @@ bool ResumptionDataDB::SaveApplicationToDB( device_id, &application_primary_key, global_properties_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert application data to DB."); + SDL_LOG_WARN("Incorrect insert application data to DB."); db_->RollbackTransaction(); return false; } if (!InsertFilesData(GetApplicationFiles(application), application_primary_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert file data to DB."); + SDL_LOG_WARN("Incorrect insert file data to DB."); db_->RollbackTransaction(); return false; } if (!InsertSubMenuData(GetApplicationSubMenus(application), application_primary_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert submenu data to DB."); + SDL_LOG_WARN("Incorrect insert submenu data to DB."); db_->RollbackTransaction(); return false; } if (!InsertCommandsData(GetApplicationCommands(application), application_primary_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert commands data to DB."); + SDL_LOG_WARN("Incorrect insert commands data to DB."); db_->RollbackTransaction(); return false; } if (!InsertSubscriptionsData(GetApplicationSubscriptions(application), application_primary_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert subscriptions data to DB."); + SDL_LOG_WARN("Incorrect insert subscriptions data to DB."); db_->RollbackTransaction(); return false; } if (!InsertChoiceSetData(GetApplicationInteractionChoiseSets(application), application_primary_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert choiceset data to DB."); + SDL_LOG_WARN("Incorrect insert choiceset data to DB."); db_->RollbackTransaction(); return false; } @@ -1954,14 +1923,14 @@ bool ResumptionDataDB::SaveApplicationToDB( const smart_objects::SmartObject& application, const std::string& policy_app_id, const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); int64_t application_primary_key = 0; int64_t global_properties_key = 0; db_->BeginTransaction(); if (!InsertGlobalPropertiesData(application["globalProperties"], global_properties_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert globalProperties data to DB."); + SDL_LOG_WARN("Incorrect insert globalProperties data to DB."); db_->RollbackTransaction(); return false; } @@ -1970,38 +1939,38 @@ bool ResumptionDataDB::SaveApplicationToDB( device_id, &application_primary_key, global_properties_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert application data to DB."); + SDL_LOG_WARN("Incorrect insert application data to DB."); db_->RollbackTransaction(); return false; } if (!InsertFilesData(application["applicationFiles"], application_primary_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert file data to DB."); + SDL_LOG_WARN("Incorrect insert file data to DB."); db_->RollbackTransaction(); return false; } if (!InsertSubMenuData(application["applicationSubMenus"], application_primary_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert submenu data to DB."); + SDL_LOG_WARN("Incorrect insert submenu data to DB."); db_->RollbackTransaction(); return false; } if (!InsertCommandsData(application["applicationCommands"], application_primary_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert commands data to DB."); + SDL_LOG_WARN("Incorrect insert commands data to DB."); db_->RollbackTransaction(); return false; } if (!InsertSubscriptionsData(application["subscriptions"], application_primary_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert subscriptions data to DB."); + SDL_LOG_WARN("Incorrect insert subscriptions data to DB."); db_->RollbackTransaction(); return false; } if (!InsertChoiceSetData(application["applicationChoiceSets"], application_primary_key)) { - LOG4CXX_WARN(logger_, "Incorrect insert choiceset data to DB."); + SDL_LOG_WARN("Incorrect insert choiceset data to DB."); db_->RollbackTransaction(); return false; } @@ -2011,20 +1980,19 @@ bool ResumptionDataDB::SaveApplicationToDB( bool ResumptionDataDB::InsertFilesData(const smart_objects::SmartObject& files, int64_t application_primary_key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; const size_t length_files_array = files.length(); if (0 == length_files_array) { - LOG4CXX_INFO(logger_, "Application doesn't contain files"); + SDL_LOG_INFO("Application doesn't contain files"); return true; } utils::dbms::SQLQuery query_insert_file(db()); if (!query_insert_file.Prepare(kInsertToFile)) { - LOG4CXX_WARN(logger_, - "Problem with verification queries for insertion files"); + SDL_LOG_WARN("Problem with verification queries for insertion files"); return false; } /* Positions of binding data for "query_insert_file": @@ -2040,7 +2008,7 @@ bool ResumptionDataDB::InsertFilesData(const smart_objects::SmartObject& files, query_insert_file.Bind(3, (files[i][strings::sync_file_name]).asString()); if (!query_insert_file.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insertion of files data"); + SDL_LOG_WARN("Incorrect insertion of files data"); return false; } @@ -2048,31 +2016,30 @@ bool ResumptionDataDB::InsertFilesData(const smart_objects::SmartObject& files, query_insert_file.LastInsertId(), kInsertToApplicationFilesArray)) || !query_insert_file.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insertion to application files array"); + SDL_LOG_WARN("Incorrect insertion to application files array"); return false; } } - LOG4CXX_INFO(logger_, "Files data were inserted successfully to DB"); + SDL_LOG_INFO("Files data were inserted successfully to DB"); return true; } bool ResumptionDataDB::InsertSubMenuData( const smart_objects::SmartObject& submenus, int64_t application_primary_key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; const size_t length_submenu_array = submenus.length(); if (0 == length_submenu_array) { - LOG4CXX_INFO(logger_, "Application doesn't contain submenu"); + SDL_LOG_INFO("Application doesn't contain submenu"); return true; } utils::dbms::SQLQuery query_insert_submenu(db()); if (!query_insert_submenu.Prepare(kInsertToSubMenu)) { - LOG4CXX_WARN(logger_, - "Problem with verification queries for insertion submenu"); + SDL_LOG_WARN("Problem with verification queries for insertion submenu"); return false; } /* Positions of binding data for "query_insert_submenu": @@ -2085,7 +2052,7 @@ bool ResumptionDataDB::InsertSubMenuData( CustomBind(strings::position, submenus[i], query_insert_submenu, 2); if (!query_insert_submenu.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insertion of submenu data"); + SDL_LOG_WARN("Incorrect insertion of submenu data"); return false; } @@ -2093,24 +2060,24 @@ bool ResumptionDataDB::InsertSubMenuData( query_insert_submenu.LastInsertId(), kInsertToApplicationSubMenuArray)) || !query_insert_submenu.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insertion to application submenu array"); + SDL_LOG_WARN("Incorrect insertion to application submenu array"); return false; } } - LOG4CXX_INFO(logger_, "Data about submenu were inserted successfully to DB"); + SDL_LOG_INFO("Data about submenu were inserted successfully to DB"); return true; } bool ResumptionDataDB::InsertCommandsData( const smart_objects::SmartObject& commands, int64_t application_primary_key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; const size_t length_command_array = commands.length(); if (0 == length_command_array) { - LOG4CXX_INFO(logger_, "Application doesn't contain command"); + SDL_LOG_INFO("Application doesn't contain command"); return true; } utils::dbms::SQLQuery query_insert_command(db()); @@ -2118,8 +2085,7 @@ bool ResumptionDataDB::InsertCommandsData( int64_t command_primary_key = 0; if (!query_insert_command.Prepare(kInsertToCommand)) { - LOG4CXX_WARN(logger_, - "Problem with verification queries for insertion commands"); + SDL_LOG_WARN("Problem with verification queries for insertion commands"); return false; } /* Positions of binding data for "query_insert_command": @@ -2132,7 +2098,7 @@ bool ResumptionDataDB::InsertCommandsData( query_insert_command.Bind(0, commands[i][strings::cmd_id].asInt()); if (commands[i].keyExists(strings::cmd_icon)) { if (!ExecInsertImage(image_primary_key, commands[i][strings::cmd_icon])) { - LOG4CXX_WARN(logger_, "Problem with insert command image to DB"); + SDL_LOG_WARN("Problem with insert command image to DB"); return false; } query_insert_command.Bind(1, image_primary_key); @@ -2152,7 +2118,7 @@ bool ResumptionDataDB::InsertCommandsData( query_insert_command.Bind(4); } if (!query_insert_command.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insertion of command data to DB"); + SDL_LOG_WARN("Incorrect insertion of command data to DB"); return false; } command_primary_key = query_insert_command.LastInsertId(); @@ -2167,8 +2133,7 @@ bool ResumptionDataDB::InsertCommandsData( command_primary_key, kInsertApplicationCommandArray)) || !query_insert_command.Reset()) { - LOG4CXX_WARN(logger_, - "Incorrect insertion to application commands array"); + SDL_LOG_WARN("Incorrect insertion to application commands array"); return false; } } @@ -2178,12 +2143,12 @@ bool ResumptionDataDB::InsertCommandsData( bool ResumptionDataDB::InsertSubscriptionsData( const smart_objects::SmartObject& subscriptions, int64_t application_primary_key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; if (subscriptions.empty()) { - LOG4CXX_INFO(logger_, "Application doesn't contain subscriptions"); + SDL_LOG_INFO("Application doesn't contain subscriptions"); return true; } const SmartObject& btn_sub = subscriptions[strings::application_buttons]; @@ -2195,8 +2160,7 @@ bool ResumptionDataDB::InsertSubscriptionsData( utils::dbms::SQLQuery insert_subscriptions(db()); if (!insert_subscriptions.Prepare(kInsertSubscriptions)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Problem with verification queries for insertion subscriptions"); return false; } @@ -2217,23 +2181,23 @@ bool ResumptionDataDB::InsertSubscriptionsData( insert_subscriptions.Bind(2); } if (!insert_subscriptions.Exec() || !insert_subscriptions.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insertion of buttons to subscriptions"); + SDL_LOG_WARN("Incorrect insertion of buttons to subscriptions"); return false; } } - LOG4CXX_INFO(logger_, "Subscriptions data were saved successfully"); + SDL_LOG_INFO("Subscriptions data were saved successfully"); return true; } bool ResumptionDataDB::InsertChoiceSetData( const smart_objects::SmartObject& choicesets, int64_t application_primary_key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; if (choicesets.empty()) { - LOG4CXX_INFO(logger_, "Application doesn't contain choiceSet"); + SDL_LOG_INFO("Application doesn't contain choiceSet"); return true; } int64_t choice_set_key = 0; @@ -2250,27 +2214,27 @@ bool ResumptionDataDB::InsertChoiceSetData( if (!ExecInsertDataToArray(choice_set_key, application_primary_key, kInsertApplicationChoiceSetArray)) { - LOG4CXX_WARN(logger_, - "Problem with insertion data to" - " applicationChoiceSetArray table"); + SDL_LOG_WARN( + "Problem with insertion data to" + " applicationChoiceSetArray table"); return false; } } - LOG4CXX_INFO(logger_, "Choice set data were saved to DB successfully"); + SDL_LOG_INFO("Choice set data were saved to DB successfully"); return true; } bool ResumptionDataDB::ExecInsertApplicationChoiceSet( int64_t& choice_set_primary_key, const smart_objects::SmartObject& choiceset) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery insert_application_choice_set(db()); if (!insert_application_choice_set.Prepare(kInsertApplicationChoiceSet)) { - LOG4CXX_WARN(logger_, - "Problem with preparation insert " - "application choice set query"); + SDL_LOG_WARN( + "Problem with preparation insert " + "application choice set query"); return false; } /* Positions of binding data for "insert_application_choice_set": @@ -2282,19 +2246,18 @@ bool ResumptionDataDB::ExecInsertApplicationChoiceSet( 1, choiceset[strings::interaction_choice_set_id].asInt()); if (!insert_application_choice_set.Exec()) { - LOG4CXX_WARN(logger_, - "Problem with execution insert application choice set query"); + SDL_LOG_WARN("Problem with execution insert application choice set query"); return false; } choice_set_primary_key = insert_application_choice_set.LastInsertId(); - LOG4CXX_INFO(logger_, "Application choice data were saved successfully"); + SDL_LOG_INFO("Application choice data were saved successfully"); return true; } bool ResumptionDataDB::InsertGlobalPropertiesData( const smart_objects::SmartObject& global_properties, int64_t& global_properties_key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; SmartMap::iterator it_begin = global_properties.map_begin(); @@ -2302,22 +2265,22 @@ bool ResumptionDataDB::InsertGlobalPropertiesData( bool data_exists = false; while (it_begin != it_end) { if (SmartType::SmartType_Null != ((it_begin->second).getType())) { - LOG4CXX_INFO(logger_, "Global properties contains - " << it_begin->first); + SDL_LOG_INFO("Global properties contains - " << it_begin->first); data_exists = true; break; } ++it_begin; } if (!data_exists) { - LOG4CXX_INFO(logger_, "Application doesn't contain global properties"); + SDL_LOG_INFO("Application doesn't contain global properties"); return true; } utils::dbms::SQLQuery insert_global_properties(db()); if (!insert_global_properties.Prepare(kInsertGlobalProperties)) { - LOG4CXX_WARN(logger_, - "Problem with preparation query " - "insert_global_properties"); + SDL_LOG_WARN( + "Problem with preparation query " + "insert_global_properties"); return false; } /* Positions of binding data for "insert_global_properties": @@ -2342,7 +2305,7 @@ bool ResumptionDataDB::InsertGlobalPropertiesData( if (ExecInsertImage(image_key, global_properties[strings::menu_icon])) { insert_global_properties.Bind(2, image_key); } else { - LOG4CXX_WARN(logger_, "Problem with insert image to global properties"); + SDL_LOG_WARN("Problem with insert image to global properties"); return false; } } @@ -2365,8 +2328,7 @@ bool ResumptionDataDB::InsertGlobalPropertiesData( strings::auto_complete_text, kb_prop, insert_global_properties, 6); } if (!insert_global_properties.Exec()) { - LOG4CXX_WARN(logger_, - "Problem with insert data to global properties table"); + SDL_LOG_WARN("Problem with insert data to global properties table"); return false; } @@ -2379,8 +2341,7 @@ bool ResumptionDataDB::InsertGlobalPropertiesData( global_properties_key, global_properties[strings::keyboard_properties] [strings::limited_character_list])) { - LOG4CXX_WARN(logger_, - "Problem with insert data to limited_character table"); + SDL_LOG_WARN("Problem with insert data to limited_character table"); return false; } } @@ -2389,25 +2350,24 @@ bool ResumptionDataDB::InsertGlobalPropertiesData( global_properties[strings::vr_help].getType()) { if (!ExecInsertVRHelpItem(global_properties_key, global_properties[strings::vr_help])) { - LOG4CXX_WARN(logger_, "Problem with insert data to vrHelpItem table"); + SDL_LOG_WARN("Problem with insert data to vrHelpItem table"); return false; } } if (!ExecInsertHelpTimeoutArray(global_properties, global_properties_key)) { - LOG4CXX_WARN(logger_, - "Problem with insert data to HelpTimeoutPromptArray table"); + SDL_LOG_WARN("Problem with insert data to HelpTimeoutPromptArray table"); return false; } - LOG4CXX_INFO(logger_, "Global properties data were saved successfully"); + SDL_LOG_INFO("Global properties data were saved successfully"); return true; } bool ResumptionDataDB::ExecInsertHelpTimeoutArray( const smart_objects::SmartObject& global_properties, int64_t global_properties_key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; using namespace smart_objects; size_t timeout_prompt_length = 0; @@ -2423,16 +2383,14 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray( timeout_prompt_length = global_properties[strings::timeout_prompt].length(); } if (0 == timeout_prompt_length && 0 == help_prompt_length) { - LOG4CXX_INFO(logger_, - "Application doesn't HelpPrompt and timoutPrompt data"); + SDL_LOG_INFO("Application doesn't HelpPrompt and timoutPrompt data"); return true; } utils::dbms::SQLQuery insert_help_prompt_array(db()); if (!insert_help_prompt_array.Prepare(kInsertHelpTimeoutPromptArray)) { - LOG4CXX_WARN(logger_, - "Problem with verification query insert_help_prompt_array"); + SDL_LOG_WARN("Problem with verification query insert_help_prompt_array"); return false; } int64_t tts_chunk_key = 0; @@ -2449,8 +2407,7 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray( if (i < timeout_prompt_length) { if (!ExecInsertTTSChunks(global_properties[strings::timeout_prompt][i], tts_chunk_key)) { - LOG4CXX_WARN(logger_, - "Problem with insertion timeoutPrompt's ttsChunk"); + SDL_LOG_WARN("Problem with insertion timeoutPrompt's ttsChunk"); return false; } insert_help_prompt_array.Bind(1, tts_chunk_key); @@ -2461,7 +2418,7 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray( if (i < help_prompt_length) { if (!ExecInsertTTSChunks(global_properties[strings::help_prompt][i], tts_chunk_key)) { - LOG4CXX_WARN(logger_, "Problem with insertion helpPrompt's ttsChunk"); + SDL_LOG_WARN("Problem with insertion helpPrompt's ttsChunk"); return false; } insert_help_prompt_array.Bind(2, tts_chunk_key); @@ -2469,23 +2426,22 @@ bool ResumptionDataDB::ExecInsertHelpTimeoutArray( insert_help_prompt_array.Bind(2); } if (!insert_help_prompt_array.Exec() || !insert_help_prompt_array.Reset()) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Problem with execution or resetting insert_help_prompt_array query"); return false; } } - LOG4CXX_INFO(logger_, "Data were saved to helpTimeoutPromptArray table"); + SDL_LOG_INFO("Data were saved to helpTimeoutPromptArray table"); return true; } bool ResumptionDataDB::ExecInsertTTSChunks( const smart_objects::SmartObject& tts_chunk, int64_t& tts_chunk_key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery insert_tts_chunk(db()); if (!insert_tts_chunk.Prepare(kInsertTTSChunk)) { - LOG4CXX_WARN(logger_, "Problem with verification insert_tts_chunk query"); + SDL_LOG_WARN("Problem with verification insert_tts_chunk query"); return false; } /* Positions of binding data for "insert_tts_chunk": @@ -2494,24 +2450,24 @@ bool ResumptionDataDB::ExecInsertTTSChunks( insert_tts_chunk.Bind(0, tts_chunk[strings::type].asInt()); insert_tts_chunk.Bind(1, tts_chunk[strings::text].asString()); if (!insert_tts_chunk.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution insert_tts_chunk query"); + SDL_LOG_WARN("Problem with execution insert_tts_chunk query"); return false; } tts_chunk_key = insert_tts_chunk.LastInsertId(); - LOG4CXX_WARN(logger_, "TTSChunk was saved successfully"); + SDL_LOG_WARN("TTSChunk was saved successfully"); return true; } bool ResumptionDataDB::ExecInsertLimitedCharacters( int64_t global_properties_key, const smart_objects::SmartObject& characters_array) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery insert_characters(db()); if (!insert_characters.Prepare(kInsertTableLimitedCharacter)) { - LOG4CXX_WARN(logger_, - "Problem with preparation query " - "insert_characters"); + SDL_LOG_WARN( + "Problem with preparation query " + "insert_characters"); return false; } size_t length_characters_array = characters_array.length(); @@ -2521,31 +2477,29 @@ bool ResumptionDataDB::ExecInsertLimitedCharacters( insert_characters.Bind(0, characters_array[i].asString()); if (!insert_characters.Exec()) { - LOG4CXX_WARN(logger_, - "Problem with insert data to limited_character table"); + SDL_LOG_WARN("Problem with insert data to limited_character table"); return false; } if ((!ExecInsertDataToArray(global_properties_key, insert_characters.LastInsertId(), kInsertCharacterArray)) || (!insert_characters.Reset())) { - LOG4CXX_WARN(logger_, "Problem with insert data to characterArray table"); + SDL_LOG_WARN("Problem with insert data to characterArray table"); return false; } } - LOG4CXX_INFO(logger_, - "Data were saved successfully to limited_character table"); + SDL_LOG_INFO("Data were saved successfully to limited_character table"); return true; } bool ResumptionDataDB::ExecInsertVRHelpItem( int64_t global_properties_key, const smart_objects::SmartObject& vrhelp_array) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery insert_vrhelp_item(db()); if (!insert_vrhelp_item.Prepare(kInsertVRHelpItem)) { - LOG4CXX_WARN(logger_, "Problem with preparation query insert_vrhelp_item"); + SDL_LOG_WARN("Problem with preparation query insert_vrhelp_item"); return false; } int64_t image_primary_key = 0; @@ -2560,7 +2514,7 @@ bool ResumptionDataDB::ExecInsertVRHelpItem( if (vrhelp_array[i].keyExists(strings::image)) { if (!ExecInsertImage(image_primary_key, vrhelp_array[i][strings::image])) { - LOG4CXX_INFO(logger_, "Problem with insert image to vrHelpItem table"); + SDL_LOG_INFO("Problem with insert image to vrHelpItem table"); return false; } insert_vrhelp_item.Bind(2, image_primary_key); @@ -2569,7 +2523,7 @@ bool ResumptionDataDB::ExecInsertVRHelpItem( } if (!insert_vrhelp_item.Exec()) { - LOG4CXX_INFO(logger_, "Problem with insert data vrHelpItem table"); + SDL_LOG_INFO("Problem with insert data vrHelpItem table"); return false; } @@ -2577,13 +2531,11 @@ bool ResumptionDataDB::ExecInsertVRHelpItem( insert_vrhelp_item.LastInsertId(), kInsertVRHelpItemArray)) || (!insert_vrhelp_item.Reset())) { - LOG4CXX_WARN(logger_, - "Problem with insert data to vrHelpItemArray table"); + SDL_LOG_WARN("Problem with insert data to vrHelpItemArray table"); return false; } } - LOG4CXX_INFO(logger_, - "Data were saved successfully to vrHelpItem array table"); + SDL_LOG_INFO("Data were saved successfully to vrHelpItem array table"); return true; } @@ -2591,7 +2543,7 @@ bool ResumptionDataDB::InsertApplicationData( app_mngr::ApplicationSharedPtr application, const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationParams app(application); return InsertApplicationData(app, policy_app_id, device_id, NULL, 0); } @@ -2602,12 +2554,12 @@ bool ResumptionDataDB::InsertApplicationData( const std::string& device_id, int64_t* application_primary_key, int64_t global_properties_key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery query(db()); if (!application.m_is_valid) { - LOG4CXX_ERROR(logger_, "Invalid application params passed."); + SDL_LOG_ERROR("Invalid application params passed."); return false; } @@ -2622,9 +2574,9 @@ bool ResumptionDataDB::InsertApplicationData( application_manager_.IsAppSubscribedForWayPoints(application.app_ptr); if (!query.Prepare(kInsertApplication)) { - LOG4CXX_WARN(logger_, - "Problem with verification query " - "for insert to table application"); + SDL_LOG_WARN( + "Problem with verification query " + "for insert to table application"); return false; } @@ -2659,13 +2611,13 @@ bool ResumptionDataDB::InsertApplicationData( query.Bind(11, is_subscribed_for_way_points); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution query"); + SDL_LOG_WARN("Problem with execution query"); return false; } if (NULL != application_primary_key) { *application_primary_key = query.LastInsertId(); } - LOG4CXX_INFO(logger_, "Data were saved successfully to application table"); + SDL_LOG_INFO("Data were saved successfully to application table"); return true; } @@ -2673,7 +2625,7 @@ void ResumptionDataDB::CustomBind(const std::string& key, const smart_objects::SmartObject& so, utils::dbms::SQLQuery& query, const int pos) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace smart_objects; if (so.keyExists(key) && SmartType::SmartType_Null != so[key].getType()) { switch (so[key].getType()) { @@ -2686,7 +2638,7 @@ void ResumptionDataDB::CustomBind(const std::string& key, break; } default: { - LOG4CXX_WARN(logger_, "Incorrect type"); + SDL_LOG_WARN("Incorrect type"); break; } } @@ -2699,9 +2651,9 @@ bool ResumptionDataDB::PrepareSelectQuery(utils::dbms::SQLQuery& query, const std::string& policy_app_id, const std::string& device_id, const std::string& text_query) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!query.Prepare(text_query)) { - LOG4CXX_WARN(logger_, "Problem with verification query"); + SDL_LOG_WARN("Problem with verification query"); return false; } query.Bind(0, policy_app_id); @@ -2710,13 +2662,12 @@ bool ResumptionDataDB::PrepareSelectQuery(utils::dbms::SQLQuery& query, } void ResumptionDataDB::UpdateDataOnAwake() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (query.Prepare(kUpdateIgnOffCount)) { if (query.Exec()) { - LOG4CXX_INFO(logger_, - "Values of ignition off counts were updated successfully"); + SDL_LOG_INFO("Values of ignition off counts were updated successfully"); WriteDb(); } } @@ -2726,7 +2677,7 @@ bool ResumptionDataDB::UpdateApplicationData( app_mngr::ApplicationConstSharedPtr application, const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery query(db()); @@ -2735,9 +2686,9 @@ bool ResumptionDataDB::UpdateApplicationData( application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if (!query.Prepare(kUpdateApplicationData)) { - LOG4CXX_WARN(logger_, - "Problem with verification query " - "for updating some application data"); + SDL_LOG_WARN( + "Problem with verification query " + "for updating some application data"); return false; } @@ -2752,28 +2703,27 @@ bool ResumptionDataDB::UpdateApplicationData( query.Bind(3, device_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution query"); + SDL_LOG_WARN("Problem with execution query"); return false; } - LOG4CXX_INFO(logger_, "Data were updated successfully in application table"); + SDL_LOG_INFO("Data were updated successfully in application table"); return true; } void ResumptionDataDB::WriteDb() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); db_->Backup(); } bool ResumptionDataDB::UpdateGrammarID(const std::string& policy_app_id, const std::string& device_id, const uint32_t grammar_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; utils::dbms::SQLQuery query(db()); if (!query.Prepare(kUpdateGrammarID)) { - LOG4CXX_WARN(logger_, - "Problem with verification query for updating grammar id."); + SDL_LOG_WARN("Problem with verification query for updating grammar id."); return false; } @@ -2786,10 +2736,10 @@ bool ResumptionDataDB::UpdateGrammarID(const std::string& policy_app_id, query.Bind(2, device_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Problem with execution query"); + SDL_LOG_WARN("Problem with execution query"); return false; } - LOG4CXX_INFO(logger_, "Data were updated successfully in application table"); + SDL_LOG_INFO("Data were updated successfully in application table"); return true; } diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc index 3623c18b90..10fe73f2b2 100644 --- a/src/components/application_manager/src/resumption/resumption_data_json.cc +++ b/src/components/application_manager/src/resumption/resumption_data_json.cc @@ -43,7 +43,7 @@ namespace resumption { namespace formatters = ns_smart_device_link::ns_json_handler::formatters; -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOG_VARIABLE("Resumption") ResumptionDataJson::ResumptionDataJson( resumption::LastStateWrapperPtr last_state_wrapper, @@ -54,12 +54,11 @@ ResumptionDataJson::ResumptionDataJson( void ResumptionDataJson::SaveApplication( app_mngr::ApplicationSharedPtr application) { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); const std::string& policy_app_id = application->policy_app_id(); - LOG4CXX_DEBUG(logger_, - "app_id : " << application->app_id() + SDL_LOG_DEBUG("app_id : " << application->app_id() << " policy_app_id : " << policy_app_id); const std::string hash = application->curHash(); const uint32_t grammar_id = application->get_grammar_id(); @@ -110,12 +109,12 @@ void ResumptionDataJson::SaveApplication( json_app[strings::subscribed_for_way_points] = is_subscribed_for_way_points; accessor.GetMutableData().set_dictionary(dictionary); - LOG4CXX_DEBUG(logger_, "SaveApplication : " << json_app.toStyledString()); + SDL_LOG_DEBUG("SaveApplication : " << json_app.toStyledString()); } bool ResumptionDataJson::IsHMIApplicationIdExist(uint32_t hmi_app_id) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); @@ -134,13 +133,13 @@ bool ResumptionDataJson::IsHMIApplicationIdExist(uint32_t hmi_app_id) const { uint32_t ResumptionDataJson::GetHMIApplicationID( const std::string& policy_app_id, const std::string& device_id) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t hmi_app_id = 0; const int idx = GetObjectIndex(policy_app_id, device_id); if (-1 == idx) { - LOG4CXX_WARN(logger_, "Application not saved"); + SDL_LOG_WARN("Application not saved"); return hmi_app_id; } resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); @@ -150,13 +149,13 @@ uint32_t ResumptionDataJson::GetHMIApplicationID( json_app.isMember(strings::device_id)) { hmi_app_id = json_app[strings::hmi_app_id].asUInt(); } - LOG4CXX_DEBUG(logger_, "hmi_app_id :" << hmi_app_id); + SDL_LOG_DEBUG("hmi_app_id :" << hmi_app_id); return hmi_app_id; } void ResumptionDataJson::IncrementIgnOffCount() { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Json::Value to_save = Json::arrayValue; Json::Value dictionary; @@ -169,7 +168,7 @@ void ResumptionDataJson::IncrementIgnOffCount() { const uint32_t counter_value = ign_off_count.asUInt(); ign_off_count = counter_value + 1; } else { - LOG4CXX_WARN(logger_, "Unknown key among saved applications"); + SDL_LOG_WARN("Unknown key among saved applications"); Json::Value& ign_off_count = json_app[strings::ign_off_count]; ign_off_count = 1; } @@ -178,12 +177,12 @@ void ResumptionDataJson::IncrementIgnOffCount() { SetSavedApplication(to_save, dictionary); SetLastIgnOffTime(time(nullptr), dictionary); accessor.GetMutableData().set_dictionary(dictionary); - LOG4CXX_DEBUG(logger_, GetResumptionData(dictionary).toStyledString()); + SDL_LOG_DEBUG(GetResumptionData(dictionary).toStyledString()); } void ResumptionDataJson::DecrementIgnOffCount() { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); @@ -192,12 +191,12 @@ void ResumptionDataJson::DecrementIgnOffCount() { if (saved_app.isMember(strings::ign_off_count)) { const uint32_t ign_off_count = saved_app[strings::ign_off_count].asUInt(); if (0 == ign_off_count) { - LOG4CXX_WARN(logger_, "Application has not been suspended"); + SDL_LOG_WARN("Application has not been suspended"); } else { saved_app[strings::ign_off_count] = ign_off_count - 1; } } else { - LOG4CXX_WARN(logger_, "Unknown key among saved applications"); + SDL_LOG_WARN("Unknown key among saved applications"); saved_app[strings::ign_off_count] = 0; } } @@ -208,25 +207,24 @@ bool ResumptionDataJson::GetHashId(const std::string& policy_app_id, const std::string& device_id, std::string& hash_id) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const int idx = GetObjectIndex(policy_app_id, device_id); if (-1 == idx) { - LOG4CXX_WARN(logger_, "Application not saved"); + SDL_LOG_WARN("Application not saved"); return false; } resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); const Json::Value& json_app = GetSavedApplications(dictionary)[idx]; - LOG4CXX_DEBUG(logger_, - "Saved_application_data: " << json_app.toStyledString()); + SDL_LOG_DEBUG("Saved_application_data: " << json_app.toStyledString()); if (json_app.isMember(strings::hash_id) && json_app.isMember(strings::time_stamp)) { hash_id = json_app[strings::hash_id].asString(); return true; } - LOG4CXX_WARN(logger_, "There are some unknown keys in the dictionary."); + SDL_LOG_WARN("There are some unknown keys in the dictionary."); return false; } @@ -235,7 +233,7 @@ bool ResumptionDataJson::GetSavedApplication( const std::string& device_id, smart_objects::SmartObject& saved_app) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const int idx = GetObjectIndex(policy_app_id, device_id); if (-1 == idx) { @@ -252,7 +250,7 @@ bool ResumptionDataJson::GetSavedApplication( bool ResumptionDataJson::RemoveApplicationFromSaved( const std::string& policy_app_id, const std::string& device_id) { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool result = false; std::vector<Json::Value> temp; @@ -273,7 +271,7 @@ bool ResumptionDataJson::RemoveApplicationFromSaved( } if (false == result) { - LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false")); + SDL_LOG_TRACE("EXIT result: " << (result ? "true" : "false")); accessor.GetMutableData().set_dictionary(dictionary); return result; } @@ -282,14 +280,14 @@ bool ResumptionDataJson::RemoveApplicationFromSaved( for (auto& app : temp) { GetSavedApplications(dictionary).append(app); } - LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false")); + SDL_LOG_TRACE("EXIT result: " << (result ? "true" : "false")); accessor.GetMutableData().set_dictionary(dictionary); return result; } uint32_t ResumptionDataJson::GetIgnOffTime() const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); @@ -297,14 +295,14 @@ uint32_t ResumptionDataJson::GetIgnOffTime() const { if (!resumption.isMember(strings::last_ign_off_time)) { resumption[strings::last_ign_off_time] = 0; accessor.GetMutableData().set_dictionary(dictionary); - LOG4CXX_WARN(logger_, "last_save_time section is missed"); + SDL_LOG_WARN("last_save_time section is missed"); } return resumption[strings::last_ign_off_time].asUInt(); } uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); @@ -312,7 +310,7 @@ uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const { if (resumption.isMember(strings::global_ign_on_counter)) { const uint32_t global_ign_on_counter = resumption[strings::global_ign_on_counter].asUInt(); - LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter); + SDL_LOG_DEBUG("Global Ign On Counter = " << global_ign_on_counter); return global_ign_on_counter; } return 1; @@ -320,7 +318,7 @@ uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const { void ResumptionDataJson::IncrementGlobalIgnOnCounter() { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); @@ -328,13 +326,11 @@ void ResumptionDataJson::IncrementGlobalIgnOnCounter() { if (resumption.isMember(strings::global_ign_on_counter)) { const uint32_t global_ign_on_counter = resumption[strings::global_ign_on_counter].asUInt(); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Global IGN ON counter in resumption data: " << global_ign_on_counter); resumption[strings::global_ign_on_counter] = global_ign_on_counter + 1; - LOG4CXX_DEBUG(logger_, - "Global IGN ON counter new value: " - << resumption[strings::global_ign_on_counter].asUInt()); + SDL_LOG_DEBUG("Global IGN ON counter new value: " + << resumption[strings::global_ign_on_counter].asUInt()); } else { resumption[strings::global_ign_on_counter] = 1; } @@ -344,7 +340,7 @@ void ResumptionDataJson::IncrementGlobalIgnOnCounter() { void ResumptionDataJson::ResetGlobalIgnOnCount() { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); @@ -352,12 +348,12 @@ void ResumptionDataJson::ResetGlobalIgnOnCount() { resumption[strings::global_ign_on_counter] = 0; accessor.GetMutableData().set_dictionary(dictionary); - LOG4CXX_DEBUG(logger_, "Global IGN ON counter resetting"); + SDL_LOG_DEBUG("Global IGN ON counter resetting"); } ssize_t ResumptionDataJson::IsApplicationSaved( const std::string& policy_app_id, const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return GetObjectIndex(policy_app_id, device_id); } @@ -367,7 +363,7 @@ Json::Value& ResumptionDataJson::GetFromSavedOrAppend( const std::string& device_id, Json::Value& dictionary) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Json::Value& saved_apps = GetSavedApplications(dictionary); for (auto& saved_app : saved_apps) { @@ -383,7 +379,7 @@ Json::Value& ResumptionDataJson::GetFromSavedOrAppend( void ResumptionDataJson::GetDataForLoadResumeData( smart_objects::SmartObject& saved_data) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject so_array_data(smart_objects::SmartType_Array); int i = 0; @@ -417,14 +413,13 @@ void ResumptionDataJson::UpdateHmiLevel( const std::string& policy_app_id, const std::string& device_id, mobile_apis::HMILevel::eType hmi_level) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; int idx = GetObjectIndex(policy_app_id, device_id); if (-1 == idx) { - LOG4CXX_WARN(logger_, - "Application isn't saved with mobile_app_id = " - << policy_app_id << " device_id = " << device_id); + SDL_LOG_WARN("Application isn't saved with mobile_app_id = " + << policy_app_id << " device_id = " << device_id); return; } resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); @@ -436,16 +431,16 @@ void ResumptionDataJson::UpdateHmiLevel( Json::Value& ResumptionDataJson::GetSavedApplications( Json::Value& dictionary) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Json::Value& resumption = GetResumptionData(dictionary); if (!resumption.isMember(strings::resume_app_list)) { resumption[strings::resume_app_list] = Json::Value(Json::arrayValue); - LOG4CXX_WARN(logger_, "app_list section is missed"); + SDL_LOG_WARN("app_list section is missed"); } Json::Value& resume_app_list = resumption[strings::resume_app_list]; if (!resume_app_list.isArray()) { - LOG4CXX_ERROR(logger_, "resume_app_list type INVALID rewrite"); + SDL_LOG_ERROR("resume_app_list type INVALID rewrite"); resume_app_list = Json::Value(Json::arrayValue); } return resume_app_list; @@ -454,15 +449,15 @@ Json::Value& ResumptionDataJson::GetSavedApplications( Json::Value& ResumptionDataJson::GetResumptionData( Json::Value& dictionary) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!dictionary.isMember(strings::resumption)) { dictionary[strings::resumption] = Json::Value(Json::objectValue); - LOG4CXX_WARN(logger_, "resumption section is missed"); + SDL_LOG_WARN("resumption section is missed"); } Json::Value& resumption = dictionary[strings::resumption]; if (!resumption.isObject()) { - LOG4CXX_ERROR(logger_, "resumption type INVALID rewrite"); + SDL_LOG_ERROR("resumption type INVALID rewrite"); resumption = Json::Value(Json::objectValue); } return resumption; @@ -471,7 +466,7 @@ Json::Value& ResumptionDataJson::GetResumptionData( ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id, const std::string& device_id) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); @@ -485,7 +480,7 @@ ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id, const std::string& saved_device_id = apps[idx][strings::device_id].asString(); if (device_id == saved_device_id && policy_app_id == saved_app_id) { - LOG4CXX_DEBUG(logger_, "Found " << idx); + SDL_LOG_DEBUG("Found " << idx); return idx; } } @@ -495,7 +490,7 @@ ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id, bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); @@ -506,13 +501,13 @@ bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const { !json_app.isMember(strings::hmi_app_id) || !json_app.isMember(strings::time_stamp) || !json_app.isMember(strings::device_id)) { - LOG4CXX_ERROR(logger_, "Wrong resumption data"); + SDL_LOG_ERROR("Wrong resumption data"); return false; } if (json_app.isMember(strings::hmi_app_id) && 0 >= json_app[strings::hmi_app_id].asUInt()) { - LOG4CXX_ERROR(logger_, "Wrong resumption hmi app ID"); + SDL_LOG_ERROR("Wrong resumption hmi app ID"); return false; } @@ -521,7 +516,7 @@ bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const { void ResumptionDataJson::SetSavedApplication(Json::Value& apps_json, Json::Value& dictionary) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Json::Value& app_list = GetSavedApplications(dictionary); app_list = apps_json; @@ -530,21 +525,21 @@ void ResumptionDataJson::SetSavedApplication(Json::Value& apps_json, void ResumptionDataJson::SetLastIgnOffTime(time_t ign_off_time, Json::Value& dictionary) { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); - LOG4CXX_WARN(logger_, "ign_off_time = " << ign_off_time); + SDL_LOG_WARN("ign_off_time = " << ign_off_time); Json::Value& resumption = GetResumptionData(dictionary); resumption[strings::last_ign_off_time] = static_cast<uint32_t>(ign_off_time); } bool ResumptionDataJson::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return true; } bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id, const std::string& app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace app_mngr; resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); @@ -552,8 +547,7 @@ bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id, Json::Value& application = GetFromSavedOrAppend(app_id, device_id, dictionary); if (application.isNull()) { - LOG4CXX_DEBUG(logger_, - "Application " << app_id << " with device_id " << device_id + SDL_LOG_DEBUG("Application " << app_id << " with device_id " << device_id << " hasn't been found in resumption data."); return false; } @@ -565,10 +559,9 @@ bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id, application[strings::application_files].clear(); application.removeMember(strings::grammar_id); accessor.GetMutableData().set_dictionary(dictionary); - LOG4CXX_DEBUG(logger_, - "Resumption data for application " - << app_id << " with device_id " << device_id - << " has been dropped."); + SDL_LOG_DEBUG("Resumption data for application " + << app_id << " with device_id " << device_id + << " has been dropped."); return true; } diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc index 44a5af6f41..b8dad59830 100644 --- a/src/components/application_manager/src/rpc_handler_impl.cc +++ b/src/components/application_manager/src/rpc_handler_impl.cc @@ -37,7 +37,7 @@ namespace application_manager { namespace rpc_handler { -CREATE_LOGGERPTR_LOCAL(logger_, "RPCHandlerImpl") +SDL_CREATE_LOG_VARIABLE("RPCHandlerImpl") namespace formatters = ns_smart_device_link::ns_json_handler::formatters; namespace jhs = ns_smart_device_link::ns_json_handler::strings; namespace plugin_names = application_manager::plugin_manager::plugin_names; @@ -60,7 +60,7 @@ RPCHandlerImpl::~RPCHandlerImpl() {} void RPCHandlerImpl::ProcessMessageFromMobile( const std::shared_ptr<Message> message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef TELEMETRY_MONITOR AMTelemetryObserver::MessageMetricSharedPtr metric( new AMTelemetryObserver::MessageMetric()); @@ -71,13 +71,13 @@ void RPCHandlerImpl::ProcessMessageFromMobile( bool allow_unknown_parameters = false; DCHECK_OR_RETURN_VOID(so_from_mobile); if (!so_from_mobile) { - LOG4CXX_ERROR(logger_, "Null pointer"); + SDL_LOG_ERROR("Null pointer"); return; } if (message->type() == application_manager::MessageType::kRequest && message->correlation_id() < 0) { - LOG4CXX_ERROR(logger_, "Request correlation id < 0. Returning INVALID_ID"); + SDL_LOG_ERROR("Request correlation id < 0. Returning INVALID_ID"); std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse(message->connection_key(), message->function_id(), @@ -102,9 +102,8 @@ void RPCHandlerImpl::ProcessMessageFromMobile( if (app_manager_.GetRPCService().IsAppServiceRPC( message->function_id(), commands::Command::SOURCE_MOBILE) || rpc_passing) { - LOG4CXX_DEBUG(logger_, - "Allowing unknown parameters for request function " - << message->function_id()); + SDL_LOG_DEBUG("Allowing unknown parameters for request function " + << message->function_id()); allow_unknown_parameters = true; } @@ -114,7 +113,7 @@ void RPCHandlerImpl::ProcessMessageFromMobile( warning_info, allow_unknown_parameters, !rpc_passing)) { - LOG4CXX_ERROR(logger_, "Cannot create smart object from message"); + SDL_LOG_ERROR("Cannot create smart object from message"); return; } @@ -136,7 +135,7 @@ void RPCHandlerImpl::ProcessMessageFromMobile( message_type)) { // Since PassThrough failed, refiltering the message if (!ConvertMessageToSO(*message, *so_from_mobile, warning_info)) { - LOG4CXX_ERROR(logger_, "Cannot create smart object from message"); + SDL_LOG_ERROR("Cannot create smart object from message"); return; } } @@ -148,7 +147,7 @@ void RPCHandlerImpl::ProcessMessageFromMobile( if (!app_manager_.GetRPCService().ManageMobileCommand( so_from_mobile, commands::Command::SOURCE_MOBILE, warning_info)) { - LOG4CXX_ERROR(logger_, "Received command didn't run successfully"); + SDL_LOG_ERROR("Received command didn't run successfully"); } #ifdef TELEMETRY_MONITOR metric->end = date_time::getCurrentTime(); @@ -160,7 +159,7 @@ void RPCHandlerImpl::ProcessMessageFromMobile( void RPCHandlerImpl::ProcessMessageFromHMI( const std::shared_ptr<Message> message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr smart_object = std::make_shared<smart_objects::SmartObject>(); bool allow_unknown_parameters = false; @@ -174,9 +173,8 @@ void RPCHandlerImpl::ProcessMessageFromHMI( converted_result[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); if (app_manager_.GetRPCService().IsAppServiceRPC( function_id, commands::Command::SOURCE_HMI)) { - LOG4CXX_DEBUG( - logger_, - "Allowing unknown parameters for request function " << function_id); + SDL_LOG_DEBUG("Allowing unknown parameters for request function " + << function_id); allow_unknown_parameters = true; } @@ -191,36 +189,35 @@ void RPCHandlerImpl::ProcessMessageFromHMI( (*smart_object)[strings::msg_params][strings::info] = std::string("Invalid message received from vehicle"); } else { - LOG4CXX_ERROR(logger_, "Cannot create smart object from message"); + SDL_LOG_ERROR("Cannot create smart object from message"); return; } } if (!warning_info.empty()) { - LOG4CXX_WARN(logger_, - "Warning while parsing HMI message: " << warning_info); + SDL_LOG_WARN("Warning while parsing HMI message: " << warning_info); } - LOG4CXX_DEBUG(logger_, "Converted message, trying to create hmi command"); + SDL_LOG_DEBUG("Converted message, trying to create hmi command"); if (!app_manager_.GetRPCService().ManageHMICommand( smart_object, commands::Command::SOURCE_HMI, warning_info)) { - LOG4CXX_ERROR(logger_, "Received command didn't run successfully"); + SDL_LOG_ERROR("Received command didn't run successfully"); } } void RPCHandlerImpl::Handle(const impl::MessageFromMobile message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!message) { - LOG4CXX_ERROR(logger_, "Null-pointer message received."); + SDL_LOG_ERROR("Null-pointer message received."); return; } if (app_manager_.is_stopping()) { - LOG4CXX_INFO(logger_, "Application manager is stopping"); + SDL_LOG_INFO("Application manager is stopping"); return; } if (app_manager_.IsLowVoltage()) { - LOG4CXX_ERROR(logger_, "Low Voltage is active."); + SDL_LOG_ERROR("Low Voltage is active."); return; } @@ -228,14 +225,14 @@ void RPCHandlerImpl::Handle(const impl::MessageFromMobile message) { } void RPCHandlerImpl::Handle(const impl::MessageFromHmi message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!message) { - LOG4CXX_ERROR(logger_, "Null-pointer message received."); + SDL_LOG_ERROR("Null-pointer message received."); return; } if (app_manager_.IsLowVoltage()) { - LOG4CXX_ERROR(logger_, "Low Voltage is active."); + SDL_LOG_ERROR("Low Voltage is active."); return; } @@ -244,15 +241,15 @@ void RPCHandlerImpl::Handle(const impl::MessageFromHmi message) { void RPCHandlerImpl::OnMessageReceived( const protocol_handler::RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app_manager_.IsLowVoltage()) { - LOG4CXX_ERROR(logger_, "Low Voltage is active."); + SDL_LOG_ERROR("Low Voltage is active."); return; } if (!message) { - LOG4CXX_ERROR(logger_, "Null-pointer message received."); + SDL_LOG_ERROR("Null-pointer message received."); NOTREACHED(); return; } @@ -260,7 +257,7 @@ void RPCHandlerImpl::OnMessageReceived( std::shared_ptr<Message> outgoing_message = ConvertRawMsgToMessage(message); if (outgoing_message) { - LOG4CXX_DEBUG(logger_, "Posting new Message"); + SDL_LOG_DEBUG("Posting new Message"); messages_from_mobile_.PostMessage( impl::MessageFromMobile(outgoing_message)); } @@ -268,15 +265,15 @@ void RPCHandlerImpl::OnMessageReceived( void RPCHandlerImpl::OnMobileMessageSent( const protocol_handler::RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void RPCHandlerImpl::OnMessageReceived( hmi_message_handler::MessageSharedPointer message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!message) { - LOG4CXX_ERROR(logger_, "Null-pointer message received."); + SDL_LOG_ERROR("Null-pointer message received."); NOTREACHED(); return; } @@ -335,11 +332,10 @@ bool RPCHandlerImpl::ConvertMessageToSO( std::string& out_warning_info, const bool allow_unknown_parameters, const bool validate_params) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "\t\t\tMessage to convert: protocol " - << message.protocol_version() << "; json " - << message.json_message()); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("\t\t\tMessage to convert: protocol " + << message.protocol_version() << "; json " + << message.json_message()); switch (message.protocol_version()) { case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5: @@ -371,10 +367,9 @@ bool RPCHandlerImpl::ConvertMessageToSO( (validate_params && !ValidateRpcSO( output, msg_version, report, allow_unknown_parameters))) { - LOG4CXX_WARN(logger_, - "Failed to parse string to smart object with API version " - << msg_version.toString() << " : " - << message.json_message()); + SDL_LOG_WARN("Failed to parse string to smart object with API version " + << msg_version.toString() << " : " + << message.json_message()); std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( @@ -391,9 +386,8 @@ bool RPCHandlerImpl::ConvertMessageToSO( return false; } - LOG4CXX_DEBUG(logger_, - "Convertion result for sdl object is true function_id " - << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); + SDL_LOG_DEBUG("Convertion result for sdl object is true function_id " + << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); // Populate any warning info generated during the validation process out_warning_info = rpc::PrettyFormat(report); @@ -404,11 +398,9 @@ bool RPCHandlerImpl::ConvertMessageToSO( message.protocol_version(); if (message.binary_data()) { if (message.payload_size() < message.data_size()) { - LOG4CXX_ERROR(logger_, - "Incomplete binary" - << " binary size should be " << message.data_size() - << " payload data size is " - << message.payload_size()); + SDL_LOG_ERROR("Incomplete binary" + << " binary size should be " << message.data_size() + << " payload data size is " << message.payload_size()); std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( message.connection_key(), @@ -431,12 +423,11 @@ bool RPCHandlerImpl::ConvertMessageToSO( formatters::FormatterJsonRpc::FromString< hmi_apis::FunctionID::eType, hmi_apis::messageType::eType>(message.json_message(), output); - LOG4CXX_DEBUG(logger_, - "Convertion result: " - << result << " function id " - << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); + SDL_LOG_DEBUG("Convertion result: " + << result << " function id " + << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); if (!hmi_so_factory().attachSchema(output, true)) { - LOG4CXX_WARN(logger_, "Failed to attach schema to object."); + SDL_LOG_WARN("Failed to attach schema to object."); return false; } @@ -447,9 +438,8 @@ bool RPCHandlerImpl::ConvertMessageToSO( smart_objects::errors::OK != output.validate( &report, empty_version, allow_unknown_parameters)) { - LOG4CXX_ERROR( - logger_, - "Incorrect parameter from HMI - " << rpc::PrettyFormat(report)); + SDL_LOG_ERROR("Incorrect parameter from HMI - " + << rpc::PrettyFormat(report)); return HandleWrongMessageType(output, report); } @@ -459,7 +449,7 @@ bool RPCHandlerImpl::ConvertMessageToSO( static ns_smart_device_link_rpc::V1::v4_protocol_v1_2_no_extra v1_shema; if (message.function_id() == 0 || message.type() == kUnknownType) { - LOG4CXX_ERROR(logger_, "Message received: UNSUPPORTED_VERSION"); + SDL_LOG_ERROR("Message received: UNSUPPORTED_VERSION"); int32_t conversation_result = formatters::CFormatterJsonSDLRPCv1::fromString< @@ -493,27 +483,26 @@ bool RPCHandlerImpl::ConvertMessageToSO( break; } default: - LOG4CXX_WARN(logger_, - "Application used unsupported protocol :" - << message.protocol_version() << "."); + SDL_LOG_WARN("Application used unsupported protocol :" + << message.protocol_version() << "."); return false; } output[strings::params][strings::protection] = message.is_message_encrypted(); - LOG4CXX_DEBUG(logger_, "Successfully parsed message into smart object"); + SDL_LOG_DEBUG("Successfully parsed message into smart object"); return true; } bool RPCHandlerImpl::HandleWrongMessageType( smart_objects::SmartObject& output, rpc::ValidationReport report) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); switch (output[strings::params][strings::message_type].asInt()) { case application_manager::MessageType::kNotification: { - LOG4CXX_ERROR(logger_, "Ignore wrong HMI notification"); + SDL_LOG_ERROR("Ignore wrong HMI notification"); return false; } case application_manager::MessageType::kRequest: { - LOG4CXX_ERROR(logger_, "Received invalid data on HMI request"); + SDL_LOG_ERROR("Received invalid data on HMI request"); output.erase(strings::msg_params); output[strings::params].erase(hmi_response::message); output[strings::params][hmi_response::code] = @@ -524,15 +513,15 @@ bool RPCHandlerImpl::HandleWrongMessageType( return true; } case application_manager::MessageType::kResponse: { - LOG4CXX_ERROR(logger_, "Received invalid data on HMI response"); + SDL_LOG_ERROR("Received invalid data on HMI response"); break; } case application_manager::MessageType::kUnknownType: { - LOG4CXX_ERROR(logger_, "Received unknown type data on HMI"); + SDL_LOG_ERROR("Received unknown type data on HMI"); break; } default: { - LOG4CXX_ERROR(logger_, "Received error response on HMI"); + SDL_LOG_ERROR("Received error response on HMI"); break; } } @@ -553,7 +542,7 @@ bool RPCHandlerImpl::ValidateRpcSO(smart_objects::SmartObject& message, message, !allow_unknown_parameters, msg_version, &report_out) || message.validate(&report_out, msg_version, allow_unknown_parameters) != smart_objects::errors::OK) { - LOG4CXX_WARN(logger_, "Failed to parse string to smart object"); + SDL_LOG_WARN("Failed to parse string to smart object"); return false; } return true; @@ -561,15 +550,15 @@ bool RPCHandlerImpl::ValidateRpcSO(smart_objects::SmartObject& message, std::shared_ptr<Message> RPCHandlerImpl::ConvertRawMsgToMessage( const protocol_handler::RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(message); std::shared_ptr<Message> outgoing_message; - LOG4CXX_DEBUG(logger_, "Service type." << message->service_type()); + SDL_LOG_DEBUG("Service type." << message->service_type()); if (message->service_type() != protocol_handler::kRpc && message->service_type() != protocol_handler::kBulk) { // skip this message, not under handling of ApplicationManager - LOG4CXX_TRACE(logger_, "Skipping message; not the under AM handling."); + SDL_LOG_TRACE("Skipping message; not the under AM handling."); return outgoing_message; } @@ -579,7 +568,7 @@ std::shared_ptr<Message> RPCHandlerImpl::ConvertRawMsgToMessage( if (convertion_result) { outgoing_message = std::shared_ptr<Message>(convertion_result); } else { - LOG4CXX_ERROR(logger_, "Received invalid message"); + SDL_LOG_ERROR("Received invalid message"); } return outgoing_message; diff --git a/src/components/application_manager/src/rpc_passing_handler.cc b/src/components/application_manager/src/rpc_passing_handler.cc index 7f72632bb1..74a865ff4f 100644 --- a/src/components/application_manager/src/rpc_passing_handler.cc +++ b/src/components/application_manager/src/rpc_passing_handler.cc @@ -52,7 +52,7 @@ #include "smart_objects/enum_schema_item.h" #include "utils/timer_task_impl.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "RPCPassingHandler") +SDL_CREATE_LOG_VARIABLE("RPCPassingHandler") namespace application_manager { @@ -98,12 +98,12 @@ bool RPCPassingHandler::ExtractRPCParams( const smart_objects::SmartObject& s_map, const ApplicationSharedPtr app, const std::string& function_id_str) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); RPCParams params; if (smart_objects::SmartType_Map == s_map.getType()) { for (auto iter = s_map.map_begin(); iter != s_map.map_end(); ++iter) { - LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first); + SDL_LOG_DEBUG("Request's param: " << iter->first); params.insert(iter->first); } } @@ -131,7 +131,7 @@ bool RPCPassingHandler::ExtractRPCParams( bool RPCPassingHandler::IsPassthroughAllowed( smart_objects::SmartObject rpc_message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t connection_key = rpc_message[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = app_manager_.application(connection_key); @@ -162,31 +162,30 @@ bool RPCPassingHandler::IsPassthroughAllowed( } bool RPCPassingHandler::RPCPassThrough(smart_objects::SmartObject rpc_message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t correlation_id = rpc_message[strings::params][strings::correlation_id].asUInt(); int32_t message_type = rpc_message[strings::params][strings::message_type].asInt(); - LOG4CXX_DEBUG(logger_, "RPC_PASSING: "); + SDL_LOG_DEBUG("RPC_PASSING: "); MessageHelper::PrintSmartObject(rpc_message); // Clear timers for timed out requests ClearCompletedTimers(); switch (message_type) { case MessageType::kRequest: { - LOG4CXX_DEBUG(logger_, "Handle request"); + SDL_LOG_DEBUG("Handle request"); rpc_request_queue_lock_.Acquire(); if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) { rpc_request_queue_lock_.Release(); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Correlation id DOES NOT exist in map. Constructing request queue"); PopulateRPCRequestQueue(rpc_message); } else { rpc_request_queue_lock_.Release(); - LOG4CXX_DEBUG(logger_, "Correlation id DOES exist in map. Returning"); + SDL_LOG_DEBUG("Correlation id DOES exist in map. Returning"); std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( rpc_message[strings::params][strings::connection_key].asUInt(), @@ -204,8 +203,7 @@ bool RPCPassingHandler::RPCPassThrough(smart_objects::SmartObject rpc_message) { rpc_request_queue_lock_.Acquire(); if (rpc_request_queue[correlation_id].second.empty()) { - LOG4CXX_DEBUG(logger_, - "No services left in map. Using core to handle request"); + SDL_LOG_DEBUG("No services left in map. Using core to handle request"); rpc_request_queue.erase(correlation_id); rpc_request_queue_lock_.Release(); return false; @@ -219,7 +217,7 @@ bool RPCPassingHandler::RPCPassThrough(smart_objects::SmartObject rpc_message) { } case MessageType::kResponse: { - LOG4CXX_DEBUG(logger_, "Handle response"); + SDL_LOG_DEBUG("Handle response"); rpc_request_queue_lock_.Acquire(); if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) { rpc_request_queue_lock_.Release(); @@ -235,11 +233,11 @@ bool RPCPassingHandler::RPCPassThrough(smart_objects::SmartObject rpc_message) { &result_code); if (result_code == mobile_apis::Result::UNSUPPORTED_REQUEST) { - LOG4CXX_DEBUG(logger_, "Service sent UNSUPPORTED_REQUEST"); + SDL_LOG_DEBUG("Service sent UNSUPPORTED_REQUEST"); PerformNextRequest(correlation_id); return true; } else { - LOG4CXX_DEBUG(logger_, "Valid RPC passing response"); + SDL_LOG_DEBUG("Valid RPC passing response"); ForwardResponseToMobile(correlation_id, rpc_message); return true; } @@ -285,16 +283,14 @@ void RPCPassingHandler::PopulateRPCRequestQueue( sync_primitives::AutoLock lock(rpc_request_queue_lock_); rpc_request_queue[correlation_id] = entry; - LOG4CXX_DEBUG(logger_, - "Added " << rpc_request_queue[correlation_id].second.size() + SDL_LOG_DEBUG("Added " << rpc_request_queue[correlation_id].second.size() << " requests to the queue"); } void RPCPassingHandler::ForwardRequestToMobile(uint32_t correlation_id) { rpc_request_queue_lock_.Acquire(); uint32_t connection_key = rpc_request_queue[correlation_id].second.front().connection_key; - LOG4CXX_DEBUG(logger_, - "Forwarding request to service with app id " << connection_key); + SDL_LOG_DEBUG("Forwarding request to service with app id " << connection_key); smart_objects::SmartObject message(rpc_request_queue[correlation_id].first); message[strings::params][strings::connection_key] = connection_key; @@ -306,8 +302,7 @@ void RPCPassingHandler::ForwardRequestToMobile(uint32_t correlation_id) { } void RPCPassingHandler::ForwardRequestToCore(uint32_t correlation_id) { - LOG4CXX_DEBUG(logger_, - "No services left in map. using core to handle request"); + SDL_LOG_DEBUG("No services left in map. using core to handle request"); rpc_request_queue_lock_.Acquire(); smart_objects::SmartObject message(rpc_request_queue[correlation_id].first); smart_objects::SmartObjectSPtr result = @@ -354,8 +349,7 @@ void RPCPassingHandler::ForwardResponseToMobile( .asUInt(); rpc_request_queue_lock_.Release(); - LOG4CXX_DEBUG(logger_, - "Forwarding response to mobile app " << origin_connection_key); + SDL_LOG_DEBUG("Forwarding response to mobile app " << origin_connection_key); smart_objects::SmartObject message(response_message); message[strings::params][strings::connection_key] = origin_connection_key; smart_objects::SmartObjectSPtr result = @@ -364,10 +358,10 @@ void RPCPassingHandler::ForwardResponseToMobile( } bool RPCPassingHandler::PerformNextRequest(uint32_t correlation_id) { - LOG4CXX_DEBUG(logger_, "Performing next request in queue"); + SDL_LOG_DEBUG("Performing next request in queue"); rpc_request_queue_lock_.Acquire(); if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) { - LOG4CXX_ERROR(logger_, "Correlation id does NOT exist in map"); + SDL_LOG_ERROR("Correlation id does NOT exist in map"); rpc_request_queue_lock_.Release(); return false; } @@ -386,7 +380,7 @@ bool RPCPassingHandler::PerformNextRequest(uint32_t correlation_id) { void RPCPassingHandler::OnPassThroughRequestTimeout() { timeout_queue_lock_.Acquire(); - LOG4CXX_DEBUG(logger_, "Request Timed out"); + SDL_LOG_DEBUG("Request Timed out"); auto timeout_entry = timeout_queue_.front(); uint32_t correlation_id = timeout_entry.second; timeout_queue_lock_.Release(); @@ -396,13 +390,12 @@ void RPCPassingHandler::OnPassThroughRequestTimeout() { void RPCPassingHandler::ClearCompletedTimers() { sync_primitives::AutoLock lock(timeout_queue_lock_); - LOG4CXX_DEBUG(logger_, "Clearing Completed Timers"); + SDL_LOG_DEBUG("Clearing Completed Timers"); for (auto it = timeout_queue_.begin(); it != timeout_queue_.end();) { TimerSPtr timer = it->first; if (timer->is_completed()) { - LOG4CXX_DEBUG( - logger_, - "Removing completed timer for correlation id " << it->second); + SDL_LOG_DEBUG("Removing completed timer for correlation id " + << it->second); it = timeout_queue_.erase(it); } else { ++it; @@ -418,9 +411,8 @@ void RPCPassingHandler::AddRequestTimer(uint32_t correlation_id) { const uint32_t timeout_ms = app_manager_.get_settings().rpc_pass_through_timeout(); rpc_passing_timer->Start(timeout_ms, timer::kSingleShot); - LOG4CXX_DEBUG( - logger_, - "Adding and starting timer for correlation id " << correlation_id); + SDL_LOG_DEBUG("Adding and starting timer for correlation id " + << correlation_id); sync_primitives::AutoLock lock(timeout_queue_lock_); timeout_queue_.push_back(std::make_pair(rpc_passing_timer, correlation_id)); } @@ -432,8 +424,7 @@ void RPCPassingHandler::RemoveRequestTimer(uint32_t correlation_id) { TimerSPtr timer = it->first; uint32_t cid = it->second; if (cid == correlation_id) { - LOG4CXX_DEBUG(logger_, - "Removing timer for correlation id " << correlation_id); + SDL_LOG_DEBUG("Removing timer for correlation id " << correlation_id); it = timeout_queue_.erase(it); } else { ++it; diff --git a/src/components/application_manager/src/rpc_protection_manager_impl.cc b/src/components/application_manager/src/rpc_protection_manager_impl.cc index 4afceb9e5b..64b732ddb2 100644 --- a/src/components/application_manager/src/rpc_protection_manager_impl.cc +++ b/src/components/application_manager/src/rpc_protection_manager_impl.cc @@ -35,7 +35,7 @@ #include "application_manager/message_helper.h" #include "utils/helpers.h" -CREATE_LOGGERPTR_LOCAL(logger_, "RPCProtectionManagerImpl"); +SDL_CREATE_LOG_VARIABLE("RPCProtectionManagerImpl"); namespace application_manager { @@ -51,33 +51,33 @@ std::vector<std::string> kExceptionRPCs = {"RegisterAppInterface", RPCProtectionManagerImpl::RPCProtectionManagerImpl( policy::PolicyHandlerInterface& policy_handler) : policy_handler_(policy_handler) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } bool RPCProtectionManagerImpl::CheckPolicyEncryptionFlag( const uint32_t function_id, const ApplicationSharedPtr app, const bool is_rpc_service_secure) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& policy_encryption_flag_getter = policy_handler_.PolicyEncryptionFlagGetter(); if (!policy_encryption_flag_getter) { - LOG4CXX_ERROR(logger_, "Policy Encryption Flag getter is not inited"); + SDL_LOG_ERROR("Policy Encryption Flag getter is not inited"); return false; } const std::string function_name = policy_encryption_flag_getter->GetPolicyFunctionName(function_id); - LOG4CXX_DEBUG(logger_, "Function for check is " << function_name); + SDL_LOG_DEBUG("Function for check is " << function_name); if (!is_rpc_service_secure && IsExceptionRPC(function_id)) { - LOG4CXX_WARN(logger_, - "Exception RPC can be sent in an non secure service despite " - "encryption required flag"); + SDL_LOG_WARN( + "Exception RPC can be sent in an non secure service despite " + "encryption required flag"); return false; } if (!app) { - LOG4CXX_WARN(logger_, "Received app nullptr"); + SDL_LOG_WARN("Received app nullptr"); return false; } @@ -88,14 +88,13 @@ bool RPCProtectionManagerImpl::CheckPolicyEncryptionFlag( bool RPCProtectionManagerImpl::IsEncryptionRequiredByPolicy( const std::string& policy_app_id, const std::string& function_name) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto it = encrypted_rpcs_.find(policy_app_id); if (encrypted_rpcs_.end() == it) { - LOG4CXX_WARN( - logger_, - "App specific policies for app: " << policy_app_id << " not found"); + SDL_LOG_WARN("App specific policies for app: " << policy_app_id + << " not found"); it = encrypted_rpcs_.find(policy_table::kDefaultApp); return encrypted_rpcs_.end() != it ? (*it).second.find(function_name) != (*it).second.end() @@ -107,8 +106,8 @@ bool RPCProtectionManagerImpl::IsEncryptionRequiredByPolicy( bool RPCProtectionManagerImpl::IsInEncryptionNeededCache( const uint32_t app_id, const uint32_t correlation_id) const { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "correlation_id is " << correlation_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("correlation_id is " << correlation_id); return encryption_needed_cache_.find(std::make_pair( app_id, correlation_id)) != encryption_needed_cache_.end(); @@ -124,44 +123,43 @@ bool RPCProtectionManagerImpl::IsExceptionRPC( void RPCProtectionManagerImpl::AddToEncryptionNeededCache( const uint32_t app_id, const uint32_t correlation_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(message_needed_encryption_lock_); - LOG4CXX_DEBUG(logger_, "Adding rpc with correlation id: " << correlation_id); + SDL_LOG_DEBUG("Adding rpc with correlation id: " << correlation_id); encryption_needed_cache_.insert(std::make_pair(app_id, correlation_id)); } void RPCProtectionManagerImpl::RemoveFromEncryptionNeededCache( const uint32_t app_id, const uint32_t correlation_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(message_needed_encryption_lock_); - LOG4CXX_DEBUG(logger_, - "Removing rpc with correlation id: " << correlation_id); + SDL_LOG_DEBUG("Removing rpc with correlation id: " << correlation_id); encryption_needed_cache_.erase(std::make_pair(app_id, correlation_id)); } void RPCProtectionManagerImpl::OnPTUFinished(const bool ptu_result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(encrypted_rpcs_lock_); if (ptu_result) { - LOG4CXX_TRACE(logger_, - "PTU finished successfully, commencing internal encrypted " - "RPC cache update"); + SDL_LOG_TRACE( + "PTU finished successfully, commencing internal encrypted " + "RPC cache update"); encrypted_rpcs_.clear(); SaveEncryptedRPC(); } else { - LOG4CXX_WARN(logger_, - "PTU was unsuccessful. Keeping internal RPC cache from " - "current snapshot"); + SDL_LOG_WARN( + "PTU was unsuccessful. Keeping internal RPC cache from " + "current snapshot"); } } void RPCProtectionManagerImpl::SaveEncryptedRPC() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto policy_encryption_flag_getter = policy_handler_.PolicyEncryptionFlagGetter(); @@ -170,14 +168,14 @@ void RPCProtectionManagerImpl::SaveEncryptedRPC() { policy_encryption_flag_getter->GetApplicationPolicyIDs(); for (const auto& app : policy_policy_app_ids) { - LOG4CXX_DEBUG(logger_, "Processing app name: " << app); + SDL_LOG_DEBUG("Processing app name: " << app); encrypted_rpcs_[app] = GetEncryptedRPCsForApp(app); } } void RPCProtectionManagerImpl::OnPTInited() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); encrypted_rpcs_.clear(); @@ -187,7 +185,7 @@ void RPCProtectionManagerImpl::OnPTInited() { RPCProtectionManagerImpl::FunctionNames RPCProtectionManagerImpl::GetEncryptedRPCsForApp( const std::string& policy_app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionNames encrypted_rpcs; const auto policy_encryption_flag_getter = @@ -200,11 +198,11 @@ RPCProtectionManagerImpl::GetEncryptedRPCsForApp( const auto function_groups = policy_encryption_flag_getter->GetFunctionalGroupsForApp(policy_app_id); - auto fill_encrypted_rpcs = [&encrypted_rpcs]( - const std::string& function_name) { - LOG4CXX_DEBUG(logger_, "Adding required encryprion rpc: " << function_name); - encrypted_rpcs.insert(function_name); - }; + auto fill_encrypted_rpcs = + [&encrypted_rpcs](const std::string& function_name) { + SDL_LOG_DEBUG("Adding required encryprion rpc: " << function_name); + encrypted_rpcs.insert(function_name); + }; for (const auto& function_group : function_groups) { if (policy_encryption_flag_getter->FunctionGroupNeedEncryption( diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc index c7959c2386..248db00729 100644 --- a/src/components/application_manager/src/rpc_service_impl.cc +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -41,7 +41,7 @@ namespace application_manager { namespace rpc_service { -CREATE_LOGGERPTR_LOCAL(logger_, "RPCServiceImpl") +SDL_CREATE_LOG_VARIABLE("RPCServiceImpl") namespace formatters = ns_smart_device_link::ns_json_handler::formatters; namespace jhs = ns_smart_device_link::ns_json_handler::strings; namespace plugin_names = application_manager::plugin_manager::plugin_names; @@ -69,7 +69,7 @@ RPCServiceImpl::RPCServiceImpl( RPCServiceImpl::~RPCServiceImpl() {} void RPCServiceImpl::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); messages_to_mobile_.Shutdown(); messages_to_hmi_.Shutdown(); @@ -79,7 +79,7 @@ EncryptionFlagCheckResult RPCServiceImpl::IsEncryptionRequired( const smart_objects::SmartObject& message, std::shared_ptr<Application> app, const bool is_rpc_service_secure) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto function_id = message[strings::params][strings::function_id].asUInt(); const auto correlation_id = @@ -122,15 +122,15 @@ bool RPCServiceImpl::ManageMobileCommand( const commands::MessageSharedPtr message, commands::Command::CommandSource source, const std::string warning_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!message) { - LOG4CXX_WARN(logger_, "Null-pointer message received."); + SDL_LOG_WARN("Null-pointer message received."); return false; } if (app_manager_.IsLowVoltage()) { - LOG4CXX_WARN(logger_, "Low Voltage is active"); + SDL_LOG_WARN("Low Voltage is active"); return false; } @@ -165,7 +165,7 @@ bool RPCServiceImpl::ManageMobileCommand( (mobile_apis::FunctionID::UnregisterAppInterfaceID != function_id)) { app = app_manager_.application(connection_key); if (!app) { - LOG4CXX_ERROR(logger_, "RET APPLICATION_NOT_REGISTERED"); + SDL_LOG_ERROR("RET APPLICATION_NOT_REGISTERED"); smart_objects::SmartObjectSPtr response = MessageHelper::CreateNegativeResponse( connection_key, @@ -197,7 +197,7 @@ bool RPCServiceImpl::ManageMobileCommand( auto plugin = app_manager_.GetPluginManager().FindPluginToProcess(function_id, source); if (!plugin) { - LOG4CXX_WARN(logger_, "Failed to find plugin : " << plugin.error()); + SDL_LOG_WARN("Failed to find plugin : " << plugin.error()); CheckSourceForUnsupportedRequest(message, source); return false; } @@ -205,7 +205,7 @@ bool RPCServiceImpl::ManageMobileCommand( auto command = factory.CreateCommand(message, source); if (!command) { - LOG4CXX_WARN(logger_, "Failed to create mobile command from smart object"); + SDL_LOG_WARN("Failed to create mobile command from smart object"); return false; } @@ -257,12 +257,11 @@ bool RPCServiceImpl::ManageMobileCommand( request_ctrl_.addMobileRequest(command, app_hmi_level); if (result == request_controller::RequestController::SUCCESS) { - LOG4CXX_DEBUG(logger_, "Perform request"); + SDL_LOG_DEBUG("Perform request"); } else if (result == request_controller::RequestController:: TOO_MANY_PENDING_REQUESTS) { - LOG4CXX_ERROR(logger_, - "RET Unable top perform request: " - << "TOO_MANY_PENDING_REQUESTS"); + SDL_LOG_ERROR("RET Unable top perform request: " + << "TOO_MANY_PENDING_REQUESTS"); smart_objects::SmartObjectSPtr response = MessageHelper::CreateNegativeResponse( @@ -280,9 +279,8 @@ bool RPCServiceImpl::ManageMobileCommand( return false; } else if (result == request_controller::RequestController::TOO_MANY_REQUESTS) { - LOG4CXX_ERROR(logger_, - "RET Unable to perform request: " - << "TOO_MANY_REQUESTS"); + SDL_LOG_ERROR("RET Unable to perform request: " + << "TOO_MANY_REQUESTS"); ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( @@ -301,9 +299,8 @@ bool RPCServiceImpl::ManageMobileCommand( return false; } else if (result == request_controller::RequestController:: NONE_HMI_LEVEL_MANY_REQUESTS) { - LOG4CXX_ERROR(logger_, - "RET Unable to perform request: " - << "REQUEST_WHILE_IN_NONE_HMI_LEVEL"); + SDL_LOG_ERROR("RET Unable to perform request: " + << "REQUEST_WHILE_IN_NONE_HMI_LEVEL"); ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( @@ -320,13 +317,13 @@ bool RPCServiceImpl::ManageMobileCommand( connection_key, mobile_apis::Result::INVALID_ENUM, false); return false; } else { - LOG4CXX_ERROR(logger_, "RET Unable to perform request: Unknown case"); + SDL_LOG_ERROR("RET Unable to perform request: Unknown case"); return false; } return true; } - LOG4CXX_ERROR(logger_, "RET UNKNOWN MESSAGE TYPE " << message_type); + SDL_LOG_ERROR("RET UNKNOWN MESSAGE TYPE " << message_type); return false; } @@ -338,15 +335,15 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message, bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message, commands::Command::CommandSource source, const std::string warning_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!message) { - LOG4CXX_WARN(logger_, "Null-pointer message received."); + SDL_LOG_WARN("Null-pointer message received."); return false; } if (app_manager_.IsLowVoltage()) { - LOG4CXX_WARN(logger_, "Low Voltage is active"); + SDL_LOG_WARN("Low Voltage is active"); return false; } @@ -356,7 +353,7 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message, auto plugin = app_manager_.GetPluginManager().FindPluginToProcess(function_id, source); if (!plugin) { - LOG4CXX_WARN(logger_, "Filed to find plugin : " << plugin.error()); + SDL_LOG_WARN("Filed to find plugin : " << plugin.error()); return false; } @@ -364,7 +361,7 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message, auto command = factory.CreateCommand(message, source); if (!command) { - LOG4CXX_WARN(logger_, "Failed to create command from smart object"); + SDL_LOG_WARN("Failed to create command from smart object"); return false; } @@ -386,7 +383,7 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message, (*(message.get()))[strings::params][strings::message_type].asInt(); if (kRequest == message_type) { - LOG4CXX_DEBUG(logger_, "ManageHMICommand"); + SDL_LOG_DEBUG("ManageHMICommand"); command->set_warning_info(warning_info); request_ctrl_.addHMIRequest(command); } @@ -406,21 +403,20 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message, } void RPCServiceImpl::Handle(const impl::MessageToHmi message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!hmi_handler_) { - LOG4CXX_ERROR(logger_, "Observer is not set for HMIMessageHandler"); + SDL_LOG_ERROR("Observer is not set for HMIMessageHandler"); return; } hmi_handler_->SendMessageToHMI(message); - LOG4CXX_INFO(logger_, "Message for HMI given away"); + SDL_LOG_INFO("Message for HMI given away"); } void RPCServiceImpl::Handle(const impl::MessageToMobile message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!protocol_handler_) { - LOG4CXX_WARN(logger_, - "Protocol Handler is not set; cannot send message to mobile."); + SDL_LOG_WARN("Protocol Handler is not set; cannot send message to mobile."); return; } @@ -428,7 +424,7 @@ void RPCServiceImpl::Handle(const impl::MessageToMobile message) { MobileMessageHandler::HandleOutgoingMessageProtocol(message)); if (!rawMessage) { - LOG4CXX_ERROR(logger_, "Failed to create raw message."); + SDL_LOG_ERROR("Failed to create raw message."); return; } @@ -458,9 +454,9 @@ void RPCServiceImpl::Handle(const impl::MessageToMobile message) { correlation_id); if (needs_encryption && !is_service_secure) { - LOG4CXX_WARN(logger_, - "Unable to send rpc that requires encryption without secure " - "rpc service"); + SDL_LOG_WARN( + "Unable to send rpc that requires encryption without secure " + "rpc service"); return; }; @@ -468,7 +464,7 @@ void RPCServiceImpl::Handle(const impl::MessageToMobile message) { rawMessage, needs_encryption, is_final); rpc_protection_manager_->RemoveFromEncryptionNeededCache(app_id, correlation_id); - LOG4CXX_INFO(logger_, "Message for mobile given away"); + SDL_LOG_INFO("Message for mobile given away"); if (close_session) { app_manager_.connection_handler().CloseSession(message->connection_key(), @@ -479,16 +475,16 @@ void RPCServiceImpl::Handle(const impl::MessageToMobile message) { void RPCServiceImpl::SendMessageToMobile( const application_manager::commands::MessageSharedPtr message, bool final_message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!message) { - LOG4CXX_ERROR(logger_, "Null-pointer message received."); + SDL_LOG_ERROR("Null-pointer message received."); NOTREACHED(); return; } if (!protocol_handler_) { - LOG4CXX_WARN(logger_, "No Protocol Handler set"); + SDL_LOG_WARN("No Protocol Handler set"); return; } @@ -500,7 +496,7 @@ void RPCServiceImpl::SendMessageToMobile( bool allow_unknown_parameters = false; if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with connection key"); + SDL_LOG_ERROR("No application associated with connection key"); if (is_result_code_exists && ((*message)[strings::msg_params][strings::result_code] == ns_smart_device_link_rpc::V1::Result::UNSUPPORTED_VERSION)) { @@ -532,9 +528,8 @@ void RPCServiceImpl::SendMessageToMobile( if (IsAppServiceRPC(function_id, commands::Command::CommandSource::SOURCE_SDL) || rpc_passing) { - LOG4CXX_DEBUG( - logger_, - "Allowing unknown parameters for response function " << function_id); + SDL_LOG_DEBUG("Allowing unknown parameters for response function " + << function_id); allow_unknown_parameters = true; } @@ -552,13 +547,12 @@ void RPCServiceImpl::SendMessageToMobile( (*message)[strings::params][strings::function_id].asUInt()); mobile_so_factory().attachSchema(*message, false); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Attached schema to message, result if valid: " << message->isValid()); if (!ConvertSOtoMessage( (*message), (*message_to_send), allow_unknown_parameters)) { - LOG4CXX_WARN(logger_, "Can't send msg to Mobile: failed to create string"); + SDL_LOG_WARN("Can't send msg to Mobile: failed to create string"); return; } @@ -582,7 +576,7 @@ void RPCServiceImpl::SendMessageToMobile( for (; iter != iter_end; ++iter) { if (true == iter->second.asBool()) { - LOG4CXX_INFO(logger_, "Request's param: " << iter->first); + SDL_LOG_INFO("Request's param: " << iter->first); params.insert(iter->first); } } @@ -593,8 +587,7 @@ void RPCServiceImpl::SendMessageToMobile( app_manager_.CheckPolicyPermissions( app, window_id, string_functionID, params); if (mobile_apis::Result::SUCCESS != check_result) { - LOG4CXX_WARN(logger_, - "Function \"" << string_functionID << "\" (#" + SDL_LOG_WARN("Function \"" << string_functionID << "\" (#" << api_function_id << ") not allowed by policy"); return; @@ -612,8 +605,7 @@ void RPCServiceImpl::SendMessageToMobile( } if (message_to_send->binary_data()) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Binary data size: " << message_to_send->binary_data()->size()); } messages_to_mobile_.PostMessage( @@ -622,15 +614,15 @@ void RPCServiceImpl::SendMessageToMobile( void RPCServiceImpl::SendMessageToHMI( const commands::MessageSharedPtr message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!message) { - LOG4CXX_WARN(logger_, "Null-pointer message received."); + SDL_LOG_WARN("Null-pointer message received."); NOTREACHED(); return; } if (!hmi_handler_) { - LOG4CXX_WARN(logger_, "No HMI Handler set"); + SDL_LOG_WARN("No HMI Handler set"); return; } @@ -639,28 +631,25 @@ void RPCServiceImpl::SendMessageToHMI( std::shared_ptr<Message> message_to_send( new Message(protocol_handler::MessagePriority::kDefault)); if (!message_to_send) { - LOG4CXX_ERROR(logger_, "Null pointer"); + SDL_LOG_ERROR("Null pointer"); return; } hmi_so_factory().attachSchema(*message, false); - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( "Attached schema to message, result if valid: " << message->isValid()); if (IsAppServiceRPC((*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt(), commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) { - LOG4CXX_DEBUG(logger_, - "Allowing unknown parameters for response function " - << (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); + SDL_LOG_DEBUG("Allowing unknown parameters for response function " + << (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt()); allow_unknown_parameters = true; } if (!ConvertSOtoMessage( *message, *message_to_send, allow_unknown_parameters)) { - LOG4CXX_WARN(logger_, - "Cannot send message to HMI: failed to create string"); + SDL_LOG_WARN("Cannot send message to HMI: failed to create string"); return; } messages_to_hmi_.PostMessage(impl::MessageToHmi(message_to_send)); @@ -716,16 +705,15 @@ bool RPCServiceImpl::ConvertSOtoMessage( const ns_smart_device_link::ns_smart_objects::SmartObject& message, Message& output, const bool allow_unknown_parameters) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (smart_objects::SmartType_Null == message.getType() || smart_objects::SmartType_Invalid == message.getType()) { - LOG4CXX_WARN(logger_, "Invalid smart object received."); + SDL_LOG_WARN("Invalid smart object received."); return false; } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Message with protocol: " << message.getElement(jhs::S_PARAMS) .getElement(jhs::S_PROTOCOL_TYPE) .asInt()); @@ -742,7 +730,7 @@ bool RPCServiceImpl::ConvertSOtoMessage( if (protocol_version == 1) { if (!formatters::CFormatterJsonSDLRPCv1::toString( message, output_string, !allow_unknown_parameters)) { - LOG4CXX_WARN(logger_, "Failed to serialize smart object"); + SDL_LOG_WARN("Failed to serialize smart object"); return false; } output.set_protocol_version( @@ -750,7 +738,7 @@ bool RPCServiceImpl::ConvertSOtoMessage( } else { if (!formatters::CFormatterJsonSDLRPCv2::toString( message, output_string, !allow_unknown_parameters)) { - LOG4CXX_WARN(logger_, "Failed to serialize smart object"); + SDL_LOG_WARN("Failed to serialize smart object"); return false; } output.set_protocol_version( @@ -763,7 +751,7 @@ bool RPCServiceImpl::ConvertSOtoMessage( case 1: { if (!formatters::FormatterJsonRpc::ToString( message, output_string, !allow_unknown_parameters)) { - LOG4CXX_WARN(logger_, "Failed to serialize smart object"); + SDL_LOG_WARN("Failed to serialize smart object"); return false; } output.set_protocol_version( @@ -775,7 +763,7 @@ bool RPCServiceImpl::ConvertSOtoMessage( return false; } - LOG4CXX_DEBUG(logger_, "Conversion result: " << output_string); + SDL_LOG_DEBUG("Conversion result: " << output_string); output.set_connection_key(message.getElement(jhs::S_PARAMS) .getElement(strings::connection_key) @@ -810,7 +798,7 @@ bool RPCServiceImpl::ConvertSOtoMessage( output.set_binary_data(&binaryData); } - LOG4CXX_DEBUG(logger_, "Successfully parsed smart object into message"); + SDL_LOG_DEBUG("Successfully parsed smart object into message"); return true; } diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index ffff294664..3cebc74a4a 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -40,7 +40,7 @@ namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "StateControllerImpl") +SDL_CREATE_LOG_VARIABLE("StateControllerImpl") namespace { bool IsStateChanged(const HmiState& old_state, const HmiState& new_state) { @@ -70,13 +70,12 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, const WindowID window_id, HmiStatePtr state, const bool request_hmi_state_change) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(HmiState::STATE_ID_REGULAR == state->state_id()); - LOG4CXX_DEBUG(logger_, - "Set window #" << window_id << " regular state " << *state); + SDL_LOG_DEBUG("Set window #" << window_id << " regular state " << *state); if (state->hmi_level() == mobile_apis::HMILevel::INVALID_ENUM || state->audio_streaming_state() == @@ -84,7 +83,7 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, state->video_streaming_state() == mobile_apis::VideoStreamingState::INVALID_ENUM || state->system_context() == mobile_apis::SystemContext::INVALID_ENUM) { - LOG4CXX_ERROR(logger_, "Got invalid state"); + SDL_LOG_ERROR("Got invalid state"); return; } @@ -102,7 +101,7 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, return; } - LOG4CXX_DEBUG(logger_, "Resolved state: " << *resolved_state); + SDL_LOG_DEBUG("Resolved state: " << *resolved_state); const hmi_apis::Common_HMILevel::eType hmi_level = static_cast<hmi_apis::Common_HMILevel::eType>( resolved_state->hmi_level()); @@ -120,7 +119,7 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, app_mngr_.set_application_id(corr_id, app->hmi_app_id()); return; } - LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateApp"); + SDL_LOG_ERROR("Unable to send BC.ActivateApp"); return; } ApplyRegularState(app, window_id, resolved_state); @@ -133,7 +132,7 @@ void StateControllerImpl::SetRegularState( const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::VideoStreamingState::eType video_state, const bool request_hmi_state_change) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_regular = app->RegularHmiState(window_id); DCHECK_OR_RETURN_VOID(prev_regular); @@ -154,7 +153,7 @@ void StateControllerImpl::SetRegularState( const mobile_apis::HMILevel::eType hmi_level, const bool request_hmi_state_change) { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_regular = app->RegularHmiState(window_id); @@ -180,7 +179,7 @@ void StateControllerImpl::SetRegularState( const mobile_apis::VideoStreamingState::eType video_state, const mobile_apis::SystemContext::eType system_context, const bool request_hmi_state_change) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_regular = app->RegularHmiState(window_id); @@ -202,7 +201,7 @@ void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, const WindowID window_id, const mobile_apis::HMILevel::eType hmi_level) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_state = app->RegularHmiState(window_id); HmiStatePtr hmi_state = @@ -221,7 +220,7 @@ void StateControllerImpl::SetRegularState( ApplicationSharedPtr app, const WindowID window_id, const mobile_apis::SystemContext::eType system_context) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_regular = app->RegularHmiState(window_id); DCHECK_OR_RETURN_VOID(prev_regular); @@ -243,7 +242,7 @@ void StateControllerImpl::SetRegularState( const WindowID window_id, const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::VideoStreamingState::eType video_state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_state = app->RegularHmiState(window_id); DCHECK_OR_RETURN_VOID(prev_state); @@ -261,7 +260,7 @@ void StateControllerImpl::SetRegularState( void StateControllerImpl::SetRegularState(ApplicationSharedPtr app, const WindowID window_id, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(state); @@ -347,16 +346,14 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()( // - all audio/video applications with the same app type become BACKGROUND if (!IsStreamableHMILevel(state_->hmi_level())) { - LOG4CXX_DEBUG(logger_, - "Applied for app " << applied_->app_id() << " HMI level " + SDL_LOG_DEBUG("Applied for app " << applied_->app_id() << " HMI level " << state_->hmi_level() << " is NOT streamable. Exit."); return; } if (!IsStreamableHMILevel(state_to_resolve->hmi_level())) { - LOG4CXX_DEBUG(logger_, - "To resolve app " << app_to_resolve->app_id() << " HMI level " + SDL_LOG_DEBUG("To resolve app " << app_to_resolve->app_id() << " HMI level " << state_to_resolve->hmi_level() << " is NOT streamable. Exit."); return; @@ -415,8 +412,7 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()( state_to_resolve->video_streaming_state()) != std::make_tuple( result_hmi_level, result_audio_state, result_video_state)) { - LOG4CXX_DEBUG(logger_, - "Application " << app_to_resolve->app_id() << " window " + SDL_LOG_DEBUG("Application " << app_to_resolve->app_id() << " window " << window_id_ << " will change state to: " << "HMI level " << to_resolve_hmi_level << " --> " << result_hmi_level << ", audio " @@ -430,8 +426,7 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()( result_audio_state, result_video_state); } else { - LOG4CXX_DEBUG(logger_, - "Application " << app_to_resolve->app_id() << " window " + SDL_LOG_DEBUG("Application " << app_to_resolve->app_id() << " window " << window_id_ << " will NOT change HMI level"); } } @@ -439,8 +434,8 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()( HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app, HmiStatePtr state) const { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "State to resolve: " << *state); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("State to resolve: " << *state); HmiStatePtr available_state = CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); @@ -466,18 +461,17 @@ HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app, bool StateControllerImpl::IsResumptionAllowed(ApplicationSharedPtr app, HmiStatePtr state) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis; if (!app->is_resuming() || !IsStreamableHMILevel(state->hmi_level())) { - LOG4CXX_DEBUG(logger_, "Application is not in resuming mode."); + SDL_LOG_DEBUG("Application is not in resuming mode."); return true; } if (IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE) && app->is_media_application()) { - LOG4CXX_DEBUG(logger_, - "Resumption for media app is not allowed. " - << "AUDIO_SOURCE event is active"); + SDL_LOG_DEBUG("Resumption for media app is not allowed. " + << "AUDIO_SOURCE event is active"); return false; } @@ -487,9 +481,8 @@ bool StateControllerImpl::IsResumptionAllowed(ApplicationSharedPtr app, if (IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI) && (is_navi_app || is_mob_projection_app || is_wep_app)) { - LOG4CXX_DEBUG(logger_, - "Resumption for navi and projection apps is not allowed. " - << "EMBEDDED_NAVI event is active"); + SDL_LOG_DEBUG("Resumption for navi and projection apps is not allowed. " + << "EMBEDDED_NAVI event is active"); return false; } @@ -498,10 +491,10 @@ bool StateControllerImpl::IsResumptionAllowed(ApplicationSharedPtr app, mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel( ApplicationSharedPtr app, mobile_apis::HMILevel::eType hmi_level) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); mobile_apis::HMILevel::eType result = hmi_level; - LOG4CXX_DEBUG(logger_, "HMI Level: " << hmi_level); + SDL_LOG_DEBUG("HMI Level: " << hmi_level); if (!IsStreamableHMILevel(hmi_level)) { return result; @@ -528,15 +521,15 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel( result = mobile_apis::HMILevel::HMI_LIMITED; } else if (app->is_navi() && IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE)) { - LOG4CXX_DEBUG(logger_, - "Navigation app will be resumed to LIMITED, " - "because of AUDIO_SOURCE ia active."); + SDL_LOG_DEBUG( + "Navigation app will be resumed to LIMITED, " + "because of AUDIO_SOURCE ia active."); result = mobile_apis::HMILevel::HMI_LIMITED; } else if (app->is_media_application() && IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI)) { - LOG4CXX_DEBUG(logger_, - "Media app will be resumed to LIMITED, " - "because of EMBEDDED_NAVI is active."); + SDL_LOG_DEBUG( + "Media app will be resumed to LIMITED, " + "because of EMBEDDED_NAVI is active."); result = mobile_apis::HMILevel::HMI_LIMITED; } } else if (is_active_app_exist) { @@ -549,8 +542,8 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel( bool StateControllerImpl::IsStateAvailable(ApplicationSharedPtr app, HmiStatePtr state) const { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Checking state: " << *state); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Checking state: " << *state); if (app->is_resuming()) { return IsStateAvailableForResumption(app, state); @@ -559,51 +552,46 @@ bool StateControllerImpl::IsStateAvailable(ApplicationSharedPtr app, if (IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE) || IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI)) { if (HMILevel::HMI_FULL == state->hmi_level()) { - LOG4CXX_DEBUG(logger_, - "AUDIO_SOURCE or EMBEDDED_NAVI is active." - << " Requested state is not available"); + SDL_LOG_DEBUG("AUDIO_SOURCE or EMBEDDED_NAVI is active." + << " Requested state is not available"); return false; } } - LOG4CXX_DEBUG(logger_, "Requested state is available"); + SDL_LOG_DEBUG("Requested state is available"); return true; } bool StateControllerImpl::IsStateAvailableForResumption( ApplicationSharedPtr app, HmiStatePtr state) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis; if (!app->is_resuming() || !IsStreamableHMILevel(state->hmi_level())) { - LOG4CXX_DEBUG(logger_, - "Application is not in resuming mode." - << " Requested state is available"); + SDL_LOG_DEBUG("Application is not in resuming mode." + << " Requested state is available"); return true; } if (IsTempStateActive(HmiState::StateID::STATE_ID_VR_SESSION) || IsTempStateActive(HmiState::StateID::STATE_ID_SAFETY_MODE)) { - LOG4CXX_DEBUG(logger_, - "Requested state is not available. " - << "VR session or emergency event is active"); + SDL_LOG_DEBUG("Requested state is not available. " + << "VR session or emergency event is active"); return false; } if (IsTempStateActive(HmiState::StateID::STATE_ID_PHONE_CALL) && app->is_media_application()) { - LOG4CXX_DEBUG(logger_, - "Requested state for media application " - << "is not available. Phone call is active"); + SDL_LOG_DEBUG("Requested state for media application " + << "is not available. Phone call is active"); return false; } if (IsTempStateActive(HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) { - LOG4CXX_DEBUG(logger_, - "Requested state is not available. " - << "Deactivate HMI event is active"); + SDL_LOG_DEBUG("Requested state is not available. " + << "Deactivate HMI event is active"); return false; } - LOG4CXX_DEBUG(logger_, "Requested state is available"); + SDL_LOG_DEBUG("Requested state is available"); return true; } @@ -611,10 +599,9 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app, const WindowID window_id, HmiStatePtr state) { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(state); - LOG4CXX_DEBUG(logger_, - "Setup window #" << window_id << " regular state: " << *state); + SDL_LOG_DEBUG("Setup window #" << window_id << " regular state: " << *state); HmiStatePtr curr_state = app->CurrentHmiState(window_id); HmiStatePtr old_state = CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); @@ -628,9 +615,8 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app, if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id && HMILevel::HMI_LIMITED == state->hmi_level() && app->is_resuming()) { - LOG4CXX_DEBUG(logger_, - "Resuming to LIMITED level. " - << "Send OnResumeAudioSource notification"); + SDL_LOG_DEBUG("Resuming to LIMITED level. " + << "Send OnResumeAudioSource notification"); MessageHelper::SendOnResumeAudioSourceToHMI(app->app_id(), app_mngr_); } @@ -644,7 +630,7 @@ void StateControllerImpl::SetupRegularHmiState( const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_state, const mobile_apis::VideoStreamingState::eType video_state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); HmiStatePtr prev_state = app->RegularHmiState(window_id); DCHECK_OR_RETURN_VOID(prev_state); @@ -662,39 +648,36 @@ void StateControllerImpl::SetupRegularHmiState( void StateControllerImpl::ApplyRegularState(ApplicationSharedPtr app, const WindowID window_id, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(state); DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR); - LOG4CXX_DEBUG(logger_, - "Applying to app " << app->app_id() << " window #" << window_id + SDL_LOG_DEBUG("Applying to app " << app->app_id() << " window #" << window_id << " state " << *state); SetupRegularHmiState(app, window_id, state); if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) { - LOG4CXX_DEBUG(logger_, "No need to resolve conflicts for a widget"); + SDL_LOG_DEBUG("No need to resolve conflicts for a widget"); return; } - LOG4CXX_DEBUG(logger_, - "Resolving HMI level conflicts for app " << app->app_id()); + SDL_LOG_DEBUG("Resolving HMI level conflicts for app " << app->app_id()); ForEachApplication(HmiLevelConflictResolver(app, window_id, state, this)); } void StateControllerImpl::UpdateAppWindowsStreamingState( ApplicationSharedPtr app, HmiStatePtr state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto window_ids = app->GetWindowIds(); for (auto window_id : window_ids) { HmiStatePtr window_hmi_state = app->RegularHmiState(window_id); - LOG4CXX_DEBUG( - logger_, "State: " << *state << " window state: " << *window_hmi_state); + SDL_LOG_DEBUG("State: " << *state + << " window state: " << *window_hmi_state); if (window_hmi_state->audio_streaming_state() != state->audio_streaming_state() || window_hmi_state->video_streaming_state() != state->video_streaming_state()) { - LOG4CXX_DEBUG(logger_, - "Updating streaming state for window #" << window_id); + SDL_LOG_DEBUG("Updating streaming state for window #" << window_id); HmiStatePtr new_window_state = CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); @@ -721,7 +704,7 @@ void StateControllerImpl::on_event(const event_engine::Event& event) { using namespace hmi_apis; namespace FunctionID = hmi_apis::FunctionID; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const SmartObject& message = event.smart_object(); const FunctionID::eType id = static_cast<FunctionID::eType>(event.id()); switch (id) { @@ -806,8 +789,7 @@ void StateControllerImpl::on_event(const event_engine::Event& event) { } } - LOG4CXX_WARN(logger_, - "Couldn't recognize state id (val='" << state_id << "')"); + SDL_LOG_WARN("Couldn't recognize state id (val='" << state_id << "')"); break; } default: @@ -816,7 +798,7 @@ void StateControllerImpl::on_event(const event_engine::Event& event) { } void StateControllerImpl::ActivateDefaultWindow(ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis; const WindowID window_id = PredefinedWindows::DEFAULT_WINDOW; @@ -838,7 +820,7 @@ void StateControllerImpl::ActivateDefaultWindow(ApplicationSharedPtr app) { } void StateControllerImpl::ExitDefaultWindow(ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis; const WindowID window_id = PredefinedWindows::DEFAULT_WINDOW; @@ -861,26 +843,24 @@ void StateControllerImpl::OnStateChanged(ApplicationSharedPtr app, const WindowID window_id, HmiStatePtr old_state, HmiStatePtr new_state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); DCHECK_OR_RETURN_VOID(old_state); DCHECK_OR_RETURN_VOID(new_state); - LOG4CXX_DEBUG(logger_, - "Window #" << window_id << " old state: " << *old_state); - LOG4CXX_DEBUG(logger_, - "Window #" << window_id << " new state: " << *new_state); + SDL_LOG_DEBUG("Window #" << window_id << " old state: " << *old_state); + SDL_LOG_DEBUG("Window #" << window_id << " new state: " << *new_state); if (!IsStateChanged(*old_state, *new_state)) { - LOG4CXX_DEBUG(logger_, "State has NOT been changed."); + SDL_LOG_DEBUG("State has NOT been changed."); return; } MessageHelper::SendHMIStatusNotification(app, window_id, app_mngr_); if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) { - LOG4CXX_DEBUG(logger_, - "State was changed not for a main application window. No " - "additional actions required"); + SDL_LOG_DEBUG( + "State was changed not for a main application window. No " + "additional actions required"); return; } @@ -900,7 +880,7 @@ bool StateControllerImpl::IsTempStateActive(HmiState::StateID id) const { void StateControllerImpl::OnApplicationRegistered( ApplicationSharedPtr app, const mobile_apis::HMILevel::eType default_level) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // After app registration HMI level should be set for DEFAULT_WINDOW only OnAppWindowAdded(app, @@ -917,7 +897,7 @@ void StateControllerImpl::OnAppWindowAdded( namespace HMILevel = mobile_apis::HMILevel; namespace AudioStreamingState = mobile_apis::AudioStreamingState; namespace SystemContext = mobile_apis::SystemContext; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); { @@ -956,7 +936,7 @@ int64_t StateControllerImpl::RequestHMIStateChange( ApplicationConstSharedPtr app, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr request = NULL; if (hmi_apis::Common_HMILevel::NONE == level) { request = MessageHelper::GetBCCloseApplicationRequestToHMI(app, app_mngr_); @@ -969,11 +949,11 @@ int64_t StateControllerImpl::RequestHMIStateChange( app_mngr_); } if (!request) { - LOG4CXX_ERROR(logger_, "Unable to create request"); + SDL_LOG_ERROR("Unable to create request"); return -1; } if (!app_mngr_.GetRPCService().ManageHMICommand(request)) { - LOG4CXX_ERROR(logger_, "Unable to send request"); + SDL_LOG_ERROR("Unable to send request"); return -1; } const uint32_t corr_id = @@ -982,7 +962,7 @@ int64_t StateControllerImpl::RequestHMIStateChange( } void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); const WindowIds window_ids = app->GetWindowIds(); @@ -997,7 +977,7 @@ void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) { } void StateControllerImpl::TempStateStarted(HmiState::StateID id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock autolock(active_states_lock_); @@ -1007,11 +987,11 @@ void StateControllerImpl::TempStateStarted(HmiState::StateID id) { } } - LOG4CXX_ERROR(logger_, "StateID '" << id << "' is already active"); + SDL_LOG_ERROR("StateID '" << id << "' is already active"); } void StateControllerImpl::TempStateStopped(HmiState::StateID ID) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock autolock(active_states_lock_); active_states_.remove(ID); @@ -1023,15 +1003,14 @@ void StateControllerImpl::TempStateStopped(HmiState::StateID ID) { void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app, const WindowID window_id) { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); const HmiStatePtr regular = app->RegularHmiState(window_id); DCHECK_OR_RETURN_VOID(regular); HmiStatePtr new_regular = std::make_shared<HmiState>(*regular); - LOG4CXX_DEBUG(logger_, - "Window #" << window_id << " current HMI level: '" + SDL_LOG_DEBUG("Window #" << window_id << " current HMI level: '" << app->hmi_level(window_id) << "'"); const bool is_audio_app = app->IsAudioApplication(); const bool is_video_app = app->IsVideoApplication(); @@ -1083,12 +1062,12 @@ void StateControllerImpl::OnHMIResponse( void StateControllerImpl::OnAppActivated( const smart_objects::SmartObject& message) { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t app_id = message[strings::msg_params][strings::app_id].asUInt(); ApplicationSharedPtr app = app_mngr_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application with id " << app_id << " not found"); + SDL_LOG_ERROR("Application with id " << app_id << " not found"); return; } @@ -1099,9 +1078,8 @@ void StateControllerImpl::OnAppActivated( const auto window_ids = app->GetWindowIds(); if (!helpers::in_range(window_ids, window_id)) { - LOG4CXX_ERROR( - logger_, - "Application " << app_id << " does not contain window #" << window_id); + SDL_LOG_ERROR("Application " << app_id << " does not contain window #" + << window_id); return; } @@ -1124,12 +1102,12 @@ void StateControllerImpl::OnAppActivated( void StateControllerImpl::OnAppDeactivated( const smart_objects::SmartObject& message) { using namespace mobile_apis; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t app_id = message[strings::msg_params][strings::app_id].asUInt(); ApplicationSharedPtr app = app_mngr_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application with id " << app_id << " not found"); + SDL_LOG_ERROR("Application with id " << app_id << " not found"); return; } @@ -1140,9 +1118,8 @@ void StateControllerImpl::OnAppDeactivated( const auto window_ids = app->GetWindowIds(); if (!helpers::in_range(window_ids, window_id)) { - LOG4CXX_ERROR( - logger_, - "Application " << app_id << " does not contain window #" << window_id); + SDL_LOG_ERROR("Application " << app_id << " does not contain window #" + << window_id); return; } @@ -1187,7 +1164,7 @@ void StateControllerImpl::OnVideoStreamingStopped( } bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); switch (state_id) { case HmiState::STATE_ID_CURRENT: case HmiState::STATE_ID_REGULAR: @@ -1201,7 +1178,7 @@ bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const { HmiStatePtr StateControllerImpl::CreateHmiState( std::shared_ptr<Application> app, HmiState::StateID state_id) const { using namespace utils; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); HmiStatePtr new_state; switch (state_id) { case HmiState::STATE_ID_PHONE_CALL: { @@ -1249,7 +1226,7 @@ HmiStatePtr StateControllerImpl::CreateHmiState( break; } default: - LOG4CXX_FATAL(logger_, "Invalid state_id " << state_id); + SDL_LOG_FATAL("Invalid state_id " << state_id); NOTREACHED(); break; } @@ -1264,10 +1241,9 @@ mobile_apis::AudioStreamingState::eType StateControllerImpl::CalcAudioState( state = mobile_apis::AudioStreamingState::AUDIBLE; } - LOG4CXX_DEBUG(logger_, - "Calculated audio state of app " - << app->app_id() << " for " << hmi_level << " HMI level is " - << state); + SDL_LOG_DEBUG("Calculated audio state of app " + << app->app_id() << " for " << hmi_level << " HMI level is " + << state); return state; } @@ -1280,10 +1256,9 @@ mobile_apis::VideoStreamingState::eType StateControllerImpl::CalcVideoState( state = mobile_apis::VideoStreamingState::STREAMABLE; } - LOG4CXX_DEBUG(logger_, - "Calculated video state of app " - << app->app_id() << " for " << hmi_level << " HMI level is " - << state); + SDL_LOG_DEBUG("Calculated video state of app " + << app->app_id() << " for " << hmi_level << " HMI level is " + << state); return state; } diff --git a/src/components/application_manager/src/system_time/system_time_handler_impl.cc b/src/components/application_manager/src/system_time/system_time_handler_impl.cc index deb92d5d81..3aee6d7e21 100644 --- a/src/components/application_manager/src/system_time/system_time_handler_impl.cc +++ b/src/components/application_manager/src/system_time/system_time_handler_impl.cc @@ -41,7 +41,7 @@ namespace application_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "SystemTimeHandler") +SDL_CREATE_LOG_VARIABLE("SystemTimeHandler") SystemTimeHandlerImpl::SystemTimeHandlerImpl( ApplicationManager& application_manager) @@ -51,66 +51,65 @@ SystemTimeHandlerImpl::SystemTimeHandlerImpl( , last_time_(0) , system_time_listener_(NULL) , app_manager_(application_manager) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); subscribe_on_event( hmi_apis::FunctionID::BasicCommunication_OnSystemTimeReady); } SystemTimeHandlerImpl::~SystemTimeHandlerImpl() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); unsubscribe_from_all_hmi_events(); } void SystemTimeHandlerImpl::DoSystemTimeQuery() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace application_manager; sync_primitives::AutoLock lock(state_lock_); if (!utc_time_can_be_received_) { - LOG4CXX_INFO(logger_, - "Navi module is not yet ready." - << "Will process request once it became ready."); + SDL_LOG_INFO("Navi module is not yet ready." + << " Will process request once it became ready."); return; } SendTimeRequest(); } void SystemTimeHandlerImpl::DoSubscribe(utils::SystemTimeListener* listener) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(listener); sync_primitives::AutoLock lock(system_time_listener_lock_); system_time_listener_ = listener; } void SystemTimeHandlerImpl::ResetPendingSystemTimeRequests() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); unsubscribe_from_event( hmi_apis::FunctionID::BasicCommunication_GetSystemTime); awaiting_get_system_time_ = false; } void SystemTimeHandlerImpl::DoUnsubscribe(utils::SystemTimeListener* listener) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(system_time_listener_lock_); system_time_listener_ = NULL; } time_t SystemTimeHandlerImpl::FetchSystemTime() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return last_time_; } bool SystemTimeHandlerImpl::utc_time_can_be_received() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(state_lock_); return utc_time_can_be_received_; } void SystemTimeHandlerImpl::SendTimeRequest() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (awaiting_get_system_time_) { - LOG4CXX_WARN(logger_, "Another GetSystemTime request in progress. Skipped"); + SDL_LOG_WARN("Another GetSystemTime request in progress. Skipped"); return; } @@ -124,7 +123,7 @@ void SystemTimeHandlerImpl::SendTimeRequest() { void SystemTimeHandlerImpl::on_event( const application_manager::event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace application_manager; using namespace hmi_apis::FunctionID; switch (event.id()) { @@ -135,13 +134,13 @@ void SystemTimeHandlerImpl::on_event( ProcessSystemTimeResponse(event); break; default: - LOG4CXX_ERROR(logger_, "Unknown Event received"); + SDL_LOG_ERROR("Unknown Event received"); break; } } void SystemTimeHandlerImpl::ProcessSystemTimeReadyNotification() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(state_lock_); utc_time_can_be_received_ = true; unsubscribe_from_event( @@ -150,7 +149,7 @@ void SystemTimeHandlerImpl::ProcessSystemTimeReadyNotification() { void SystemTimeHandlerImpl::ProcessSystemTimeResponse( const application_manager::event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); const auto result = static_cast<hmi_apis::Common_Result::eType>( |