diff options
author | VladSemenyuk <VSemenyuk@luxoft.com> | 2020-09-01 20:35:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 13:35:06 -0400 |
commit | 062d3b0f2a6eb2185d14dc80a885cdfe4860ce23 (patch) | |
tree | 766c4725b8b129cec2d420ff65ae7e9731e91194 | |
parent | 79fb6408810d776278bf3499c5273eb04159b076 (diff) | |
download | sdl_core-062d3b0f2a6eb2185d14dc80a885cdfe4860ce23.tar.gz |
[SDL 0046] Implement logger abstraction (#3472)
* Implement logger abstraction. Integrate it to SDL.
Create one logger instance for shared libraries
* Rename all logger macros.
* Update src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
Co-authored-by: Shobhit Adlakha <ShobhitAd@users.noreply.github.com>
* Fix review comments(errors in log messages)
* Fix review coments
* Fix code style
* Add logger variable creation to new commads
* Fix review comment
* Fixe review comment(class imblemtation moved to .cc file)
Co-authored-by: Shobhit Adlakha <ShobhitAd@users.noreply.github.com>
664 files changed, 10273 insertions, 11086 deletions
diff --git a/src/appMain/life_cycle_impl.cc b/src/appMain/life_cycle_impl.cc index 4c2d1e88ac..a14ca1240c 100644 --- a/src/appMain/life_cycle_impl.cc +++ b/src/appMain/life_cycle_impl.cc @@ -43,17 +43,13 @@ #include "security_manager/security_manager_impl.h" #endif // ENABLE_SECURITY -#ifdef ENABLE_LOG -#include "utils/log_message_loop_thread.h" -#endif // ENABLE_LOG - #include "appMain/low_voltage_signals_handler.h" using threads::Thread; namespace main_namespace { -CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain") +SDL_CREATE_LOG_VARIABLE("SDLMain") LifeCycleImpl::LifeCycleImpl(const profile::Profile& profile) : transport_manager_(NULL) @@ -78,7 +74,7 @@ LifeCycleImpl::LifeCycleImpl(const profile::Profile& profile) } bool LifeCycleImpl::StartComponents() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(!last_state_wrapper_); auto last_state = std::make_shared<resumption::LastStateImpl>( @@ -123,7 +119,7 @@ bool LifeCycleImpl::StartComponents() { app_manager_->set_connection_handler(connection_handler_); app_manager_->AddPolicyObserver(protocol_handler_); if (!app_manager_->Init(last_state_wrapper_, media_manager_)) { - LOG4CXX_ERROR(logger_, "Application manager init failed."); + SDL_LOG_ERROR("Application manager init failed."); return false; } @@ -146,7 +142,7 @@ bool LifeCycleImpl::StartComponents() { app_manager_->AddPolicyObserver(security_manager_); if (!crypto_manager_->Init()) { - LOG4CXX_ERROR(logger_, "CryptoManager initialization fail."); + SDL_LOG_ERROR("CryptoManager initialization fail."); return false; } #endif // ENABLE_SECURITY @@ -175,7 +171,7 @@ bool LifeCycleImpl::StartComponents() { app_manager_->set_protocol_handler(protocol_handler_); if (transport_manager::E_SUCCESS != transport_manager_->Init(last_state_wrapper_)) { - LOG4CXX_ERROR(logger_, "Transport manager init failed."); + SDL_LOG_ERROR("Transport manager init failed."); return false; } // start transport manager @@ -193,7 +189,7 @@ bool LifeCycleImpl::StartComponents() { } void LifeCycleImpl::LowVoltage() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager_->PerformActionOnClients( transport_manager::TransportAction::kListeningOff); transport_manager_->StopEventsProcessing(); @@ -202,12 +198,12 @@ void LifeCycleImpl::LowVoltage() { } void LifeCycleImpl::IgnitionOff() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); kill(getpid(), SIGINT); } void LifeCycleImpl::WakeUp() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager_->Reinit(); transport_manager_->PerformActionOnClients( transport_manager::TransportAction::kListeningOn); @@ -235,35 +231,35 @@ namespace { void sig_handler(int sig) { switch (sig) { case SIGINT: - LOG4CXX_DEBUG(logger_, "SIGINT signal has been caught"); + SDL_LOG_DEBUG("SIGINT signal has been caught"); break; case SIGTERM: - LOG4CXX_DEBUG(logger_, "SIGTERM signal has been caught"); + SDL_LOG_DEBUG("SIGTERM signal has been caught"); break; case SIGSEGV: - LOG4CXX_DEBUG(logger_, "SIGSEGV signal has been caught"); - FLUSH_LOGGER(); + SDL_LOG_DEBUG("SIGSEGV signal has been caught"); + SDL_FLUSH_LOGGER(); // exit need to prevent endless sending SIGSEGV // http://stackoverflow.com/questions/2663456/how-to-write-a-signal-handler-to-catch-sigsegv abort(); default: - LOG4CXX_DEBUG(logger_, "Unexpected signal has been caught"); + SDL_LOG_DEBUG("Unexpected signal has been caught"); exit(EXIT_FAILURE); } } } // namespace void LifeCycleImpl::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Register signal handlers and wait sys signals // from OS if (!utils::Signals::WaitTerminationSignals(&sig_handler)) { - LOG4CXX_FATAL(logger_, "Fail to catch system signal!"); + SDL_LOG_FATAL("Fail to catch system signal!"); } } void LifeCycleImpl::StopComponents() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(hmi_handler_); hmi_handler_->set_message_observer(NULL); @@ -277,7 +273,7 @@ void LifeCycleImpl::StopComponents() { DCHECK_OR_RETURN_VOID(app_manager_); app_manager_->Stop(); - LOG4CXX_INFO(logger_, "Stopping Protocol Handler"); + SDL_LOG_INFO("Stopping Protocol Handler"); DCHECK_OR_RETURN_VOID(protocol_handler_); protocol_handler_->RemoveProtocolObserver(media_manager_); @@ -285,23 +281,23 @@ void LifeCycleImpl::StopComponents() { protocol_handler_->RemoveProtocolObserver(security_manager_); if (security_manager_) { security_manager_->RemoveListener(app_manager_); - LOG4CXX_INFO(logger_, "Destroying Crypto Manager"); + SDL_LOG_INFO("Destroying Crypto Manager"); delete crypto_manager_; crypto_manager_ = NULL; - LOG4CXX_INFO(logger_, "Destroying Security Manager"); + SDL_LOG_INFO("Destroying Security Manager"); delete security_manager_; security_manager_ = NULL; } #endif // ENABLE_SECURITY protocol_handler_->Stop(); - LOG4CXX_INFO(logger_, "Destroying Media Manager"); + SDL_LOG_INFO("Destroying Media Manager"); DCHECK_OR_RETURN_VOID(media_manager_); media_manager_->SetProtocolHandler(NULL); delete media_manager_; media_manager_ = NULL; - LOG4CXX_INFO(logger_, "Destroying Transport Manager."); + SDL_LOG_INFO("Destroying Transport Manager."); DCHECK_OR_RETURN_VOID(transport_manager_); transport_manager_->PerformActionOnClients( transport_manager::TransportAction::kVisibilityOff); @@ -309,31 +305,31 @@ void LifeCycleImpl::StopComponents() { delete transport_manager_; transport_manager_ = NULL; - LOG4CXX_INFO(logger_, "Stopping Connection Handler."); + SDL_LOG_INFO("Stopping Connection Handler."); DCHECK_OR_RETURN_VOID(connection_handler_); connection_handler_->Stop(); - LOG4CXX_INFO(logger_, "Destroying Protocol Handler"); + SDL_LOG_INFO("Destroying Protocol Handler"); DCHECK(protocol_handler_); delete protocol_handler_; protocol_handler_ = NULL; - LOG4CXX_INFO(logger_, "Destroying Connection Handler."); + SDL_LOG_INFO("Destroying Connection Handler."); delete connection_handler_; connection_handler_ = NULL; - LOG4CXX_INFO(logger_, "Destroying Last State."); + SDL_LOG_INFO("Destroying Last State."); last_state_wrapper_.reset(); - LOG4CXX_INFO(logger_, "Destroying Application Manager."); + SDL_LOG_INFO("Destroying Application Manager."); DCHECK(app_manager_); delete app_manager_; app_manager_ = NULL; - LOG4CXX_INFO(logger_, "Destroying Low Voltage Signals Handler."); + SDL_LOG_INFO("Destroying Low Voltage Signals Handler."); low_voltage_signals_handler_.reset(); - LOG4CXX_INFO(logger_, "Destroying HMI Message Handler and MB adapter."); + SDL_LOG_INFO("Destroying HMI Message Handler and MB adapter."); #ifdef MESSAGEBROKER_HMIADAPTER if (mb_adapter_) { @@ -349,7 +345,7 @@ void LifeCycleImpl::StopComponents() { delete mb_adapter_thread_; mb_adapter_thread_ = NULL; } - LOG4CXX_INFO(logger_, "Destroying Message Broker"); + SDL_LOG_INFO("Destroying Message Broker"); #endif // MESSAGEBROKER_HMIADAPTER DCHECK_OR_RETURN_VOID(hmi_handler_); delete hmi_handler_; diff --git a/src/appMain/low_voltage_signals_handler.cc b/src/appMain/low_voltage_signals_handler.cc index 8a3d0dfb9b..e9760e94e8 100644 --- a/src/appMain/low_voltage_signals_handler.cc +++ b/src/appMain/low_voltage_signals_handler.cc @@ -46,7 +46,7 @@ namespace main_namespace { -CREATE_LOGGERPTR_GLOBAL(logger_, "LowVoltageSignalsHandler") +SDL_CREATE_LOG_VARIABLE("LowVoltageSignalsHandler") LowVoltageSignalsHandler::LowVoltageSignalsHandler( LifeCycle& life_cycle, const LowVoltageSignalsOffset& offset_data) @@ -93,22 +93,21 @@ LowVoltageSignalsHandler::~LowVoltageSignalsHandler() { void LowVoltageSignalsHandler::HandleSignal(const int signo) { if (SIGLOWVOLTAGE_ == signo) { - LOG4CXX_DEBUG(logger_, "Received LOW_VOLTAGE signal"); + SDL_LOG_DEBUG("Received LOW_VOLTAGE signal"); life_cycle_.LowVoltage(); cpid_ = utils::Signals::Fork(); if (0 > cpid_) { - LOG4CXX_FATAL(logger_, - "Error due fork() call. Error: " << strerror(errno)); + SDL_LOG_FATAL("Error due fork() call. Error: " << strerror(errno)); utils::Signals::ExitProcess(EXIT_FAILURE); } if (0 != cpid_) { // In Parent process - LOG4CXX_DEBUG(logger_, "Child PID: " << cpid_); + SDL_LOG_DEBUG("Child PID: " << cpid_); utils::Signals::WaitPid(cpid_, nullptr, 0); - LOG4CXX_DEBUG(logger_, "Child process: " << cpid_ << " is stopped"); + SDL_LOG_DEBUG("Child process: " << cpid_ << " is stopped"); life_cycle_.WakeUp(); } else { // In Child process @@ -148,8 +147,7 @@ void NotificationThreadDelegate::threadMain() { low_voltage_signals_handler_.LowVoltageSignalsMask(); const int err = sigwait(&lv_mask, &signo); if (0 != err) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Sigwait() error! Signals set contains an invalid signal number!"); continue; } @@ -158,7 +156,7 @@ void NotificationThreadDelegate::threadMain() { } void NotificationThreadDelegate::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ThreadDelegate::exitThreadMain(); } diff --git a/src/appMain/main.cc b/src/appMain/main.cc index ade6a0054c..34c5b4dbfa 100644 --- a/src/appMain/main.cc +++ b/src/appMain/main.cc @@ -42,10 +42,11 @@ #include <vector> // ---------------------------------------------------------------------------- - #ifdef ENABLE_LOG -#include "utils/log_message_loop_thread.h" +#include "utils/logger/log4cxxlogger.h" +#include "utils/logger/logger_impl.h" #endif // ENABLE_LOG + #include "utils/logger.h" #include "appMain/life_cycle_impl.h" @@ -62,7 +63,7 @@ #include "media_manager/media_manager_impl.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain") +SDL_CREATE_LOG_VARIABLE("SDLMain") namespace { @@ -79,7 +80,7 @@ const std::string kLocalHostAddress = "127.0.0.1"; bool InitHmi(std::string hmi_link) { struct stat sb; if (stat(hmi_link.c_str(), &sb) == -1) { - LOG4CXX_FATAL(logger_, "HMI index file " << hmi_link << " doesn't exist!"); + SDL_LOG_FATAL("HMI index file " << hmi_link << " doesn't exist!"); return false; } return utils::System(kBrowser, kBrowserName) @@ -103,6 +104,12 @@ int32_t main(int32_t argc, char** argv) { exit(EXIT_FAILURE); } +#ifdef ENABLE_LOG + auto logger_impl = + std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl()); + logger::Logger::instance(logger_impl.get()); +#endif // ENABLE_LOG + // -------------------------------------------------------------------------- // Components initialization profile::Profile profile_instance; @@ -131,57 +138,61 @@ int32_t main(int32_t argc, char** argv) { exit(EXIT_FAILURE); } - // -------------------------------------------------------------------------- - // Logger initialization - INIT_LOGGER("log4cxx.properties", profile_instance.logs_enabled()); +#ifdef ENABLE_LOG + if (profile_instance.logs_enabled()) { + // Logger initialization + // Redefine for each paticular logger implementation + auto logger = std::unique_ptr<logger::Log4CXXLogger>( + new logger::Log4CXXLogger("log4cxx.properties")); + logger_impl->Init(std::move(logger)); + } +#endif threads::Thread::SetNameForId(threads::Thread::CurrentId(), "SDLCore"); if (!utils::appenders_loader.Loaded()) { - LOG4CXX_ERROR(logger_, - "Appenders plugin not loaded, file logging disabled"); + SDL_LOG_ERROR("Appenders plugin not loaded, file logging disabled"); } - LOG4CXX_INFO(logger_, "Application started!"); - LOG4CXX_INFO(logger_, "SDL version: " << profile_instance.sdl_version()); + SDL_LOG_INFO("Application started!"); + SDL_LOG_INFO("SDL version: " << profile_instance.sdl_version()); // Check if no error values were read from config file if (profile_instance.ErrorOccured()) { - LOG4CXX_FATAL(logger_, profile_instance.ErrorDescription()); - FLUSH_LOGGER(); - DEINIT_LOGGER(); + SDL_LOG_FATAL(profile_instance.ErrorDescription()); + SDL_DEINIT_LOGGER(); exit(EXIT_FAILURE); } // -------------------------------------------------------------------------- // Components initialization if (!life_cycle->StartComponents()) { - LOG4CXX_FATAL(logger_, "Failed to start components"); + SDL_LOG_FATAL("Failed to start components"); life_cycle->StopComponents(); - DEINIT_LOGGER(); + SDL_DEINIT_LOGGER(); exit(EXIT_FAILURE); } - LOG4CXX_INFO(logger_, "Components Started"); + SDL_LOG_INFO("Components Started"); // -------------------------------------------------------------------------- // Third-Party components initialization. if (!life_cycle->InitMessageSystem()) { - LOG4CXX_FATAL(logger_, "Failed to init message system"); + SDL_LOG_FATAL("Failed to init message system"); life_cycle->StopComponents(); - DEINIT_LOGGER(); + SDL_DEINIT_LOGGER(); _exit(EXIT_FAILURE); } - LOG4CXX_INFO(logger_, "InitMessageBroker successful"); + SDL_LOG_INFO("InitMessageBroker successful"); if (profile_instance.launch_hmi()) { if (profile_instance.server_address() == kLocalHostAddress) { - LOG4CXX_INFO(logger_, "Start HMI on localhost"); + SDL_LOG_INFO("Start HMI on localhost"); #ifdef WEB_HMI if (!InitHmi(profile_instance.link_to_web_hmi())) { - LOG4CXX_INFO(logger_, "InitHmi successful"); + SDL_LOG_INFO("InitHmi successful"); } else { - LOG4CXX_WARN(logger_, "Failed to init HMI"); + SDL_LOG_WARN("Failed to init HMI"); } #endif } @@ -189,12 +200,12 @@ int32_t main(int32_t argc, char** argv) { // -------------------------------------------------------------------------- life_cycle->Run(); - LOG4CXX_INFO(logger_, "Stop SDL due to caught signal"); + SDL_LOG_INFO("Stop SDL due to caught signal"); life_cycle->StopComponents(); - LOG4CXX_INFO(logger_, "Application has been stopped successfuly"); + SDL_LOG_INFO("Application has been stopped successfuly"); - DEINIT_LOGGER(); + SDL_DEINIT_LOGGER(); return EXIT_SUCCESS; } diff --git a/src/appMain/signal_handlers.cc b/src/appMain/signal_handlers.cc index c9c09d10a2..5386cacc99 100644 --- a/src/appMain/signal_handlers.cc +++ b/src/appMain/signal_handlers.cc @@ -35,6 +35,6 @@ #include "utils/logger.h" namespace main_namespace { -CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain") +SDL_CREATE_LOG_VARIABLE("SDLMain") } // namespace main_namespace diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 5bdebc441e..33d7a9b82f 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -132,7 +132,7 @@ struct AppIconInfo { : endpoint(ws_endpoint), pending_request(pending) {} }; -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("ApplicationManager") typedef std::shared_ptr<timer::Timer> TimerSPtr; class ApplicationManagerImpl @@ -1256,14 +1256,12 @@ class ApplicationManagerImpl void PrepareApplicationListSO(ApplicationList app_list, smart_objects::SmartObject& applications, ApplicationManager& app_mngr) { - CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager"); - smart_objects::SmartArray* app_array = applications.asArray(); uint32_t app_count = NULL == app_array ? 0 : app_array->size(); typename ApplicationList::const_iterator it; for (it = app_list.begin(); it != app_list.end(); ++it) { if (it->use_count() == 0) { - LOG4CXX_ERROR(logger_, "Application not found "); + SDL_LOG_ERROR("Application not found"); continue; } @@ -1277,12 +1275,12 @@ class ApplicationManagerImpl app_mngr)) { applications[app_count++] = hmi_application; } else { - LOG4CXX_DEBUG(logger_, "Can't CreateHMIApplicationStruct "); + SDL_LOG_DEBUG("Can't CreateHMIApplicationStruct"); } } if (0 == app_count) { - LOG4CXX_WARN(logger_, "Empty applications list"); + SDL_LOG_WARN("Empty applications list"); } } diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index 151c4d7874..e3e30a9eff 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -218,10 +218,6 @@ class CommandImpl : public Command { CommandParametersPermissions parameters_permissions_; CommandParametersPermissions removed_parameters_permissions_; -#ifdef ENABLE_LOG - static log4cxx::LoggerPtr logger_; -#endif // ENABLE_LOG - private: DISALLOW_COPY_AND_ASSIGN(CommandImpl); }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h index 5d85237899..444636ed75 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h @@ -34,6 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_RPC_PLUGIN_H #include "application_manager/command_factory.h" +#include "utils/ilogger.h" namespace app_service_rpc_plugin { namespace app_mngr = application_manager; @@ -75,7 +76,8 @@ class AppServiceRpcPlugin : public plugins::RPCPlugin { }; } // namespace app_service_rpc_plugin -extern "C" application_manager::plugin_manager::RPCPlugin* Create(); +extern "C" application_manager::plugin_manager::RPCPlugin* Create( + logger::Logger* logger_instance); extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data); #endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_PLUGIN_H diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc index 87f947d250..5d5e96fdb7 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc @@ -33,7 +33,7 @@ #include "app_service_rpc_plugin/app_service_app_extension.h" #include "app_service_rpc_plugin/app_service_rpc_plugin.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") +SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin") namespace app_service_rpc_plugin { @@ -44,22 +44,22 @@ AppServiceAppExtension::AppServiceAppExtension( : app_mngr::AppExtension(AppServiceAppExtensionUID) , plugin_(plugin) , app_(app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } AppServiceAppExtension::~AppServiceAppExtension() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } bool AppServiceAppExtension::SubscribeToAppService( const std::string app_service_type) { - LOG4CXX_DEBUG(logger_, "Subscribe to app service: " << app_service_type); + SDL_LOG_DEBUG("Subscribe to app service: " << app_service_type); return subscribed_data_.insert(app_service_type).second; } bool AppServiceAppExtension::UnsubscribeFromAppService( const std::string app_service_type) { - LOG4CXX_DEBUG(logger_, app_service_type); + SDL_LOG_DEBUG(app_service_type); auto it = subscribed_data_.find(app_service_type); if (it != subscribed_data_.end()) { subscribed_data_.erase(it); @@ -69,14 +69,13 @@ bool AppServiceAppExtension::UnsubscribeFromAppService( } void AppServiceAppExtension::UnsubscribeFromAppService() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); subscribed_data_.clear(); } bool AppServiceAppExtension::IsSubscribedToAppService( const std::string app_service_type) const { - LOG4CXX_DEBUG(logger_, - "isSubscribedToAppService for type: " << app_service_type); + SDL_LOG_DEBUG("isSubscribedToAppService for type: " << app_service_type); return subscribed_data_.find(app_service_type) != subscribed_data_.end(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc index 8ce4d10b6e..ff40b587cb 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc @@ -32,7 +32,7 @@ #include "app_service_rpc_plugin/app_service_command_factory.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") +SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin") namespace app_service_rpc_plugin { @@ -45,11 +45,11 @@ AppServiceCommandFactory::AppServiceCommandFactory( application_manager, rpc_service, hmi_capabilities, policy_handler)) , mobile_command_factory_(new AppServiceMobileCommandFactory( application_manager, rpc_service, hmi_capabilities, policy_handler)) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } AppServiceCommandFactory::~AppServiceCommandFactory() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } app_mngr::CommandSharedPtr AppServiceCommandFactory::CreateCommand( @@ -66,8 +66,7 @@ app_mngr::CommandSharedPtr AppServiceCommandFactory::CreateCommand( bool AppServiceCommandFactory::IsAbleToProcess( const int32_t function_id, const commands::Command::CommandSource source) const { - LOG4CXX_DEBUG(logger_, - "AppServiceCommandFactory::IsAbleToProcess" << function_id + SDL_LOG_DEBUG("AppServiceCommandFactory::IsAbleToProcess" << function_id << " " << source); return (commands::Command::SOURCE_HMI == source || commands::Command::SOURCE_SDL_TO_HMI == source) diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc index 3090ea8ced..1e468242af 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc @@ -55,7 +55,7 @@ #include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h" #include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") +SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin") namespace app_service_rpc_plugin { namespace strings = app_mngr::strings; @@ -69,7 +69,7 @@ AppServiceHmiCommandFactory::AppServiceHmiCommandFactory( , rpc_service_(rpc_service) , hmi_capabilities_(hmi_capabilities) , policy_handler_(policy_handler) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand( @@ -95,9 +95,8 @@ app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand( } UNUSED(message_type_str); - LOG4CXX_DEBUG(logger_, - "HMICommandFactory::CreateCommand function_id: " - << function_id << ", message type: " << message_type_str); + SDL_LOG_DEBUG("HMICommandFactory::CreateCommand function_id: " + << function_id << ", message type: " << message_type_str); return buildCommandCreator(function_id, message_type, source).create(message); } @@ -105,8 +104,7 @@ app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand( bool AppServiceHmiCommandFactory::IsAbleToProcess( const int32_t function_id, const app_mngr::commands::Command::CommandSource source) const { - LOG4CXX_DEBUG(logger_, - "HMI App Service Plugin IsAbleToProcess: " << function_id); + SDL_LOG_DEBUG("HMI App Service Plugin IsAbleToProcess: " << function_id); UNUSED(source); return buildCommandCreator( function_id, hmi_apis::messageType::INVALID_ENUM, source) @@ -120,8 +118,7 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( auto factory = app_mngr::CommandCreatorFactory( application_manager_, rpc_service_, hmi_capabilities_, policy_handler_); - LOG4CXX_DEBUG(logger_, - "buildCommandCreator: " << function_id << " " << source); + SDL_LOG_DEBUG("buildCommandCreator: " << function_id << " " << source); switch (function_id) { case hmi_apis::FunctionID::AppService_PublishAppService: @@ -191,7 +188,7 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator( : factory.GetCreator< commands::ASGetActiveServiceConsentResponse>(); default: - LOG4CXX_WARN(logger_, "Unsupported HMI function_id: " << function_id); + SDL_LOG_WARN("Unsupported HMI function_id: " << function_id); } return factory.GetCreator<app_mngr::InvalidCommand>(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc index 5c44fb5fae..4a2fe5c2c9 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc @@ -50,7 +50,7 @@ #include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h" #include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") +SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin") namespace app_service_rpc_plugin { namespace strings = app_mngr::strings; @@ -64,7 +64,7 @@ AppServiceMobileCommandFactory::AppServiceMobileCommandFactory( , rpc_service_(rpc_service) , hmi_capabilities_(hmi_capabilities) , policy_handler_(policy_handler) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } app_mngr::CommandSharedPtr AppServiceMobileCommandFactory::CreateCommand( @@ -88,9 +88,8 @@ app_mngr::CommandSharedPtr AppServiceMobileCommandFactory::CreateCommand( } UNUSED(message_type_str); - LOG4CXX_DEBUG(logger_, - "HMICommandFactory::CreateCommand function_id: " - << function_id << ", message type: " << message_type_str); + SDL_LOG_DEBUG("HMICommandFactory::CreateCommand function_id: " + << function_id << ", message type: " << message_type_str); return buildCommandCreator(function_id, message_type, source).create(message); } @@ -170,7 +169,7 @@ app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator( } break; default: - LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); + SDL_LOG_WARN("Unsupported function_id: " << function_id); } return factory.GetCreator<app_mngr::InvalidCommand>(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc index 1c3a9c77c5..fd7b03fabc 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc @@ -38,7 +38,7 @@ #include "application_manager/smart_object_keys.h" namespace app_service_rpc_plugin { -CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin") +SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin") namespace strings = application_manager::strings; namespace plugins = application_manager::plugin_manager; @@ -109,12 +109,12 @@ void AppServiceRpcPlugin::DeleteSubscriptions( extern "C" __attribute__((visibility("default"))) application_manager::plugin_manager::RPCPlugin* -Create() { +Create(logger::Logger* logger_instance) { + logger::Logger::instance(logger_instance); return new app_service_rpc_plugin::AppServiceRpcPlugin(); } extern "C" __attribute__((visibility("default"))) void Delete( application_manager::plugin_manager::RPCPlugin* data) { delete data; - DELETE_THREAD_LOGGER(app_service_rpc_plugin::logger_); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc index fd7312ca98..d9cf7acf1b 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc @@ -38,6 +38,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASAppServiceActivationRequest::ASAppServiceActivationRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ ASAppServiceActivationRequest::ASAppServiceActivationRequest( ASAppServiceActivationRequest::~ASAppServiceActivationRequest() {} void ASAppServiceActivationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); AppServiceManager& service_manager = application_manager_.GetAppServiceManager(); smart_objects::SmartObject params = (*message_)[strings::msg_params]; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc index c77d3ed381..434fad51e9 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc @@ -36,6 +36,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASAppServiceActivationResponse::ASAppServiceActivationResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ ASAppServiceActivationResponse::ASAppServiceActivationResponse( ASAppServiceActivationResponse::~ASAppServiceActivationResponse() {} void ASAppServiceActivationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToHMI(message_); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc index b1f3d6fdbf..e80c5f741c 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc @@ -36,6 +36,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASGetActiveServiceConsentRequest::ASGetActiveServiceConsentRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ ASGetActiveServiceConsentRequest::ASGetActiveServiceConsentRequest( ASGetActiveServiceConsentRequest::~ASGetActiveServiceConsentRequest() {} void ASGetActiveServiceConsentRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc index 038c2922ad..5e59c9f3ab 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc @@ -36,6 +36,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASGetActiveServiceConsentResponse::ASGetActiveServiceConsentResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ ASGetActiveServiceConsentResponse::ASGetActiveServiceConsentResponse( ASGetActiveServiceConsentResponse::~ASGetActiveServiceConsentResponse() {} void ASGetActiveServiceConsentResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::AppService_GetActiveServiceConsent); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc index e03c0ad15a..32fccb0192 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc @@ -43,6 +43,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASGetAppServiceDataRequestFromHMI::ASGetAppServiceDataRequestFromHMI( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -58,12 +60,12 @@ ASGetAppServiceDataRequestFromHMI::ASGetAppServiceDataRequestFromHMI( ASGetAppServiceDataRequestFromHMI::~ASGetAppServiceDataRequestFromHMI() {} void ASGetAppServiceDataRequestFromHMI::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string service_type = (*message_)[strings::msg_params][strings::service_type].asString(); - LOG4CXX_DEBUG(logger_, "Get Service Type: " << service_type); + SDL_LOG_DEBUG("Get Service Type: " << service_type); SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID, hmi_apis::FunctionID::AppService_GetAppServiceData, @@ -172,8 +174,7 @@ void ASGetAppServiceDataRequestFromHMI::GetMediaImagePaths( bool ASGetAppServiceDataRequestFromHMI::ValidateResponse( smart_objects::SmartObject& message_params) { if (!message_params.keyExists(strings::service_data)) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "GASD response received without any service data, passing through"); return true; } @@ -185,8 +186,7 @@ bool ASGetAppServiceDataRequestFromHMI::ValidateResponse( auto service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); if (!service) { - LOG4CXX_ERROR(logger_, - "GASD response received with an unpublished service ID"); + SDL_LOG_ERROR("GASD response received with an unpublished service ID"); SendErrorResponse( correlation_id(), hmi_apis::FunctionID::AppService_GetAppServiceData, @@ -202,8 +202,7 @@ bool ASGetAppServiceDataRequestFromHMI::ValidateResponse( service_type, &service_type_value)) { auto app = application_manager_.application(service->connection_key); if (!app) { - LOG4CXX_ERROR(logger_, - "Failed to find service provider for GASD response"); + SDL_LOG_ERROR("Failed to find service provider for GASD response"); SendErrorResponse( correlation_id(), hmi_apis::FunctionID::AppService_GetAppServiceData, @@ -277,7 +276,7 @@ void ASGetAppServiceDataRequestFromHMI::on_event( } void ASGetAppServiceDataRequestFromHMI::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendErrorResponse(correlation_id(), hmi_apis::FunctionID::AppService_GetAppServiceData, hmi_apis::Common_Result::GENERIC_ERROR, diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc index 635cd7319a..e0b99105d7 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc @@ -38,6 +38,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASGetAppServiceDataRequestToHMI::ASGetAppServiceDataRequestToHMI( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ ASGetAppServiceDataRequestToHMI::ASGetAppServiceDataRequestToHMI( ASGetAppServiceDataRequestToHMI::~ASGetAppServiceDataRequestToHMI() {} void ASGetAppServiceDataRequestToHMI::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc index c0b1b274fb..853c382f46 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc @@ -41,6 +41,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASGetAppServiceDataResponseFromHMI::ASGetAppServiceDataResponseFromHMI( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ ASGetAppServiceDataResponseFromHMI::ASGetAppServiceDataResponseFromHMI( ASGetAppServiceDataResponseFromHMI::~ASGetAppServiceDataResponseFromHMI() {} void ASGetAppServiceDataResponseFromHMI::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::AppService_GetAppServiceData); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc index b489ec4765..6c53feb68f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc @@ -38,6 +38,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASGetAppServiceDataResponseToHMI::ASGetAppServiceDataResponseToHMI( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ ASGetAppServiceDataResponseToHMI::ASGetAppServiceDataResponseToHMI( ASGetAppServiceDataResponseToHMI::~ASGetAppServiceDataResponseToHMI() {} void ASGetAppServiceDataResponseToHMI::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToHMI(message_); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc index fa704c1995..ac3666bf2e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc @@ -38,6 +38,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASGetAppServiceRecordsRequest::ASGetAppServiceRecordsRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ ASGetAppServiceRecordsRequest::ASGetAppServiceRecordsRequest( ASGetAppServiceRecordsRequest::~ASGetAppServiceRecordsRequest() {} void ASGetAppServiceRecordsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string type; if ((*message_)[strings::msg_params].keyExists(strings::service_type)) { type = (*message_)[strings::msg_params][strings::service_type].asString(); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc index 0479aa8d31..f5f45d23f1 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc @@ -36,6 +36,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASGetAppServiceRecordsResponse::ASGetAppServiceRecordsResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ ASGetAppServiceRecordsResponse::ASGetAppServiceRecordsResponse( ASGetAppServiceRecordsResponse::~ASGetAppServiceRecordsResponse() {} void ASGetAppServiceRecordsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToHMI(message_); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc index 6499b08c28..f5a1aac05c 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -39,6 +39,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASPerformAppServiceInteractionRequestFromHMI:: ASPerformAppServiceInteractionRequestFromHMI( const application_manager::commands::MessageSharedPtr& message, @@ -56,7 +58,7 @@ ASPerformAppServiceInteractionRequestFromHMI:: ~ASPerformAppServiceInteractionRequestFromHMI() {} void ASPerformAppServiceInteractionRequestFromHMI::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; std::string hmi_origin_id = @@ -148,7 +150,7 @@ void ASPerformAppServiceInteractionRequestFromHMI::on_event( } void ASPerformAppServiceInteractionRequestFromHMI::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject response_params; response_params[strings::info] = "The provider did not respond to the request"; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc index 22876328de..a0f5d69ed8 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc @@ -36,6 +36,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASPerformAppServiceInteractionRequestToHMI:: ASPerformAppServiceInteractionRequestToHMI( const application_manager::commands::MessageSharedPtr& message, @@ -53,7 +55,7 @@ ASPerformAppServiceInteractionRequestToHMI:: ~ASPerformAppServiceInteractionRequestToHMI() {} void ASPerformAppServiceInteractionRequestToHMI::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc index a2ffa65a73..c8608588c0 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc @@ -36,6 +36,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASPerformAppServiceInteractionResponseFromHMI:: ASPerformAppServiceInteractionResponseFromHMI( const application_manager::commands::MessageSharedPtr& message, @@ -53,7 +55,7 @@ ASPerformAppServiceInteractionResponseFromHMI:: ~ASPerformAppServiceInteractionResponseFromHMI() {} void ASPerformAppServiceInteractionResponseFromHMI::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::AppService_PerformAppServiceInteraction); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc index 5ddef55c2a..45d6a15999 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc @@ -36,6 +36,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASPerformAppServiceInteractionResponseToHMI:: ASPerformAppServiceInteractionResponseToHMI( const application_manager::commands::MessageSharedPtr& message, @@ -53,7 +55,7 @@ ASPerformAppServiceInteractionResponseToHMI:: ~ASPerformAppServiceInteractionResponseToHMI() {} void ASPerformAppServiceInteractionResponseToHMI::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToHMI(message_); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc index 35a3e8a6b3..156530f9e3 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc @@ -39,6 +39,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASPublishAppServiceRequest::ASPublishAppServiceRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,8 +56,8 @@ ASPublishAppServiceRequest::ASPublishAppServiceRequest( ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {} void ASPublishAppServiceRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Received a PublishAppService request from HMI"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Received a PublishAppService request from HMI"); smart_objects::SmartObject response_params = smart_objects::SmartObject(smart_objects::SmartType_Map); smart_objects::SmartObject manifest = diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc index c143315b8c..49d3968cef 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc @@ -37,6 +37,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASPublishAppServiceResponse::ASPublishAppServiceResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ ASPublishAppServiceResponse::ASPublishAppServiceResponse( ASPublishAppServiceResponse::~ASPublishAppServiceResponse() {} void ASPublishAppServiceResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToHMI(message_); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc index 30905b5fa2..f29b974862 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc @@ -40,6 +40,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASUnpublishAppServiceRequest::ASUnpublishAppServiceRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ ASUnpublishAppServiceRequest::ASUnpublishAppServiceRequest( ASUnpublishAppServiceRequest::~ASUnpublishAppServiceRequest() {} void ASUnpublishAppServiceRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string service_id = (*message_)[strings::msg_params][strings::service_id].asString(); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc index 0c8b479da8..6b665fafd0 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc @@ -39,6 +39,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ASUnpublishAppServiceResponse::ASUnpublishAppServiceResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ ASUnpublishAppServiceResponse::ASUnpublishAppServiceResponse( ASUnpublishAppServiceResponse::~ASUnpublishAppServiceResponse() {} void ASUnpublishAppServiceResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToHMI(message_); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc index db1716ecb8..0f1fbcf1ce 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc @@ -41,6 +41,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnASAppServiceDataNotification::OnASAppServiceDataNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -156,8 +158,7 @@ void OnASAppServiceDataNotification::GetNavigationImagePaths( bool OnASAppServiceDataNotification::ValidateParams( smart_objects::SmartObject& message_params) { if (!message_params.keyExists(strings::service_data)) { - LOG4CXX_DEBUG(logger_, - "OASD notification received without any service data"); + SDL_LOG_DEBUG("OASD notification received without any service data"); return false; } smart_objects::SmartObject& service_data = @@ -168,8 +169,7 @@ bool OnASAppServiceDataNotification::ValidateParams( auto service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); if (!service) { - LOG4CXX_ERROR(logger_, - "OASD notification received with an unpublished service ID"); + SDL_LOG_ERROR("OASD notification received with an unpublished service ID"); return false; } @@ -179,8 +179,7 @@ bool OnASAppServiceDataNotification::ValidateParams( service_type, &service_type_value)) { auto app = application_manager_.application(service->connection_key); if (!app) { - LOG4CXX_ERROR(logger_, - "Failed to find service provider for OASD message"); + SDL_LOG_ERROR("Failed to find service provider for OASD message"); return false; } @@ -204,8 +203,8 @@ bool OnASAppServiceDataNotification::ValidateParams( } void OnASAppServiceDataNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Sending AS data to HMI"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Sending AS data to HMI"); if (ValidateParams((*message_)[strings::msg_params])) { SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc index 1c73fc73f4..5483873c3c 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc @@ -38,6 +38,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,8 +56,8 @@ OnASAppServiceDataNotificationFromHMI:: ~OnASAppServiceDataNotificationFromHMI() {} void OnASAppServiceDataNotificationFromHMI::Run() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Received an OnAppServiceData from HMI"); std::string service_id = (*message_)[strings::msg_params][strings::service_data] @@ -64,14 +66,14 @@ void OnASAppServiceDataNotificationFromHMI::Run() { AppService* service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); if (!service) { - LOG4CXX_ERROR( - logger_, "No published services exist with service ID: " << service_id); + SDL_LOG_ERROR( + "No published services exist with service ID: " << service_id); return; } else if (service->mobile_service) { - LOG4CXX_ERROR(logger_, "Service was not published by the HMI"); + SDL_LOG_ERROR("Service was not published by the HMI"); return; } else if (!service->record[strings::service_active].asBool()) { - LOG4CXX_ERROR(logger_, "Service is not active"); + SDL_LOG_ERROR("Service is not active"); return; } @@ -83,11 +85,9 @@ void OnASAppServiceDataNotificationFromHMI::Run() { service->record[strings::service_manifest][strings::service_type] .asString(); if (published_service_type != service_type) { - LOG4CXX_ERROR(logger_, - "Service type mismatch, expected " - << service_type - << ", but service was published with type " - << published_service_type); + SDL_LOG_ERROR("Service type mismatch, expected " + << service_type << ", but service was published with type " + << published_service_type); return; } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc index e3bf40308d..719856625d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -42,6 +42,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetAppServiceDataRequest::GetAppServiceDataRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,7 +59,7 @@ GetAppServiceDataRequest::GetAppServiceDataRequest( GetAppServiceDataRequest::~GetAppServiceDataRequest() {} void GetAppServiceDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID, hmi_apis::FunctionID::AppService_GetAppServiceData, diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc index 0af1a5436b..1a8912518a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc @@ -38,6 +38,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetAppServiceDataRequestToMobile::GetAppServiceDataRequestToMobile( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ GetAppServiceDataRequestToMobile::GetAppServiceDataRequestToMobile( GetAppServiceDataRequestToMobile::~GetAppServiceDataRequestToMobile() {} void GetAppServiceDataRequestToMobile::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc index 32ad8e014d..9c0b46c209 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc @@ -38,6 +38,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetAppServiceDataResponse::GetAppServiceDataResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ GetAppServiceDataResponse::GetAppServiceDataResponse( GetAppServiceDataResponse::~GetAppServiceDataResponse() {} void GetAppServiceDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc index 90fca04eb2..04b969502b 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc @@ -40,6 +40,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetAppServiceDataResponseFromMobile::GetAppServiceDataResponseFromMobile( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ GetAppServiceDataResponseFromMobile::GetAppServiceDataResponseFromMobile( GetAppServiceDataResponseFromMobile::~GetAppServiceDataResponseFromMobile() {} void GetAppServiceDataResponseFromMobile::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::MobileEvent event(mobile_apis::FunctionID::GetAppServiceDataID); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc index 1ffe99462d..674578946a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc @@ -46,6 +46,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAppServiceDataNotification::OnAppServiceDataNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -61,8 +63,8 @@ OnAppServiceDataNotification::OnAppServiceDataNotification( OnAppServiceDataNotification::~OnAppServiceDataNotification() {} void OnAppServiceDataNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Sending OnAppServiceData to consumer"); std::string service_id = (*message_)[strings::msg_params][strings::service_data] @@ -72,15 +74,15 @@ void OnAppServiceDataNotification::Run() { application_manager_.GetAppServiceManager().FindServiceByID(service_id); if (!service) { - LOG4CXX_ERROR(logger_, "Service sending OnAppServiceData is not published"); + SDL_LOG_ERROR("Service sending OnAppServiceData is not published"); return; } else if (!service ->record[strings::service_manifest] [strings::allow_app_consumers] .asBool()) { - LOG4CXX_ERROR(logger_, - "Service does not allow for app consumers, skipping mobile " - "OnAppServiceData notification"); + SDL_LOG_ERROR( + "Service does not allow for app consumers, skipping mobile " + "OnAppServiceData notification"); return; } @@ -93,7 +95,7 @@ void OnAppServiceDataNotification::Run() { [service_type](const ApplicationSharedPtr app) { DCHECK_OR_RETURN(app, false); auto& ext = AppServiceAppExtension::ExtractASExtension(*app); - LOG4CXX_DEBUG(logger_, "Check subscription for type: " << service_type); + SDL_LOG_DEBUG("Check subscription for type: " << service_type); return ext.IsSubscribedToAppService(service_type); }; @@ -107,12 +109,11 @@ void OnAppServiceDataNotification::Run() { for (; applications.end() != app_it; ++app_it) { const ApplicationSharedPtr app = *app_it; if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); continue; } - LOG4CXX_DEBUG(logger_, - "Sending OnAppServiceDataNotification to mobile connection: " - << app->app_id()); + SDL_LOG_DEBUG("Sending OnAppServiceDataNotification to mobile connection: " + << app->app_id()); (*message_)[app_mngr::strings::params][app_mngr::strings::connection_key] = app->app_id(); SendNotification(); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc index 5caacc9801..4c1caebd36 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc @@ -41,6 +41,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAppServiceDataNotificationFromMobile::OnAppServiceDataNotificationFromMobile( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,8 +59,8 @@ OnAppServiceDataNotificationFromMobile:: ~OnAppServiceDataNotificationFromMobile() {} void OnAppServiceDataNotificationFromMobile::Run() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Received an OnAppServiceData"); MessageHelper::PrintSmartObject(*message_); uint32_t app_connection_key = connection_key(); @@ -74,9 +76,9 @@ void OnAppServiceDataNotificationFromMobile::Run() { app->policy_app_id(), std::string(), service_type, NULL); if (!result) { - LOG4CXX_DEBUG(logger_, - "Incorrect service type received in " - "OnAppServiceDataNotificationFromMobile"); + SDL_LOG_DEBUG( + "Incorrect service type received in " + "OnAppServiceDataNotificationFromMobile"); return; } @@ -87,15 +89,15 @@ void OnAppServiceDataNotificationFromMobile::Run() { AppService* service = application_manager_.GetAppServiceManager().FindServiceByID(service_id); if (!service) { - LOG4CXX_ERROR( - logger_, "No published services exist with service ID: " << service_id); + SDL_LOG_ERROR( + "No published services exist with service ID: " << service_id); return; } else if (!service->mobile_service || service->connection_key != app_connection_key) { - LOG4CXX_ERROR(logger_, "Service was not published by this application"); + SDL_LOG_ERROR("Service was not published by this application"); return; } else if (!service->record[strings::service_active].asBool()) { - LOG4CXX_ERROR(logger_, "Service is not active"); + SDL_LOG_ERROR("Service is not active"); return; } @@ -103,11 +105,9 @@ void OnAppServiceDataNotificationFromMobile::Run() { service->record[strings::service_manifest][strings::service_type] .asString(); if (published_service_type != service_type) { - LOG4CXX_ERROR(logger_, - "Service type mismatch, expected " - << service_type - << ", but service was published with type " - << published_service_type); + SDL_LOG_ERROR("Service type mismatch, expected " + << service_type << ", but service was published with type " + << published_service_type); return; } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc index 63b6e47d8e..c303e6d99f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -41,6 +41,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest( PerformAppServiceInteractionRequest::~PerformAppServiceInteractionRequest() {} void PerformAppServiceInteractionRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto app = application_manager_.application(connection_key()); if (!app) { @@ -122,7 +124,7 @@ void PerformAppServiceInteractionRequest::Run() { void PerformAppServiceInteractionRequest::on_event( const event_engine::Event& event) { - LOG4CXX_DEBUG(logger_, "HMI PerformAppServiceInteraction on_event"); + SDL_LOG_DEBUG("HMI PerformAppServiceInteraction on_event"); const smart_objects::SmartObject& event_message = event.smart_object(); auto msg_params = event_message[strings::msg_params]; @@ -169,7 +171,7 @@ void PerformAppServiceInteractionRequest::on_event( void PerformAppServiceInteractionRequest::on_event( const event_engine::MobileEvent& event) { - LOG4CXX_DEBUG(logger_, "Mobile PerformAppServiceInteraction on_event"); + SDL_LOG_DEBUG("Mobile PerformAppServiceInteraction on_event"); const smart_objects::SmartObject& event_message = event.smart_object(); auto msg_params = event_message[strings::msg_params]; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc index 2a7b644cb3..4997f63232 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc @@ -37,6 +37,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + PerformAppServiceInteractionRequestToMobile:: PerformAppServiceInteractionRequestToMobile( const application_manager::commands::MessageSharedPtr& message, @@ -54,7 +56,7 @@ PerformAppServiceInteractionRequestToMobile:: ~PerformAppServiceInteractionRequestToMobile() {} void PerformAppServiceInteractionRequestToMobile::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc index 5e84f42c34..a5a81eb325 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc @@ -37,6 +37,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + PerformAppServiceInteractionResponse::PerformAppServiceInteractionResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ PerformAppServiceInteractionResponse::PerformAppServiceInteractionResponse( PerformAppServiceInteractionResponse::~PerformAppServiceInteractionResponse() {} void PerformAppServiceInteractionResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc index 9912df84ce..25ef530b8d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc @@ -38,6 +38,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + PerformAppServiceInteractionResponseFromMobile:: PerformAppServiceInteractionResponseFromMobile( const application_manager::commands::MessageSharedPtr& message, @@ -55,7 +57,7 @@ PerformAppServiceInteractionResponseFromMobile:: ~PerformAppServiceInteractionResponseFromMobile() {} void PerformAppServiceInteractionResponseFromMobile::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::MobileEvent event( mobile_apis::FunctionID::PerformAppServiceInteractionID); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index 53d1bf82fa..f2bc66520b 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -43,6 +43,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + PublishAppServiceRequest::PublishAppServiceRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -58,8 +60,8 @@ PublishAppServiceRequest::PublishAppServiceRequest( PublishAppServiceRequest::~PublishAppServiceRequest() {} void PublishAppServiceRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Received a PublishAppService " << connection_key()); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Received a PublishAppService " << connection_key()); MessageHelper::PrintSmartObject(*message_); smart_objects::SmartObject response_params = diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc index d1bfc6e154..53dff48f43 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc @@ -39,6 +39,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + PublishAppServiceResponse::PublishAppServiceResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ PublishAppServiceResponse::PublishAppServiceResponse( PublishAppServiceResponse::~PublishAppServiceResponse() {} void PublishAppServiceResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc index 2cb43bce07..200bae01d9 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc @@ -41,6 +41,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UnpublishAppServiceRequest::UnpublishAppServiceRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ UnpublishAppServiceRequest::UnpublishAppServiceRequest( UnpublishAppServiceRequest::~UnpublishAppServiceRequest() {} void UnpublishAppServiceRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string service_id = (*message_)[strings::msg_params][strings::service_id].asString(); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc index 22450ecc4c..6b48c7f225 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc @@ -39,6 +39,8 @@ namespace app_service_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UnpublishAppServiceResponse::UnpublishAppServiceResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UnpublishAppServiceResponse::UnpublishAppServiceResponse( UnpublishAppServiceResponse::~UnpublishAppServiceResponse() {} void UnpublishAppServiceResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h index e12bd88e58..51e0668930 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h @@ -42,6 +42,7 @@ #include "rc_rpc_plugin/rc_capabilities_manager.h" #include "rc_rpc_plugin/rc_consent_manager.h" #include "rc_rpc_plugin/resource_allocation_manager.h" +#include "utils/ilogger.h" namespace rc_rpc_plugin { namespace plugins = application_manager::plugin_manager; @@ -120,7 +121,8 @@ class RCRPCPlugin : public plugins::RPCPlugin { }; } // namespace rc_rpc_plugin -extern "C" application_manager::plugin_manager::RPCPlugin* Create(); +extern "C" application_manager::plugin_manager::RPCPlugin* Create( + logger::Logger* logger_instance); extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data); #endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_RPC_PLUGIN_H_ diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc index 75faf5db8c..6fe3e31aa4 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc @@ -38,6 +38,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCButtonPressRequest::RCButtonPressRequest( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -50,7 +52,7 @@ RCButtonPressRequest::RCButtonPressRequest( RCButtonPressRequest::~RCButtonPressRequest() {} void RCButtonPressRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc index 5c1691ed7b..33610c5a4d 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc @@ -36,6 +36,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCButtonPressResponse::RCButtonPressResponse( const application_manager::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -47,7 +49,7 @@ RCButtonPressResponse::RCButtonPressResponse( params.policy_handler_) {} void RCButtonPressResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::event_engine::Event event( hmi_apis::FunctionID::Buttons_ButtonPress); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc index 774ee04677..a4d2d96772 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc @@ -36,6 +36,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCGetInteriorVehicleDataConsentRequest::RCGetInteriorVehicleDataConsentRequest( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -49,7 +51,7 @@ RCGetInteriorVehicleDataConsentRequest:: ~RCGetInteriorVehicleDataConsentRequest() {} void RCGetInteriorVehicleDataConsentRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc index 3244857656..1ae8158602 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc @@ -36,6 +36,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCGetInteriorVehicleDataConsentResponse:: RCGetInteriorVehicleDataConsentResponse( const application_manager::commands::MessageSharedPtr& message, @@ -48,7 +50,7 @@ RCGetInteriorVehicleDataConsentResponse:: params.policy_handler_) {} void RCGetInteriorVehicleDataConsentResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::event_engine::Event event( hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc index c7baf75e27..ffe124f3bd 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc @@ -36,6 +36,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCGetInteriorVehicleDataRequest::RCGetInteriorVehicleDataRequest( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -48,7 +50,7 @@ RCGetInteriorVehicleDataRequest::RCGetInteriorVehicleDataRequest( RCGetInteriorVehicleDataRequest::~RCGetInteriorVehicleDataRequest() {} void RCGetInteriorVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc index a366aa65fa..7e935621d4 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc @@ -37,6 +37,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCGetInteriorVehicleDataResponse::RCGetInteriorVehicleDataResponse( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -48,7 +50,7 @@ RCGetInteriorVehicleDataResponse::RCGetInteriorVehicleDataResponse( params.policy_handler_) {} void RCGetInteriorVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::event_engine::Event event( hmi_apis::FunctionID::RC_GetInteriorVehicleData); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc index c6cf1b0d5a..68587e0861 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc @@ -37,6 +37,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCOnInteriorVehicleDataNotification::RCOnInteriorVehicleDataNotification( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -50,7 +52,7 @@ RCOnInteriorVehicleDataNotification::RCOnInteriorVehicleDataNotification( RCOnInteriorVehicleDataNotification::~RCOnInteriorVehicleDataNotification() {} void RCOnInteriorVehicleDataNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[app_mngr::strings::params][app_mngr::strings::function_id] = static_cast<int>(mobile_apis::FunctionID::eType::OnInteriorVehicleDataID); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc index 45b0d13582..b7a343a907 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc @@ -47,7 +47,7 @@ std::map<std::string, hmi_apis::Common_RCAccessMode::eType> access_modes{ {enums_value::kAskDriver, hmi_apis::Common_RCAccessMode::ASK_DRIVER}}; } -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") +SDL_CREATE_LOG_VARIABLE("Commands") RCOnRemoteControlSettingsNotification::RCOnRemoteControlSettingsNotification( const app_mngr::commands::MessageSharedPtr& message, @@ -89,18 +89,17 @@ std::string AccessModeToString( } void RCOnRemoteControlSettingsNotification::DisallowRCFunctionality() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); interior_data_manager_.OnDisablingRC(); } void RCOnRemoteControlSettingsNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!(*message_)[app_mngr::strings::msg_params].keyExists( message_params::kAllowed)) { - LOG4CXX_DEBUG(logger_, - "Notification is ignored due to \"allow\" parameter absense"); - LOG4CXX_DEBUG(logger_, "RC Functionality remains unchanged"); + SDL_LOG_DEBUG("Notification is ignored due to \"allow\" parameter absense"); + SDL_LOG_DEBUG("RC Functionality remains unchanged"); return; } @@ -110,7 +109,7 @@ void RCOnRemoteControlSettingsNotification::Run() { if (is_allowed) { hmi_apis::Common_RCAccessMode::eType access_mode = hmi_apis::Common_RCAccessMode::INVALID_ENUM; - LOG4CXX_DEBUG(logger_, "Allowing RC Functionality"); + SDL_LOG_DEBUG("Allowing RC Functionality"); resource_allocation_manager_.set_rc_enabled(true); if ((*message_)[app_mngr::strings::msg_params].keyExists( message_params::kAccessMode)) { @@ -118,18 +117,16 @@ void RCOnRemoteControlSettingsNotification::Run() { (*message_)[app_mngr::strings::msg_params] [message_params::kAccessMode] .asUInt()); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Setting up access mode : " << AccessModeToString(access_mode)); } else { access_mode = resource_allocation_manager_.GetAccessMode(); - LOG4CXX_DEBUG(logger_, - "No access mode received. Using last known: " - << AccessModeToString(access_mode)); + SDL_LOG_DEBUG("No access mode received. Using last known: " + << AccessModeToString(access_mode)); } resource_allocation_manager_.SetAccessMode(access_mode); } else { - LOG4CXX_DEBUG(logger_, "Disallowing RC Functionality"); + SDL_LOG_DEBUG("Disallowing RC Functionality"); DisallowRCFunctionality(); resource_allocation_manager_.ResetAllAllocations(); resource_allocation_manager_.set_rc_enabled(false); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc index 2f203afc2d..f0ff1afbb3 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc @@ -37,6 +37,8 @@ namespace app_mngr = application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCSetGlobalPropertiesRequest::RCSetGlobalPropertiesRequest( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -47,7 +49,7 @@ RCSetGlobalPropertiesRequest::RCSetGlobalPropertiesRequest( params.policy_handler_) {} void RCSetGlobalPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc index c31314ec21..3779cfc198 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc @@ -35,6 +35,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCSetGlobalPropertiesResponse::RCSetGlobalPropertiesResponse( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -46,7 +48,7 @@ RCSetGlobalPropertiesResponse::RCSetGlobalPropertiesResponse( params.policy_handler_) {} void RCSetGlobalPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::event_engine::Event event( hmi_apis::FunctionID::RC_SetGlobalProperties); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc index f0d5ecc177..618f200d18 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc @@ -36,6 +36,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCSetInteriorVehicleDataRequest::RCSetInteriorVehicleDataRequest( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -47,7 +49,7 @@ RCSetInteriorVehicleDataRequest::RCSetInteriorVehicleDataRequest( RCSetInteriorVehicleDataRequest::~RCSetInteriorVehicleDataRequest() {} void RCSetInteriorVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc index 56d924debe..94cf2837d8 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc @@ -36,6 +36,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCSetInteriorVehicleDataResponse::RCSetInteriorVehicleDataResponse( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -47,7 +49,7 @@ RCSetInteriorVehicleDataResponse::RCSetInteriorVehicleDataResponse( params.policy_handler_) {} void RCSetInteriorVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::event_engine::Event event( hmi_apis::FunctionID::RC_SetInteriorVehicleData); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc index 3adc48dfbf..9bf7977bdf 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc @@ -45,7 +45,7 @@ namespace commands { using namespace json_keys; using namespace message_params; -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") +SDL_CREATE_LOG_VARIABLE("Commands") ButtonPressRequest::ButtonPressRequest( const app_mngr::commands::MessageSharedPtr& message, @@ -78,7 +78,7 @@ const mobile_apis::ButtonName::eType ButtonPressRequest::GetButtonId() const { } void ButtonPressRequest::Execute() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); const bool button_name_matches_module_type = @@ -106,14 +106,13 @@ void ButtonPressRequest::Execute() { &(*message_)[app_mngr::strings::msg_params], true); } else if (!button_name_matches_module_type) { - LOG4CXX_WARN(logger_, "Request module type and button name mismatch!"); + SDL_LOG_WARN("Request module type and button name mismatch!"); SetResourceState(module_type, ResourceState::FREE); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Request module type and button name mismatch!"); } else { - LOG4CXX_WARN(logger_, - "Requested button or module does not exist in capabilities!"); + SDL_LOG_WARN("Requested button or module does not exist in capabilities!"); SetResourceState(module_type, ResourceState::FREE); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE, @@ -123,7 +122,7 @@ void ButtonPressRequest::Execute() { AcquireResult::eType ButtonPressRequest::AcquireResource( const app_mngr::commands::MessageSharedPtr& message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); app_mngr::ApplicationSharedPtr app = application_manager_.application(CommandRequestImpl::connection_key()); @@ -134,13 +133,13 @@ AcquireResult::eType ButtonPressRequest::AcquireResource( bool ButtonPressRequest::IsResourceFree(const std::string& module_type, const std::string& module_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return resource_allocation_manager_.IsResourceFree(module_type, module_id); } void ButtonPressRequest::SetResourceState(const std::string& module_type, const ResourceState::eType state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = application_manager_.application(CommandRequestImpl::connection_key()); @@ -149,7 +148,7 @@ void ButtonPressRequest::SetResourceState(const std::string& module_type, } void ButtonPressRequest::on_event(const app_mngr::event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); RCCommandRequest::on_event(event); if (hmi_apis::FunctionID::Buttons_ButtonPress != event.id()) { @@ -180,7 +179,7 @@ void ButtonPressRequest::on_event(const app_mngr::event_engine::Event& event) { auto app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer."); + SDL_LOG_ERROR("NULL pointer."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, ""); return; } @@ -221,7 +220,7 @@ std::string ButtonPressRequest::ModuleType() const { } std::string ButtonPressRequest::ModuleId() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto msg_params = (*message_)[app_mngr::strings::msg_params]; if (msg_params.keyExists(message_params::kModuleId)) { return msg_params[message_params::kModuleId].asString(); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc index 491b0363c9..7f9ccf5839 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc @@ -36,6 +36,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ButtonPressResponse::ButtonPressResponse( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -48,7 +50,7 @@ ButtonPressResponse::ButtonPressResponse( ButtonPressResponse::~ButtonPressResponse() {} void ButtonPressResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager_.GetRPCService().SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc index fd661afd5f..a13a7f2a9e 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc @@ -45,13 +45,15 @@ namespace rc_rpc_plugin { namespace app_mngr = application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetInteriorVehicleDataConsentRequest::GetInteriorVehicleDataConsentRequest( const application_manager::commands::MessageSharedPtr& message, const RCCommandParams& params) : RCCommandRequest(message, params) {} void GetInteriorVehicleDataConsentRequest::Execute() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto& msg_params = (*message_)[app_mngr::strings::msg_params]; @@ -65,9 +67,9 @@ void GetInteriorVehicleDataConsentRequest::Execute() { } if (msg_params[message_params::kModuleIds].empty()) { - LOG4CXX_DEBUG(logger_, - "ModuleIds collection is empty. Will be add default " - "module_id from capabilities"); + SDL_LOG_DEBUG( + "ModuleIds collection is empty. Will be add default " + "module_id from capabilities"); const auto module_id = rc_capabilities_manager_.GetDefaultModuleIdFromCapabilities( @@ -81,8 +83,7 @@ void GetInteriorVehicleDataConsentRequest::Execute() { *(msg_params[message_params::kModuleIds].asArray())) { const ModuleUid module(module_type, module_id.asString()); if (!rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) { - LOG4CXX_WARN(logger_, - "Accessing not supported module: " << module_type << " " + SDL_LOG_WARN("Accessing not supported module: " << module_type << " " << module_id.asString()); SetResourceState(module_type, ResourceState::FREE); SendResponse(false, @@ -94,8 +95,7 @@ void GetInteriorVehicleDataConsentRequest::Execute() { smart_objects::SmartObject response_params; if (GetCalculatedVehicleDataConsent(response_params)) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "No need to send request to HMI. Sending cached consents to mobile"); SendResponse(true, mobile_apis::Result::SUCCESS, nullptr, &response_params); return; @@ -107,8 +107,8 @@ void GetInteriorVehicleDataConsentRequest::Execute() { hmi_request_consents_ = smart_objects::SmartObject(response_params[message_params::kAllowed]); - LOG4CXX_DEBUG( - logger_, "Filtering out module ids with successfully calculated consent"); + SDL_LOG_DEBUG( + "Filtering out module ids with successfully calculated consent"); smart_objects::SmartObject hmi_msg_params(msg_params); auto module_ids_for_consent = @@ -126,9 +126,9 @@ void GetInteriorVehicleDataConsentRequest::Execute() { } } - LOG4CXX_DEBUG(logger_, - "Forwarding request to HMI with moduleIds for modules with " - "unknown consent"); + SDL_LOG_DEBUG( + "Forwarding request to HMI with moduleIds for modules with " + "unknown consent"); SendHMIRequest(hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent, (&hmi_msg_params), true); @@ -136,10 +136,10 @@ void GetInteriorVehicleDataConsentRequest::Execute() { void GetInteriorVehicleDataConsentRequest::on_event( const app_mngr::event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (event.id() != hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent) { - LOG4CXX_ERROR(logger_, "Received wrong event. FunctionID: " << event.id()); + SDL_LOG_ERROR("Received wrong event. FunctionID: " << event.id()); return; } @@ -169,7 +169,7 @@ void GetInteriorVehicleDataConsentRequest::on_event( .empty()) { std::string info_out = "Collection of consents is absent in HMI response or empty"; - LOG4CXX_ERROR(logger_, info_out); + SDL_LOG_ERROR(info_out); SendResponse(false, mobile_apis::Result::GENERIC_ERROR, info_out.c_str()); return; } @@ -194,13 +194,12 @@ void GetInteriorVehicleDataConsentRequest::on_event( "HMI response has incorrect number of consents expected: " + std::to_string(number_of_expected_response_consents) + ", actual: " + std::to_string(response_consents->size()); - LOG4CXX_ERROR(logger_, info_out); + SDL_LOG_ERROR(info_out); SendResponse(false, mobile_apis::Result::GENERIC_ERROR, info_out.c_str()); return; } - LOG4CXX_DEBUG(logger_, - "Adding back filtered out module ids for response to mobile"); + SDL_LOG_DEBUG("Adding back filtered out module ids for response to mobile"); uint32_t response_consents_counter = 0; for (auto& consent : *(hmi_request_consents_.asArray())) { // Only modify consent for moduleIds allowed by location constraints @@ -221,7 +220,7 @@ void GetInteriorVehicleDataConsentRequest::on_event( response_info, hmi_response[app_mngr::strings::msg_params]); if (!result_of_saving) { - LOG4CXX_DEBUG(logger_, "Consent saving failed"); + SDL_LOG_DEBUG("Consent saving failed"); SendResponse( false, mobile_apis::Result::GENERIC_ERROR, response_info.c_str()); return; @@ -255,7 +254,7 @@ GetInteriorVehicleDataConsentRequest::~GetInteriorVehicleDataConsentRequest() {} bool GetInteriorVehicleDataConsentRequest::IsUserLocationValid( const ModuleUid& module_uid) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!rc_capabilities_manager_.IsSeatLocationCapabilityProvided()) { return true; @@ -278,7 +277,7 @@ rc_rpc_types::ModuleConsent GetInteriorVehicleDataConsentRequest::GetModuleConsentByAccessMode( const ModuleUid& module_uid, const hmi_apis::Common_RCAccessMode::eType access_mode) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto get_auto_allow_consent = [](const ModuleUid& module_uid) { return rc_rpc_types::ModuleConsent::CONSENTED; @@ -328,31 +327,26 @@ GetInteriorVehicleDataConsentRequest::GetModuleConsentByAccessMode( switch (access_mode) { case hmi_apis::Common_RCAccessMode::AUTO_ALLOW: { - LOG4CXX_DEBUG(logger_, - "Calculating consent for module(" - << module_uid.first << ", " << module_uid.second - << ") in accessMode: AUTO_ALLOW"); + SDL_LOG_DEBUG("Calculating consent for module(" + << module_uid.first << ", " << module_uid.second + << ") in accessMode: AUTO_ALLOW"); return get_auto_allow_consent(module_uid); } case hmi_apis::Common_RCAccessMode::AUTO_DENY: { - LOG4CXX_DEBUG(logger_, - "Calculating consent for module(" - << module_uid.first << ", " << module_uid.second - << ") in accessMode: AUTO_DENY"); + SDL_LOG_DEBUG("Calculating consent for module(" + << module_uid.first << ", " << module_uid.second + << ") in accessMode: AUTO_DENY"); return get_auto_deny_consent(module_uid); } case hmi_apis::Common_RCAccessMode::ASK_DRIVER: { - LOG4CXX_DEBUG(logger_, - "Calculating consent for module(" - << module_uid.first << ", " << module_uid.second - << ") in accessMode: ASK_DRIVER"); + SDL_LOG_DEBUG("Calculating consent for module(" + << module_uid.first << ", " << module_uid.second + << ") in accessMode: ASK_DRIVER"); return get_ask_driver_consent(module_uid); } default: { - LOG4CXX_DEBUG(logger_, - "Unknown accessMode specified. Denying consent for module(" - << module_uid.first << ", " << module_uid.second - << ")"); + SDL_LOG_DEBUG("Unknown accessMode specified. Denying consent for module(" + << module_uid.first << ", " << module_uid.second << ")"); return rc_rpc_types::ModuleConsent::NOT_CONSENTED; } } @@ -360,7 +354,7 @@ GetInteriorVehicleDataConsentRequest::GetModuleConsentByAccessMode( bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent( smart_objects::SmartObject& out_response) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); out_response = smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map); @@ -391,10 +385,9 @@ bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent( const ModuleUid module_uid(module_type, module_id.asString()); // Check if the user_location is covered by the module's serviceArea if (!IsUserLocationValid(module_uid)) { - LOG4CXX_DEBUG(logger_, - "User is outside the serviceArea for module(" - << module_uid.first << ", " << module_uid.second - << "). Denying consent"); + SDL_LOG_DEBUG("User is outside the serviceArea for module(" + << module_uid.first << ", " << module_uid.second + << "). Denying consent"); modules_consent_array->push_back(smart_objects::SmartObject(false)); continue; } @@ -404,10 +397,8 @@ bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent( const bool is_multiple_access_allowed = rc_capabilities_manager_.IsMultipleAccessAllowed(module_uid); if (!is_multiple_access_allowed) { - LOG4CXX_DEBUG(logger_, - "multipleAccess disallowed for module(" - << module_uid.first << ", " << module_uid.second - << ")"); + SDL_LOG_DEBUG("multipleAccess disallowed for module(" + << module_uid.first << ", " << module_uid.second << ")"); module_consent = get_disallowed_multiple_access_consent(module_uid); modules_consent_array->push_back(smart_objects::SmartObject( module_consent == rc_rpc_types::ModuleConsent::CONSENTED)); @@ -418,10 +409,9 @@ bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent( module_consent = GetModuleConsentByAccessMode(module_uid, access_mode); if (module_consent == rc_rpc_types::ModuleConsent::NOT_EXISTS) { - LOG4CXX_DEBUG(logger_, - "Unable to calculate consent for module(" - << module_uid.first << ", " << module_uid.second - << "), should send moduleId to HMI for consent"); + SDL_LOG_DEBUG("Unable to calculate consent for module(" + << module_uid.first << ", " << module_uid.second + << "), should send moduleId to HMI for consent"); modules_consent_array->push_back(smart_objects::SmartObject()); can_handle_internally = false; continue; @@ -434,7 +424,7 @@ bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent( bool GetInteriorVehicleDataConsentRequest::SaveModuleIdConsents( std::string& info_out, const smart_objects::SmartObject& msg_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& allowed = msg_params[message_params::kAllowed]; const auto& moduleIds = @@ -444,7 +434,7 @@ bool GetInteriorVehicleDataConsentRequest::SaveModuleIdConsents( info_out = "The received module_id collection from mobile and received consent " "collection from HMI are not equal by size."; - LOG4CXX_ERROR(logger_, info_out); + SDL_LOG_ERROR(info_out); return false; } std::string module_type = ModuleType(); @@ -456,8 +446,7 @@ bool GetInteriorVehicleDataConsentRequest::SaveModuleIdConsents( auto application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, - "Application with connection key:" << connection_key() + SDL_LOG_ERROR("Application with connection key:" << connection_key() << " isn't registered"); return false; } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc index 3e197fbdea..fe33e29e44 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc @@ -35,6 +35,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetInteriorVehicleDataConsentResponse::GetInteriorVehicleDataConsentResponse( const application_manager::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -46,7 +48,7 @@ GetInteriorVehicleDataConsentResponse::GetInteriorVehicleDataConsentResponse( params.policy_handler_) {} void GetInteriorVehicleDataConsentResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager_.GetRPCService().SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc index e89b260dca..7d274870bc 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc @@ -44,7 +44,7 @@ namespace commands { using namespace json_keys; using namespace message_params; -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") +SDL_CREATE_LOG_VARIABLE("Commands") GetInteriorVehicleDataRequest::GetInteriorVehicleDataRequest( const app_mngr::commands::MessageSharedPtr& message, @@ -53,7 +53,7 @@ GetInteriorVehicleDataRequest::GetInteriorVehicleDataRequest( , excessive_subscription_occured_(false) {} bool GetInteriorVehicleDataRequest::ProcessCapabilities() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto rc_capability = hmi_capabilities_.rc_capability(); const std::string module_type = ModuleType(); @@ -61,9 +61,8 @@ bool GetInteriorVehicleDataRequest::ProcessCapabilities() { const ModuleUid module(module_type, module_id); if (rc_capability && !rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) { - LOG4CXX_WARN( - logger_, - "Accessing not supported module: " << module_type << " " << module_id); + SDL_LOG_WARN("Accessing not supported module: " << module_type << " " + << module_id); SetResourceState(ModuleType(), ResourceState::FREE); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE, @@ -100,7 +99,7 @@ void GetInteriorVehicleDataRequest::FilterDisabledModuleData( void GetInteriorVehicleDataRequest::ProcessResponseToMobileFromCache( app_mngr::ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping(); const std::string module_type = ModuleType(); const std::string module_id = ModuleId(); @@ -118,9 +117,8 @@ void GetInteriorVehicleDataRequest::ProcessResponseToMobileFromCache( module_id; const auto& request_msg_params = (*message_)[app_mngr::strings::msg_params]; - LOG4CXX_DEBUG(logger_, - "kSubscribe exist" << request_msg_params.keyExists( - message_params::kSubscribe)); + SDL_LOG_DEBUG("kSubscribe exist" + << request_msg_params.keyExists(message_params::kSubscribe)); if (request_msg_params.keyExists(message_params::kSubscribe)) { response_msg_params[message_params::kIsSubscribed] = request_msg_params[message_params::kSubscribe].asBool(); @@ -140,7 +138,7 @@ void GetInteriorVehicleDataRequest::ProcessResponseToMobileFromCache( } bool GetInteriorVehicleDataRequest::CheckRateLimits() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); const std::string module_id = ModuleId(); const ModuleUid module(module_type, module_id); @@ -148,7 +146,7 @@ bool GetInteriorVehicleDataRequest::CheckRateLimits() { } bool GetInteriorVehicleDataRequest::AppShouldBeUnsubscribed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& msg_params = (*message_)[app_mngr::strings::msg_params]; if (msg_params.keyExists(message_params::kSubscribe)) { return !(msg_params[message_params::kSubscribe].asBool()); @@ -158,7 +156,7 @@ bool GetInteriorVehicleDataRequest::AppShouldBeUnsubscribed() { bool GetInteriorVehicleDataRequest::TheLastAppShouldBeUnsubscribed( app_mngr::ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (AppShouldBeUnsubscribed()) { const std::string module_type = ModuleType(); const std::string module_id = ModuleId(); @@ -167,9 +165,8 @@ bool GetInteriorVehicleDataRequest::TheLastAppShouldBeUnsubscribed( RCHelpers::AppsSubscribedToModule(application_manager_, module); if (subscribed_to_module_type.size() == 1 && subscribed_to_module_type.front() == app) { - LOG4CXX_DEBUG(logger_, - "The last application unsubscribes from " - << module_type << " " << module_id); + SDL_LOG_DEBUG("The last application unsubscribes from " + << module_type << " " << module_id); return true; } } @@ -177,7 +174,7 @@ bool GetInteriorVehicleDataRequest::TheLastAppShouldBeUnsubscribed( } void GetInteriorVehicleDataRequest::Execute() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ProcessCapabilities()) { return; @@ -199,7 +196,7 @@ void GetInteriorVehicleDataRequest::Execute() { RemoveExcessiveSubscription(); } if (!CheckRateLimits()) { - LOG4CXX_WARN(logger_, "GetInteriorVehicleData frequency is too high."); + SDL_LOG_WARN("GetInteriorVehicleData frequency is too high."); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -216,7 +213,7 @@ void GetInteriorVehicleDataRequest::Execute() { void GetInteriorVehicleDataRequest::on_event( const app_mngr::event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); RCCommandRequest::on_event(event); if (hmi_apis::FunctionID::RC_GetInteriorVehicleData != event.id()) { @@ -244,10 +241,8 @@ void GetInteriorVehicleDataRequest::on_event( if (result) { if (!IsModuleIdProvided(hmi_response)) { - LOG4CXX_WARN(logger_, - "conditional mandatory parameter " - << message_params::kModuleId - << " missed in hmi response"); + SDL_LOG_WARN("conditional mandatory parameter " + << message_params::kModuleId << " missed in hmi response"); result = false; result_code = mobile_apis::Result::GENERIC_ERROR; } @@ -288,7 +283,7 @@ GetInteriorVehicleDataRequest::~GetInteriorVehicleDataRequest() {} void GetInteriorVehicleDataRequest::ProccessSubscription( const ns_smart_device_link::ns_smart_objects::SmartObject& hmi_response) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool is_subscribe_present_in_request = (*message_)[app_mngr::strings::msg_params].keyExists( @@ -332,10 +327,8 @@ void GetInteriorVehicleDataRequest::ProccessSubscription( } if (is_subscribe_present_in_request && !isSubscribed_present_in_response) { - LOG4CXX_WARN(logger_, - "conditional mandatory parameter " - << message_params::kIsSubscribed - << " missed in hmi response"); + SDL_LOG_WARN("conditional mandatory parameter " + << message_params::kIsSubscribed << " missed in hmi response"); is_subscribed = extension->IsSubscribedToInteriorVehicleData(module); temp_hmi_response[app_mngr::strings::msg_params] @@ -344,8 +337,7 @@ void GetInteriorVehicleDataRequest::ProccessSubscription( } if (!is_subscribe_present_in_request && isSubscribed_present_in_response) { - LOG4CXX_WARN(logger_, - "Parameter " << message_params::kIsSubscribed + SDL_LOG_WARN("Parameter " << message_params::kIsSubscribed << " is ignored due to absence '" << message_params::kSubscribe << "' parameter in request"); @@ -364,31 +356,27 @@ void GetInteriorVehicleDataRequest::ProccessSubscription( .asBool(); is_subscribed = response_subscribe; - LOG4CXX_TRACE(logger_, "request_subscribe = " << request_subscribe); - LOG4CXX_TRACE(logger_, "response_subscribe = " << response_subscribe); + SDL_LOG_TRACE("request_subscribe = " << request_subscribe); + SDL_LOG_TRACE("response_subscribe = " << response_subscribe); if (request_subscribe == response_subscribe) { const std::string module_type = ModuleType(); const std::string module_id = ModuleId(); const ModuleUid module(module_type, module_id); if (response_subscribe) { - LOG4CXX_DEBUG(logger_, - "SubscribeToInteriorVehicleData " << app->app_id() << " " - << module_type << " " - << module_id); + SDL_LOG_DEBUG("SubscribeToInteriorVehicleData " + << app->app_id() << " " << module_type << " " << module_id); extension->SubscribeToInteriorVehicleData(module); } else { - LOG4CXX_DEBUG(logger_, - "UnsubscribeFromInteriorVehicleData " - << app->app_id() << " " << module_type << " " - << module_id); + SDL_LOG_DEBUG("UnsubscribeFromInteriorVehicleData " + << app->app_id() << " " << module_type << " " << module_id); extension->UnsubscribeFromInteriorVehicleData(module); } } } bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool is_subscribe_present_in_request = (*message_)[app_mngr::strings::msg_params].keyExists( message_params::kSubscribe); @@ -416,12 +404,12 @@ bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription() { } void GetInteriorVehicleDataRequest::RemoveExcessiveSubscription() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[app_mngr::strings::msg_params].erase(message_params::kSubscribe); } std::string GetInteriorVehicleDataRequest::ModuleType() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); mobile_apis::ModuleType::eType module_type = static_cast<mobile_apis::ModuleType::eType>( (*message_)[app_mngr::strings::msg_params] @@ -434,7 +422,7 @@ std::string GetInteriorVehicleDataRequest::ModuleType() const { } std::string GetInteriorVehicleDataRequest::ModuleId() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto msg_params = (*message_)[app_mngr::strings::msg_params]; if (msg_params.keyExists(message_params::kModuleId)) { return msg_params[message_params::kModuleId].asString(); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc index b1fa8d6ea0..1c19cc641d 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc @@ -37,6 +37,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetInteriorVehicleDataResponse::GetInteriorVehicleDataResponse( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -49,7 +51,7 @@ GetInteriorVehicleDataResponse::GetInteriorVehicleDataResponse( GetInteriorVehicleDataResponse::~GetInteriorVehicleDataResponse() {} void GetInteriorVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); RCHelpers::RemoveRedundantGPSDataFromIVDataMsg( (*message_)[app_mngr::strings::msg_params]); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc index 91ecbe77eb..f7a9ae50bd 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc @@ -40,7 +40,7 @@ namespace rc_rpc_plugin { namespace commands { -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") +SDL_CREATE_LOG_VARIABLE("Commands") OnInteriorVehicleDataNotification::OnInteriorVehicleDataNotification( const app_mngr::commands::MessageSharedPtr& message, @@ -65,7 +65,7 @@ void OnInteriorVehicleDataNotification::AddDataToCache( } void OnInteriorVehicleDataNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); const std::string module_id = ModuleId(); @@ -87,10 +87,9 @@ void OnInteriorVehicleDataNotification::Run() { const auto extension = RCHelpers::GetRCExtension(app); DCHECK(extension); - LOG4CXX_TRACE(logger_, - "Check subscription for " << app.app_id() - << "and module type " << module_type - << " " << module_id); + SDL_LOG_TRACE("Check subscription for " + << app.app_id() << "and module type " << module_type << " " + << module_id); if (extension->IsSubscribedToInteriorVehicleData(module)) { (*message_)[app_mngr::strings::params] @@ -105,7 +104,7 @@ void OnInteriorVehicleDataNotification::Run() { } std::string OnInteriorVehicleDataNotification::ModuleId() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto msg_params = (*message_)[app_mngr::strings::msg_params]; if (msg_params[message_params::kModuleData].keyExists( message_params::kModuleId)) { diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc index 375db9cd9d..e7532636b2 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc @@ -41,6 +41,8 @@ namespace rc_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + namespace { struct ResponseParams { std::string response_info; @@ -90,7 +92,7 @@ ReleaseInteriorVehicleDataModuleRequest:: : RCCommandRequest(message, params) {} bool ReleaseInteriorVehicleDataModuleRequest::ProcessCapabilities() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto rc_capability = hmi_capabilities_.rc_capability(); const std::string module_type = ModuleType(); @@ -98,9 +100,8 @@ bool ReleaseInteriorVehicleDataModuleRequest::ProcessCapabilities() { const ModuleUid module(module_type, module_id); if (rc_capability && !rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) { - LOG4CXX_WARN( - logger_, - "Accessing not supported module: " << module_type << " " << module_id); + SDL_LOG_WARN("Accessing not supported module: " << module_type << " " + << module_id); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE, "Accessing not supported module"); @@ -110,7 +111,7 @@ bool ReleaseInteriorVehicleDataModuleRequest::ProcessCapabilities() { } void ReleaseInteriorVehicleDataModuleRequest::Execute() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ProcessCapabilities()) { return; @@ -122,7 +123,7 @@ void ReleaseInteriorVehicleDataModuleRequest::Execute() { ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -149,12 +150,11 @@ void ReleaseInteriorVehicleDataModuleRequest::Execute() { NotificationTrigger::MODULE_ALLOCATION, app); } - LOG4CXX_DEBUG(logger_, - "Resource for module: " - << ModuleType() << " with id: " << module_id - << " was released with result " << std::boolalpha - << response_params.success_result - << " and result_code: " << response_params.result_code); + SDL_LOG_DEBUG("Resource for module: " + << ModuleType() << " with id: " << module_id + << " was released with result " << std::boolalpha + << response_params.success_result + << " and result_code: " << response_params.result_code); SendResponse(response_params.success_result, response_params.result_code, @@ -162,7 +162,7 @@ void ReleaseInteriorVehicleDataModuleRequest::Execute() { } std::string ReleaseInteriorVehicleDataModuleRequest::ModuleType() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); mobile_apis::ModuleType::eType module_type = static_cast<mobile_apis::ModuleType::eType>( (*message_)[app_mngr::strings::msg_params] @@ -176,7 +176,7 @@ std::string ReleaseInteriorVehicleDataModuleRequest::ModuleType() const { } std::string ReleaseInteriorVehicleDataModuleRequest::ModuleId() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto msg_params = (*message_)[app_mngr::strings::msg_params]; if (msg_params.keyExists(message_params::kModuleId)) { return msg_params[message_params::kModuleId].asString(); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc index fae792f143..766c523b58 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc @@ -35,6 +35,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ReleaseInteriorVehicleDataModuleResponse:: ReleaseInteriorVehicleDataModuleResponse( const application_manager::commands::MessageSharedPtr& message, @@ -47,7 +49,7 @@ ReleaseInteriorVehicleDataModuleResponse:: params.policy_handler_) {} void ReleaseInteriorVehicleDataModuleResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager_.GetRPCService().SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc index dfcc6205b1..8dd4eab306 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc @@ -45,7 +45,7 @@ namespace commands { using namespace json_keys; using namespace message_params; -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") +SDL_CREATE_LOG_VARIABLE("Commands") SetInteriorVehicleDataRequest::SetInteriorVehicleDataRequest( const app_mngr::commands::MessageSharedPtr& message, @@ -62,7 +62,7 @@ SetInteriorVehicleDataRequest::~SetInteriorVehicleDataRequest() {} */ bool ClearUnrelatedModuleData(const std::string& module_type, smart_objects::SmartObject& module_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& all_module_types = RCHelpers::GetModuleTypesList(); const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping(); bool module_type_and_data_match = false; @@ -106,11 +106,11 @@ mobile_apis::Result::eType PrepareResultCodeAndInfo( info = "Accessing not supported module data."; } return result_code; - LOG4CXX_WARN(logger_, info); + SDL_LOG_WARN(info); } void SetInteriorVehicleDataRequest::Execute() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& module_data = (*message_)[app_mngr::strings::msg_params][message_params::kModuleData]; @@ -120,8 +120,7 @@ void SetInteriorVehicleDataRequest::Execute() { const std::string module_id = ModuleId(); const ModuleUid module(module_type, module_id); if (!rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) { - LOG4CXX_WARN(logger_, - "Accessing not supported module: " << module_type << " " + SDL_LOG_WARN("Accessing not supported module: " << module_type << " " << module_id); SetResourceState(ModuleType(), ResourceState::FREE); SendResponse(false, @@ -146,7 +145,7 @@ void SetInteriorVehicleDataRequest::Execute() { if (rc_capabilities_manager_.AreAllParamsReadOnly(module_data, module_type)) { - LOG4CXX_WARN(logger_, "All request params in module type are READ ONLY!"); + SDL_LOG_WARN("All request params in module type are READ ONLY!"); SetResourceState(ModuleType(), ResourceState::FREE); SendResponse(false, mobile_apis::Result::READ_ONLY, @@ -158,7 +157,7 @@ void SetInteriorVehicleDataRequest::Execute() { if (rc_capabilities_manager_.AreReadOnlyParamsPresent( module_data, module_type, module_data_capabilities)) { - LOG4CXX_DEBUG(logger_, "Request module type has READ ONLY parameters"); + SDL_LOG_DEBUG("Request module type has READ ONLY parameters"); if (enums_value::kLight == module_data_capabilities.first && capabilitiesStatus::kSuccess != module_data_capabilities.second) { @@ -170,7 +169,7 @@ void SetInteriorVehicleDataRequest::Execute() { return; } - LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameters... "); + SDL_LOG_DEBUG("Cutting-off READ ONLY parameters... "); CutOffReadOnlyParams(module_data); } @@ -190,7 +189,7 @@ void SetInteriorVehicleDataRequest::Execute() { if (app_wants_to_set_audio_src) { if (!app->IsAllowedToChangeAudioSource()) { - LOG4CXX_WARN(logger_, "App is not allowed to change audio source"); + SDL_LOG_WARN("App is not allowed to change audio source"); SetResourceState(ModuleType(), ResourceState::FREE); SendResponse(false, mobile_apis::Result::REJECTED, @@ -210,7 +209,7 @@ void SetInteriorVehicleDataRequest::Execute() { &(*message_)[app_mngr::strings::msg_params], true); } else { - LOG4CXX_WARN(logger_, "Request module type & data mismatch!"); + SDL_LOG_WARN("Request module type & data mismatch!"); SetResourceState(ModuleType(), ResourceState::FREE); SendResponse(false, mobile_apis::Result::INVALID_DATA, @@ -220,7 +219,7 @@ void SetInteriorVehicleDataRequest::Execute() { void SetInteriorVehicleDataRequest::on_event( const app_mngr::event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); RCCommandRequest::on_event(event); if (hmi_apis::FunctionID::RC_SetInteriorVehicleData != event.id()) { @@ -244,10 +243,8 @@ void SetInteriorVehicleDataRequest::on_event( if (result) { if (!IsModuleIdProvided(hmi_response)) { - LOG4CXX_WARN(logger_, - "conditional mandatory parameter " - << message_params::kModuleId - << " missed in hmi response"); + SDL_LOG_WARN("conditional mandatory parameter " + << message_params::kModuleId << " missed in hmi response"); result = false; result_code = mobile_apis::Result::GENERIC_ERROR; } @@ -265,7 +262,7 @@ void SetInteriorVehicleDataRequest::on_event( auto app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer."); + SDL_LOG_ERROR("NULL pointer."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, ""); return; } @@ -298,7 +295,7 @@ void SetInteriorVehicleDataRequest::on_event( void SetInteriorVehicleDataRequest::CheckAudioSource( const smart_objects::SmartObject& audio_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (audio_data.keyExists(message_params::kSource)) { application_manager_.set_current_audio_source( audio_data[message_params::kSource].asUInt()); @@ -307,7 +304,7 @@ void SetInteriorVehicleDataRequest::CheckAudioSource( void SetInteriorVehicleDataRequest::CutOffReadOnlyParams( smart_objects::SmartObject& module_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); const auto& module_type_params = rc_capabilities_manager_.ControlDataForType(module_data, module_type); @@ -319,9 +316,8 @@ void SetInteriorVehicleDataRequest::CutOffReadOnlyParams( for (; it != equalizer_settings.asArray()->end(); ++it) { if (it->keyExists(message_params::kChannelName)) { it->erase(message_params::kChannelName); - LOG4CXX_DEBUG(logger_, - "Cutting-off READ ONLY parameter: " - << message_params::kChannelName); + SDL_LOG_DEBUG("Cutting-off READ ONLY parameter: " + << message_params::kChannelName); } } } @@ -332,13 +328,13 @@ void SetInteriorVehicleDataRequest::CutOffReadOnlyParams( for (const auto& param : ro_params) { if (module_type_params.keyExists(param)) { module_data[data_mapping(module_type)].erase(param); - LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << param); + SDL_LOG_DEBUG("Cutting-off READ ONLY parameter: " << param); } } } std::string SetInteriorVehicleDataRequest::ModuleType() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); mobile_apis::ModuleType::eType module_type = static_cast<mobile_apis::ModuleType::eType>( (*message_)[app_mngr::strings::msg_params] @@ -351,7 +347,7 @@ std::string SetInteriorVehicleDataRequest::ModuleType() const { } std::string SetInteriorVehicleDataRequest::ModuleId() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto msg_params = (*message_)[app_mngr::strings::msg_params]; if (msg_params[message_params::kModuleData].keyExists( message_params::kModuleId)) { @@ -372,7 +368,7 @@ std::string SetInteriorVehicleDataRequest::ModuleId() const { AcquireResult::eType SetInteriorVehicleDataRequest::AcquireResource( const app_mngr::commands::MessageSharedPtr& message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); app_mngr::ApplicationSharedPtr app = application_manager_.application(CommandRequestImpl::connection_key()); @@ -388,7 +384,7 @@ bool SetInteriorVehicleDataRequest::IsResourceFree( void SetInteriorVehicleDataRequest::SetResourceState( const std::string& module_type, const ResourceState::eType state) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = application_manager_.application(CommandRequestImpl::connection_key()); resource_allocation_manager_.SetResourceState( diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc index 4dedd4b5a2..aeab82e12c 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc @@ -5,6 +5,8 @@ namespace rc_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SetInteriorVehicleDataResponse::SetInteriorVehicleDataResponse( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) @@ -17,7 +19,7 @@ SetInteriorVehicleDataResponse::SetInteriorVehicleDataResponse( SetInteriorVehicleDataResponse::~SetInteriorVehicleDataResponse() {} void SetInteriorVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager_.GetRPCService().SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc index 98f168c015..53222e0d04 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc @@ -41,7 +41,7 @@ #include "rc_rpc_plugin/rc_module_constants.h" #include "smart_objects/enum_schema_item.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") +SDL_CREATE_LOG_VARIABLE("Commands") namespace rc_rpc_plugin { namespace commands { @@ -75,7 +75,7 @@ bool RCCommandRequest::IsInterfaceAvailable( } void RCCommandRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); SetResourceState(module_type, ResourceState::FREE); SendResponse( @@ -83,7 +83,7 @@ void RCCommandRequest::onTimeOut() { } bool RCCommandRequest::CheckDriverConsent() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = application_manager_.application(CommandRequestImpl::connection_key()); @@ -108,14 +108,14 @@ rc_rpc_plugin::TypeAccess RCCommandRequest::CheckModule( bool RCCommandRequest::IsModuleIdProvided( const smart_objects::SmartObject& hmi_response) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return hmi_response[app_mngr::strings::msg_params] [message_params::kModuleData] .keyExists(message_params::kModuleId); } void RCCommandRequest::SendDisallowed(rc_rpc_plugin::TypeAccess access) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string info; if (rc_rpc_plugin::kDisallowed == access) { info = disallowed_info_.empty() @@ -124,33 +124,33 @@ void RCCommandRequest::SendDisallowed(rc_rpc_plugin::TypeAccess access) { } else { return; } - LOG4CXX_ERROR(logger_, info); + SDL_LOG_ERROR(info); SendResponse(false, mobile_apis::Result::DISALLOWED, info.c_str()); } void RCCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = application_manager_.application(CommandRequestImpl::connection_key()); if (!IsInterfaceAvailable(app_mngr::HmiInterfaces::HMI_INTERFACE_RC)) { - LOG4CXX_WARN(logger_, "HMI interface RC is not available"); + SDL_LOG_WARN("HMI interface RC is not available"); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE, "RC is not supported by system"); return; } - LOG4CXX_TRACE(logger_, "RC interface is available!"); + SDL_LOG_TRACE("RC interface is available!"); if (!policy_handler_.CheckHMIType( app->policy_app_id(), mobile_apis::AppHMIType::eType::REMOTE_CONTROL, app->app_types())) { - LOG4CXX_WARN(logger_, "Application has no remote control functions"); + SDL_LOG_WARN("Application has no remote control functions"); SendResponse(false, mobile_apis::Result::DISALLOWED, ""); return; } if (!resource_allocation_manager_.is_rc_enabled()) { - LOG4CXX_WARN(logger_, "Remote control is disabled by user"); + SDL_LOG_WARN("Remote control is disabled by user"); SetResourceState(ModuleType(), ResourceState::FREE); SendResponse(false, mobile_apis::Result::USER_DISALLOWED, @@ -159,7 +159,7 @@ void RCCommandRequest::Run() { } auto rc_capability = hmi_capabilities_.rc_capability(); if (!rc_capability || rc_capability->empty()) { - LOG4CXX_WARN(logger_, "Accessing not supported module: " << ModuleType()); + SDL_LOG_WARN("Accessing not supported module: " << ModuleType()); SetResourceState(ModuleType(), ResourceState::FREE); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE, @@ -178,12 +178,12 @@ void RCCommandRequest::Run() { } bool RCCommandRequest::AcquireResources() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); const std::string module_id = ModuleId(); if (!IsResourceFree(module_type, module_id)) { - LOG4CXX_WARN(logger_, "Resource is busy."); + SDL_LOG_WARN("Resource is busy."); SendResponse(false, mobile_apis::Result::IN_USE, ""); return false; } @@ -211,7 +211,7 @@ bool RCCommandRequest::AcquireResources() { } void RCCommandRequest::on_event(const app_mngr::event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (event.id() == hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent) { ProcessAccessResponse(event); @@ -223,13 +223,13 @@ void RCCommandRequest::on_event(const app_mngr::event_engine::Event& event) { void RCCommandRequest::ProcessAccessResponse( const app_mngr::event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = application_manager_.application(CommandRequestImpl::connection_key()); const std::string module_type = ModuleType(); const std::string module_id = ModuleId(); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer."); + SDL_LOG_ERROR("NULL pointer."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, ""); return; } @@ -275,7 +275,7 @@ void RCCommandRequest::ProcessConsentResult(const bool is_allowed, const std::string& module_type, const std::string& module_id, const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_allowed) { SetResourceState(module_type, ResourceState::BUSY); Execute(); // run child's logic @@ -293,7 +293,7 @@ void RCCommandRequest::ProcessConsentResult(const bool is_allowed, void RCCommandRequest::ProcessAskDriverMode(const std::string& module_type, const std::string& module_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto app = application_manager_.application(CommandRequestImpl::connection_key()); const std::string policy_app_id = app->policy_app_id(); @@ -321,7 +321,7 @@ void RCCommandRequest::ProcessAskDriverMode(const std::string& module_type, void RCCommandRequest::SendGetUserConsent( const std::string& module_type, const smart_objects::SmartObject& module_ids) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = application_manager_.application(CommandRequestImpl::connection_key()); DCHECK(app); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc index 3e50818210..ab33fde764 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc @@ -41,7 +41,7 @@ namespace rc_rpc_plugin { -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule"); +SDL_CREATE_LOG_VARIABLE("RemoteControlModule"); InteriorDataCacheImpl::InteriorDataCacheImpl() {} @@ -49,9 +49,8 @@ InteriorDataCacheImpl::~InteriorDataCacheImpl() {} void InteriorDataCacheImpl::Add(const ModuleUid& module, const smart_objects::SmartObject& module_data) { - LOG4CXX_TRACE( - logger_, - "module_type : " << module.first << " module_id : " << module.second); + SDL_LOG_TRACE("module_type : " << module.first + << " module_id : " << module.second); sync_primitives::AutoLock autolock(cached_data_lock_); auto it = cached_data_.find(module); if (cached_data_.end() == it) { @@ -63,19 +62,17 @@ void InteriorDataCacheImpl::Add(const ModuleUid& module, smart_objects::SmartObject InteriorDataCacheImpl::Retrieve( const ModuleUid& module) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(cached_data_lock_); auto it = cached_data_.find(module); if (it == cached_data_.end()) { - LOG4CXX_WARN(logger_, - "Module with type: " << module.first + SDL_LOG_WARN("Module with type: " << module.first << " and id: " << module.second << " was not found in cache"); return smart_objects::SmartObject(smart_objects::SmartType_Null); } - LOG4CXX_TRACE( - logger_, - "module_type : " << module.first << " module_id : " << module.second); + SDL_LOG_TRACE("module_type : " << module.first + << " module_id : " << module.second); return it->second; } @@ -92,34 +89,31 @@ std::vector<ModuleUid> InteriorDataCacheImpl::GetCachedModulesByType( } bool InteriorDataCacheImpl::Contains(const ModuleUid& module) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(cached_data_lock_); auto it = cached_data_.find(module); const bool contains = it != cached_data_.end(); - LOG4CXX_TRACE(logger_, - "module_type : " << module.first + SDL_LOG_TRACE("module_type : " << module.first << " module_id : " << module.second << " " << (contains ? "true" : "false")); return contains; } void InteriorDataCacheImpl::Remove(const ModuleUid& module) { - LOG4CXX_TRACE( - logger_, - "module_type : " << module.first << " module_id : " << module.second); + SDL_LOG_TRACE("module_type : " << module.first + << " module_id : " << module.second); sync_primitives::AutoLock autolock(cached_data_lock_); auto it = cached_data_.find(module); if (cached_data_.end() == it) { - LOG4CXX_TRACE( - logger_, - "Not existing module : " << module.first << " " << module.second); + SDL_LOG_TRACE("Not existing module : " << module.first << " " + << module.second); return; } cached_data_.erase(it); } void InteriorDataCacheImpl::Clear() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(cached_data_lock_); cached_data_.clear(); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc index 50568de63a..a4d4026da7 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc @@ -5,7 +5,7 @@ #include "rc_rpc_plugin/rc_rpc_plugin.h" namespace rc_rpc_plugin { -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule"); +SDL_CREATE_LOG_VARIABLE("RemoteControlModule"); InteriorDataManagerImpl::InteriorDataManagerImpl( RCRPCPlugin& rc_plugin, @@ -31,7 +31,7 @@ void InteriorDataManagerImpl::OnApplicationEvent( } void InteriorDataManagerImpl::OnDisablingRC() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto existing_subscription = AppsSubscribedModules(); std::set<ModuleUid> subscribed_modules; for (auto& pair : existing_subscription) { @@ -43,22 +43,21 @@ void InteriorDataManagerImpl::OnDisablingRC() { } } for (auto& module : subscribed_modules) { - LOG4CXX_TRACE(logger_, - "unsubscribe from module type: " << module.first + SDL_LOG_TRACE("unsubscribe from module type: " << module.first << " id: " << module.second); UnsubscribeFromInteriorVehicleData(module); } } void InteriorDataManagerImpl::StoreRequestToHMITime(const ModuleUid& module) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(requests_to_hmi_history_lock_); requests_to_hmi_history_[module].push_back(date_time::getCurrentTime()); } bool InteriorDataManagerImpl::CheckRequestsToHMIFrequency( const ModuleUid& module) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock autolock(requests_to_hmi_history_lock_); ClearOldRequestsToHMIHistory(); const auto& history = requests_to_hmi_history_[module]; @@ -107,7 +106,7 @@ void InteriorDataManagerImpl::UpdateHMISubscriptionsOnPolicyUpdated() { void InteriorDataManagerImpl::UpdateHMISubscriptionsOnAppUnregistered( application_manager::Application& app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto rc_extension = RCHelpers::GetRCExtension(app); auto subscribed_data = rc_extension->InteriorVehicleDataSubscriptions(); rc_extension->UnsubscribeFromInteriorVehicleData(); @@ -128,8 +127,7 @@ void InteriorDataManagerImpl::UnsubscribeFromInteriorVehicleData( cache_.Remove(module); auto unsubscribe_request = RCHelpers::CreateUnsubscribeRequestToHMI( module, app_mngr_.GetNextHMICorrelationID()); - LOG4CXX_DEBUG(logger_, - "Send Unsubscribe from module type: " << module.first << " id: " + SDL_LOG_DEBUG("Send Unsubscribe from module type: " << module.first << " id: " << module.second); rpc_service_.ManageHMICommand(unsubscribe_request); } @@ -142,9 +140,8 @@ void InteriorDataManagerImpl::UnsubscribeFromInteriorVehicleDataOfType( cache_.Remove(module); auto unsubscribe_request = RCHelpers::CreateUnsubscribeRequestToHMI( module, app_mngr_.GetNextHMICorrelationID()); - LOG4CXX_DEBUG(logger_, - "Send Unsubscribe from module type: " - << module.first << " id: " << module.second); + SDL_LOG_DEBUG("Send Unsubscribe from module type: " + << module.first << " id: " << module.second); rpc_service_.ManageHMICommand(unsubscribe_request); } } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc index 0f68769b38..75ccd46e4d 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc @@ -35,7 +35,7 @@ #include "rc_rpc_plugin/rc_module_constants.h" namespace rc_rpc_plugin { -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") +SDL_CREATE_LOG_VARIABLE("RemoteControlModule") RCCapabilitiesManagerImpl::RCCapabilitiesManagerImpl( application_manager::HMICapabilities& hmi_capabilities) @@ -45,22 +45,20 @@ const std::string RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilitiesStructure( const smart_objects::SmartObject& control_capabilities, const std::string& module_type) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (control_capabilities.keyExists(message_params::kModuleInfo)) { // moduleId - mandatory param for ModuleInfo structure const auto module_id = control_capabilities[message_params::kModuleInfo] [message_params::kModuleId] .asString(); - LOG4CXX_WARN(logger_, - "Use default moduleId from hmi capabilities: " - << module_id - << " for requested moduleType: " << module_type); + SDL_LOG_WARN("Use default moduleId from hmi capabilities: " + << module_id << " for requested moduleType: " << module_type); return module_id; } - LOG4CXX_WARN(logger_, - "There are no moduleInfo in hmi capabilities for requested " - "moduleType " - << module_type); + SDL_LOG_WARN( + "There are no moduleInfo in hmi capabilities for requested " + "moduleType " + << module_type); return ""; } @@ -68,42 +66,40 @@ const std::string RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilitiesArray( const smart_objects::SmartObject& control_capabilities, const std::string& module_type) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (auto& cap_item : *(control_capabilities.asArray())) { if (cap_item.keyExists(message_params::kModuleInfo)) { // moduleId - mandatory param for ModuleInfo structure const auto module_id = cap_item[message_params::kModuleInfo][message_params::kModuleId] .asString(); - LOG4CXX_WARN(logger_, - "Use default moduleId from hmi capabilities: " - << module_id - << " for requested moduleType: " << module_type); + SDL_LOG_WARN("Use default moduleId from hmi capabilities: " + << module_id + << " for requested moduleType: " << module_type); return module_id; } } - LOG4CXX_WARN(logger_, - "There are no moduleInfo in hmi capabilities for requested " - "moduleType " - << module_type); + SDL_LOG_WARN( + "There are no moduleInfo in hmi capabilities for requested " + "moduleType " + << module_type); return ""; } const std::string RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilities( const std::string& module_type) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto rc_capabilities_ptr = hmi_capabilities_.rc_capability(); if (!rc_capabilities_ptr) { - LOG4CXX_WARN(logger_, "RC capability is not initialized"); + SDL_LOG_WARN("RC capability is not initialized"); return std::string(); } auto rc_capabilities = *rc_capabilities_ptr; const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping(); if (!rc_capabilities.keyExists(mapping(module_type))) { - LOG4CXX_WARN( - logger_, - "There is no RC capability for requested module_type " << module_type); + SDL_LOG_WARN("There is no RC capability for requested module_type " + << module_type); return ""; } if (enums_value::kHmiSettings == module_type || @@ -118,24 +114,24 @@ const std::string RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilities( const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilitiesStructure( const smart_objects::SmartObject& control_capabilities, const std::string& module_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (control_capabilities.keyExists(message_params::kModuleInfo) && (module_id == control_capabilities[message_params::kModuleInfo] [message_params::kModuleId] .asString())) { return true; } - LOG4CXX_WARN(logger_, - "There are no moduleInfo in hmi capabilities for requested " - "moduleId " - << module_id); + SDL_LOG_WARN( + "There are no moduleInfo in hmi capabilities for requested " + "moduleId " + << module_id); return false; } const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilitiesArrays( const smart_objects::SmartObject& control_capabilities, const std::string& module_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (auto& cap_item : *(control_capabilities.asArray())) { if (cap_item.keyExists(message_params::kModuleInfo) && (module_id == @@ -144,17 +140,17 @@ const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilitiesArrays( return true; } } - LOG4CXX_WARN(logger_, - "There are no moduleInfo in hmi capabilities for requested " - "moduleId " - << module_id); + SDL_LOG_WARN( + "There are no moduleInfo in hmi capabilities for requested " + "moduleId " + << module_id); return false; } const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilities( const smart_objects::SmartObject& rc_capabilities, const ModuleUid& module) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (module.second.empty()) { return true; } @@ -170,11 +166,11 @@ const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilities( bool RCCapabilitiesManagerImpl::CheckIfModuleExistsInCapabilities( const ModuleUid& module) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto rc_capabilities_ptr = hmi_capabilities_.rc_capability(); if (!rc_capabilities_ptr) { - LOG4CXX_WARN(logger_, "RC capability is not initialized"); + SDL_LOG_WARN("RC capability is not initialized"); return false; } @@ -217,7 +213,7 @@ RCCapabilitiesManagerImpl::GetCapabilitiesToModuleTypeMapping() const { {strings::khmiSettingsControlCapabilities, enums_value::kHmiSettings}}; auto it = mapping.find(control_cap); if (mapping.end() == it) { - LOG4CXX_ERROR(logger_, "Unknown control capability " << control_cap); + SDL_LOG_ERROR("Unknown control capability " << control_cap); return std::string(); } return it->second; @@ -237,7 +233,7 @@ void RCCapabilitiesManagerImpl::GetResourcesFromCapabilitiesStructure( .asString(); out_resources.push_back(std::make_pair(mapping(capability_key), module_id)); } else { - LOG4CXX_WARN(logger_, "There are no moduleId in " << capability_key); + SDL_LOG_WARN("There are no moduleId in " << capability_key); out_resources.push_back(std::make_pair(mapping(capability_key), "")); } } @@ -255,19 +251,18 @@ void RCCapabilitiesManagerImpl::GetResourcesFromCapabilitiesArray( out_resources.push_back( std::make_pair(mapping(capability_key), module_id)); } else { - LOG4CXX_WARN(logger_, - "There are no moduleId for item from " << capability_key); + SDL_LOG_WARN("There are no moduleId for item from " << capability_key); out_resources.push_back(std::make_pair(mapping(capability_key), "")); } } } const std::vector<ModuleUid> RCCapabilitiesManagerImpl::GetResources() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<ModuleUid> resources; auto rc_capabilities_ptr = hmi_capabilities_.rc_capability(); if (!rc_capabilities_ptr) { - LOG4CXX_WARN(logger_, "RC capability is not initialized"); + SDL_LOG_WARN("RC capability is not initialized"); return resources; } @@ -290,11 +285,11 @@ const std::vector<ModuleUid> RCCapabilitiesManagerImpl::GetResources() const { const std::string RCCapabilitiesManagerImpl::GetModuleIdForSeatLocation( const mobile_apis::SupportedSeat::eType id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto rc_capabilities_ptr = hmi_capabilities_.rc_capability(); if (!rc_capabilities_ptr) { - LOG4CXX_WARN(logger_, "RC capability is not initialized."); + SDL_LOG_WARN("RC capability is not initialized."); return std::string(); } @@ -314,7 +309,7 @@ const std::string RCCapabilitiesManagerImpl::GetModuleIdForSeatLocation( .asString(); } } - LOG4CXX_DEBUG(logger_, "There are no capabitities for requested id: " << id); + SDL_LOG_DEBUG("There are no capabitities for requested id: " << id); return ""; } @@ -322,7 +317,7 @@ bool RCCapabilitiesManagerImpl::CheckIfButtonExistInRCCaps( const mobile_apis::ButtonName::eType button) const { auto rc_capabilities_ptr = hmi_capabilities_.rc_capability(); if (!rc_capabilities_ptr) { - LOG4CXX_WARN(logger_, "RC capability is not initialized"); + SDL_LOG_WARN("RC capability is not initialized"); return false; } @@ -344,15 +339,13 @@ bool RCCapabilitiesManagerImpl::CheckIfButtonExistInRCCaps( const mobile_apis::ButtonName::eType current_button = static_cast<mobile_apis::ButtonName::eType>(current_id); if (current_button == button) { - LOG4CXX_TRACE( - logger_, - "Button id " << current_button << " exist in capabilities"); + SDL_LOG_TRACE("Button id " << current_button + << " exist in capabilities"); return true; } } } - LOG4CXX_TRACE(logger_, - "Button id " << button << " do not exist in capabilities"); + SDL_LOG_TRACE("Button id " << button << " do not exist in capabilities"); return false; } @@ -368,33 +361,30 @@ RCCapabilitiesManagerImpl::GetCapabilitiesByModuleIdFromArray( return cap_item; } } - LOG4CXX_WARN(logger_, - "Capabilities for moduleId " << module_id + SDL_LOG_WARN("Capabilities for moduleId " << module_id << " do not exist in capabilities"); return smart_objects::SmartObject(smart_objects::SmartType_Null); } bool RCCapabilitiesManagerImpl::CheckButtonName( const std::string& module_type, const std::string& button_name) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto rc_capabilities = hmi_capabilities_.rc_capability(); if (!rc_capabilities) { - LOG4CXX_ERROR(logger_, "No remote controll capabilities available"); + SDL_LOG_ERROR("No remote controll capabilities available"); return false; } if (enums_value::kRadio == module_type) { if (!helpers::in_range(RCHelpers::buttons_radio(), button_name)) { - LOG4CXX_WARN(logger_, - "Trying to acceess climate button with module type radio"); + SDL_LOG_WARN("Trying to acceess climate button with module type radio"); return false; } } if (enums_value::kClimate == module_type) { if (!helpers::in_range(RCHelpers::buttons_climate(), button_name)) { - LOG4CXX_WARN(logger_, - "Trying to acceess radio button with module type climate"); + SDL_LOG_WARN("Trying to acceess radio button with module type climate"); return false; } } @@ -484,10 +474,10 @@ RCCapabilitiesManagerImpl::GetModuleDataToCapabilitiesMapping() const { ModuleTypeCapability RCCapabilitiesManagerImpl::GetModuleDataCapabilities( const smart_objects::SmartObject& module_data, const std::string& module_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto rc_capabilities_ptr = hmi_capabilities_.rc_capability(); if (!rc_capabilities_ptr) { - LOG4CXX_WARN(logger_, "RC capability is not initialized"); + SDL_LOG_WARN("RC capability is not initialized"); return {std::string(), capabilitiesStatus::kInvalidStatus}; } @@ -505,7 +495,7 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetModuleDataCapabilities( const auto capabilities_key = get_capabilities_key(module_type); if (module_data.keyExists(module_data_key)) { if (!rc_capabilities.keyExists(capabilities_key)) { - LOG4CXX_DEBUG(logger_, module_data_key << " capabilities not present"); + SDL_LOG_DEBUG(module_data_key << " capabilities not present"); return module_data_capabilities; } const auto& caps = rc_capabilities[capabilities_key]; @@ -528,7 +518,7 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetModuleDataCapabilities( ModuleTypeCapability RCCapabilitiesManagerImpl::GetControlDataCapabilities( const smart_objects::SmartObject& capabilities, const smart_objects::SmartObject& control_data) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::map<std::string, std::string> mapping = GetModuleDataToCapabilitiesMapping(); @@ -582,31 +572,27 @@ capabilitiesStatus RCCapabilitiesManagerImpl::GetItemCapability( const auto it = mapping.find(request_parameter); if (it == mapping.end()) { - LOG4CXX_DEBUG( - logger_, - "Parameter " << request_parameter << " doesn't exist in capabilities."); + SDL_LOG_DEBUG("Parameter " << request_parameter + << " doesn't exist in capabilities."); return capabilitiesStatus::kMissedParam; } const std::string& caps_key = it->second; - LOG4CXX_DEBUG(logger_, - "Checking request parameter " - << request_parameter - << " with capabilities. Appropriate key is " << caps_key); + SDL_LOG_DEBUG("Checking request parameter " + << request_parameter + << " with capabilities. Appropriate key is " << caps_key); if (!capabilities.keyExists(caps_key)) { - LOG4CXX_DEBUG(logger_, - "Capability " << caps_key + SDL_LOG_DEBUG("Capability " << caps_key << " is missed in RemoteControl capabilities"); return capabilitiesStatus::kMissedParam; } if (!capabilities[caps_key].asBool()) { - LOG4CXX_DEBUG(logger_, - "Capability " - << caps_key - << " is switched off in RemoteControl capabilities"); + SDL_LOG_DEBUG("Capability " + << caps_key + << " is switched off in RemoteControl capabilities"); capabilitiesStatus status = capabilitiesStatus::kMissedParam; if (mobile_apis::Result::READ_ONLY == switched_off_result) { status = capabilitiesStatus::kReadOnly; @@ -620,7 +606,7 @@ capabilitiesStatus RCCapabilitiesManagerImpl::GetItemCapability( ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightDataCapabilities( const smart_objects::SmartObject& capabilities, const smart_objects::SmartObject& control_data) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::map<std::string, std::string> mapping = GetLightCapabilitiesMapping(); for (auto it = control_data.map_begin(); it != control_data.map_end(); ++it) { @@ -648,14 +634,14 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightDataCapabilities( ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightNameCapabilities( const smart_objects::SmartObject& capabilities_status, const smart_objects::SmartObject& light_data) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (auto& so : *(capabilities_status.asArray())) { const int64_t current_id = so[message_params::kName].asInt(); if (current_id == light_data[message_params::kId].asInt()) { return GetLightDataCapabilities(so, light_data); } } - LOG4CXX_DEBUG(logger_, "There is no such light name in capabilities"); + SDL_LOG_DEBUG("There is no such light name in capabilities"); return std::make_pair(message_params::kLightState, capabilitiesStatus::kMissedLightName); } @@ -667,18 +653,16 @@ ModuleTypeCapability RCCapabilitiesManagerImpl::GetRadioBandByCapabilities( static_cast<mobile_apis::RadioBand::eType>(request_parameter.asUInt()); if (mobile_apis::RadioBand::XM == radio_band) { if (!capabilities_status.keyExists(strings::kSiriusxmRadioAvailable)) { - LOG4CXX_DEBUG(logger_, - "Capability " - << strings::kSiriusxmRadioAvailable - << " is missed in RemoteControl capabilities"); + SDL_LOG_DEBUG("Capability " + << strings::kSiriusxmRadioAvailable + << " is missed in RemoteControl capabilities"); return std::make_pair(strings::kSiriusxmRadioAvailable, capabilitiesStatus::kMissedParam); } if (!capabilities_status[strings::kSiriusxmRadioAvailable].asBool()) { - LOG4CXX_DEBUG(logger_, - "Capability " - << strings::kSiriusxmRadioAvailable - << " is switched off in RemoteControl capabilities"); + SDL_LOG_DEBUG("Capability " + << strings::kSiriusxmRadioAvailable + << " is switched off in RemoteControl capabilities"); return std::make_pair(strings::kSiriusxmRadioAvailable, capabilitiesStatus::kMissedParam); } @@ -708,9 +692,8 @@ bool RCCapabilitiesManagerImpl::CheckReadOnlyParamsForAudio( for (auto& so : *(equalizer_settings.asArray())) { if (so.keyExists(message_params::kChannelName)) { - LOG4CXX_DEBUG(logger_, - "READ ONLY parameter. ChannelName = " - << so[message_params::kChannelName].asString()); + SDL_LOG_DEBUG("READ ONLY parameter. ChannelName = " + << so[message_params::kChannelName].asString()); return true; } } @@ -737,10 +720,8 @@ bool RCCapabilitiesManagerImpl::CheckReadOnlyParamsForLight( mobile_apis::LightStatus::RAMP_DOWN, mobile_apis::LightStatus::UNKNOWN, mobile_apis::LightStatus::INVALID)) { - LOG4CXX_DEBUG( - logger_, - "READ ONLY parameter. Status = " - << light_data[message_params::kLightStatus].asInt()); + SDL_LOG_DEBUG("READ ONLY parameter. Status = " + << light_data[message_params::kLightStatus].asInt()); return true; } } @@ -754,7 +735,7 @@ bool RCCapabilitiesManagerImpl::AreReadOnlyParamsPresent( const smart_objects::SmartObject& module_data, const std::string& module_type, ModuleTypeCapability& module_data_capabilities) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& module_type_params = ControlDataForType(module_data, module_type); @@ -787,7 +768,7 @@ bool RCCapabilitiesManagerImpl::AreReadOnlyParamsPresent( bool RCCapabilitiesManagerImpl::AreAllParamsReadOnly( const smart_objects::SmartObject& module_data, const std::string& module_type) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& module_type_params = ControlDataForType(module_data, module_type); auto it = module_type_params.map_begin(); @@ -799,15 +780,15 @@ bool RCCapabilitiesManagerImpl::AreAllParamsReadOnly( } } - LOG4CXX_DEBUG(logger_, "All params are ReadOnly"); + SDL_LOG_DEBUG("All params are ReadOnly"); return true; } bool RCCapabilitiesManagerImpl::IsSeatLocationCapabilityProvided() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto seat_location_capability = hmi_capabilities_.seat_location_capability(); if (!seat_location_capability || seat_location_capability->empty()) { - LOG4CXX_DEBUG(logger_, "Seat Location capability is not provided by HMI"); + SDL_LOG_DEBUG("Seat Location capability is not provided by HMI"); return false; } @@ -821,15 +802,14 @@ bool RCCapabilitiesManagerImpl::IsSeatLocationCapabilityProvided() const { } } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Seat Location capability doesn't contain all necessary parameters"); return false; } const Grid RCCapabilitiesManagerImpl::GetDriverLocationFromSeatLocationCapability() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Grid grid; if (IsSeatLocationCapabilityProvided()) { auto seat_location_capability = @@ -845,7 +825,7 @@ RCCapabilitiesManagerImpl::GetDriverLocationFromSeatLocationCapability() const { driver_location[strings::kRowspan].asInt(), driver_location[strings::kLevelspan].asInt()); } else { - LOG4CXX_DEBUG(logger_, "Driver's location doesn't provided"); + SDL_LOG_DEBUG("Driver's location doesn't provided"); } } return grid; @@ -909,7 +889,7 @@ Grid RCCapabilitiesManagerImpl::GetModuleServiceArea( const ModuleUid& module) const { auto rc_capabilities_ptr = hmi_capabilities_.rc_capability(); if (!rc_capabilities_ptr) { - LOG4CXX_WARN(logger_, "RC capability is not initialized"); + SDL_LOG_WARN("RC capability is not initialized"); return Grid(); } @@ -918,7 +898,7 @@ Grid RCCapabilitiesManagerImpl::GetModuleServiceArea( const auto& module_type = module.first; const auto& capabilities_key = mapping(module_type); if (!rc_capabilities.keyExists(capabilities_key)) { - LOG4CXX_DEBUG(logger_, module_type << "control capabilities not present"); + SDL_LOG_DEBUG(module_type << "control capabilities not present"); return Grid(); } const auto& caps = rc_capabilities[capabilities_key]; @@ -949,7 +929,7 @@ bool RCCapabilitiesManagerImpl::IsMultipleAccessAllowed( const ModuleUid& module) const { auto rc_capabilities_ptr = hmi_capabilities_.rc_capability(); if (!rc_capabilities_ptr) { - LOG4CXX_ERROR(logger_, "RC capability is not initialized"); + SDL_LOG_ERROR("RC capability is not initialized"); return false; } @@ -958,7 +938,7 @@ bool RCCapabilitiesManagerImpl::IsMultipleAccessAllowed( const auto& module_type = module.first; const auto& capabilities_key = mapping(module_type); if (!rc_capabilities.keyExists(capabilities_key)) { - LOG4CXX_DEBUG(logger_, module_type << "control capabilities not present"); + SDL_LOG_DEBUG(module_type << "control capabilities not present"); return false; } const auto& caps = rc_capabilities[capabilities_key]; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc index 4ca2cf5182..e2b67effee 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc @@ -62,7 +62,7 @@ #include "rc_rpc_plugin/interior_data_cache.h" #include "rc_rpc_plugin/resource_allocation_manager.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") +SDL_CREATE_LOG_VARIABLE("RemoteControlModule") namespace application_manager { using rc_rpc_plugin::InteriorDataCache; using rc_rpc_plugin::RCCommandParams; @@ -113,7 +113,7 @@ struct RCCommandCreatorFactory { template <typename RCCommandType> CommandCreator& GetCreator() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); static RCCommandCreator<RCCommandType> res(params_); return res; } @@ -178,9 +178,8 @@ bool RCCommandFactory::IsAbleToProcess( CommandCreator& RCCommandFactory::get_mobile_command_creator( const mobile_apis::FunctionID::eType id, const mobile_apis::messageType::eType message_type) const { - LOG4CXX_DEBUG(logger_, - "get_mobile_command_creator function_id: " - << id << " message_type: " << message_type); + SDL_LOG_DEBUG("get_mobile_command_creator function_id: " + << id << " message_type: " << message_type); RCCommandCreatorFactory rc_factory(params_); switch (id) { case mobile_apis::FunctionID::ButtonPressID: { @@ -266,8 +265,7 @@ CommandCreator& RCCommandFactory::get_mobile_creator_factory( CommandCreator& RCCommandFactory::get_hmi_creator_factory( const hmi_apis::FunctionID::eType id, const hmi_apis::messageType::eType message_type) const { - LOG4CXX_DEBUG(logger_, - "CreateHMICommand function_id: " << id << " message_type: " + SDL_LOG_DEBUG("CreateHMICommand function_id: " << id << " message_type: " << message_type); RCCommandCreatorFactory rc_factory(params_); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc index 1d7db181eb..e851e65adc 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc @@ -45,7 +45,7 @@ namespace rc_rpc_plugin { namespace app_mngr = application_manager; -CREATE_LOGGERPTR_GLOBAL(logger_, "RCConsentManager") +SDL_CREATE_LOG_VARIABLE("RCConsentManager") RCConsentManagerImpl::RCConsentManagerImpl( resumption::LastStateWrapperPtr last_state, @@ -59,7 +59,7 @@ void RCConsentManagerImpl::SaveModuleConsents( const std::string& policy_app_id, const std::string& mac_address, const rc_rpc_types::ModuleIdConsentVector& module_consents) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (const auto& consent : module_consents) { std::string module_type = consent.module_id.first; @@ -90,9 +90,8 @@ rc_rpc_types::ModuleConsent RCConsentManagerImpl::GetModuleConsent( last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary); if (module_consents.empty()) { - LOG4CXX_DEBUG( - logger_, - "For app: " << app_id << " module type doesn't have any consents"); + SDL_LOG_DEBUG("For app: " << app_id + << " module type doesn't have any consents"); return rc_rpc_types::ModuleConsent::NOT_EXISTS; } @@ -103,8 +102,7 @@ rc_rpc_types::ModuleConsent RCConsentManagerImpl::GetModuleConsent( } } - LOG4CXX_DEBUG(logger_, - "For app: " << app_id << " and module resource [" + SDL_LOG_DEBUG("For app: " << app_id << " and module resource [" << module_id.first << ":" << module_id.second << "] consent is absent"); @@ -112,7 +110,7 @@ rc_rpc_types::ModuleConsent RCConsentManagerImpl::GetModuleConsent( } void RCConsentManagerImpl::RemoveExpiredConsents() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto last_state_accessor = last_state_->get_accessor(); auto last_state_dictionary = last_state_accessor.GetData().dictionary(); @@ -147,7 +145,7 @@ void RCConsentManagerImpl::RemoveAllConsents() { rc_rpc_types::ModuleConsentState RCConsentManagerImpl::CheckModuleConsentState( const Json::Value& module_consent) const { if (!module_consent.isMember(message_params::kConsentDate)) { - LOG4CXX_DEBUG(logger_, "Date of consent is absent"); + SDL_LOG_DEBUG("Date of consent is absent"); return rc_rpc_types::ModuleConsentState::NOT_EXISTS; } @@ -160,10 +158,9 @@ rc_rpc_types::ModuleConsentState RCConsentManagerImpl::CheckModuleConsentState( const auto past_period_in_days = date_time::calculateAmountDaysFromDate(consent_date); - LOG4CXX_DEBUG( - logger_, - "Keeping time of consent is: " << past_period_in_days << " days"); - LOG4CXX_DEBUG(logger_, "Period for expired: " << period_for_expiring); + SDL_LOG_DEBUG("Keeping time of consent is: " << past_period_in_days + << " days"); + SDL_LOG_DEBUG("Period for expired: " << period_for_expiring); return (past_period_in_days >= period_for_expiring) ? rc_rpc_types::ModuleConsentState::EXPIRED @@ -205,17 +202,15 @@ void RCConsentManagerImpl::RemoveModuleExpiredConsents( const bool is_expired = rc_rpc_types::ModuleConsentState::EXPIRED == CheckModuleConsentState(consent); if (is_expired) { - LOG4CXX_DEBUG(logger_, - "Consent for module resource [" - << consent[message_params::kModuleId].asString() - << "] is expired and will be removed"); + SDL_LOG_DEBUG("Consent for module resource [" + << consent[message_params::kModuleId].asString() + << "] is expired and will be removed"); } if (is_module_id_exists && !is_expired) { - LOG4CXX_DEBUG(logger_, - "Consent for module resource [" - << consent[message_params::kModuleId].asString() - << "] is actual."); + SDL_LOG_DEBUG("Consent for module resource [" + << consent[message_params::kModuleId].asString() + << "] is actual."); temp_consents.append(consent); } } @@ -232,14 +227,14 @@ Json::Value& RCConsentManagerImpl::GetRemoteControlDataOrAppend( if (!last_state_data.isMember(app_mngr::strings::remote_control)) { last_state_data[app_mngr::strings::remote_control] = Json::Value(Json::objectValue); - LOG4CXX_DEBUG(logger_, "remote_control section is missed"); + SDL_LOG_DEBUG("remote_control section is missed"); } Json::Value& remote_control = last_state_data[app_mngr::strings::remote_control]; if (!remote_control.isObject()) { - LOG4CXX_ERROR(logger_, "remote_control type INVALID rewrite"); + SDL_LOG_ERROR("remote_control type INVALID rewrite"); remote_control = Json::Value(Json::objectValue); } return remote_control; @@ -252,7 +247,7 @@ Json::Value& RCConsentManagerImpl::GetDeviceApplicationsOrAppend( auto& apps_consents = GetAppsConsentsOrAppend(last_state_data); if (!apps_consents.isArray()) { - LOG4CXX_DEBUG(logger_, "applications_consents type INVALID rewrite"); + SDL_LOG_DEBUG("applications_consents type INVALID rewrite"); apps_consents = Json::Value(Json::arrayValue); } @@ -288,7 +283,7 @@ Json::Value& RCConsentManagerImpl::GetAppConsentsListOrAppend( sync_primitives::AutoLock autolock(applications_lock_); if (!device_applications.isArray()) { - LOG4CXX_DEBUG(logger_, "applications_consents type INVALID rewrite"); + SDL_LOG_DEBUG("applications_consents type INVALID rewrite"); device_applications = Json::Value(Json::arrayValue); } @@ -323,14 +318,14 @@ Json::Value& RCConsentManagerImpl::GetAppsConsentsOrAppend( sync_primitives::AutoLock autolock(remote_control_lock_); if (!remote_control.isMember(message_params::kAppConsents)) { - LOG4CXX_DEBUG(logger_, "app_consents section is missed"); + SDL_LOG_DEBUG("app_consents section is missed"); remote_control[message_params::kAppConsents] = Json::Value(Json::arrayValue); } auto& app_consents = remote_control[message_params::kAppConsents]; if (!app_consents.isArray()) { - LOG4CXX_DEBUG(logger_, "applications_consents type INVALID rewrite"); + SDL_LOG_DEBUG("applications_consents type INVALID rewrite"); app_consents = Json::Value(Json::arrayValue); } return app_consents; @@ -358,10 +353,8 @@ Json::Value& RCConsentManagerImpl::GetModuleTypeConsentsOrAppend( // In case of absent specified module_type in section of specified // application, will be added empty section with this module type. - LOG4CXX_DEBUG( - logger_, - "Section module_type: " << module_type - << " is missed for app_id:" << policy_app_id); + SDL_LOG_DEBUG("Section module_type: " + << module_type << " is missed for app_id:" << policy_app_id); auto consent_item = Json::Value(Json::objectValue); consent_item[message_params::kModuleType] = module_type; consent_item[message_params::kModuleConsents] = Json::Value(Json::arrayValue); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc index f344dd15a7..dea7203717 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc @@ -6,7 +6,7 @@ #include "rc_rpc_plugin/rc_rpc_plugin.h" namespace rc_rpc_plugin { -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule"); +SDL_CREATE_LOG_VARIABLE("RemoteControlModule"); const std::vector<std::string> RCHelpers::buttons_climate() { std::vector<std::string> data; @@ -138,7 +138,7 @@ RCHelpers::GetModuleTypeToDataMapping() { {enums_value::kHmiSettings, message_params::kHmiSettingsControlData}}; auto it = mapping.find(module_type); if (mapping.end() == it) { - LOG4CXX_ERROR(logger_, "Unknown module type" << module_type); + SDL_LOG_ERROR("Unknown module type " << module_type); return std::string(); } return it->second; @@ -159,7 +159,7 @@ RCHelpers::GetModuleTypeToCapabilitiesMapping() { {enums_value::kHmiSettings, strings::khmiSettingsControlCapabilities}}; auto it = mapping.find(module_type); if (mapping.end() == it) { - LOG4CXX_ERROR(logger_, "Unknown module type" << module_type); + SDL_LOG_ERROR("Unknown module type " << module_type); return std::string(); } return it->second; @@ -175,7 +175,7 @@ const std::vector<std::string> RCHelpers::GetModuleTypesList() { RCAppExtensionPtr RCHelpers::GetRCExtension( application_manager::Application& app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto extension_interface = app.QueryInterface(RCRPCPlugin::kRCPluginID); auto extension = std::static_pointer_cast<RCAppExtension>(extension_interface); @@ -257,7 +257,7 @@ void RCHelpers::RemoveRedundantGPSDataFromIVDataMsg( using namespace message_params; using namespace application_manager::strings; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!msg_params.keyExists(kModuleData)) { return; } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc index c2aa639fda..6e9a751bb6 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc @@ -43,7 +43,7 @@ #include "utils/helpers.h" namespace rc_rpc_plugin { -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule"); +SDL_CREATE_LOG_VARIABLE("RemoteControlModule"); namespace plugins = application_manager::plugin_manager; @@ -115,12 +115,11 @@ void RCRPCPlugin::OnPolicyEvent( void RCRPCPlugin::OnApplicationEvent( application_manager::plugin_manager::ApplicationEvent event, application_manager::ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!application->is_remote_control_supported()) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Remote control is not supported for application with app_id: " - << application->app_id()); + << application->app_id()); return; } switch (event) { @@ -179,12 +178,12 @@ RCRPCPlugin::Apps RCRPCPlugin::GetRCApplications( extern "C" __attribute__((visibility("default"))) application_manager::plugin_manager::RPCPlugin* -Create() { +Create(logger::Logger* logger_instance) { + logger::Logger::instance(logger_instance); return new rc_rpc_plugin::RCRPCPlugin(); } // namespace rc_rpc_plugin extern "C" __attribute__((visibility("default"))) void Delete( application_manager::plugin_manager::RPCPlugin* data) { delete data; - DELETE_THREAD_LOGGER(rc_rpc_plugin::logger_); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc index 049f9a3cf3..fe9bb5eec3 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc @@ -45,7 +45,7 @@ namespace rc_rpc_plugin { -CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule") +SDL_CREATE_LOG_VARIABLE("RemoteControlModule") ResourceAllocationManagerImpl::ResourceAllocationManagerImpl( application_manager::ApplicationManager& app_mngr, @@ -63,11 +63,11 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource( const std::string& module_type, const std::string& module_id, const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const application_manager::ApplicationSharedPtr acquiring_app = app_mngr_.application(app_id); if (!acquiring_app) { - LOG4CXX_WARN(logger_, "App with app_id: " << app_id << "does not exist!"); + SDL_LOG_WARN("App with app_id: " << app_id << " does not exist!"); return AcquireResult::IN_USE; } @@ -75,9 +75,9 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource( if (rc_capabilities_manager_.IsSeatLocationCapabilityProvided() && !IsUserLocationValid(module, acquiring_app)) { - LOG4CXX_WARN(logger_, - "Resource acquisition is not allowed " - "according to location verification."); + SDL_LOG_WARN( + "Resource acquisition is not allowed " + "according to location verification."); return AcquireResult::REJECTED; } @@ -85,23 +85,20 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource( const AllocatedResources::const_iterator allocated_it = allocated_resources_.find(module); if (allocated_resources_.end() == allocated_it) { - LOG4CXX_DEBUG(logger_, - "Resource is not acquired yet. " - << "App: " << app_id << " is allowed to acquire " - << module_type << " " << module_id); + SDL_LOG_DEBUG("Resource is not acquired yet. " + << "App: " << app_id << " is allowed to acquire " + << module_type << " " << module_id); return AcquireResult::ALLOWED; } if (app_id == allocated_resources_[module]) { - LOG4CXX_DEBUG(logger_, - "App: " << app_id << " is already acquired resource " + SDL_LOG_DEBUG("App: " << app_id << " is already acquired resource " << module_type << " " << module_id); return AcquireResult::ALLOWED; } if (IsModuleTypeRejected(module_type, module_id, app_id)) { - LOG4CXX_DEBUG(logger_, - "Driver disallowed app: " << app_id << " to acquire " + SDL_LOG_DEBUG("Driver disallowed app: " << app_id << " to acquire " << module_type << " " << module_id); return AcquireResult::REJECTED; } @@ -110,42 +107,37 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource( acquiring_app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if (mobile_apis::HMILevel::HMI_FULL != acquiring_app_hmi_level) { - LOG4CXX_DEBUG(logger_, - "Aquiring resources is not allowed in HMI level: " - << acquiring_app_hmi_level << ". App: " << app_id - << " is disallowed to acquire " << module_type << " " - << module_id); + SDL_LOG_DEBUG("Acquiring resources is not allowed in HMI level: " + << acquiring_app_hmi_level << ". App: " << app_id + << " is disallowed to acquire " << module_type << " " + << module_id); return AcquireResult::REJECTED; } if (!rc_capabilities_manager_.IsMultipleAccessAllowed(module)) { - LOG4CXX_DEBUG(logger_, - "Multiple access for the: " << module_type << " " << module_id + SDL_LOG_DEBUG("Multiple access for the: " << module_type << " " << module_id << " isn't allowed"); return AcquireResult::REJECTED; } switch (current_access_mode_) { case hmi_apis::Common_RCAccessMode::AUTO_DENY: { - LOG4CXX_DEBUG(logger_, - "Current access_mode is AUTO_DENY. " - << "App: " << app_id << " is disallowed to acquire " - << module_type << " " << module_id); + SDL_LOG_DEBUG("Current access_mode is AUTO_DENY. " + << "App: " << app_id << " is disallowed to acquire " + << module_type << " " << module_id); return AcquireResult::IN_USE; } case hmi_apis::Common_RCAccessMode::ASK_DRIVER: { - LOG4CXX_DEBUG(logger_, - "Current access_mode is ASK_DRIVER. " - "Driver confirmation is required for app: " - << app_id << " to acquire " << module_type << " " - << module_id); + SDL_LOG_DEBUG( + "Current access_mode is ASK_DRIVER. " + "Driver confirmation is required for app: " + << app_id << " to acquire " << module_type << " " << module_id); return AcquireResult::ASK_DRIVER; } case hmi_apis::Common_RCAccessMode::AUTO_ALLOW: { - LOG4CXX_DEBUG(logger_, - "Current access_mode is AUTO_ALLOW. " - << "App: " << app_id << " is allowed to acquire " - << module_type << " " << module_id); + SDL_LOG_DEBUG("Current access_mode is AUTO_ALLOW. " + << "App: " << app_id << " is allowed to acquire " + << module_type << " " << module_id); return AcquireResult::ALLOWED; } default: { DCHECK_OR_RETURN(false, AcquireResult::IN_USE); } @@ -154,7 +146,7 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource( bool ResourceAllocationManagerImpl::IsUserLocationValid( ModuleUid& module, application_manager::ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto extension = RCHelpers::GetRCExtension(*app); DCHECK_OR_RETURN(extension, false); const auto user_location = extension->GetUserLocation(); @@ -166,15 +158,14 @@ bool ResourceAllocationManagerImpl::IsUserLocationValid( if (is_driver || user_location.IntersectionExists(module_service_area)) { return true; } - LOG4CXX_DEBUG(logger_, "User location is not valid"); + SDL_LOG_DEBUG("User location is not valid"); return false; } void ResourceAllocationManagerImpl::ReleaseModuleType( const std::string& module_type, const uint32_t application_id) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "Release " << module_type << " " + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Release " << module_type << " " << " by " << application_id); Resources allocated_resources = GetAcquiredResources(application_id); for (const auto& resource : allocated_resources) { @@ -185,7 +176,7 @@ void ResourceAllocationManagerImpl::ReleaseModuleType( } void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Apps app_list = RCRPCPlugin::GetRCApplications(app_mngr_); Apps::const_iterator app = app_list.begin(); @@ -200,8 +191,7 @@ void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() { &allowed_modules); std::sort(allowed_modules.begin(), allowed_modules.end()); - LOG4CXX_DEBUG(logger_, - "Acquired modules: " << acquired_modules.size() + SDL_LOG_DEBUG("Acquired modules: " << acquired_modules.size() << " , allowed modules: " << allowed_modules.size()); @@ -242,7 +232,7 @@ void ConstructOnRCStatusNotificationParams( using smart_objects::SmartObject; using smart_objects::SmartType_Array; using smart_objects::SmartType_Map; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto modules_inserter = [](SmartObject& result_modules) { return [&result_modules](const ModuleUid& module) { @@ -275,7 +265,7 @@ void ConstructOnRCStatusNotificationParams( smart_objects::SmartObjectSPtr ResourceAllocationManagerImpl::CreateOnRCStatusNotificationToMobile( const application_manager::ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using application_manager::MessageHelper; auto msg_to_mobile = MessageHelper::CreateNotification( mobile_apis::FunctionID::OnRCStatusID, app->app_id()); @@ -298,7 +288,7 @@ ResourceAllocationManagerImpl::CreateOnRCStatusNotificationToMobile( smart_objects::SmartObjectSPtr ResourceAllocationManagerImpl::CreateOnRCStatusNotificationToHmi( const application_manager::ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using application_manager::MessageHelper; auto msg_to_hmi = MessageHelper::CreateHMINotification(hmi_apis::FunctionID::RC_OnRCStatus); @@ -314,7 +304,7 @@ ResourceAllocationManagerImpl::CreateOnRCStatusNotificationToHmi( void ResourceAllocationManagerImpl::SendOnRCStatusNotifications( NotificationTrigger::eType event, application_manager::ApplicationSharedPtr application) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr msg_to_mobile; smart_objects::SmartObjectSPtr msg_to_hmi; if (NotificationTrigger::APP_REGISTRATION == event) { @@ -351,9 +341,8 @@ ResourceReleasedState::eType ResourceAllocationManagerImpl::ReleaseResource( const std::string& module_type, const std::string& module_id, const uint32_t application_id) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "Release " << module_type << " " << module_id << " by " + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Release " << module_type << " " << module_id << " by " << application_id); return SetResourceFree(module_type, module_id, application_id); } @@ -362,35 +351,32 @@ void ResourceAllocationManagerImpl::SetResourceAcquired( const std::string& module_type, const std::string& module_id, const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ModuleUid module(module_type, module_id); allocated_resources_[module] = app_id; } bool ResourceAllocationManagerImpl::IsResourceAlreadyAcquiredByApp( const ModuleUid& moduleUid, const uint32_t app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto allocation = allocated_resources_.find(moduleUid); if (allocated_resources_.end() == allocation) { - LOG4CXX_DEBUG(logger_, - "Resource " << moduleUid.first + SDL_LOG_DEBUG("Resource " << moduleUid.first << " is not allocated for any application."); return false; } if (allocation->second != app_id) { - LOG4CXX_DEBUG(logger_, - "Resource " - << moduleUid.first - << " is already allocated by app:" << allocation->second - << ". Asquire has been asked for app:" << app_id); + SDL_LOG_DEBUG("Resource " + << moduleUid.first + << " is already allocated by app:" << allocation->second + << ". Acquire has been asked for app:" << app_id); return false; } - LOG4CXX_DEBUG(logger_, - "Resource " << moduleUid.first + SDL_LOG_DEBUG("Resource " << moduleUid.first << " is allocated by app:" << allocation->second); return true; @@ -404,26 +390,24 @@ ResourceReleasedState::eType ResourceAllocationManagerImpl::SetResourceFree( AllocatedResources::const_iterator allocation = allocated_resources_.find(module); if (allocated_resources_.end() == allocation) { - LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is not allocated."); + SDL_LOG_DEBUG("Resource " << module_type << " is not allocated."); return ResourceReleasedState::NOT_ALLOCATED; } if (app_id != allocation->second) { - LOG4CXX_ERROR(logger_, - "Resource " << module_type + SDL_LOG_ERROR("Resource " << module_type << " is allocated by different application " << allocation->second); return ResourceReleasedState::IS_ALLOCATED; } allocated_resources_.erase(allocation); - LOG4CXX_DEBUG( - logger_, - "Resource " << module_type << ":" << module_id << " is released."); + SDL_LOG_DEBUG("Resource " << module_type << ":" << module_id + << " is released."); return ResourceReleasedState::IS_RELEASED; } std::vector<ModuleUid> ResourceAllocationManagerImpl::GetAcquiredResources( const uint32_t application_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Resources allocated_resources; AllocatedResources::const_iterator allocation = allocated_resources_.begin(); for (; allocated_resources_.end() != allocation; ++allocation) { @@ -432,8 +416,7 @@ std::vector<ModuleUid> ResourceAllocationManagerImpl::GetAcquiredResources( } } - LOG4CXX_DEBUG(logger_, - "Application " << application_id << " acquired " + SDL_LOG_DEBUG("Application " << application_id << " acquired " << allocated_resources.size() << " resource(s)."); @@ -442,15 +425,14 @@ std::vector<ModuleUid> ResourceAllocationManagerImpl::GetAcquiredResources( std::set<std::string> ResourceAllocationManagerImpl::GetAcquiredModuleTypes( const uint32_t application_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Resources allocated_resources = GetAcquiredResources(application_id); std::set<std::string> acquired_module_types; for (const auto& resource : allocated_resources) { acquired_module_types.insert(resource.first); } - LOG4CXX_DEBUG(logger_, - "Application " << application_id << " acquired " + SDL_LOG_DEBUG("Application " << application_id << " acquired " << acquired_module_types.size() << " module type(s)."); @@ -462,9 +444,8 @@ void ResourceAllocationManagerImpl::SetResourceState( const std::string& module_id, const uint32_t app_id, const ResourceState::eType state) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "Setting state for " << module_type << " by app_id " << app_id + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Setting state for " << module_type << " by app_id " << app_id << " to state " << state); ModuleUid module(module_type, module_id); { @@ -474,36 +455,33 @@ void ResourceAllocationManagerImpl::SetResourceState( const bool acquired = allocated_resources_.end() != allocated_it; if (acquired) { - LOG4CXX_DEBUG(logger_, - "Resource " << module_type << " is already acquired." + SDL_LOG_DEBUG("Resource " << module_type << " is already acquired." << " Owner application id is " << allocated_it->second << " Changing application id is " << app_id); } else { - LOG4CXX_DEBUG(logger_, - "Resource " << module_type << " is not acquired yet"); + SDL_LOG_DEBUG("Resource " << module_type << " is not acquired yet"); } } sync_primitives::AutoLock lock(resources_state_lock_); resources_state_[module] = state; - LOG4CXX_DEBUG(logger_, "Resource " << module_type << " got state " << state); + SDL_LOG_DEBUG("Resource " << module_type << " got state " << state); } bool ResourceAllocationManagerImpl::IsResourceFree( const std::string& module_type, const std::string& module_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ModuleUid module(module_type, module_id); sync_primitives::AutoLock lock(resources_state_lock_); const ResourcesState::const_iterator resource = resources_state_.find(module); if (resources_state_.end() == resource) { - LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is free."); + SDL_LOG_DEBUG("Resource " << module_type << " is free."); return true; } - LOG4CXX_DEBUG(logger_, - "Resource " << module_type << " state is " << resource->second); + SDL_LOG_DEBUG("Resource " << module_type << " state is " << resource->second); return ResourceState::FREE == resource->second; } @@ -526,7 +504,7 @@ void ResourceAllocationManagerImpl::ForceAcquireResource( const std::string& module_type, const std::string& module_id, const uint32_t app_id) { - LOG4CXX_DEBUG(logger_, "Force " << app_id << " acquiring " << module_type); + SDL_LOG_DEBUG("Force " << app_id << " acquiring " << module_type); sync_primitives::AutoLock lock(allocated_resources_lock_); SetResourceAcquired(module_type, module_id, app_id); } @@ -535,7 +513,7 @@ bool ResourceAllocationManagerImpl::IsModuleTypeRejected( const std::string& module_type, const std::string& module_id, const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ModuleUid module(module_type, module_id); sync_primitives::AutoLock lock(rejected_resources_for_application_lock_); RejectedResources::iterator it = @@ -555,7 +533,7 @@ void ResourceAllocationManagerImpl::OnDriverDisallowed( const std::string& module_type, const std::string& module_id, const uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ModuleUid module(module_type, module_id); sync_primitives::AutoLock lock(rejected_resources_for_application_lock_); auto it = rejected_resources_for_application_.find(app_id); @@ -572,9 +550,8 @@ void ResourceAllocationManagerImpl::OnApplicationEvent( application_manager::plugin_manager::ApplicationEvent event, application_manager::ApplicationSharedPtr application) { using application_manager::plugin_manager::ApplicationEvent; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "Event " << event << " came for " << application->app_id()); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Event " << event << " came for " << application->app_id()); if (ApplicationEvent::kApplicationExit == event || ApplicationEvent::kApplicationUnregistered == event) { @@ -594,8 +571,8 @@ void ResourceAllocationManagerImpl::OnApplicationEvent( void ResourceAllocationManagerImpl::OnPolicyEvent( application_manager::plugin_manager::PolicyEvent event) { using application_manager::plugin_manager::PolicyEvent; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Event " << event); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Event " << event); if (PolicyEvent::kApplicationPolicyUpdated == event) { ProcessApplicationPolicyUpdate(); @@ -609,7 +586,7 @@ void ResourceAllocationManagerImpl::OnPolicyEvent( } void ResourceAllocationManagerImpl::ResetAllAllocations() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock lock(resources_state_lock_); resources_state_.clear(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h index 9c770279ab..f707396f5e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h @@ -34,6 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_RPC_PLUGIN_H #include "application_manager/command_factory.h" #include "application_manager/plugin_manager/rpc_plugin.h" +#include "utils/ilogger.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -74,6 +75,7 @@ class SDLRPCPlugin : public plugins::RPCPlugin { }; } // namespace sdl_rpc_plugin -extern "C" application_manager::plugin_manager::RPCPlugin* Create(); +extern "C" application_manager::plugin_manager::RPCPlugin* Create( + logger::Logger* logger_instances); extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data); #endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_RPC_PLUGIN_H diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc index c6d181bf57..35fb2204ac 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ActivateAppRequest::ActivateAppRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,11 +54,11 @@ ActivateAppRequest::ActivateAppRequest( policy_handle) {} ActivateAppRequest::~ActivateAppRequest() { - LOG4CXX_TRACE(logger_, "~ActivateAppRequest"); + SDL_LOG_TRACE("~ActivateAppRequest"); } void ActivateAppRequest::Run() { - LOG4CXX_TRACE(logger_, "enter " << correlation_id()); + SDL_LOG_TRACE("enter " << correlation_id()); uint32_t app_id = RequestToHMI::application_id(); application_manager_.set_application_id(correlation_id(), app_id); #ifdef ENABLE_LOG @@ -66,11 +68,11 @@ void ActivateAppRequest::Run() { static_cast<mobile_apis::HMILevel::eType>( (*message_)[strings::msg_params][strings::activate_app_hmi_level] .asInt()); - LOG4CXX_TRACE(logger_, "requested_hmi_level = " << requested_hmi_level); + SDL_LOG_TRACE("requested_hmi_level = " << requested_hmi_level); } #endif SendRequest(); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc index b829ef711e..9615f83170 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ActivateAppResponse::ActivateAppResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,12 +55,12 @@ ActivateAppResponse::ActivateAppResponse( ActivateAppResponse::~ActivateAppResponse() {} void ActivateAppResponse::Run() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_ActivateApp); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc index 93999f704d..8ddad0945c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AddStatisticsInfoNotification::AddStatisticsInfoNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ AddStatisticsInfoNotification::AddStatisticsInfoNotification( AddStatisticsInfoNotification::~AddStatisticsInfoNotification() {} void AddStatisticsInfoNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); int type = (*message_)[strings::msg_params][hmi_notification::statistic_type] .asInt(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc index 68c7896a7f..fdb2f454d5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AllowAllAppsRequest::AllowAllAppsRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ AllowAllAppsRequest::AllowAllAppsRequest( AllowAllAppsRequest::~AllowAllAppsRequest() {} void AllowAllAppsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc index c2182f4853..be049aaea2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AllowAllAppsResponse::AllowAllAppsResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ AllowAllAppsResponse::AllowAllAppsResponse( AllowAllAppsResponse::~AllowAllAppsResponse() {} void AllowAllAppsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager_.SetAllAppsAllowed( (*message_)[strings::msg_params][hmi_response::allowed].asBool()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc index 6b5af76fb1..32fb35b344 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AllowAppRequest::AllowAppRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ AllowAppRequest::AllowAppRequest( AllowAppRequest::~AllowAppRequest() {} void AllowAppRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc index c62645c6c0..458b7097e3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AllowAppResponse::AllowAppResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ AllowAppResponse::AllowAppResponse( AllowAppResponse::~AllowAppResponse() {} void AllowAppResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t connection_key = (*message_)[strings::params][strings::connection_key].asInt(); @@ -61,7 +63,7 @@ void AllowAppResponse::Run() { ApplicationSharedPtr app = application_manager_.application(connection_key); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } app->set_app_allowed( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc index b021faefd8..f87f103b0f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc @@ -36,6 +36,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BasicCommunicationCloseApplicationRequest:: BasicCommunicationCloseApplicationRequest( const application_manager::commands::MessageSharedPtr& message, @@ -53,7 +55,7 @@ BasicCommunicationCloseApplicationRequest:: ~BasicCommunicationCloseApplicationRequest() {} void BasicCommunicationCloseApplicationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc index 2e56271cf2..74df410213 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc @@ -36,6 +36,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BasicCommunicationCloseApplicationResponse:: BasicCommunicationCloseApplicationResponse( const application_manager::commands::MessageSharedPtr& message, @@ -53,7 +55,7 @@ BasicCommunicationCloseApplicationResponse:: ~BasicCommunicationCloseApplicationResponse() {} void BasicCommunicationCloseApplicationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_CloseApplication); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc index 19c9fa91d8..a6e95f9f72 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -50,7 +52,7 @@ BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest( policy_handler) {} void BasicCommunicationGetSystemTimeRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager_.protocol_handler().NotifyOnGetSystemTimeFailed(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc index e26753b3f2..1376376bb8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc @@ -33,7 +33,7 @@ #include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h" #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "Commands") +SDL_CREATE_LOG_VARIABLE("Commands") namespace sdl_rpc_plugin { using namespace application_manager; @@ -53,7 +53,7 @@ BasicCommunicationGetSystemTimeResponse:: policy_handler) {} void BasicCommunicationGetSystemTimeResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_GetSystemTime); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc index 361dc5fea6..52f8c4329f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAwakeSDLNotification::OnAwakeSDLNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ OnAwakeSDLNotification::OnAwakeSDLNotification( OnAwakeSDLNotification::~OnAwakeSDLNotification() {} void OnAwakeSDLNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!application_manager_.resume_controller().is_suspended()) { return; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc index 052a40a888..62c4a0ff3d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BasicCommunicationSystemRequest::BasicCommunicationSystemRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ BasicCommunicationSystemRequest::BasicCommunicationSystemRequest( BasicCommunicationSystemRequest::~BasicCommunicationSystemRequest() {} void BasicCommunicationSystemRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc index 0b052de88d..06b31cb73d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BasicCommunicationSystemResponse::BasicCommunicationSystemResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ BasicCommunicationSystemResponse::BasicCommunicationSystemResponse( BasicCommunicationSystemResponse::~BasicCommunicationSystemResponse() {} void BasicCommunicationSystemResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_SystemRequest); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc index 0dafa21e33..fddcc50a16 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc @@ -39,6 +39,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BCGetAppPropertiesRequest::BCGetAppPropertiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,15 +56,14 @@ BCGetAppPropertiesRequest::BCGetAppPropertiesRequest( void BCGetAppPropertiesRequest::FillAppProperties( const std::string& policy_app_id, smart_objects::SmartObject& out_properties) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy::AppProperties app_properties; const bool result = policy_handler_.GetAppProperties(policy_app_id, app_properties); if (!result) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Failed to get app parameters for policy_app_id: " << policy_app_id); return; } @@ -98,7 +99,7 @@ void BCGetAppPropertiesRequest::FillAppProperties( } void BCGetAppPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& msg_params = (*message_)[strings::msg_params]; smart_objects::SmartObject response_params(smart_objects::SmartType_Map); @@ -111,9 +112,9 @@ void BCGetAppPropertiesRequest::Run() { response_params[strings::properties][0] = properties; } } else { - LOG4CXX_DEBUG(logger_, - "policyAppID was absent in request, all apps properties " - "will be returned."); + SDL_LOG_DEBUG( + "policyAppID was absent in request, all apps properties " + "will be returned."); const auto app_ids = policy_handler_.GetApplicationPolicyIDs(); int i = 0; for (auto& app_id : app_ids) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc index 57949a949b..006cc536bf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc @@ -40,6 +40,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BCGetAppPropertiesResponse::BCGetAppPropertiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ BCGetAppPropertiesResponse::BCGetAppPropertiesResponse( policy_handler) {} void BCGetAppPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToHMI(message_); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc index b735cd9bdf..a8a47d1fef 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc @@ -39,6 +39,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BCGetFilePathRequest::BCGetFilePathRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ BCGetFilePathRequest::BCGetFilePathRequest( BCGetFilePathRequest::~BCGetFilePathRequest() {} void BCGetFilePathRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc index 58cda68a2b..f9d3fbe953 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc @@ -40,6 +40,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BCGetFilePathResponse::BCGetFilePathResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ BCGetFilePathResponse::BCGetFilePathResponse( BCGetFilePathResponse::~BCGetFilePathResponse() {} void BCGetFilePathResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager::event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_GetFilePath); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc index a4c5d6b1b4..dd5ea3bb85 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc @@ -40,6 +40,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BCSetAppPropertiesRequest::BCSetAppPropertiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ BCSetAppPropertiesRequest::BCSetAppPropertiesRequest( policy_handler) {} void BCSetAppPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& properties = (*message_)[strings::msg_params][strings::properties]; @@ -81,9 +83,8 @@ void BCSetAppPropertiesRequest::Run() { application_manager_.GetRPCService().ManageHMICommand(notification); } if (is_new_app) { - LOG4CXX_ERROR(logger_, - "Message contains unknow policyAppId: " - << policy_app_id << ", PTU will be triggered"); + SDL_LOG_ERROR("Message contains unknow policyAppId: " + << policy_app_id << ", PTU will be triggered"); policy_handler_.OnLocalAppAdded(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc index 928a17d0f8..a99e3d6a3e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc @@ -41,6 +41,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + BCSetAppPropertiesResponse::BCSetAppPropertiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ BCSetAppPropertiesResponse::BCSetAppPropertiesResponse( policy_handler) {} void BCSetAppPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToHMI(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc index c0d22dcb89..d9c7901c67 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ButtonGetCapabilitiesRequest::ButtonGetCapabilitiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,13 +55,13 @@ ButtonGetCapabilitiesRequest::ButtonGetCapabilitiesRequest( ButtonGetCapabilitiesRequest::~ButtonGetCapabilitiesRequest() {} void ButtonGetCapabilitiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void ButtonGetCapabilitiesRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::Buttons_GetCapabilities); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc index cc3a61a9df..20250af222 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ButtonGetCapabilitiesResponse::ButtonGetCapabilitiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ ButtonGetCapabilitiesResponse::ButtonGetCapabilitiesResponse( ButtonGetCapabilitiesResponse::~ButtonGetCapabilitiesResponse() {} void ButtonGetCapabilitiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); @@ -62,7 +64,7 @@ void ButtonGetCapabilitiesResponse::Run() { hmi_apis::FunctionID::Buttons_GetCapabilities); if (hmi_apis::Common_Result::SUCCESS != code) { - LOG4CXX_ERROR(logger_, "Error is returned. Capabilities won't be updated."); + SDL_LOG_ERROR("Error is returned. Capabilities won't be updated."); return; } @@ -81,8 +83,7 @@ void ButtonGetCapabilitiesResponse::Run() { if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::buttons, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save Buttons.GetCapabilities response to cache"); + SDL_LOG_ERROR("Failed to save Buttons.GetCapabilities response to cache"); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc index 988794f668..b4b838b8dd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ClosePopupRequest::ClosePopupRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ ClosePopupRequest::ClosePopupRequest( ClosePopupRequest::~ClosePopupRequest() {} void ClosePopupRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc index 072e1960e9..76ed7a749a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ClosePopupResponse::ClosePopupResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ ClosePopupResponse::ClosePopupResponse( ClosePopupResponse::~ClosePopupResponse() {} void ClosePopupResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO(VS): Process response from HMI } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc index 71782ef575..0bc9090bbe 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DecryptCertificateRequest::DecryptCertificateRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -50,7 +52,7 @@ DecryptCertificateRequest::DecryptCertificateRequest( policy_handle) {} void DecryptCertificateRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint32_t correlation_id = RequestToHMI::correlation_id(); const uint32_t app_id = RequestToHMI::application_id(); application_manager_.set_application_id(correlation_id, app_id); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc index cf2a4d092c..5c3bf9d0e2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DecryptCertificateResponse::DecryptCertificateResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ DecryptCertificateResponse::DecryptCertificateResponse( DecryptCertificateResponse::~DecryptCertificateResponse() {} void DecryptCertificateResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc index 7a505a46f3..1b42abd055 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetSystemInfoRequest::GetSystemInfoRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ GetSystemInfoRequest::GetSystemInfoRequest( GetSystemInfoRequest::~GetSystemInfoRequest() {} void GetSystemInfoRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t correlation_id = RequestToHMI::correlation_id(); uint32_t app_id = RequestToHMI::application_id(); application_manager_.set_application_id(correlation_id, app_id); @@ -60,7 +62,7 @@ void GetSystemInfoRequest::Run() { } void GetSystemInfoRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateCachedCapabilities(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc index 7a7d015e21..77605b31c3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc @@ -37,6 +37,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetSystemInfoResponse::GetSystemInfoResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,14 +54,14 @@ GetSystemInfoResponse::GetSystemInfoResponse( GetSystemInfoResponse::~GetSystemInfoResponse() {} void GetSystemInfoResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto code = static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); hmi_capabilities_.set_ccpu_version(policy_handler_.GetCCPUVersionFromPT()); if (hmi_apis::Common_Result::SUCCESS != code) { - LOG4CXX_WARN(logger_, "GetSystemError returns an error code " << code); + SDL_LOG_WARN("GetSystemError returns an error code " << code); hmi_capabilities_.UpdateCachedCapabilities(); policy_handler_.SetPreloadedPtFlag(false); return; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc index b8c61ca902..288d7c0927 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + MixingAudioSupportedRequest::MixingAudioSupportedRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ MixingAudioSupportedRequest::MixingAudioSupportedRequest( MixingAudioSupportedRequest::~MixingAudioSupportedRequest() {} void MixingAudioSupportedRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc index 089e56e598..e9dc69db2b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + MixingAudioSupportedResponse::MixingAudioSupportedResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ MixingAudioSupportedResponse::MixingAudioSupportedResponse( MixingAudioSupportedResponse::~MixingAudioSupportedResponse() {} void MixingAudioSupportedResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.set_attenuated_supported( (*message_)[strings::msg_params][hmi_response::attenuated_supported] diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc index 8390fea5bc..9010e32125 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviAlertManeuverRequest::NaviAlertManeuverRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ NaviAlertManeuverRequest::NaviAlertManeuverRequest( NaviAlertManeuverRequest::~NaviAlertManeuverRequest() {} void NaviAlertManeuverRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc index a1603f069d..40f4471586 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviAlertManeuverResponse::NaviAlertManeuverResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ NaviAlertManeuverResponse::NaviAlertManeuverResponse( NaviAlertManeuverResponse::~NaviAlertManeuverResponse() {} void NaviAlertManeuverResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_AlertManeuver); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc index 47f2f2505e..b9860bcd02 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AudioStartStreamRequest::AudioStartStreamRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,13 +55,12 @@ AudioStartStreamRequest::AudioStartStreamRequest( policy_handle) , EventObserver(application_manager.event_dispatcher()) , retry_number_(0) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::pair<uint32_t, int32_t> stream_retry = application_manager_.get_settings().start_stream_retry_amount(); default_timeout_ = stream_retry.second; retry_number_ = stream_retry.first; - LOG4CXX_DEBUG(logger_, - "default_timeout_ = " << default_timeout_ + SDL_LOG_DEBUG("default_timeout_ = " << default_timeout_ << "; retry_number_ = " << retry_number_); } @@ -69,17 +70,16 @@ AudioStartStreamRequest::~AudioStartStreamRequest() { } void AudioStartStreamRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app_mngr::commands::CheckAvailabilityHMIInterfaces( application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { - LOG4CXX_INFO(logger_, "Interface Navi is not supported by system"); + SDL_LOG_INFO("Interface Navi is not supported by system"); return; } ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR(logger_, - "Application with hmi_app_id " << application_id() + SDL_LOG_ERROR("Application with hmi_app_id " << application_id() << " does not exist"); return; } @@ -92,33 +92,31 @@ void AudioStartStreamRequest::Run() { void AudioStartStreamRequest::on_event(const event_engine::Event& event) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR(logger_, - "StartAudioStreamRequest aborted. Application not found"); + SDL_LOG_ERROR("StartAudioStreamRequest aborted. Application not found"); return; } const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_StartAudioStream: { - LOG4CXX_DEBUG(logger_, "Received StartStream event"); + SDL_LOG_DEBUG("Received StartStream event"); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); if (hmi_apis::Common_Result::SUCCESS == code) { - LOG4CXX_INFO(logger_, "StartAudioStream response SUCCESS"); + SDL_LOG_INFO("StartAudioStream response SUCCESS"); if (application_manager_.HMIStateAllowsStreaming(app->app_id(), ServiceType::kAudio)) { app->set_audio_streaming_approved(true); } else { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "StartAudioStreamRequest aborted. Application can not stream"); } application_manager_.TerminateRequest( @@ -126,25 +124,25 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) { break; } if (hmi_apis::Common_Result::REJECTED == code) { - LOG4CXX_INFO(logger_, "StartAudioStream response REJECTED"); + SDL_LOG_INFO("StartAudioStream response REJECTED"); RetryStartSession(); break; } } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } } void AudioStartStreamRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); RetryStartSession(); } void AudioStartStreamRequest::RetryStartSession() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager_.TerminateRequest( connection_key(), correlation_id(), function_id()); @@ -152,20 +150,18 @@ void AudioStartStreamRequest::RetryStartSession() { ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR(logger_, - "StartAudioStreamRequest aborted. Application not found"); + SDL_LOG_ERROR("StartAudioStreamRequest aborted. Application not found"); return; } if (!app->audio_streaming_allowed()) { - LOG4CXX_WARN(logger_, "Audio streaming not allowed"); + SDL_LOG_WARN("Audio streaming not allowed"); return; } if (app->audio_streaming_approved()) { - LOG4CXX_INFO(logger_, - "AudioStartStream retry sequence stopped. " - << "SUCCESS received"); + SDL_LOG_INFO("AudioStartStream retry sequence stopped. " + << "SUCCESS received"); app->set_audio_stream_retry_number(0); return; } @@ -173,15 +169,13 @@ void AudioStartStreamRequest::RetryStartSession() { uint32_t curr_retry_number = app->audio_stream_retry_number(); if (curr_retry_number <= retry_number_) { - LOG4CXX_DEBUG( - logger_, - "Retry number " << curr_retry_number << " of " << retry_number_); + SDL_LOG_DEBUG("Retry number " << curr_retry_number << " of " + << retry_number_); MessageHelper::SendAudioStartStream(app->app_id(), application_manager_); app->set_audio_stream_retry_number(++curr_retry_number); } else { - LOG4CXX_DEBUG(logger_, - "Audio start stream retry sequence stopped. " - << "Attempts expired."); + SDL_LOG_DEBUG("Audio start stream retry sequence stopped. " + << "Attempts expired."); application_manager_.EndNaviServices(app->app_id()); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc index 61d49577f6..99ddceaa55 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AudioStartStreamResponse::AudioStartStreamResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ AudioStartStreamResponse::AudioStartStreamResponse( AudioStartStreamResponse::~AudioStartStreamResponse() {} void AudioStartStreamResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_StartAudioStream); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc index a5d436f015..e20d0e1cb6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AudioStopStreamRequest::AudioStopStreamRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,10 +53,10 @@ AudioStopStreamRequest::AudioStopStreamRequest( AudioStopStreamRequest::~AudioStopStreamRequest() {} void AudioStopStreamRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app_mngr::commands::CheckAvailabilityHMIInterfaces( application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { - LOG4CXX_INFO(logger_, "Interface Navi is not supported by system"); + SDL_LOG_INFO("Interface Navi is not supported by system"); return; } SendRequest(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc index 98023ab571..1b2f2c476c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AudioStopStreamResponse::AudioStopStreamResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ AudioStopStreamResponse::AudioStopStreamResponse( AudioStopStreamResponse::~AudioStopStreamResponse() {} void AudioStopStreamResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc index edc4afe1e4..d0ef35c8fa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviGetWayPointsRequest::NaviGetWayPointsRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ NaviGetWayPointsRequest::NaviGetWayPointsRequest( NaviGetWayPointsRequest::~NaviGetWayPointsRequest() {} void NaviGetWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc index 0f0b652d01..97ef0cae2b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviGetWayPointsResponse::NaviGetWayPointsResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ NaviGetWayPointsResponse::NaviGetWayPointsResponse( NaviGetWayPointsResponse::~NaviGetWayPointsResponse() {} void NaviGetWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_GetWayPoints); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc index 15e5b46b36..4caa307be3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviIsReadyRequest::NaviIsReadyRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,18 +55,18 @@ NaviIsReadyRequest::NaviIsReadyRequest( NaviIsReadyRequest::~NaviIsReadyRequest() {} void NaviIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); subscribe_on_event(hmi_apis::FunctionID::Navigation_IsReady, correlation_id()); SendRequest(); } void NaviIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_IsReady: { - LOG4CXX_DEBUG(logger_, "Received Navigation_IsReady event"); + SDL_LOG_DEBUG("Received Navigation_IsReady event"); unsubscribe_from_event(hmi_apis::FunctionID::Navigation_IsReady); const bool is_available = app_mngr::commands::ChangeInterfaceState( application_manager_, @@ -76,7 +78,7 @@ void NaviIsReadyRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc index 073513eda9..2d7f2ec025 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviIsReadyResponse::NaviIsReadyResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ NaviIsReadyResponse::NaviIsReadyResponse( NaviIsReadyResponse::~NaviIsReadyResponse() {} void NaviIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_IsReady); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc index 360870e21c..db7e73144d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviSendLocationRequest::NaviSendLocationRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ NaviSendLocationRequest::NaviSendLocationRequest( NaviSendLocationRequest::~NaviSendLocationRequest() {} void NaviSendLocationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc index dc60f2fbf0..d4d3ea0c2c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviSendLocationResponse::NaviSendLocationResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ NaviSendLocationResponse::NaviSendLocationResponse( NaviSendLocationResponse::~NaviSendLocationResponse() {} void NaviSendLocationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_SendLocation); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc index 764315f37f..e4fbdaa0d6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviSetVideoConfigRequest::NaviSetVideoConfigRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,19 +57,18 @@ NaviSetVideoConfigRequest::NaviSetVideoConfigRequest( NaviSetVideoConfigRequest::~NaviSetVideoConfigRequest() {} void NaviSetVideoConfigRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app_mngr::commands::CheckAvailabilityHMIInterfaces( application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { - LOG4CXX_WARN(logger_, "HMI interface Navigation is not supported"); + SDL_LOG_WARN("HMI interface Navigation is not supported"); return; } ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR( - logger_, - "Application with hmi_app_id " << application_id() << "does not exist"); + SDL_LOG_ERROR("Application with hmi_app_id " << application_id() + << " does not exist"); return; } @@ -77,13 +78,12 @@ void NaviSetVideoConfigRequest::Run() { } void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR(logger_, - "Application is not found, abort NaviSetVideoConfigRequest"); + SDL_LOG_ERROR("Application is not found, abort NaviSetVideoConfigRequest"); return; } @@ -97,12 +97,11 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { std::vector<std::string> rejected_params; if (code == hmi_apis::Common_Result::SUCCESS) { - LOG4CXX_DEBUG(logger_, "Received SetVideoConfig success response"); + SDL_LOG_DEBUG("Received SetVideoConfig success response"); result = true; } else { - LOG4CXX_DEBUG( - logger_, - "Received SetVideoConfig failure response (" << event.id() << ")"); + SDL_LOG_DEBUG("Received SetVideoConfig failure response (" << event.id() + << ")"); result = false; if (message[strings::msg_params].keyExists(strings::rejected_params)) { const smart_objects::SmartArray* list = @@ -128,18 +127,18 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { break; } default: - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); break; } } void NaviSetVideoConfigRequest::onTimeOut() { - LOG4CXX_WARN(logger_, "Timed out while waiting for SetVideoConfig response"); + SDL_LOG_WARN("Timed out while waiting for SetVideoConfig response"); ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not found"); + SDL_LOG_ERROR("Application is not found"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc index e4a30c9da5..5291ef8adf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviSetVideoConfigResponse::NaviSetVideoConfigResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ NaviSetVideoConfigResponse::NaviSetVideoConfigResponse( NaviSetVideoConfigResponse::~NaviSetVideoConfigResponse() {} void NaviSetVideoConfigResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_SetVideoConfig); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc index 95dd4561fc..ddfc7cc187 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviShowConstantTBTRequest::NaviShowConstantTBTRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ NaviShowConstantTBTRequest::NaviShowConstantTBTRequest( NaviShowConstantTBTRequest::~NaviShowConstantTBTRequest() {} void NaviShowConstantTBTRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc index f73099d29a..869b76863d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviShowConstantTBTResponse::NaviShowConstantTBTResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ NaviShowConstantTBTResponse::NaviShowConstantTBTResponse( NaviShowConstantTBTResponse::~NaviShowConstantTBTResponse() {} void NaviShowConstantTBTResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_ShowConstantTBT); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc index 00974085c3..d0f95ee385 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviStartStreamRequest::NaviStartStreamRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,13 +55,12 @@ NaviStartStreamRequest::NaviStartStreamRequest( policy_handle) , EventObserver(application_manager.event_dispatcher()) , retry_number_(0) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::pair<uint32_t, int32_t> stream_retry = application_manager_.get_settings().start_stream_retry_amount(); default_timeout_ = stream_retry.second; retry_number_ = stream_retry.first; - LOG4CXX_DEBUG(logger_, - "default_timeout_ = " << default_timeout_ + SDL_LOG_DEBUG("default_timeout_ = " << default_timeout_ << "; retry_number_ = " << retry_number_); } @@ -71,18 +72,17 @@ NaviStartStreamRequest::~NaviStartStreamRequest() { } void NaviStartStreamRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app_mngr::commands::CheckAvailabilityHMIInterfaces( application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { - LOG4CXX_INFO(logger_, "Interface Navi is not supported by system"); + SDL_LOG_INFO("Interface Navi is not supported by system"); return; } ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR( - logger_, - "Application with hmi_app_id " << application_id() << "does not exist"); + SDL_LOG_ERROR("Application with hmi_app_id " << application_id() + << " does not exist"); return; } SetAllowedToTerminate(false); @@ -94,33 +94,31 @@ void NaviStartStreamRequest::Run() { void NaviStartStreamRequest::on_event(const event_engine::Event& event) { using namespace protocol_handler; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR(logger_, - "NaviStartStreamRequest aborted. Application not found"); + SDL_LOG_ERROR("NaviStartStreamRequest aborted. Application not found"); return; } const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_StartStream: { - LOG4CXX_DEBUG(logger_, "Received StartStream event"); + SDL_LOG_DEBUG("Received StartStream event"); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); if (hmi_apis::Common_Result::SUCCESS == code) { - LOG4CXX_INFO(logger_, "NaviStartStreamResponse SUCCESS"); + SDL_LOG_INFO("NaviStartStreamResponse SUCCESS"); if (application_manager_.HMIStateAllowsStreaming( app->app_id(), ServiceType::kMobileNav)) { app->set_video_streaming_approved(true); } else { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "NaviStartStreamRequest aborted. Application can not stream"); } application_manager_.TerminateRequest( @@ -128,25 +126,25 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) { break; } if (hmi_apis::Common_Result::REJECTED == code) { - LOG4CXX_INFO(logger_, "StartStream response REJECTED "); + SDL_LOG_INFO("StartStream response REJECTED"); RetryStartSession(); break; } } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } } void NaviStartStreamRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); RetryStartSession(); } void NaviStartStreamRequest::RetryStartSession() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager_.TerminateRequest( connection_key(), correlation_id(), function_id()); @@ -154,20 +152,18 @@ void NaviStartStreamRequest::RetryStartSession() { ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { - LOG4CXX_ERROR(logger_, - "NaviStartStreamRequest aborted. Application not found"); + SDL_LOG_ERROR("NaviStartStreamRequest aborted. Application not found"); return; } if (!app->video_streaming_allowed()) { - LOG4CXX_WARN(logger_, "Video streaming not allowed"); + SDL_LOG_WARN("Video streaming not allowed"); return; } if (app->video_streaming_approved()) { - LOG4CXX_INFO(logger_, - "NaviStartStream retry sequence stopped. " - << "SUCCESS received"); + SDL_LOG_INFO("NaviStartStream retry sequence stopped. " + << "SUCCESS received"); app->set_video_stream_retry_number(0); return; } @@ -175,15 +171,13 @@ void NaviStartStreamRequest::RetryStartSession() { uint32_t curr_retry_number = app->video_stream_retry_number(); if (curr_retry_number <= retry_number_) { - LOG4CXX_DEBUG( - logger_, - "Retry number " << curr_retry_number << " of " << retry_number_); + SDL_LOG_DEBUG("Retry number " << curr_retry_number << " of " + << retry_number_); MessageHelper::SendNaviStartStream(app->app_id(), application_manager_); app->set_video_stream_retry_number(++curr_retry_number); } else { - LOG4CXX_DEBUG(logger_, - "NaviStartStream retry sequence stopped. " - << "Attempts expired"); + SDL_LOG_DEBUG("NaviStartStream retry sequence stopped. " + << "Attempts expired"); application_manager_.EndNaviServices(app->app_id()); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc index eafd81148a..a6595f1b8a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviStartStreamResponse::NaviStartStreamResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ NaviStartStreamResponse::NaviStartStreamResponse( NaviStartStreamResponse::~NaviStartStreamResponse() {} void NaviStartStreamResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_StartStream); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc index ad09b0aee1..c86803413b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviStopStreamRequest::NaviStopStreamRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,10 +53,10 @@ NaviStopStreamRequest::NaviStopStreamRequest( NaviStopStreamRequest::~NaviStopStreamRequest() {} void NaviStopStreamRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app_mngr::commands::CheckAvailabilityHMIInterfaces( application_manager_, HmiInterfaces::HMI_INTERFACE_Navigation)) { - LOG4CXX_INFO(logger_, "Interface Navi is not supported by system"); + SDL_LOG_INFO("Interface Navi is not supported by system"); return; } SendRequest(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc index ff8c0bddff..3c12c527d8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviStopStreamResponse::NaviStopStreamResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ NaviStopStreamResponse::NaviStopStreamResponse( NaviStopStreamResponse::~NaviStopStreamResponse() {} void NaviStopStreamResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc index ba29f552b7..c08998ddf3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviSubscribeWayPointsRequest::NaviSubscribeWayPointsRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ NaviSubscribeWayPointsRequest::NaviSubscribeWayPointsRequest( NaviSubscribeWayPointsRequest::~NaviSubscribeWayPointsRequest() {} void NaviSubscribeWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc index ddf8f75e58..37b4e8bbd3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviSubscribeWayPointsResponse::NaviSubscribeWayPointsResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ NaviSubscribeWayPointsResponse::NaviSubscribeWayPointsResponse( NaviSubscribeWayPointsResponse::~NaviSubscribeWayPointsResponse() {} void NaviSubscribeWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::Navigation_SubscribeWayPoints); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc index d3c998cfdf..e3a690a971 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviUnsubscribeWayPointsRequest::NaviUnsubscribeWayPointsRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ NaviUnsubscribeWayPointsRequest::NaviUnsubscribeWayPointsRequest( NaviUnsubscribeWayPointsRequest::~NaviUnsubscribeWayPointsRequest() {} void NaviUnsubscribeWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc index beed29e1e2..b84d89e658 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviUnsubscribeWayPointsResponse::NaviUnsubscribeWayPointsResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ NaviUnsubscribeWayPointsResponse::NaviUnsubscribeWayPointsResponse( NaviUnsubscribeWayPointsResponse::~NaviUnsubscribeWayPointsResponse() {} void NaviUnsubscribeWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc index a8a258b1c0..91c764b5b4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviUpdateTurnListRequest::NaviUpdateTurnListRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ NaviUpdateTurnListRequest::NaviUpdateTurnListRequest( NaviUpdateTurnListRequest::~NaviUpdateTurnListRequest() {} void NaviUpdateTurnListRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc index a2f737df38..033c7f1383 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + NaviUpdateTurnListResponse::NaviUpdateTurnListResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ NaviUpdateTurnListResponse::NaviUpdateTurnListResponse( NaviUpdateTurnListResponse::~NaviUpdateTurnListResponse() {} void NaviUpdateTurnListResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc index 204cc7d347..985056e788 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAllowSDLFunctionalityNotification::OnAllowSDLFunctionalityNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ OnAllowSDLFunctionalityNotification::OnAllowSDLFunctionalityNotification( OnAllowSDLFunctionalityNotification::~OnAllowSDLFunctionalityNotification() {} void OnAllowSDLFunctionalityNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string device_id; if ((*message_)[strings::msg_params].keyExists("device")) { device_id = (*message_)[strings::msg_params]["device"]["id"].asString(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc index e882020f8b..144c184e82 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAppActivatedNotification::OnAppActivatedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnAppActivatedNotification::OnAppActivatedNotification( OnAppActivatedNotification::~OnAppActivatedNotification() {} void OnAppActivatedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_OnAppActivated); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc index 18b796eaa8..81b07ed6f2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAppDeactivatedNotification::OnAppDeactivatedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,7 +59,7 @@ OnAppDeactivatedNotification::OnAppDeactivatedNotification( OnAppDeactivatedNotification::~OnAppDeactivatedNotification() {} void OnAppDeactivatedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc index a1eb412c66..801e74eedd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAppPermissionChangedNotification::OnAppPermissionChangedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnAppPermissionChangedNotification::OnAppPermissionChangedNotification( OnAppPermissionChangedNotification::~OnAppPermissionChangedNotification() {} void OnAppPermissionChangedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc index 0033b392d2..37552e003a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc @@ -112,6 +112,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAppPermissionConsentNotification::OnAppPermissionConsentNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -127,7 +129,7 @@ OnAppPermissionConsentNotification::OnAppPermissionConsentNotification( OnAppPermissionConsentNotification::~OnAppPermissionConsentNotification() {} void OnAppPermissionConsentNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; uint32_t connection_key = 0; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc index f1fa703bbb..d31d8436f7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAppPropertiesChangeNotification::OnAppPropertiesChangeNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -50,7 +52,7 @@ OnAppPropertiesChangeNotification::OnAppPropertiesChangeNotification( policy_handle) {} void OnAppPropertiesChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc index 51c3125921..382b402383 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAppRegisteredNotification::OnAppRegisteredNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnAppRegisteredNotification::OnAppRegisteredNotification( OnAppRegisteredNotification::~OnAppRegisteredNotification() {} void OnAppRegisteredNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // SDL must notify system about app registration before any dependent actions // will be started SendNotification(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc index 07aadada81..4ff985cdf0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAppUnregisteredNotification::OnAppUnregisteredNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,13 +56,13 @@ OnAppUnregisteredNotification::OnAppUnregisteredNotification( OnAppUnregisteredNotification::~OnAppUnregisteredNotification() {} bool OnAppUnregisteredNotification::Init() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Replacement of hmi id is skipped."); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Replacement of hmi id is skipped."); return true; } void OnAppUnregisteredNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // sending event for delete VRCommand on PerformInteraction event_engine::Event event( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc index d9c1120409..d72fb1244e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAudioDataStreamingNotification::OnAudioDataStreamingNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnAudioDataStreamingNotification::OnAudioDataStreamingNotification( OnAudioDataStreamingNotification::~OnAudioDataStreamingNotification() {} void OnAudioDataStreamingNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc index 1a104c0fa1..9caec22bd2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc @@ -42,6 +42,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnBCSystemCapabilityUpdatedNotification:: OnBCSystemCapabilityUpdatedNotification( const application_manager::commands::MessageSharedPtr& message, @@ -59,10 +61,10 @@ OnBCSystemCapabilityUpdatedNotification:: ~OnBCSystemCapabilityUpdatedNotification() {} void OnBCSystemCapabilityUpdatedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "Sending BasicCommunication.OnSystemCapabilityUpdated " - "Notification to HMI"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG( + "Sending BasicCommunication.OnSystemCapabilityUpdated " + "Notification to HMI"); smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -150,9 +152,8 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { app_services->end(), matching_service_predicate); if (it != app_services->end()) { - LOG4CXX_DEBUG( - logger_, - "Replacing updated record with service_id " << service_id); + SDL_LOG_DEBUG("Replacing updated record with service_id " + << service_id); app_services->erase(it); } app_services->push_back(updated_capabilities[i]); @@ -163,7 +164,7 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { } case mobile_apis::SystemCapabilityType::DISPLAYS: { if (!hmi_capabilities_.system_display_capabilities()) { - LOG4CXX_INFO(logger_, "system_display_capabilities are not available"); + SDL_LOG_INFO("system_display_capabilities are not available"); return; } msg_params[strings::system_capability][strings::display_capabilities] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc index f32aef1102..948a4fd418 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnBCSystemCapabilityUpdatedNotificationFromHMI:: OnBCSystemCapabilityUpdatedNotificationFromHMI( const application_manager::commands::MessageSharedPtr& message, @@ -63,10 +65,10 @@ OnBCSystemCapabilityUpdatedNotificationFromHMI:: OnBCSystemCapabilityUpdatedNotificationFromHMI:: ProcessSystemDisplayCapabilities( const smart_objects::SmartObject& display_capabilities) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!(*message_)[strings::msg_params].keyExists(strings::app_id)) { - LOG4CXX_DEBUG(logger_, "Updating general display capabilities"); + SDL_LOG_DEBUG("Updating general display capabilities"); hmi_capabilities_.set_system_display_capabilities(display_capabilities); return ProcessSystemDisplayCapabilitiesResult::SUCCESS; } @@ -75,12 +77,11 @@ OnBCSystemCapabilityUpdatedNotificationFromHMI:: (*message_)[strings::msg_params][strings::app_id].asUInt(); auto app = application_manager_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, - "Application with app_id " << app_id << " is not registered"); + SDL_LOG_ERROR("Application with app_id " << app_id << " is not registered"); return ProcessSystemDisplayCapabilitiesResult::FAIL; } - LOG4CXX_DEBUG(logger_, "Updating display capabilities for app " << app_id); + SDL_LOG_DEBUG("Updating display capabilities for app " << app_id); app->set_display_capabilities(display_capabilities); // Remove app_id from notification to mobile @@ -88,7 +89,7 @@ OnBCSystemCapabilityUpdatedNotificationFromHMI:: (*message_)[strings::msg_params][strings::app_id]; (*message_)[strings::msg_params].erase(strings::app_id); if (app->is_resuming() && app->is_app_data_resumption_allowed()) { - LOG4CXX_DEBUG(logger_, "Application is resuming"); + SDL_LOG_DEBUG("Application is resuming"); app->display_capabilities_builder().UpdateDisplayCapabilities( display_capabilities); return ProcessSystemDisplayCapabilitiesResult::CAPABILITIES_CACHED; @@ -98,7 +99,7 @@ OnBCSystemCapabilityUpdatedNotificationFromHMI:: } void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = static_cast<int32_t>( @@ -113,15 +114,13 @@ void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() { const auto result = ProcessSystemDisplayCapabilities( system_capability[strings::display_capabilities]); if (ProcessSystemDisplayCapabilitiesResult::FAIL == result) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Failed to process display capabilities. Notification will " "be ignored"); return; } else if (ProcessSystemDisplayCapabilitiesResult:: CAPABILITIES_CACHED == result) { - LOG4CXX_TRACE(logger_, - "Capabilities are being cached for resuming app"); + SDL_LOG_TRACE("Capabilities are being cached for resuming app"); return; } } @@ -129,7 +128,7 @@ void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() { } case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: { if (system_capability.keyExists(strings::rc_capability)) { - LOG4CXX_DEBUG(logger_, "Updating RC Capabilities"); + SDL_LOG_DEBUG("Updating RC Capabilities"); hmi_capabilities_.set_rc_capability( system_capability[strings::rc_capability]); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc index f25e6202cd..f6911637f9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc @@ -42,6 +42,8 @@ namespace commands { namespace hmi { +SDL_CREATE_LOG_VARIABLE("Commands") + OnButtonEventNotification::OnButtonEventNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnButtonEventNotification::OnButtonEventNotification( policy_handle) {} void OnButtonEventNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::OnButtonEventID); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc index fee6b1b485..db2d81ccd1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc @@ -43,6 +43,8 @@ namespace commands { namespace hmi { +SDL_CREATE_LOG_VARIABLE("Commands") + OnButtonPressNotification::OnButtonPressNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ OnButtonPressNotification::OnButtonPressNotification( policy_handle) {} void OnButtonPressNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::Buttons_OnButtonPress); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc index 4ac752d6c5..c8d36407b8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc @@ -39,6 +39,8 @@ namespace commands { namespace hmi { +SDL_CREATE_LOG_VARIABLE("Commands") + OnButtonSubscriptionNotification::OnButtonSubscriptionNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ OnButtonSubscriptionNotification::OnButtonSubscriptionNotification( OnButtonSubscriptionNotification::~OnButtonSubscriptionNotification() {} void OnButtonSubscriptionNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc index f27c1fe5e5..9938c26192 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnDeviceChosenNotification::OnDeviceChosenNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnDeviceChosenNotification::OnDeviceChosenNotification( OnDeviceChosenNotification::~OnDeviceChosenNotification() {} void OnDeviceChosenNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if ((*message_)[strings::msg_params].keyExists(strings::device_info)) { application_manager_.ConnectToDevice( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc index 129ba8c9ba..a6619c579c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc @@ -80,6 +80,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnDeviceStateChangedNotification::OnDeviceStateChangedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -95,7 +97,7 @@ OnDeviceStateChangedNotification::OnDeviceStateChangedNotification( OnDeviceStateChangedNotification::~OnDeviceStateChangedNotification() {} void OnDeviceStateChangedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if ((*message_)[strings::msg_params]["deviceState"] == hmi_apis::Common_DeviceState::UNPAIRED) { @@ -110,11 +112,11 @@ void OnDeviceStateChangedNotification::Run() { } } else { // Policy uses hashed MAC address as device_id - LOG4CXX_DEBUG(logger_, "Device_id from HMI: " << device_id); + SDL_LOG_DEBUG("Device_id from HMI: " << device_id); std::string bt_mac = convert_to_bt_mac(device_id); - LOG4CXX_DEBUG(logger_, "Device_id as BT MAC: " << bt_mac); + SDL_LOG_DEBUG("Device_id as BT MAC: " << bt_mac); device_id = encryption::MakeHash(bt_mac); - LOG4CXX_DEBUG(logger_, "Device_id hashed as BT MAC : " << device_id); + SDL_LOG_DEBUG("Device_id hashed as BT MAC : " << device_id); } policy_handler_.RemoveDevice(device_id); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc index a743c58672..f701713d96 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc @@ -124,6 +124,8 @@ struct OnDriverDistractionProcessor { }; } // namespace +SDL_CREATE_LOG_VARIABLE("Commands") + OnDriverDistractionNotification::OnDriverDistractionNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -139,7 +141,7 @@ OnDriverDistractionNotification::OnDriverDistractionNotification( OnDriverDistractionNotification::~OnDriverDistractionNotification() {} void OnDriverDistractionNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto state = static_cast<hmi_apis::Common_DriverDistractionState::eType>( (*message_)[strings::msg_params][hmi_notification::state].asInt()); @@ -147,7 +149,7 @@ void OnDriverDistractionNotification::Run() { auto on_driver_distraction = std::make_shared<smart_objects::SmartObject>(); if (!on_driver_distraction) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } (*on_driver_distraction)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc index f6ea22ae34..13e76979a4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnEventChangedNotification::OnEventChangedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnEventChangedNotification::OnEventChangedNotification( OnEventChangedNotification::~OnEventChangedNotification() {} void OnEventChangedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_OnEventChanged); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc index 4c168f9eff..079e4f3d10 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc @@ -46,6 +46,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnExitAllApplicationsNotification::OnExitAllApplicationsNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -61,12 +63,12 @@ OnExitAllApplicationsNotification::OnExitAllApplicationsNotification( OnExitAllApplicationsNotification::~OnExitAllApplicationsNotification() {} void OnExitAllApplicationsNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const hmi_apis::Common_ApplicationsCloseReason::eType reason = static_cast<hmi_apis::Common_ApplicationsCloseReason::eType>( (*message_)[strings::msg_params][hmi_request::reason].asInt()); - LOG4CXX_DEBUG(logger_, "Reason " << reason); + SDL_LOG_DEBUG("Reason " << reason); mobile_api::AppInterfaceUnregisteredReason::eType mob_reason = mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM; @@ -90,7 +92,7 @@ void OnExitAllApplicationsNotification::Run() { return; } default: { - LOG4CXX_ERROR(logger_, "Unknown Application close reason" << reason); + SDL_LOG_ERROR("Unknown Application close reason" << reason); return; } } @@ -106,7 +108,7 @@ void OnExitAllApplicationsNotification::Run() { } void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr message = std::make_shared<smart_objects::SmartObject>( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc index 34365c12e5..2b95d2e3e8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc @@ -44,6 +44,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnExitApplicationNotification::OnExitApplicationNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -59,7 +61,7 @@ OnExitApplicationNotification::OnExitApplicationNotification( OnExitApplicationNotification::~OnExitApplicationNotification() {} void OnExitApplicationNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis; using namespace hmi_apis; @@ -68,7 +70,7 @@ void OnExitApplicationNotification::Run() { ApplicationSharedPtr app_impl = application_manager_.application(app_id); if (app_impl.use_count() == 0) { - LOG4CXX_ERROR(logger_, "Application does not exist"); + SDL_LOG_ERROR("Application does not exist"); return; } @@ -122,7 +124,7 @@ void OnExitApplicationNotification::Run() { } default: { - LOG4CXX_WARN(logger_, "Unhandled reason"); + SDL_LOG_WARN("Unhandled reason"); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc index e1f0e2b104..d96f0498a5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnFileRemovedNotification::OnFileRemovedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnFileRemovedNotification::OnFileRemovedNotification( OnFileRemovedNotification::~OnFileRemovedNotification() {} void OnFileRemovedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc index 2e8f15387f..5f03d5ffa0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnFindApplications::OnFindApplications( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnFindApplications::OnFindApplications( OnFindApplications::~OnFindApplications() {} void OnFindApplications::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO(PV): add UpdateAppsOnDevice to ApplicationManager } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc index 1e8da19c0a..2af2d1c2d6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnIgnitionCycleOverNotification::OnIgnitionCycleOverNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ OnIgnitionCycleOverNotification::OnIgnitionCycleOverNotification( OnIgnitionCycleOverNotification::~OnIgnitionCycleOverNotification() {} void OnIgnitionCycleOverNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_handler_.OnIgnitionCycleOver(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc index f611b81764..01de5ccb06 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnNaviTBTClientStateNotification::OnNaviTBTClientStateNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnNaviTBTClientStateNotification::OnNaviTBTClientStateNotification( OnNaviTBTClientStateNotification::~OnNaviTBTClientStateNotification() {} void OnNaviTBTClientStateNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc index 2a1a9c29fb..2440e918b7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnNaviWayPointChangeNotification::OnNaviWayPointChangeNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& app_man, @@ -49,7 +51,7 @@ OnNaviWayPointChangeNotification::OnNaviWayPointChangeNotification( OnNaviWayPointChangeNotification::~OnNaviWayPointChangeNotification() {} void OnNaviWayPointChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc index a0e75371b5..b883ac5c16 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc @@ -38,6 +38,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnPolicyUpdate::OnPolicyUpdate( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnPolicyUpdate::OnPolicyUpdate( OnPolicyUpdate::~OnPolicyUpdate() {} void OnPolicyUpdate::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_handler_.OnPTExchangeNeeded(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc index 441e36a385..9349bc326d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnPutFileNotification::OnPutFileNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnPutFileNotification::OnPutFileNotification( OnPutFileNotification::~OnPutFileNotification() {} void OnPutFileNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc index c9270fd80b..ef92c28ba4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnReadyNotification::OnReadyNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnReadyNotification::OnReadyNotification( OnReadyNotification::~OnReadyNotification() {} void OnReadyNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager_.OnHMIReady(); event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnReady); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc index b2c9151b40..2f5901c9e2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnReceivedPolicyUpdate::OnReceivedPolicyUpdate( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,20 +58,20 @@ OnReceivedPolicyUpdate::OnReceivedPolicyUpdate( OnReceivedPolicyUpdate::~OnReceivedPolicyUpdate() {} void OnReceivedPolicyUpdate::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE) const std::string& file_path = (*message_)[strings::msg_params][hmi_notification::policyfile].asString(); policy::BinaryMessage file_content; if (!file_system::ReadBinaryFile(file_path, file_content)) { - LOG4CXX_ERROR(logger_, "Failed to read Update file."); + SDL_LOG_ERROR("Failed to read Update file."); return; } policy_handler_.ReceiveMessageFromSDK(file_path, file_content); #else - LOG4CXX_WARN(logger_, - "This RPC is part of extended policy flow." - "Please re-build with extended policy mode enabled."); + SDL_LOG_WARN( + "This RPC is part of extended policy flow. " + "Please re-build with extended policy mode enabled."); #endif } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc index dbef717539..e05c5860db 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnRecordStartdNotification::OnRecordStartdNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnRecordStartdNotification::OnRecordStartdNotification( OnRecordStartdNotification::~OnRecordStartdNotification() {} void OnRecordStartdNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc index 11d549655e..a56a6a26e1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnResumeAudioSourceNotification::OnResumeAudioSourceNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnResumeAudioSourceNotification::OnResumeAudioSourceNotification( OnResumeAudioSourceNotification::~OnResumeAudioSourceNotification() {} void OnResumeAudioSourceNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc index d0c584c66c..90a6cdf1ce 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSDLCloseNotification::OnSDLCloseNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnSDLCloseNotification::OnSDLCloseNotification( OnSDLCloseNotification::~OnSDLCloseNotification() {} void OnSDLCloseNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc index 314a9e8f71..0774414222 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSDLConsentNeededNotification::OnSDLConsentNeededNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnSDLConsentNeededNotification::OnSDLConsentNeededNotification( OnSDLConsentNeededNotification::~OnSDLConsentNeededNotification() {} void OnSDLConsentNeededNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc index 5db38d070b..efa880f484 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSDLPersistenceCompleteNotification::OnSDLPersistenceCompleteNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnSDLPersistenceCompleteNotification::OnSDLPersistenceCompleteNotification( OnSDLPersistenceCompleteNotification::~OnSDLPersistenceCompleteNotification() {} void OnSDLPersistenceCompleteNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc index de03b75214..c1f8c337bb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc @@ -39,6 +39,8 @@ namespace commands { namespace hmi { +SDL_CREATE_LOG_VARIABLE("Commands") + OnServiceUpdateNotification::OnServiceUpdateNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ OnServiceUpdateNotification::OnServiceUpdateNotification( OnServiceUpdateNotification::~OnServiceUpdateNotification() {} void OnServiceUpdateNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc index 035def10e0..5e86618b31 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnStartDeviceDiscovery::OnStartDeviceDiscovery( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnStartDeviceDiscovery::OnStartDeviceDiscovery( OnStartDeviceDiscovery::~OnStartDeviceDiscovery() {} void OnStartDeviceDiscovery::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); application_manager_.StartDevicesDiscovery(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc index 5ee2ede198..4a2e310151 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnStatusUpdateNotification::OnStatusUpdateNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnStatusUpdateNotification::OnStatusUpdateNotification( OnStatusUpdateNotification::~OnStatusUpdateNotification() {} void OnStatusUpdateNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc index bf52492ae1..c86ef48225 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc @@ -40,6 +40,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSystemContextNotification::OnSystemContextNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnSystemContextNotification::OnSystemContextNotification( OnSystemContextNotification::~OnSystemContextNotification() {} void OnSystemContextNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); mobile_api::SystemContext::eType system_context = static_cast<mobile_api::SystemContext::eType>( @@ -93,7 +95,7 @@ void OnSystemContextNotification::Run() { application_manager_.state_controller().SetRegularState( app, window_id, system_context); } else { - LOG4CXX_ERROR(logger_, "Application does not exist"); + SDL_LOG_ERROR("Application does not exist"); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc index 9b8523e882..1f0d02ac83 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSystemErrorNotification::OnSystemErrorNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnSystemErrorNotification::OnSystemErrorNotification( OnSystemErrorNotification::~OnSystemErrorNotification() {} void OnSystemErrorNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const int code = (*message_)[strings::msg_params][hmi_notification::error].asInt(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc index 171c144055..6a3b814d05 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSystemInfoChangedNotification::OnSystemInfoChangedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnSystemInfoChangedNotification::OnSystemInfoChangedNotification( OnSystemInfoChangedNotification::~OnSystemInfoChangedNotification() {} void OnSystemInfoChangedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t lang_code = (*message_)[strings::msg_params][strings::language].asUInt(); const std::string language = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc index 4f83e3e653..b75081e30f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc @@ -48,6 +48,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSystemRequestNotification::OnSystemRequestNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -63,7 +65,7 @@ OnSystemRequestNotification::OnSystemRequestNotification( OnSystemRequestNotification::~OnSystemRequestNotification() {} void OnSystemRequestNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& params = (*message_)[strings::params]; smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -96,8 +98,7 @@ void OnSystemRequestNotification::Run() { msg_params[strings::url] = policy_handler_.GetNextUpdateUrl( policy::PTUIterationType::DefaultIteration, app_id); if (0 == app_id) { - LOG4CXX_WARN(logger_, - "Can't select application to forward OnSystemRequest."); + SDL_LOG_WARN("Can't select application to forward OnSystemRequest."); return; } msg_params[strings::app_id] = app_id; @@ -110,26 +111,24 @@ void OnSystemRequestNotification::Run() { ApplicationSharedPtr app; if (msg_params.keyExists(strings::app_id)) { const uint32_t app_id = msg_params[strings::app_id].asUInt(); - LOG4CXX_DEBUG(logger_, "Received OnSystemRequest for appID " << app_id); - LOG4CXX_DEBUG(logger_, "Searching app to send OnSystemRequest by appID."); + SDL_LOG_DEBUG("Received OnSystemRequest for appID " << app_id); + SDL_LOG_DEBUG("Searching app to send OnSystemRequest by appID."); app = application_manager_.application(app_id); } else { - LOG4CXX_DEBUG(logger_, - "Received OnSystemRequest without appID." - " One of registered apps will be used."); - LOG4CXX_DEBUG(logger_, "Searching registered app to send OnSystemRequest."); + SDL_LOG_DEBUG( + "Received OnSystemRequest without appID." + " One of registered apps will be used."); + SDL_LOG_DEBUG("Searching registered app to send OnSystemRequest."); const uint32_t selected_app_id = policy_handler_.GetAppIdForSending(); if (0 == selected_app_id) { - LOG4CXX_WARN(logger_, - "Can't select application to forward OnSystemRequest."); + SDL_LOG_WARN("Can't select application to forward OnSystemRequest."); return; } app = application_manager_.application(selected_app_id); } if (app.use_count() == 0) { - LOG4CXX_WARN(logger_, - "No valid application found to forward OnSystemRequest."); + SDL_LOG_WARN("No valid application found to forward OnSystemRequest."); return; } @@ -140,16 +139,14 @@ void OnSystemRequestNotification::Run() { if (policy::kDeviceAllowed != policy_handler_.GetUserConsentForDevice(device_mac)) { - LOG4CXX_WARN(logger_, - "Application " - << app->policy_app_id() - << " is registered from non-consented device." - "Can't forward notification to application."); + SDL_LOG_WARN("Application " + << app->policy_app_id() + << " is registered from non-consented device. " + "Can't forward notification to application."); return; } - LOG4CXX_DEBUG(logger_, - "Sending request with application id " << app->policy_app_id()); + SDL_LOG_DEBUG("Sending request with application id " << app->policy_app_id()); params[strings::connection_key] = app->app_id(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc index b068835545..980c2ded17 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSystemTimeReadyNotification::OnSystemTimeReadyNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& app_man, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc index 293857f8d5..f652761178 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnTTSLanguageChangeNotification::OnTTSLanguageChangeNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,7 +59,7 @@ OnTTSLanguageChangeNotification::OnTTSLanguageChangeNotification( OnTTSLanguageChangeNotification::~OnTTSLanguageChangeNotification() {} void OnTTSLanguageChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.set_active_tts_language( static_cast<hmi_apis::Common_Language::eType>( @@ -72,14 +74,12 @@ void OnTTSLanguageChangeNotification::Run() { std::vector<std::string> sections_to_update{hmi_response::language}; if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::tts, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save TTS.OnLanguageChange response to cache"); + SDL_LOG_ERROR("Failed to save TTS.OnLanguageChange response to cache"); } if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::vr, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save VR.OnLanguageChange response to cache"); + SDL_LOG_ERROR("Failed to save VR.OnLanguageChange response to cache"); } (*message_)[strings::msg_params][strings::hmi_display_language] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc index 8b60762b31..96f6c5cd5b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc @@ -40,6 +40,8 @@ namespace commands { namespace hmi { +SDL_CREATE_LOG_VARIABLE("Commands") + OnTTSResetTimeoutNotification::OnTTSResetTimeoutNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnTTSResetTimeoutNotification::OnTTSResetTimeoutNotification( OnTTSResetTimeoutNotification::~OnTTSResetTimeoutNotification() {} void OnTTSResetTimeoutNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_OnResetTimeout); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc index 2d215b2ec9..4126a1bd21 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnTTSStartedNotification::OnTTSStartedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnTTSStartedNotification::OnTTSStartedNotification( OnTTSStartedNotification::~OnTTSStartedNotification() {} void OnTTSStartedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_Started); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc index 6910b188f2..da69c4670e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnTTSStoppedNotification::OnTTSStoppedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ OnTTSStoppedNotification::OnTTSStoppedNotification( OnTTSStoppedNotification::~OnTTSStoppedNotification() {} void OnTTSStoppedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_Stopped); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc index 6cc9f85d6f..939e3ad649 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUICommandNotification::OnUICommandNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnUICommandNotification::OnUICommandNotification( OnUICommandNotification::~OnUICommandNotification() {} void OnUICommandNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::eType::OnCommandID); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc index f069e4ed65..d1aa146e4f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc @@ -40,6 +40,8 @@ namespace commands { namespace hmi { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUIKeyBoardInputNotification::OnUIKeyBoardInputNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnUIKeyBoardInputNotification::OnUIKeyBoardInputNotification( OnUIKeyBoardInputNotification::~OnUIKeyBoardInputNotification() {} void OnUIKeyBoardInputNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc index 995d69cc45..2f2cb2ddc6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUILanguageChangeNotification::OnUILanguageChangeNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,7 +59,7 @@ OnUILanguageChangeNotification::OnUILanguageChangeNotification( OnUILanguageChangeNotification::~OnUILanguageChangeNotification() {} void OnUILanguageChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.set_active_ui_language( static_cast<hmi_apis::Common_Language::eType>( @@ -66,8 +68,7 @@ void OnUILanguageChangeNotification::Run() { std::vector<std::string> sections_to_update{hmi_response::language}; if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::ui, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save UI.OnLanguageChange response to cache"); + SDL_LOG_ERROR("Failed to save UI.OnLanguageChange response to cache"); } (*message_)[strings::msg_params][strings::hmi_display_language] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc index bd1e1b8ea7..d8de31cfbc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc @@ -41,6 +41,8 @@ namespace commands { namespace hmi { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUIResetTimeoutNotification::OnUIResetTimeoutNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ OnUIResetTimeoutNotification::OnUIResetTimeoutNotification( OnUIResetTimeoutNotification::~OnUIResetTimeoutNotification() {} void OnUIResetTimeoutNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_OnResetTimeout); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_subtle_alert_pressed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_subtle_alert_pressed_notification.cc index b2f5f80055..dedeb38a34 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_subtle_alert_pressed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_subtle_alert_pressed_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUISubtleAlertPressedNotification::OnUISubtleAlertPressedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnUISubtleAlertPressedNotification::OnUISubtleAlertPressedNotification( OnUISubtleAlertPressedNotification::~OnUISubtleAlertPressedNotification() {} void OnUISubtleAlertPressedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::function_id] = static_cast<int32_t>( mobile_apis::FunctionID::eType::OnSubtleAlertPressedID); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc index 193c3666d2..ae980070ea 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc @@ -40,6 +40,8 @@ namespace commands { namespace hmi { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUITouchEventNotification::OnUITouchEventNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnUITouchEventNotification::OnUITouchEventNotification( OnUITouchEventNotification::~OnUITouchEventNotification() {} void OnUITouchEventNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_file_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_file_notification.cc index 4c6157c48d..b0821a0890 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_file_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_file_notification.cc @@ -40,6 +40,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUIUpdateFileNotification::OnUIUpdateFileNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnUIUpdateFileNotification::OnUIUpdateFileNotification( OnUIUpdateFileNotification::~OnUIUpdateFileNotification() {} void OnUIUpdateFileNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = @@ -66,8 +68,7 @@ void OnUIUpdateFileNotification::Run() { auto app = application_manager_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, - "Application with app_id " << app_id << " is not registered"); + SDL_LOG_ERROR("Application with app_id " << app_id << " is not registered"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_sub_menu_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_sub_menu_notification.cc index 4f867fd3bd..2e8c37f7cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_sub_menu_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_update_sub_menu_notification.cc @@ -39,6 +39,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUIUpdateSubMenuNotification::OnUIUpdateSubMenuNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ OnUIUpdateSubMenuNotification::OnUIUpdateSubMenuNotification( OnUIUpdateSubMenuNotification::~OnUIUpdateSubMenuNotification() {} void OnUIUpdateSubMenuNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::OnUpdateSubMenuID); @@ -64,8 +66,7 @@ void OnUIUpdateSubMenuNotification::Run() { auto app = application_manager_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, - "Application with app_id " << app_id << " is not registered"); + SDL_LOG_ERROR("Application with app_id " << app_id << " is not registered"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc index e6275adab2..0ff97a664c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUpdateDeviceList::OnUpdateDeviceList( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ OnUpdateDeviceList::OnUpdateDeviceList( OnUpdateDeviceList::~OnUpdateDeviceList() {} void OnUpdateDeviceList::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc index 99c6520fee..9f4e707b83 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIAccPedalPositionNotification::OnVIAccPedalPositionNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIAccPedalPositionNotification::OnVIAccPedalPositionNotification( OnVIAccPedalPositionNotification::~OnVIAccPedalPositionNotification() {} void OnVIAccPedalPositionNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc index dbfd9487e3..4227847153 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIBeltStatusNotification::OnVIBeltStatusNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIBeltStatusNotification::OnVIBeltStatusNotification( OnVIBeltStatusNotification::~OnVIBeltStatusNotification() {} void OnVIBeltStatusNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc index b8e66b9c0f..663f9342f4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIBodyInformationNotification::OnVIBodyInformationNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIBodyInformationNotification::OnVIBodyInformationNotification( OnVIBodyInformationNotification::~OnVIBodyInformationNotification() {} void OnVIBodyInformationNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc index 418c751d1c..62bec16546 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIDeviceStatusNotification::OnVIDeviceStatusNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIDeviceStatusNotification::OnVIDeviceStatusNotification( OnVIDeviceStatusNotification::~OnVIDeviceStatusNotification() {} void OnVIDeviceStatusNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc index 29545fcd87..722fddc5f1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIDriverBrakingNotification::OnVIDriverBrakingNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIDriverBrakingNotification::OnVIDriverBrakingNotification( OnVIDriverBrakingNotification::~OnVIDriverBrakingNotification() {} void OnVIDriverBrakingNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc index 4c2fb94400..8c524a3f1d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIEngineTorqueNotification::OnVIEngineTorqueNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIEngineTorqueNotification::OnVIEngineTorqueNotification( OnVIEngineTorqueNotification::~OnVIEngineTorqueNotification() {} void OnVIEngineTorqueNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc index 6ac26a74fc..3cbd22eb97 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIExternalTemperatureNotification::OnVIExternalTemperatureNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIExternalTemperatureNotification::OnVIExternalTemperatureNotification( OnVIExternalTemperatureNotification::~OnVIExternalTemperatureNotification() {} void OnVIExternalTemperatureNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc index 1f1cad5b8b..8065434063 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIFuelLevelNotification::OnVIFuelLevelNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIFuelLevelNotification::OnVIFuelLevelNotification( OnVIFuelLevelNotification::~OnVIFuelLevelNotification() {} void OnVIFuelLevelNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc index 31c80860fd..c0c60108f3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIFuelLevelStateNotification::OnVIFuelLevelStateNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIFuelLevelStateNotification::OnVIFuelLevelStateNotification( OnVIFuelLevelStateNotification::~OnVIFuelLevelStateNotification() {} void OnVIFuelLevelStateNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc index 43ae3524ad..1e18d18eba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIGpsDataNotification::OnVIGpsDataNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIGpsDataNotification::OnVIGpsDataNotification( OnVIGpsDataNotification::~OnVIGpsDataNotification() {} void OnVIGpsDataNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc index 282a173b69..29906df43f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIHeadLampStatusNotification::OnVIHeadLampStatusNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIHeadLampStatusNotification::OnVIHeadLampStatusNotification( OnVIHeadLampStatusNotification::~OnVIHeadLampStatusNotification() {} void OnVIHeadLampStatusNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc index f9bb3eca3f..c4bc32e825 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIInstantFuelConsumptionNotification::OnVIInstantFuelConsumptionNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ OnVIInstantFuelConsumptionNotification:: ~OnVIInstantFuelConsumptionNotification() {} void OnVIInstantFuelConsumptionNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc index 8f5e845c02..6139d143f6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIMyKeyNotification::OnVIMyKeyNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIMyKeyNotification::OnVIMyKeyNotification( OnVIMyKeyNotification::~OnVIMyKeyNotification() {} void OnVIMyKeyNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc index ea5d8be9ca..92f4b47fcf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIOdometerNotification::OnVIOdometerNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIOdometerNotification::OnVIOdometerNotification( OnVIOdometerNotification::~OnVIOdometerNotification() {} void OnVIOdometerNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc index 73231ff4de..c2afd7d697 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIPrndlNotification::OnVIPrndlNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIPrndlNotification::OnVIPrndlNotification( OnVIPrndlNotification::~OnVIPrndlNotification() {} void OnVIPrndlNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc index 4587939b8f..f41f5d3f56 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIRpmNotification::OnVIRpmNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIRpmNotification::OnVIRpmNotification( OnVIRpmNotification::~OnVIRpmNotification() {} void OnVIRpmNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc index df0bfd5cd7..73313b6ea4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVISpeedNotification::OnVISpeedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVISpeedNotification::OnVISpeedNotification( OnVISpeedNotification::~OnVISpeedNotification() {} void OnVISpeedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc index b7eaad7edf..e04eaab3b4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVISteeringWheelAngleNotification::OnVISteeringWheelAngleNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVISteeringWheelAngleNotification::OnVISteeringWheelAngleNotification( OnVISteeringWheelAngleNotification::~OnVISteeringWheelAngleNotification() {} void OnVISteeringWheelAngleNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc index 5f438ef8d1..bc013c2e2c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVITirePressureNotification::OnVITirePressureNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVITirePressureNotification::OnVITirePressureNotification( OnVITirePressureNotification::~OnVITirePressureNotification() {} void OnVITirePressureNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc index 1b40da4c40..4b33c2d589 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIVinNotification::OnVIVinNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIVinNotification::OnVIVinNotification( OnVIVinNotification::~OnVIVinNotification() {} void OnVIVinNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc index 7221e88ef1..dde1e642c3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIWiperStatusNotification::OnVIWiperStatusNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVIWiperStatusNotification::OnVIWiperStatusNotification( OnVIWiperStatusNotification::~OnVIWiperStatusNotification() {} void OnVIWiperStatusNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc index 7d5c0165aa..a2e56300f0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVideoDataStreamingNotification::OnVideoDataStreamingNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnVideoDataStreamingNotification::OnVideoDataStreamingNotification( OnVideoDataStreamingNotification::~OnVideoDataStreamingNotification() {} void OnVideoDataStreamingNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc index c4678f69e0..366a17ec64 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc @@ -45,6 +45,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVRCommandNotification::OnVRCommandNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -60,14 +62,14 @@ OnVRCommandNotification::OnVRCommandNotification( OnVRCommandNotification::~OnVRCommandNotification() {} void OnVRCommandNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint32_t cmd_id = (*message_)[strings::msg_params][strings::cmd_id].asUInt(); uint32_t max_cmd_id = application_manager_.get_settings().max_cmd_id(); // Check if this is one of standard VR commands (i.e. "Help") if (cmd_id > max_cmd_id + 1) { - LOG4CXX_INFO(logger_, "Switched App"); + SDL_LOG_INFO("Switched App"); const uint32_t app_id = cmd_id - max_cmd_id; ApplicationSharedPtr app = application_manager_.application(app_id); if (app) { @@ -77,7 +79,7 @@ void OnVRCommandNotification::Run() { mobile_apis::HMILevel::HMI_FULL, true); } else { - LOG4CXX_ERROR(logger_, "Unable to find appication " << app_id); + SDL_LOG_ERROR("Unable to find appication " << app_id); } return; } @@ -90,7 +92,7 @@ void OnVRCommandNotification::Run() { (*message_)[strings::msg_params][strings::app_id].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } /* check if perform interaction is active diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc index 1500f272ab..0fe84bc0df 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc @@ -43,6 +43,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVRLanguageChangeNotification::OnVRLanguageChangeNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -58,7 +60,7 @@ OnVRLanguageChangeNotification::OnVRLanguageChangeNotification( OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {} void OnVRLanguageChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.set_active_vr_language( static_cast<hmi_apis::Common_Language::eType>( @@ -67,8 +69,7 @@ void OnVRLanguageChangeNotification::Run() { std::vector<std::string> sections_to_update{hmi_response::language}; if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::vr, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save VR.OnLanguageChange response to cache"); + SDL_LOG_ERROR("Failed to save VR.OnLanguageChange response to cache"); } (*message_)[strings::msg_params][strings::hmi_display_language] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc index bfc033a865..ab0ef67535 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVRStartedNotification::OnVRStartedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnVRStartedNotification::OnVRStartedNotification( OnVRStartedNotification::~OnVRStartedNotification() {} void OnVRStartedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_Started); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc index ede1efab85..e784eac244 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVRStoppedNotification::OnVRStoppedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnVRStoppedNotification::OnVRStoppedNotification( OnVRStoppedNotification::~OnVRStoppedNotification() {} void OnVRStoppedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_Stopped); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc index d882dcd6e7..774acf54f1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCGetCapabilitiesRequest::RCGetCapabilitiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ RCGetCapabilitiesRequest::RCGetCapabilitiesRequest( RCGetCapabilitiesRequest::~RCGetCapabilitiesRequest() {} void RCGetCapabilitiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void RCGetCapabilitiesRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::RC_GetCapabilities); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc index 910c12e979..10507a516f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCGetCapabilitiesResponse::RCGetCapabilitiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ RCGetCapabilitiesResponse::RCGetCapabilitiesResponse( RCGetCapabilitiesResponse::~RCGetCapabilitiesResponse() {} void RCGetCapabilitiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto result_code = static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); @@ -60,8 +62,7 @@ void RCGetCapabilitiesResponse::Run() { hmi_apis::FunctionID::RC_GetCapabilities); if (hmi_apis::Common_Result::SUCCESS != result_code) { - LOG4CXX_DEBUG(logger_, - "Request was not successful. Don't change HMI capabilities"); + SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities"); return; } @@ -89,8 +90,7 @@ void RCGetCapabilitiesResponse::Run() { if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::rc, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save RC.GetCapabilities response to cache"); + SDL_LOG_ERROR("Failed to save RC.GetCapabilities response to cache"); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc index 4ea0d43dc3..c9a9af87fb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCIsReadyRequest::RCIsReadyRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,17 +59,17 @@ RCIsReadyRequest::RCIsReadyRequest( RCIsReadyRequest::~RCIsReadyRequest() {} void RCIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); subscribe_on_event(hmi_apis::FunctionID::RC_IsReady, correlation_id()); SendRequest(); } void RCIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::RC_IsReady: { - LOG4CXX_DEBUG(logger_, "Received RC_IsReady event"); + SDL_LOG_DEBUG("Received RC_IsReady event"); unsubscribe_from_event(hmi_apis::FunctionID::RC_IsReady); const bool is_available = app_mngr::commands::ChangeInterfaceState( application_manager_, message, HmiInterfaces::HMI_INTERFACE_RC); @@ -82,15 +84,14 @@ void RCIsReadyRequest::on_event(const event_engine::Event& event) { application_manager_, HmiInterfaces::HMI_INTERFACE_RC)) { hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::RC_GetCapabilities); - LOG4CXX_INFO(logger_, - "HmiInterfaces::HMI_INTERFACE_RC isn't available"); + SDL_LOG_INFO("HmiInterfaces::HMI_INTERFACE_RC isn't available"); return; } RequestInterfaceCapabilities(hmi_interface::rc); break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc index 71e16a831c..1ad9a30a23 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RCIsReadyResponse::RCIsReadyResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ RCIsReadyResponse::RCIsReadyResponse( RCIsReadyResponse::~RCIsReadyResponse() {} void RCIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::RC_IsReady); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index 0a6632fca8..527cf911b9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -82,6 +82,8 @@ struct SendLaunchApp }; } // namespace +SDL_CREATE_LOG_VARIABLE("Commands") + SDLActivateAppRequest::SDLActivateAppRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -99,12 +101,11 @@ SDLActivateAppRequest::~SDLActivateAppRequest() {} uint32_t SDLActivateAppRequest::app_id() const { using namespace strings; if (!(*message_).keyExists(msg_params)) { - LOG4CXX_DEBUG(logger_, msg_params << " section is absent in the message."); + SDL_LOG_DEBUG(msg_params << " section is absent in the message."); return 0; } if (!(*message_)[msg_params].keyExists(strings::app_id)) { - LOG4CXX_DEBUG(logger_, - strings::app_id << " section is absent in the message."); + SDL_LOG_DEBUG(strings::app_id << " section is absent in the message."); return 0; } return (*message_)[msg_params][strings::app_id].asUInt(); @@ -112,22 +113,22 @@ uint32_t SDLActivateAppRequest::app_id() const { #ifdef EXTERNAL_PROPRIETARY_MODE void SDLActivateAppRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis::FunctionID; ApplicationConstSharedPtr app = application_manager_.WaitingApplicationByID(app_id()); if (application_manager_.state_controller().IsStateActive( HmiState::STATE_ID_DEACTIVATE_HMI)) { - LOG4CXX_DEBUG(logger_, - "DeactivateHmi state is active. " - "Sends response with result code REJECTED"); + SDL_LOG_DEBUG( + "DeactivateHmi state is active. " + "Sends response with result code REJECTED"); SendErrorResponse(correlation_id(), static_cast<eType>(function_id()), hmi_apis::Common_Result::REJECTED, "HMIDeactivate is active"); } else if (app && !app->IsRegistered() && app->is_cloud_app()) { - LOG4CXX_DEBUG(logger_, "Starting cloud application."); + SDL_LOG_DEBUG("Starting cloud application."); const ApplicationManagerSettings& settings = application_manager_.get_settings(); uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * @@ -144,7 +145,7 @@ void SDLActivateAppRequest::Run() { #else // EXTERNAL_PROPRIETARY_MODE void SDLActivateAppRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis::FunctionID; using namespace hmi_apis::Common_Result; @@ -162,22 +163,20 @@ void SDLActivateAppRequest::Run() { application_manager_.WaitingApplicationByID(application_id); if (!app_to_activate) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Can't find application within waiting apps: " << application_id); return; } } - LOG4CXX_DEBUG(logger_, - "Found application to activate. Application id is " - << app_to_activate->app_id()); + SDL_LOG_DEBUG("Found application to activate. Application id is " + << app_to_activate->app_id()); if (application_manager_.state_controller().IsStateActive( HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) { - LOG4CXX_WARN(logger_, - "DeactivateHmi state is active. " - "Sends response with result code REJECTED"); + SDL_LOG_WARN( + "DeactivateHmi state is active. " + "Sends response with result code REJECTED"); SendErrorResponse(correlation_id(), static_cast<hmi_apis::FunctionID::eType>(function_id()), hmi_apis::Common_Result::REJECTED, @@ -186,11 +185,11 @@ void SDLActivateAppRequest::Run() { } if (app_to_activate->IsRegistered()) { - LOG4CXX_DEBUG(logger_, "Application is registered. Activating."); + SDL_LOG_DEBUG("Application is registered. Activating."); policy_handler_.OnActivateApp(application_id, correlation_id()); return; } else if (app_to_activate->is_cloud_app()) { - LOG4CXX_DEBUG(logger_, "Starting cloud application."); + SDL_LOG_DEBUG("Starting cloud application."); const ApplicationManagerSettings& settings = application_manager_.get_settings(); uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * @@ -208,29 +207,29 @@ void SDLActivateAppRequest::Run() { V4ProtoApps v4_proto_apps = get_v4_proto_apps(device_handle); if (!foreground_v4_app && v4_proto_apps.empty()) { - LOG4CXX_ERROR(logger_, - "Can't find regular foreground app with the same " - "connection id:" - << device_handle); + SDL_LOG_ERROR( + "Can't find regular foreground app with the same " + "connection id: " + << device_handle); SendErrorResponse( correlation_id(), SDL_ActivateApp, NO_APPS_REGISTERED, ""); return; } - LOG4CXX_DEBUG(logger_, - "Application is not registered yet. " - "Sending launch request."); + SDL_LOG_DEBUG( + "Application is not registered yet. " + "Sending launch request."); if (foreground_v4_app) { - LOG4CXX_DEBUG(logger_, "Sending request to foreground application."); + SDL_LOG_DEBUG("Sending request to foreground application."); MessageHelper::SendLaunchApp(foreground_v4_app->app_id(), app_to_activate->SchemaUrl(), app_to_activate->PackageName(), application_manager_); } else { - LOG4CXX_DEBUG(logger_, - "No preffered (foreground) application is found. " - "Sending request to all v4 applications."); + SDL_LOG_DEBUG( + "No preffered (foreground) application is found. " + "Sending request to all v4 applications."); std::for_each(v4_proto_apps.begin(), v4_proto_apps.end(), SendLaunchApp(app_to_activate, application_manager_)); @@ -266,8 +265,8 @@ void SDLActivateAppRequest::on_event(const event_engine::Event& event) { ApplicationSharedPtr app = application_manager_.application_by_hmi_app(hmi_application_id); if (!app) { - LOG4CXX_ERROR( - logger_, "Application not found by HMI app id: " << hmi_application_id); + SDL_LOG_ERROR( + "Application not found by HMI app id: " << hmi_application_id); return; } policy_handler_.OnActivateApp(app->app_id(), correlation_id()); @@ -277,16 +276,15 @@ uint32_t SDLActivateAppRequest::hmi_app_id( const smart_objects::SmartObject& so) const { using namespace strings; if (!so.keyExists(params)) { - LOG4CXX_DEBUG(logger_, params << " section is absent in the message."); + SDL_LOG_DEBUG(params << " section is absent in the message."); return 0; } if (!so[msg_params].keyExists(application)) { - LOG4CXX_DEBUG(logger_, application << " section is absent in the message."); + SDL_LOG_DEBUG(application << " section is absent in the message."); return 0; } if (!so[msg_params][application].keyExists(strings::app_id)) { - LOG4CXX_DEBUG(logger_, - strings::app_id << " section is absent in the message."); + SDL_LOG_DEBUG(strings::app_id << " section is absent in the message."); return 0; } return so[msg_params][application][strings::app_id].asUInt(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc index 560b75213c..2748c23a65 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SDLActivateAppResponse::SDLActivateAppResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ SDLActivateAppResponse::SDLActivateAppResponse( SDLActivateAppResponse::~SDLActivateAppResponse() {} void SDLActivateAppResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc index c8266e0f39..6cf855904c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SDLGetListOfPermissionsRequest::SDLGetListOfPermissionsRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ SDLGetListOfPermissionsRequest::SDLGetListOfPermissionsRequest( SDLGetListOfPermissionsRequest::~SDLGetListOfPermissionsRequest() {} void SDLGetListOfPermissionsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t connection_key = 0; if ((*message_)[strings::msg_params].keyExists(strings::app_id)) { connection_key = (*message_)[strings::msg_params][strings::app_id].asUInt(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc index 280d2cb071..b27fe08b47 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SDLGetListOfPermissionsResponse::SDLGetListOfPermissionsResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ SDLGetListOfPermissionsResponse::SDLGetListOfPermissionsResponse( SDLGetListOfPermissionsResponse::~SDLGetListOfPermissionsResponse() {} void SDLGetListOfPermissionsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc index 52b7f83e9b..7478a40eeb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SDLGetPolicyConfigurationDataRequest::SDLGetPolicyConfigurationDataRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ SDLGetPolicyConfigurationDataRequest::SDLGetPolicyConfigurationDataRequest( SDLGetPolicyConfigurationDataRequest::~SDLGetPolicyConfigurationDataRequest() {} void SDLGetPolicyConfigurationDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject response_value( smart_objects::SmartType::SmartType_Array); @@ -63,7 +65,7 @@ void SDLGetPolicyConfigurationDataRequest::Run() { PrepareResponseParams(response_value); if (hmi_apis::Common_Result::SUCCESS != result_code) { - LOG4CXX_ERROR(logger_, "Unable to PrepareResponseParams"); + SDL_LOG_ERROR("Unable to PrepareResponseParams"); SendErrorResponse( correlation_id(), hmi_apis::FunctionID::SDL_GetPolicyConfigurationData, @@ -87,7 +89,7 @@ void SDLGetPolicyConfigurationDataRequest::Run() { hmi_apis::Common_Result::eType SDLGetPolicyConfigurationDataRequest::PrepareResponseParams( smart_objects::SmartObject& response_out) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto policy_type = (*message_)[strings::msg_params][strings::policy_type].asString(); @@ -96,17 +98,15 @@ SDLGetPolicyConfigurationDataRequest::PrepareResponseParams( auto policy_table_data = policy_handler_.GetPolicyTableData(); if (!policy_table_data.isMember(policy_type)) { - LOG4CXX_ERROR( - logger_, - "policy_type " << policy_type << " doesn't exist in policy table."); + SDL_LOG_ERROR("policy_type " << policy_type + << " doesn't exist in policy table."); return hmi_apis::Common_Result::DATA_NOT_AVAILABLE; } auto& policy_section_table_data = policy_table_data[policy_type]; if (!policy_section_table_data.isMember(property)) { - LOG4CXX_ERROR( - logger_, - "property " << property << " doesn't exist in " << policy_type); + SDL_LOG_ERROR("property " << property << " doesn't exist in " + << policy_type); return hmi_apis::Common_Result::DATA_NOT_AVAILABLE; } @@ -126,7 +126,7 @@ void clear_new_line_symbol(std::string& str_to_clear) { smart_objects::SmartObject SDLGetPolicyConfigurationDataRequest::GetValueParam( const Json::Value& policy_property) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject value(smart_objects::SmartType_Array); auto put_element_in_value_array = [&value](const Json::Value& element, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc index 21b7dea41c..c934ef7bab 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SDLGetPolicyConfigurationDataResponse::SDLGetPolicyConfigurationDataResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ SDLGetPolicyConfigurationDataResponse:: ~SDLGetPolicyConfigurationDataResponse() {} void SDLGetPolicyConfigurationDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; rpc_service_.SendMessageToHMI(message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc index b494be56e8..ce1cb6b098 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SDLGetStatusUpdateRequest::SDLGetStatusUpdateRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ SDLGetStatusUpdateRequest::SDLGetStatusUpdateRequest( SDLGetStatusUpdateRequest::~SDLGetStatusUpdateRequest() {} void SDLGetStatusUpdateRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_handler_.OnGetStatusUpdate( (*message_)[strings::params][strings::correlation_id].asUInt()); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc index 4b0f3d0ca8..122c209906 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SDLGetStatusUpdateResponse::SDLGetStatusUpdateResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ SDLGetStatusUpdateResponse::SDLGetStatusUpdateResponse( SDLGetStatusUpdateResponse::~SDLGetStatusUpdateResponse() {} void SDLGetStatusUpdateResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc index f853cf814c..e58961e581 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SDLGetUserFriendlyMessageRequest::SDLGetUserFriendlyMessageRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,11 +56,10 @@ SDLGetUserFriendlyMessageRequest::SDLGetUserFriendlyMessageRequest( SDLGetUserFriendlyMessageRequest::~SDLGetUserFriendlyMessageRequest() {} void SDLGetUserFriendlyMessageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string messageCodes = "messageCodes"; if (!(*message_)[strings::msg_params].keyExists(messageCodes)) { - LOG4CXX_WARN(logger_, - "Mandatory parameter '" + messageCodes + "'' is missing"); + SDL_LOG_WARN("Mandatory parameter '" + messageCodes + "'' is missing"); return; } smart_objects::SmartArray* msg = @@ -71,7 +72,7 @@ void SDLGetUserFriendlyMessageRequest::Run() { for (; it != it_end; ++it) { std::string str = (*it).asString(); if (!CheckSyntax(str)) { - LOG4CXX_WARN(logger_, "Invalid data"); + SDL_LOG_WARN("Invalid data"); SendErrorResponse(correlation_id(), static_cast<hmi_apis::FunctionID::eType>(function_id()), hmi_apis::Common_Result::INVALID_DATA, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc index b95591c4fa..b56a664e4a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SDLGetUserFriendlyMessageResponse::SDLGetUserFriendlyMessageResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ SDLGetUserFriendlyMessageResponse::SDLGetUserFriendlyMessageResponse( SDLGetUserFriendlyMessageResponse::~SDLGetUserFriendlyMessageResponse() {} void SDLGetUserFriendlyMessageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc index 5f69903548..fa5e1beeb9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SDLPolicyUpdate::SDLPolicyUpdate( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ SDLPolicyUpdate::SDLPolicyUpdate( SDLPolicyUpdate::~SDLPolicyUpdate() {} void SDLPolicyUpdate::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE) SendRequest(); #else - LOG4CXX_WARN(logger_, - "This RPC is part of extended policy flow." - "Please re-build with extended policy mode enabled."); + SDL_LOG_WARN( + "This RPC is part of extended policy flow. " + "Please re-build with extended policy mode enabled."); #endif } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc index bfbf73270e..5b76a405d6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc @@ -37,6 +37,9 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { + +SDL_CREATE_LOG_VARIABLE("Commands") + SDLPolicyUpdateResponse::SDLPolicyUpdateResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +55,7 @@ SDLPolicyUpdateResponse::SDLPolicyUpdateResponse( SDLPolicyUpdateResponse::~SDLPolicyUpdateResponse() {} void SDLPolicyUpdateResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); @@ -62,7 +65,7 @@ void SDLPolicyUpdateResponse::Run() { helpers::ALL>(code, hmi_apis::Common_Result::SUCCESS, hmi_apis::Common_Result::WARNINGS)) { - LOG4CXX_ERROR(logger_, "Error is returned. PTU won't be started."); + SDL_LOG_ERROR("Error is returned. PTU won't be started."); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc index 988be68a80..84ea5590d3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSChangeRegistrationRequest::TTSChangeRegistrationRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ TTSChangeRegistrationRequest::TTSChangeRegistrationRequest( TTSChangeRegistrationRequest::~TTSChangeRegistrationRequest() {} void TTSChangeRegistrationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc index e5e38ef34a..521df2ed6d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSChangeRegistratioResponse::TTSChangeRegistratioResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ TTSChangeRegistratioResponse::TTSChangeRegistratioResponse( TTSChangeRegistratioResponse::~TTSChangeRegistratioResponse() {} void TTSChangeRegistratioResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_ChangeRegistration); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc index 85f0b93b8c..3bca6c05c1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSGetCapabilitiesRequest::TTSGetCapabilitiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ TTSGetCapabilitiesRequest::TTSGetCapabilitiesRequest( TTSGetCapabilitiesRequest::~TTSGetCapabilitiesRequest() {} void TTSGetCapabilitiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void TTSGetCapabilitiesRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_GetCapabilities); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc index e6edcdb365..167966e55b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSGetCapabilitiesResponse::TTSGetCapabilitiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ TTSGetCapabilitiesResponse::TTSGetCapabilitiesResponse( TTSGetCapabilitiesResponse::~TTSGetCapabilitiesResponse() {} void TTSGetCapabilitiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto result_code = static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); @@ -59,8 +61,7 @@ void TTSGetCapabilitiesResponse::Run() { hmi_apis::FunctionID::TTS_GetCapabilities); if (hmi_apis::Common_Result::SUCCESS != result_code) { - LOG4CXX_DEBUG(logger_, - "Request was not successful. Don't change HMI capabilities"); + SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities"); return; } @@ -81,8 +82,7 @@ void TTSGetCapabilitiesResponse::Run() { if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::tts, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save TTS.GetCapabilities response to cache"); + SDL_LOG_ERROR("Failed to save TTS.GetCapabilities response to cache"); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc index d62c9627f5..2b409c68de 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSGetLanguageRequest::TTSGetLanguageRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ TTSGetLanguageRequest::TTSGetLanguageRequest( TTSGetLanguageRequest::~TTSGetLanguageRequest() {} void TTSGetLanguageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void TTSGetLanguageRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_GetLanguage); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc index 1487fd7915..2b14bea681 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSGetLanguageResponse::TTSGetLanguageResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ TTSGetLanguageResponse::TTSGetLanguageResponse( TTSGetLanguageResponse::~TTSGetLanguageResponse() {} void TTSGetLanguageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis; const Common_Result::eType result_code = static_cast<Common_Result::eType>( @@ -63,8 +65,7 @@ void TTSGetLanguageResponse::Run() { hmi_apis::FunctionID::TTS_GetLanguage); if (Common_Result::SUCCESS != result_code) { - LOG4CXX_DEBUG(logger_, - "Request was not successful. Don't change HMI capabilities"); + SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities"); return; } @@ -81,13 +82,11 @@ void TTSGetLanguageResponse::Run() { std::vector<std::string> sections_to_update{hmi_response::language}; if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::tts, sections_to_update, message_->getSchema())) { - LOG4CXX_DEBUG(logger_, "Failed to save TTS.GetLanguage response to cache"); + SDL_LOG_DEBUG("Failed to save TTS.GetLanguage response to cache"); } - LOG4CXX_DEBUG(logger_, - "Raising event for function_id " << function_id() - << " and correlation_id " - << correlation_id()); + SDL_LOG_DEBUG("Raising event for function_id " + << function_id() << " and correlation_id " << correlation_id()); event_engine::Event event(FunctionID::TTS_GetLanguage); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc index 5d758c84b7..87df2402bb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSGetSupportedLanguagesRequest::TTSGetSupportedLanguagesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ TTSGetSupportedLanguagesRequest::TTSGetSupportedLanguagesRequest( TTSGetSupportedLanguagesRequest::~TTSGetSupportedLanguagesRequest() {} void TTSGetSupportedLanguagesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void TTSGetSupportedLanguagesRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_GetSupportedLanguages); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc index baa10394c5..6b074005b2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSGetSupportedLanguagesResponse::TTSGetSupportedLanguagesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ TTSGetSupportedLanguagesResponse::TTSGetSupportedLanguagesResponse( TTSGetSupportedLanguagesResponse::~TTSGetSupportedLanguagesResponse() {} void TTSGetSupportedLanguagesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( @@ -63,8 +65,7 @@ void TTSGetSupportedLanguagesResponse::Run() { hmi_apis::FunctionID::TTS_GetSupportedLanguages); if (hmi_apis::Common_Result::SUCCESS != code) { - LOG4CXX_DEBUG(logger_, - "Request was not successful. Don't change HMI capabilities"); + SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities"); return; } @@ -74,8 +75,7 @@ void TTSGetSupportedLanguagesResponse::Run() { std::vector<std::string> sections_to_update{hmi_response::languages}; if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::tts, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save TTS.GetSupportedLanguages response to cache"); + SDL_LOG_ERROR("Failed to save TTS.GetSupportedLanguages response to cache"); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc index 4ae737bec4..1f1f3e7eab 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSIsReadyRequest::TTSIsReadyRequest( const app_mngr::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,18 +56,18 @@ TTSIsReadyRequest::TTSIsReadyRequest( TTSIsReadyRequest::~TTSIsReadyRequest() {} void TTSIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); subscribe_on_event(hmi_apis::FunctionID::TTS_IsReady, correlation_id()); SendRequest(); } void TTSIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::TTS_IsReady: { - LOG4CXX_DEBUG(logger_, "Received TTS_IsReady event"); + SDL_LOG_DEBUG("Received TTS_IsReady event"); unsubscribe_from_event(hmi_apis::FunctionID::TTS_IsReady); const bool is_available = app_mngr::commands::ChangeInterfaceState( application_manager_, message, HmiInterfaces::HMI_INTERFACE_TTS); @@ -74,8 +76,7 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) { if (!app_mngr::commands::CheckAvailabilityHMIInterfaces( application_manager_, HmiInterfaces::HMI_INTERFACE_TTS)) { UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::tts); - LOG4CXX_INFO(logger_, - "HmiInterfaces::HMI_INTERFACE_TTS isn't available"); + SDL_LOG_INFO("HmiInterfaces::HMI_INTERFACE_TTS isn't available"); return; } @@ -83,7 +84,7 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc index 67e0fb6396..c94210e330 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSIsReadyResponse::TTSIsReadyResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ TTSIsReadyResponse::TTSIsReadyResponse( TTSIsReadyResponse::~TTSIsReadyResponse() {} void TTSIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_IsReady); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc index 0b3d9a77bf..f2a8dad4bc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSSetGlobalPropertiesRequest::TTSSetGlobalPropertiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ TTSSetGlobalPropertiesRequest::TTSSetGlobalPropertiesRequest( TTSSetGlobalPropertiesRequest::~TTSSetGlobalPropertiesRequest() {} void TTSSetGlobalPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc index 0901378c4a..35b3ce87d3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSSetGlobalPropertiesResponse::TTSSetGlobalPropertiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ TTSSetGlobalPropertiesResponse::TTSSetGlobalPropertiesResponse( TTSSetGlobalPropertiesResponse::~TTSSetGlobalPropertiesResponse() {} void TTSSetGlobalPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc index 6dce94f931..0dd48f90a9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSSpeakRequest::TTSSpeakRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ TTSSpeakRequest::TTSSpeakRequest( TTSSpeakRequest::~TTSSpeakRequest() {} void TTSSpeakRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc index 69be5ab160..c461996358 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSSpeakResponse::TTSSpeakResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ TTSSpeakResponse::TTSSpeakResponse( TTSSpeakResponse::~TTSSpeakResponse() {} void TTSSpeakResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_Speak); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc index 43c595040c..8e6270e643 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSStopSpeakingRequest::TTSStopSpeakingRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ TTSStopSpeakingRequest::TTSStopSpeakingRequest( TTSStopSpeakingRequest::~TTSStopSpeakingRequest() {} void TTSStopSpeakingRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc index 892b3e6295..64d76dcec2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + TTSStopSpeakingResponse::TTSStopSpeakingResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ TTSStopSpeakingResponse::TTSStopSpeakingResponse( TTSStopSpeakingResponse::~TTSStopSpeakingResponse() {} void TTSStopSpeakingResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::TTS_StopSpeaking); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc index 7c95e8a919..eadd0f59cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIAddCommandRequest::UIAddCommandRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIAddCommandRequest::UIAddCommandRequest( UIAddCommandRequest::~UIAddCommandRequest() {} void UIAddCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc index 72d841a878..9a582807a9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIAddCommandResponse::UIAddCommandResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ UIAddCommandResponse::UIAddCommandResponse( UIAddCommandResponse::~UIAddCommandResponse() {} void UIAddCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_AddCommand); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc index 15342c6ecb..a854a115b6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIAddSubmenuRequest::UIAddSubmenuRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIAddSubmenuRequest::UIAddSubmenuRequest( UIAddSubmenuRequest::~UIAddSubmenuRequest() {} void UIAddSubmenuRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc index ae699dc2bd..89aa425cfb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIAddSubmenuResponse::UIAddSubmenuResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UIAddSubmenuResponse::UIAddSubmenuResponse( UIAddSubmenuResponse::~UIAddSubmenuResponse() {} void UIAddSubmenuResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_AddSubMenu); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc index 793e70d9e1..def1636fbd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIAlertRequest::UIAlertRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ UIAlertRequest::UIAlertRequest( UIAlertRequest::~UIAlertRequest() {} void UIAlertRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc index f53f14e050..e1a5afa5e5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIAlertResponse::UIAlertResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UIAlertResponse::UIAlertResponse( UIAlertResponse::~UIAlertResponse() {} void UIAlertResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_Alert); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc index c186077b1e..db35e550bc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UICancelInteractionRequest::UICancelInteractionRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UICancelInteractionRequest::UICancelInteractionRequest( UICancelInteractionRequest::~UICancelInteractionRequest() {} void UICancelInteractionRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc index 2d5db4eecb..29d18ba384 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UICancelInteractionResponse::UICancelInteractionResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UICancelInteractionResponse::UICancelInteractionResponse( UICancelInteractionResponse::~UICancelInteractionResponse() {} void UICancelInteractionResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_CancelInteraction); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc index bb001b37c7..3ba9d149c4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIChangeRegistrationRequest::UIChangeRegistrationRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIChangeRegistrationRequest::UIChangeRegistrationRequest( UIChangeRegistrationRequest::~UIChangeRegistrationRequest() {} void UIChangeRegistrationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc index 8acd654488..1790f44bce 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIChangeRegistratioResponse::UIChangeRegistratioResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UIChangeRegistratioResponse::UIChangeRegistratioResponse( UIChangeRegistratioResponse::~UIChangeRegistratioResponse() {} void UIChangeRegistratioResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_ChangeRegistration); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc index b354009e3f..90071bb351 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UICreateWindowRequest::UICreateWindowRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UICreateWindowRequest::UICreateWindowRequest( UICreateWindowRequest::~UICreateWindowRequest() {} void UICreateWindowRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc index c3a323818d..1021e47595 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UICreateWindowResponse::UICreateWindowResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ UICreateWindowResponse::UICreateWindowResponse( UICreateWindowResponse::~UICreateWindowResponse() {} void UICreateWindowResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_CreateWindow); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc index 1d741bba74..2b46723216 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIDeleteCommandRequest::UIDeleteCommandRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIDeleteCommandRequest::UIDeleteCommandRequest( UIDeleteCommandRequest::~UIDeleteCommandRequest() {} void UIDeleteCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc index 40a5ec8a73..0cd3e1943d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIDeleteCommandResponse::UIDeleteCommandResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UIDeleteCommandResponse::UIDeleteCommandResponse( UIDeleteCommandResponse::~UIDeleteCommandResponse() {} void UIDeleteCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_DeleteCommand); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc index fdca37cee6..ea5745486a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIDeleteSubmenuRequest::UIDeleteSubmenuRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIDeleteSubmenuRequest::UIDeleteSubmenuRequest( UIDeleteSubmenuRequest::~UIDeleteSubmenuRequest() {} void UIDeleteSubmenuRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc index 9d522431dc..0d2d5360cc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIDeleteSubmenuResponse::UIDeleteSubmenuResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UIDeleteSubmenuResponse::UIDeleteSubmenuResponse( UIDeleteSubmenuResponse::~UIDeleteSubmenuResponse() {} void UIDeleteSubmenuResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_DeleteSubMenu); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc index 7933574d92..066b5969a6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIDeleteWindowRequest::UIDeleteWindowRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIDeleteWindowRequest::UIDeleteWindowRequest( UIDeleteWindowRequest::~UIDeleteWindowRequest() {} void UIDeleteWindowRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc index ba703e18ae..507369c4f7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIDeleteWindowResponse::UIDeleteWindowResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ UIDeleteWindowResponse::UIDeleteWindowResponse( UIDeleteWindowResponse::~UIDeleteWindowResponse() {} void UIDeleteWindowResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_DeleteWindow); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc index 92f51bc9cf..3e99b5298e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIEndAudioPassThruRequest::UIEndAudioPassThruRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIEndAudioPassThruRequest::UIEndAudioPassThruRequest( UIEndAudioPassThruRequest::~UIEndAudioPassThruRequest() {} void UIEndAudioPassThruRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc index b6639dcbb9..3b9f56f7e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIEndAudioPassThruResponse::UIEndAudioPassThruResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UIEndAudioPassThruResponse::UIEndAudioPassThruResponse( UIEndAudioPassThruResponse::~UIEndAudioPassThruResponse() {} void UIEndAudioPassThruResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_EndAudioPassThru); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc index 32c19eabcd..00a8ad761e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIGetCapabilitiesRequest::UIGetCapabilitiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ UIGetCapabilitiesRequest::UIGetCapabilitiesRequest( UIGetCapabilitiesRequest::~UIGetCapabilitiesRequest() {} void UIGetCapabilitiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void UIGetCapabilitiesRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_GetCapabilities); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc index f966f299c1..31dda22709 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIGetCapabilitiesResponse::UIGetCapabilitiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ UIGetCapabilitiesResponse::UIGetCapabilitiesResponse( UIGetCapabilitiesResponse::~UIGetCapabilitiesResponse() {} void UIGetCapabilitiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto result_code = static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); @@ -60,8 +62,7 @@ void UIGetCapabilitiesResponse::Run() { hmi_apis::FunctionID::UI_GetCapabilities); if (hmi_apis::Common_Result::SUCCESS != result_code) { - LOG4CXX_DEBUG(logger_, - "Request was not successful. Don't change HMI capabilities"); + SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities"); return; } @@ -166,8 +167,7 @@ void UIGetCapabilitiesResponse::Run() { if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::ui, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save UI.GetCapabilities response to cache"); + SDL_LOG_ERROR("Failed to save UI.GetCapabilities response to cache"); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc index 948adbdece..bf91b7e294 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIGetLanguageRequest::UIGetLanguageRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ UIGetLanguageRequest::UIGetLanguageRequest( UIGetLanguageRequest::~UIGetLanguageRequest() {} void UIGetLanguageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void UIGetLanguageRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_GetLanguage); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc index e32dbf3c47..ffeec025be 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIGetLanguageResponse::UIGetLanguageResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UIGetLanguageResponse::UIGetLanguageResponse( UIGetLanguageResponse::~UIGetLanguageResponse() {} void UIGetLanguageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis; const Common_Result::eType result_code = static_cast<Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); @@ -63,8 +65,7 @@ void UIGetLanguageResponse::Run() { hmi_apis::FunctionID::UI_GetLanguage); if (Common_Result::SUCCESS != result_code) { - LOG4CXX_DEBUG(logger_, - "Request was not successful. Don't change HMI capabilities"); + SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities"); return; } @@ -81,13 +82,11 @@ void UIGetLanguageResponse::Run() { std::vector<std::string> sections_to_update{hmi_response::language}; if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::ui, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, "Failed to save UI.GetLanguage response to cache"); + SDL_LOG_ERROR("Failed to save UI.GetLanguage response to cache"); } - LOG4CXX_DEBUG(logger_, - "Raising event for function_id " << function_id() - << " and correlation_id " - << correlation_id()); + SDL_LOG_DEBUG("Raising event for function_id " + << function_id() << " and correlation_id " << correlation_id()); event_engine::Event event(FunctionID::UI_GetLanguage); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc index 0001af9203..480fa2499f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIGetSupportedLanguagesRequest::UIGetSupportedLanguagesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ UIGetSupportedLanguagesRequest::UIGetSupportedLanguagesRequest( UIGetSupportedLanguagesRequest::~UIGetSupportedLanguagesRequest() {} void UIGetSupportedLanguagesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void UIGetSupportedLanguagesRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_GetSupportedLanguages); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc index 53704b3705..20606294ae 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIGetSupportedLanguagesResponse::UIGetSupportedLanguagesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ UIGetSupportedLanguagesResponse::UIGetSupportedLanguagesResponse( UIGetSupportedLanguagesResponse::~UIGetSupportedLanguagesResponse() {} void UIGetSupportedLanguagesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( @@ -63,8 +65,7 @@ void UIGetSupportedLanguagesResponse::Run() { hmi_apis::FunctionID::UI_GetSupportedLanguages); if (hmi_apis::Common_Result::SUCCESS != code) { - LOG4CXX_DEBUG(logger_, - "Request was not successful. Don't change HMI capabilities"); + SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities"); return; } @@ -74,8 +75,7 @@ void UIGetSupportedLanguagesResponse::Run() { std::vector<std::string> sections_to_update{hmi_response::languages}; if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::ui, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save UI.GetSupportedLanguages response to cache"); + SDL_LOG_ERROR("Failed to save UI.GetSupportedLanguages response to cache"); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc index 4882095d42..d020972ce6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIIsReadyRequest::UIIsReadyRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,17 +56,17 @@ UIIsReadyRequest::UIIsReadyRequest( UIIsReadyRequest::~UIIsReadyRequest() {} void UIIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); subscribe_on_event(hmi_apis::FunctionID::UI_IsReady, correlation_id()); SendRequest(); } void UIIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_IsReady: { - LOG4CXX_DEBUG(logger_, "Received UI_IsReady event"); + SDL_LOG_DEBUG("Received UI_IsReady event"); unsubscribe_from_event(hmi_apis::FunctionID::UI_IsReady); const bool is_available = app_mngr::commands::ChangeInterfaceState( application_manager_, message, HmiInterfaces::HMI_INTERFACE_UI); @@ -73,8 +75,7 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) { if (!app_mngr::commands::CheckAvailabilityHMIInterfaces( application_manager_, HmiInterfaces::HMI_INTERFACE_UI)) { UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::ui); - LOG4CXX_INFO(logger_, - "HmiInterfaces::HMI_INTERFACE_UI isn't available"); + SDL_LOG_INFO("HmiInterfaces::HMI_INTERFACE_UI isn't available"); return; } @@ -82,7 +83,7 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc index 96a2d1212c..99730691de 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIIsReadyResponse::UIIsReadyResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ UIIsReadyResponse::UIIsReadyResponse( UIIsReadyResponse::~UIIsReadyResponse() {} void UIIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_IsReady); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc index 18d5376b25..c8a3dc3704 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIPerformAudioPassThruRequest::UIPerformAudioPassThruRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIPerformAudioPassThruRequest::UIPerformAudioPassThruRequest( UIPerformAudioPassThruRequest::~UIPerformAudioPassThruRequest() {} void UIPerformAudioPassThruRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc index afbd1bbed7..b953dc73e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIPerformAudioPassThruResponse::UIPerformAudioPassThruResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ UIPerformAudioPassThruResponse::UIPerformAudioPassThruResponse( UIPerformAudioPassThruResponse::~UIPerformAudioPassThruResponse() {} void UIPerformAudioPassThruResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc index a07c72cbf4..83e63c006d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIPerformInteractionRequest::UIPerformInteractionRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ UIPerformInteractionRequest::UIPerformInteractionRequest( UIPerformInteractionRequest::~UIPerformInteractionRequest() {} void UIPerformInteractionRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc index 4cbc58d278..00f6f702cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIPerformInteractionResponse::UIPerformInteractionResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ UIPerformInteractionResponse::UIPerformInteractionResponse( UIPerformInteractionResponse::~UIPerformInteractionResponse() {} void UIPerformInteractionResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_PerformInteraction); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc index cad68e23aa..366235bb6d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIScrollableMessageRequest::UIScrollableMessageRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ UIScrollableMessageRequest::UIScrollableMessageRequest( UIScrollableMessageRequest::~UIScrollableMessageRequest() {} void UIScrollableMessageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc index 4e844095b4..b9a184528e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIScrollableMessageResponse::UIScrollableMessageResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ UIScrollableMessageResponse::UIScrollableMessageResponse( UIScrollableMessageResponse::~UIScrollableMessageResponse() {} void UIScrollableMessageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_ScrollableMessage); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc index 4a538ac992..9e8f4837f8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISendHapticDataRequest::UISendHapticDataRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UISendHapticDataRequest::UISendHapticDataRequest( UISendHapticDataRequest::~UISendHapticDataRequest() {} void UISendHapticDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc index 92afdaaa4a..9b55d6d63d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISendHapticDataResponse::UISendHapticDataResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UISendHapticDataResponse::UISendHapticDataResponse( UISendHapticDataResponse::~UISendHapticDataResponse() {} void UISendHapticDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_SendHapticData); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc index 821f78a046..4d158bfc20 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISetAppIconRequest::UISetAppIconRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UISetAppIconRequest::UISetAppIconRequest( UISetAppIconRequest::~UISetAppIconRequest() {} void UISetAppIconRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc index 68e96725d4..91e341375b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISetAppIconResponse::UISetAppIconResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ UISetAppIconResponse::UISetAppIconResponse( UISetAppIconResponse::~UISetAppIconResponse() {} void UISetAppIconResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_SetAppIcon); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc index 63166157c8..df0f2a9f98 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UiSetDisplayLayoutRequest::UiSetDisplayLayoutRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UiSetDisplayLayoutRequest::UiSetDisplayLayoutRequest( UiSetDisplayLayoutRequest::~UiSetDisplayLayoutRequest() {} void UiSetDisplayLayoutRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc index f35427895e..35fe55ec4d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UiSetDisplayLayoutResponse::UiSetDisplayLayoutResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UiSetDisplayLayoutResponse::UiSetDisplayLayoutResponse( UiSetDisplayLayoutResponse::~UiSetDisplayLayoutResponse() {} void UiSetDisplayLayoutResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc index 0aaaae7cc7..231796f2d5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISetGlobalPropertiesRequest::UISetGlobalPropertiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UISetGlobalPropertiesRequest::UISetGlobalPropertiesRequest( UISetGlobalPropertiesRequest::~UISetGlobalPropertiesRequest() {} void UISetGlobalPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc index 48d73d146c..e0d7f8136e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISetGlobalPropertiesResponse::UISetGlobalPropertiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ UISetGlobalPropertiesResponse::UISetGlobalPropertiesResponse( UISetGlobalPropertiesResponse::~UISetGlobalPropertiesResponse() {} void UISetGlobalPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc index 4c8fcefcdf..fdb477e41e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISetMediaClockTimerRequest::UISetMediaClockTimerRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UISetMediaClockTimerRequest::UISetMediaClockTimerRequest( UISetMediaClockTimerRequest::~UISetMediaClockTimerRequest() {} void UISetMediaClockTimerRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc index fb5b25fc2b..3df2a14863 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISetMediaClockTimerResponse::UISetMediaClockTimerResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ UISetMediaClockTimerResponse::UISetMediaClockTimerResponse( UISetMediaClockTimerResponse::~UISetMediaClockTimerResponse() {} void UISetMediaClockTimerResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc index c2c8566e82..beba7ebba9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc @@ -37,6 +37,8 @@ namespace app_mngr = application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIShowAppMenuRequest::UIShowAppMenuRequest( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIShowAppMenuRequest::UIShowAppMenuRequest( UIShowAppMenuRequest::~UIShowAppMenuRequest() {} void UIShowAppMenuRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc index 14bbc79e03..c0e13d377a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc @@ -37,6 +37,9 @@ namespace sdl_rpc_plugin { namespace app_mngr = application_manager; namespace commands { + +SDL_CREATE_LOG_VARIABLE("Commands") + UIShowAppMenuResponse::UIShowAppMenuResponse( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -52,7 +55,7 @@ UIShowAppMenuResponse::UIShowAppMenuResponse( UIShowAppMenuResponse::~UIShowAppMenuResponse() {} void UIShowAppMenuResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::event_engine::Event event(hmi_apis::FunctionID::UI_ShowAppMenu); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc index d7160dc70b..4312a4d252 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIShowRequest::UIShowRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIShowRequest::UIShowRequest( UIShowRequest::~UIShowRequest() {} void UIShowRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc index 768069bf3a..7e57aec971 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UIShowResponse::UIShowResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UIShowResponse::UIShowResponse( UIShowResponse::~UIShowResponse() {} void UIShowResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_Show); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc index eae8cc523c..63bc1e0c0e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISliderRequest::UISliderRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ UISliderRequest::UISliderRequest( UISliderRequest::~UISliderRequest() {} void UISliderRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc index 9cf7224ddb..3c78e73fdd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISliderResponse::UISliderResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ UISliderResponse::UISliderResponse( UISliderResponse::~UISliderResponse() {} void UISliderResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_Slider); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_request.cc index 02e9af4c3c..7136a533e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISubtleAlertRequest::UISubtleAlertRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -60,7 +62,7 @@ UISubtleAlertRequest::UISubtleAlertRequest( UISubtleAlertRequest::~UISubtleAlertRequest() {} void UISubtleAlertRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_response.cc index 51e9802db7..a551988c07 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_subtle_alert_response.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UISubtleAlertResponse::UISubtleAlertResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UISubtleAlertResponse::UISubtleAlertResponse( UISubtleAlertResponse::~UISubtleAlertResponse() {} void UISubtleAlertResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::UI_SubtleAlert); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc index c5966fcb36..ca23f36d5c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UpdateAppListRequest::UpdateAppListRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UpdateAppListRequest::UpdateAppListRequest( UpdateAppListRequest::~UpdateAppListRequest() {} void UpdateAppListRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc index 7fc830b4e6..3468a7a253 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UpdateAppListResponse::UpdateAppListResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UpdateAppListResponse::UpdateAppListResponse( UpdateAppListResponse::~UpdateAppListResponse() {} void UpdateAppListResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO(PV): add check } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc index 3a014480c1..c8aa295645 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UpdateDeviceListRequest::UpdateDeviceListRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,7 +59,7 @@ UpdateDeviceListRequest::UpdateDeviceListRequest( UpdateDeviceListRequest::~UpdateDeviceListRequest() {} void UpdateDeviceListRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(wait_hmi_lock); // Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA. // Flag conditional compilation for specific customer is used in order to @@ -65,10 +67,10 @@ void UpdateDeviceListRequest::Run() { // hit code to RTC if (true == application_manager_.get_settings().launch_hmi()) { if (!application_manager_.IsHMICooperating()) { - LOG4CXX_INFO(logger_, "Wait for HMI Cooperation"); + SDL_LOG_INFO("Wait for HMI Cooperation"); subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnReady); termination_condition_.Wait(auto_lock); - LOG4CXX_DEBUG(logger_, "HMI Cooperation OK"); + SDL_LOG_DEBUG("HMI Cooperation OK"); } } @@ -76,17 +78,17 @@ void UpdateDeviceListRequest::Run() { } void UpdateDeviceListRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(wait_hmi_lock); switch (event.id()) { case hmi_apis::FunctionID::BasicCommunication_OnReady: { - LOG4CXX_INFO(logger_, "received OnReady"); + SDL_LOG_INFO("received OnReady"); unsubscribe_from_event(hmi_apis::FunctionID::BasicCommunication_OnReady); termination_condition_.Broadcast(); break; }; default: { - LOG4CXX_ERROR(logger_, "Unknown event "); + SDL_LOG_ERROR("Unknown event " << event.id()); break; }; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc index d69e683f2b..9458c22aa2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UpdateDeviceListResponse::UpdateDeviceListResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ UpdateDeviceListResponse::UpdateDeviceListResponse( UpdateDeviceListResponse::~UpdateDeviceListResponse() {} void UpdateDeviceListResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO(PV): add check for correctness. } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc index a52f03b998..b9c06945b6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UpdateSDLRequest::UpdateSDLRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UpdateSDLRequest::UpdateSDLRequest( UpdateSDLRequest::~UpdateSDLRequest() {} void UpdateSDLRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_handler_.PTExchangeAtUserRequest( (*message_)[strings::params][strings::correlation_id].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc index c02cde4111..a6981b6d82 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UpdateSDLResponse::UpdateSDLResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ UpdateSDLResponse::UpdateSDLResponse( UpdateSDLResponse::~UpdateSDLResponse() {} void UpdateSDLResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_; (*message_)[strings::params][strings::protocol_version] = protocol_version_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc index 788eda5a87..a26e0479c8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRAddCommandRequest::VRAddCommandRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ VRAddCommandRequest::VRAddCommandRequest( VRAddCommandRequest::~VRAddCommandRequest() {} void VRAddCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc index 37b3e4696d..111fd1ffe5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRAddCommandResponse::VRAddCommandResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ VRAddCommandResponse::VRAddCommandResponse( VRAddCommandResponse::~VRAddCommandResponse() {} void VRAddCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_AddCommand); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc index d1be04ad44..32d326687a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRChangeRegistrationRequest::VRChangeRegistrationRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ VRChangeRegistrationRequest::VRChangeRegistrationRequest( VRChangeRegistrationRequest::~VRChangeRegistrationRequest() {} void VRChangeRegistrationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc index 27bde2bafa..85c346421d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRChangeRegistrationResponse::VRChangeRegistrationResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ VRChangeRegistrationResponse::VRChangeRegistrationResponse( VRChangeRegistrationResponse::~VRChangeRegistrationResponse() {} void VRChangeRegistrationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_ChangeRegistration); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc index ebcfe78fa9..cc6650a7ae 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRDeleteCommandRequest::VRDeleteCommandRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ VRDeleteCommandRequest::VRDeleteCommandRequest( VRDeleteCommandRequest::~VRDeleteCommandRequest() {} void VRDeleteCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc index d1d725b356..ae40f3c1f8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRDeleteCommandResponse::VRDeleteCommandResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ VRDeleteCommandResponse::VRDeleteCommandResponse( VRDeleteCommandResponse::~VRDeleteCommandResponse() {} void VRDeleteCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_DeleteCommand); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc index dd0d78cf2d..3f528f2f58 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRGetCapabilitiesRequest::VRGetCapabilitiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ VRGetCapabilitiesRequest::VRGetCapabilitiesRequest( VRGetCapabilitiesRequest::~VRGetCapabilitiesRequest() {} void VRGetCapabilitiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void VRGetCapabilitiesRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_GetCapabilities); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc index 79d532bff8..315107d94a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRGetCapabilitiesResponse::VRGetCapabilitiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ VRGetCapabilitiesResponse::VRGetCapabilitiesResponse( VRGetCapabilitiesResponse::~VRGetCapabilitiesResponse() {} void VRGetCapabilitiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto result_code = static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); @@ -59,8 +61,7 @@ void VRGetCapabilitiesResponse::Run() { hmi_apis::FunctionID::VR_GetCapabilities); if (hmi_apis::Common_Result::SUCCESS != result_code) { - LOG4CXX_DEBUG(logger_, - "Request was not successful. Don't change HMI capabilities"); + SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities"); return; } @@ -75,8 +76,7 @@ void VRGetCapabilitiesResponse::Run() { if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::vr, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, - "Failed to save VR.GetCapabilities response to cache"); + SDL_LOG_ERROR("Failed to save VR.GetCapabilities response to cache"); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc index 3aa36aee33..f5e9b0e848 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRGetLanguageRequest::VRGetLanguageRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ VRGetLanguageRequest::VRGetLanguageRequest( VRGetLanguageRequest::~VRGetLanguageRequest() {} void VRGetLanguageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void VRGetLanguageRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_GetLanguage); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc index 462ccc529c..e8c881f6f8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRGetLanguageResponse::VRGetLanguageResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ VRGetLanguageResponse::VRGetLanguageResponse( VRGetLanguageResponse::~VRGetLanguageResponse() {} void VRGetLanguageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis; const Common_Result::eType result_code = static_cast<Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); @@ -63,8 +65,7 @@ void VRGetLanguageResponse::Run() { hmi_apis::FunctionID::VR_GetLanguage); if (Common_Result::SUCCESS != result_code) { - LOG4CXX_DEBUG(logger_, - "Request was not successful. Don't change HMI capabilities"); + SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities"); return; } @@ -81,13 +82,11 @@ void VRGetLanguageResponse::Run() { std::vector<std::string> sections_to_update{hmi_response::language}; if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::vr, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR(logger_, "Failed to save VR.GetLanguage response to cache"); + SDL_LOG_ERROR("Failed to save VR.GetLanguage response to cache"); } - LOG4CXX_DEBUG(logger_, - "Raising event for function_id " << function_id() - << " and correlation_id " - << correlation_id()); + SDL_LOG_DEBUG("Raising event for function_id " + << function_id() << " and correlation_id " << correlation_id()); event_engine::Event event(FunctionID::VR_GetLanguage); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc index 5755b91ab6..73e68e8503 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRGetSupportedLanguagesRequest::VRGetSupportedLanguagesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,13 +54,13 @@ VRGetSupportedLanguagesRequest::VRGetSupportedLanguagesRequest( VRGetSupportedLanguagesRequest::~VRGetSupportedLanguagesRequest() {} void VRGetSupportedLanguagesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void VRGetSupportedLanguagesRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_GetSupportedLanguages); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc index 59602cf10a..72278fcddd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRGetSupportedLanguagesResponse::VRGetSupportedLanguagesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ VRGetSupportedLanguagesResponse::VRGetSupportedLanguagesResponse( VRGetSupportedLanguagesResponse::~VRGetSupportedLanguagesResponse() {} void VRGetSupportedLanguagesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const hmi_apis::Common_Result::eType code = static_cast<hmi_apis::Common_Result::eType>( @@ -71,8 +73,8 @@ void VRGetSupportedLanguagesResponse::Run() { std::vector<std::string> sections_to_update{hmi_response::languages}; if (!hmi_capabilities_.SaveCachedCapabilitiesToFile( hmi_interface::vr, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR( - logger_, "Failed to save VR.GetSupportedLanguages response to cache"); + SDL_LOG_ERROR( + "Failed to save VR.GetSupportedLanguages response to cache"); } } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc index f65f58f423..303e7a6843 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRIsReadyRequest::VRIsReadyRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,17 +56,17 @@ VRIsReadyRequest::VRIsReadyRequest( VRIsReadyRequest::~VRIsReadyRequest() {} void VRIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); subscribe_on_event(hmi_apis::FunctionID::VR_IsReady, correlation_id()); SendRequest(); } void VRIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::VR_IsReady: { - LOG4CXX_DEBUG(logger_, "Received VR_IsReady event"); + SDL_LOG_DEBUG("Received VR_IsReady event"); unsubscribe_from_event(hmi_apis::FunctionID::VR_IsReady); const bool is_available = app_mngr::commands::ChangeInterfaceState( application_manager_, message, HmiInterfaces::HMI_INTERFACE_VR); @@ -74,8 +76,7 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) { if (!app_mngr::commands::CheckAvailabilityHMIInterfaces( application_manager_, HmiInterfaces::HMI_INTERFACE_VR)) { UpdateRequiredInterfaceCapabilitiesRequests(hmi_interface::vr); - LOG4CXX_INFO(logger_, - "HmiInterfaces::HMI_INTERFACE_VR isn't available"); + SDL_LOG_INFO("HmiInterfaces::HMI_INTERFACE_VR isn't available"); return; } @@ -83,7 +84,7 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc index 373f97bf80..486cf32890 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRIsReadyResponse::VRIsReadyResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -51,7 +53,7 @@ VRIsReadyResponse::VRIsReadyResponse( VRIsReadyResponse::~VRIsReadyResponse() {} void VRIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_IsReady); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc index 4257158f6a..db834f05a8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRPerformInteractionRequest::VRPerformInteractionRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ VRPerformInteractionRequest::VRPerformInteractionRequest( VRPerformInteractionRequest::~VRPerformInteractionRequest() {} void VRPerformInteractionRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc index 16378ab55a..2622b4f493 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VRPerformInteractionResponse::VRPerformInteractionResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ VRPerformInteractionResponse::VRPerformInteractionResponse( VRPerformInteractionResponse::~VRPerformInteractionResponse() {} void VRPerformInteractionResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VR_PerformInteraction); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc index 1dbfc97458..0267073e41 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc @@ -45,6 +45,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + namespace custom_str = utils::custom_string; AddCommandRequest::AddCommandRequest( @@ -68,7 +70,7 @@ AddCommandRequest::AddCommandRequest( AddCommandRequest::~AddCommandRequest() {} void AddCommandRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); RemoveCommand(); CommandRequestImpl::onTimeOut(); } @@ -79,13 +81,13 @@ bool AddCommandRequest::Init() { } void AddCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); + SDL_LOG_ERROR("No application associated with session key"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -97,22 +99,22 @@ void AddCommandRequest::Run() { application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { - LOG4CXX_ERROR( - logger_, "MessageHelper::VerifyImage return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyImage return " + << verification_result); SendResponse(false, verification_result); return; } } if (!((*message_)[strings::msg_params].keyExists(strings::cmd_id))) { - LOG4CXX_ERROR(logger_, "INVALID_DATA"); + SDL_LOG_ERROR("INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } if (app->FindCommand( (*message_)[strings::msg_params][strings::cmd_id].asUInt())) { - LOG4CXX_ERROR(logger_, "INVALID_ID"); + SDL_LOG_ERROR("INVALID_ID"); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -149,13 +151,13 @@ void AddCommandRequest::Run() { } if (!data_exist) { - LOG4CXX_ERROR(logger_, "INVALID_DATA"); + SDL_LOG_ERROR("INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, "Incoming add command has contains \t\n \\t \\n"); + SDL_LOG_ERROR("Incoming add command has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -245,9 +247,9 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) { [strings::menu_name] .asString()) && (saved_parent_id == parent_id)) { - LOG4CXX_INFO(logger_, - "AddCommandRequest::CheckCommandName received" - " command name already exist in same level menu"); + SDL_LOG_INFO( + "AddCommandRequest::CheckCommandName received" + " command name already exist in same level menu"); return false; } } @@ -279,9 +281,9 @@ bool AddCommandRequest::CheckCommandVRSynonym(ApplicationConstSharedPtr app) { .asCustomString(); if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) { - LOG4CXX_INFO(logger_, - "AddCommandRequest::CheckCommandVRSynonym" - " received command vr synonym already exist"); + SDL_LOG_INFO( + "AddCommandRequest::CheckCommandVRSynonym" + " received command vr synonym already exist"); return false; } } @@ -302,9 +304,9 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) { smart_objects::SmartObject* parent = app->FindSubMenu(parent_id); if (!parent) { - LOG4CXX_INFO(logger_, - "AddCommandRequest::CheckCommandParentId received" - " submenu doesn't exist"); + SDL_LOG_INFO( + "AddCommandRequest::CheckCommandParentId received" + " submenu doesn't exist"); return false; } return true; @@ -312,7 +314,7 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) { // TODO(AKUTSAN) APPLINK-26973: Refactor AddCommandRequest void AddCommandRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -321,7 +323,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } @@ -333,7 +335,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_AddCommand: { - LOG4CXX_INFO(logger_, "Received UI_AddCommand event"); + SDL_LOG_INFO("Received UI_AddCommand event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -345,7 +347,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::VR_AddCommand: { - LOG4CXX_INFO(logger_, "Received VR_AddCommand event"); + SDL_LOG_INFO("Received VR_AddCommand event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); is_vr_received_ = true; vr_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -357,7 +359,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } @@ -411,8 +413,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { (is_no_ui_error && is_vr_invalid_unsupported) || (is_no_vr_error && is_ui_invalid_unsupported); - LOG4CXX_DEBUG(logger_, - "calculated result " << ui_result_ << " " << is_no_ui_error + SDL_LOG_DEBUG("calculated result " << ui_result_ << " " << is_no_ui_error << " " << is_no_vr_error); const bool is_vr_or_ui_warning = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( @@ -445,7 +446,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == vr_result_) { result_code = MessageHelper::HMIToMobileResult(ui_result_); } - LOG4CXX_DEBUG(logger_, "HMIToMobileResult " << result_code); + SDL_LOG_DEBUG("HMIToMobileResult " << result_code); } if (BothSend() && hmi_apis::Common_Result::SUCCESS == vr_result_) { @@ -466,7 +467,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); application->RemoveCommand(cmd_id); result = false; - LOG4CXX_DEBUG(logger_, "Result " << result); + SDL_LOG_DEBUG("Result " << result); } } @@ -481,7 +482,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { application->RemoveCommand(cmd_id); result = false; - LOG4CXX_DEBUG(logger_, "Result " << result); + SDL_LOG_DEBUG("Result " << result); } HmiInterfaces::InterfaceState ui_interface_state = @@ -496,12 +497,12 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { HmiInterfaces::STATE_NOT_AVAILABLE == vr_interface_state) || (is_ui_unsupported && HmiInterfaces::STATE_NOT_AVAILABLE == ui_interface_state))) { - LOG4CXX_DEBUG(logger_, "!BothSend() && is_vr_or_ui_unsupported"); + SDL_LOG_DEBUG("!BothSend() && is_vr_or_ui_unsupported"); result = false; } if (is_vr_and_ui_unsupported) { - LOG4CXX_DEBUG(logger_, "UI and VR interface both unsupported"); + SDL_LOG_DEBUG("UI and VR interface both unsupported"); result = false; } @@ -524,7 +525,7 @@ bool AddCommandRequest::IsPendingResponseExist() { } bool AddCommandRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { @@ -532,7 +533,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() { [strings::menu_name] .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid menu name syntax check failed."); + SDL_LOG_ERROR("Invalid menu name syntax check failed."); return true; } } @@ -545,7 +546,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::vr_commands][i] .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed"); + SDL_LOG_ERROR("Invalid vr_commands syntax check failed"); return true; } } @@ -555,7 +556,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::cmd_icon][strings::value] .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid cmd_icon value syntax check failed"); + SDL_LOG_ERROR("Invalid cmd_icon value syntax check failed"); return true; } } @@ -596,10 +597,10 @@ const std::string AddCommandRequest::GenerateMobileResponseInfo() { } void AddCommandRequest::RemoveCommand() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (app.use_count() == 0) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); + SDL_LOG_ERROR("No application associated with session key"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc index 24ff3b5a28..6e8c589cb6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AddCommandResponse::AddCommandResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ AddCommandResponse::AddCommandResponse( AddCommandResponse::~AddCommandResponse() {} void AddCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc index 71bf867054..d79cd57953 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AddSubMenuRequest::AddSubMenuRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,12 +59,12 @@ AddSubMenuRequest::AddSubMenuRequest( AddSubMenuRequest::~AddSubMenuRequest() {} void AddSubMenuRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -77,8 +79,8 @@ void AddSubMenuRequest::Run() { received_msg_params[strings::menu_icon], app, application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { - LOG4CXX_ERROR( - logger_, "MessageHelper::VerifyImage return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyImage return " + << verification_result); SendResponse(false, verification_result); return; } @@ -86,7 +88,7 @@ void AddSubMenuRequest::Run() { const int32_t menu_id = received_msg_params[strings::menu_id].asInt(); if (app->FindSubMenu(menu_id)) { - LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found."); + SDL_LOG_ERROR("Menu with id " << menu_id << " is not found."); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -100,13 +102,13 @@ void AddSubMenuRequest::Run() { : 0; if (app->IsSubMenuNameAlreadyExist(menu_name, parent_id)) { - LOG4CXX_ERROR(logger_, "Menu name " << menu_name << " is duplicated."); + SDL_LOG_ERROR("Menu name " << menu_name << " is duplicated."); SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); return; } if (!CheckSubMenuName()) { - LOG4CXX_ERROR(logger_, "Sub-menu name is not valid."); + SDL_LOG_ERROR("Sub-menu name is not valid."); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -146,7 +148,7 @@ void AddSubMenuRequest::Run() { } void AddSubMenuRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -164,7 +166,7 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } @@ -191,7 +193,7 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } @@ -203,12 +205,12 @@ bool AddSubMenuRequest::Init() { } bool AddSubMenuRequest::CheckSubMenuName() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; str = (*message_)[strings::msg_params][strings::menu_name].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_INFO(logger_, "Invalid subMenu name."); + SDL_LOG_INFO("Invalid subMenu name."); return false; } return true; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc index d91f13f1df..c9e8d1809f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AddSubMenuResponse::AddSubMenuResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ AddSubMenuResponse::AddSubMenuResponse( AddSubMenuResponse::~AddSubMenuResponse() {} void AddSubMenuResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc index 9f36f260ae..47b3a87d52 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AlertManeuverRequest::AlertManeuverRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,11 +58,11 @@ AlertManeuverRequest::AlertManeuverRequest( AlertManeuverRequest::~AlertManeuverRequest() {} void AlertManeuverRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if ((!(*message_)[strings::msg_params].keyExists(strings::soft_buttons)) && (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks))) { - LOG4CXX_ERROR(logger_, "AlertManeuverRequest::Request without parameters!"); + SDL_LOG_ERROR("AlertManeuverRequest::Request without parameters!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -69,15 +71,15 @@ void AlertManeuverRequest::Run() { (*message_)[strings::params][strings::connection_key].asUInt()); if (NULL == app.get()) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming alert maneuver has contains \\t\\n \\\\t \\\\n" - "text contains only whitespace in ttsChunks"); + SDL_LOG_ERROR( + "Incoming alert maneuver has contains \\t\\n \\\\t \\\\n" + "text contains only whitespace in ttsChunks"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -91,7 +93,7 @@ void AlertManeuverRequest::Run() { application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!"); + SDL_LOG_ERROR("Wrong soft buttons parameters!"); SendResponse(false, processing_result); return; } @@ -107,9 +109,8 @@ void AlertManeuverRequest::Run() { MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return " + << verification_result); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "One or more files needed for tts_chunks are not present"); @@ -154,12 +155,12 @@ void AlertManeuverRequest::Run() { } void AlertManeuverRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); hmi_apis::FunctionID::eType event_id = event.id(); switch (event_id) { case hmi_apis::FunctionID::Navigation_AlertManeuver: { - LOG4CXX_INFO(logger_, "Received Navigation_AlertManeuver event"); + SDL_LOG_INFO("Received Navigation_AlertManeuver event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); pending_requests_.Remove(event_id); navi_alert_maneuver_result_code_ = @@ -169,7 +170,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_Speak: { - LOG4CXX_INFO(logger_, "Received TTS_Speak event"); + SDL_LOG_INFO("Received TTS_Speak event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); pending_requests_.Remove(event_id); tts_speak_result_code_ = static_cast<hmi_apis::Common_Result::eType>( @@ -178,24 +179,24 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event"); + SDL_LOG_INFO("Received TTS_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); SendResponse( - false, mobile_apis::Result::INVALID_ENUM, "Received unknown event"); + false, mobile_apis::Result::INVALID_ENUM, "Received unknown event "); return; } } if (!pending_requests_.IsFinal(event_id)) { - LOG4CXX_DEBUG(logger_, - "There are some pending responses from HMI." - "AlertManeuverRequest still waiting."); + SDL_LOG_DEBUG( + "There are some pending responses from HMI. " + "AlertManeuverRequest still waiting."); return; } std::string return_info; @@ -214,7 +215,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { bool AlertManeuverRequest::PrepareResponseParameters( mobile_apis::Result::eType& result_code, std::string& return_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; app_mngr::commands::ResponseInfo navigation_alert_info( @@ -246,7 +247,7 @@ bool AlertManeuverRequest::PrepareResponseParameters( } bool AlertManeuverRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using smart_objects::SmartArray; if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) { @@ -258,7 +259,7 @@ bool AlertManeuverRequest::IsWhiteSpaceExist() { for (; it_tts_chunk != tts_chunks_arr->end(); ++it_tts_chunk) { const char* tts_chunk_text = (*it_tts_chunk)[strings::text].asCharArray(); if (strlen(tts_chunk_text) && !CheckSyntax(tts_chunk_text)) { - LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed"); + SDL_LOG_ERROR("Invalid tts_chunks syntax check failed"); return true; } } @@ -277,7 +278,7 @@ bool AlertManeuverRequest::IsWhiteSpaceExist() { const char* soft_button_text = (*it_soft_button)[strings::text].asCharArray(); if (!CheckSyntax(soft_button_text)) { - LOG4CXX_ERROR(logger_, "Invalid soft_buttons syntax check failed"); + SDL_LOG_ERROR("Invalid soft_buttons syntax check failed"); return true; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc index 97c93d7455..993dc75548 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AlertManeuverResponse::AlertManeuverResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ AlertManeuverResponse::AlertManeuverResponse( AlertManeuverResponse::~AlertManeuverResponse() {} void AlertManeuverResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc index a0544ee444..55783be4cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc @@ -47,6 +47,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AlertRequest::AlertRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -81,9 +83,9 @@ bool AlertRequest::Init() { // If soft buttons are present, SDL will not use initiate timeout tracking for // response. if (msg_params.keyExists(strings::soft_buttons)) { - LOG4CXX_INFO(logger_, - "Request contains soft buttons - request timeout " - "will be set to 0."); + SDL_LOG_INFO( + "Request contains soft buttons - request timeout " + "will be set to 0."); default_timeout_ = 0; } @@ -91,7 +93,7 @@ bool AlertRequest::Init() { } void AlertRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asInt(); @@ -122,24 +124,24 @@ void AlertRequest::Run() { } void AlertRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::TTS_OnResetTimeout: case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOG4CXX_INFO(logger_, - "Received UI_OnResetTimeout event " - " or TTS_OnResetTimeout event" - << awaiting_tts_speak_response_ << " " - << awaiting_tts_stop_speaking_response_ << " " - << awaiting_ui_alert_response_); + SDL_LOG_INFO( + "Received UI_OnResetTimeout event " + " or TTS_OnResetTimeout event " + << awaiting_tts_speak_response_ << " " + << awaiting_tts_stop_speaking_response_ << " " + << awaiting_ui_alert_response_); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::UI_Alert: { - LOG4CXX_INFO(logger_, "Received UI_Alert event"); + SDL_LOG_INFO("Received UI_Alert event"); // Unsubscribe from event to avoid unwanted messages EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); unsubscribe_from_event(hmi_apis::FunctionID::UI_Alert); @@ -163,7 +165,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_Speak: { - LOG4CXX_INFO(logger_, "Received TTS_Speak event"); + SDL_LOG_INFO("Received TTS_Speak event"); // Unsubscribe from event to avoid unwanted messages EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); unsubscribe_from_event(hmi_apis::FunctionID::TTS_Speak); @@ -174,7 +176,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_StopSpeaking: { - LOG4CXX_INFO(logger_, "Received TTS_StopSpeaking event"); + SDL_LOG_INFO("Received TTS_StopSpeaking event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); // Unsubscribe from event to avoid unwanted messages unsubscribe_from_event(hmi_apis::FunctionID::TTS_StopSpeaking); @@ -182,7 +184,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } @@ -238,11 +240,11 @@ bool AlertRequest::PrepareResponseParameters( } bool AlertRequest::Validate(uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); + SDL_LOG_ERROR("No application associated with session key"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } @@ -252,7 +254,7 @@ bool AlertRequest::Validate(uint32_t app_id) { app->AreCommandLimitsExceeded( static_cast<mobile_apis::FunctionID::eType>(function_id()), application_manager::TLimitSource::POLICY_TABLE)) { - LOG4CXX_ERROR(logger_, "Alert frequency is too high."); + SDL_LOG_ERROR("Alert frequency is too high."); SendResponse(false, mobile_apis::Result::REJECTED); return false; } @@ -271,7 +273,7 @@ bool AlertRequest::Validate(uint32_t app_id) { application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); + SDL_LOG_ERROR("INVALID_DATA!"); SendResponse(false, processing_result); return false; } @@ -281,7 +283,7 @@ bool AlertRequest::Validate(uint32_t app_id) { (!(*message_)[strings::msg_params].keyExists(strings::alert_text2)) && (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks) && (1 > (*message_)[strings::msg_params][strings::tts_chunks].length()))) { - LOG4CXX_ERROR(logger_, "Mandatory parameters are missing"); + SDL_LOG_ERROR("Mandatory parameters are missing"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Mandatory parameters are missing"); @@ -295,9 +297,8 @@ bool AlertRequest::Validate(uint32_t app_id) { MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return " + << verification_result); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "One or more files needed for tts_chunks are not present"); @@ -309,7 +310,7 @@ bool AlertRequest::Validate(uint32_t app_id) { } void AlertRequest::SendAlertRequest(int32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(app_id); smart_objects::SmartObject msg_params = @@ -364,7 +365,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) { application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { - LOG4CXX_ERROR(logger_, "Image verification failed."); + SDL_LOG_ERROR("Image verification failed."); SendResponse(false, verification_result); return; } @@ -401,7 +402,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) { void AlertRequest::SendSpeakRequest(int32_t app_id, bool tts_chunks_exists, size_t length_tts_chunks) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis; using namespace smart_objects; // crate HMI speak request @@ -423,13 +424,13 @@ void AlertRequest::SendSpeakRequest(int32_t app_id, } bool AlertRequest::CheckStrings() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) { str = (*message_)[strings::msg_params][strings::alert_text1].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid alert_text_1 syntax check failed"); + SDL_LOG_ERROR("Invalid alert_text_1 syntax check failed"); return false; } } @@ -437,7 +438,7 @@ bool AlertRequest::CheckStrings() { if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) { str = (*message_)[strings::msg_params][strings::alert_text2].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid alert_text_2 syntax check failed"); + SDL_LOG_ERROR("Invalid alert_text_2 syntax check failed"); return false; } } @@ -445,7 +446,7 @@ bool AlertRequest::CheckStrings() { if ((*message_)[strings::msg_params].keyExists(strings::alert_text3)) { str = (*message_)[strings::msg_params][strings::alert_text3].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid alert_text_3 syntax check failed"); + SDL_LOG_ERROR("Invalid alert_text_3 syntax check failed"); return false; } } @@ -456,7 +457,7 @@ bool AlertRequest::CheckStrings() { for (size_t i = 0; i < tts_chunks_array.length(); ++i) { str = tts_chunks_array[i][strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tts_chunks text syntax check failed"); + SDL_LOG_ERROR("Invalid tts_chunks text syntax check failed"); return false; } } @@ -465,7 +466,7 @@ bool AlertRequest::CheckStrings() { } bool AlertRequest::HasHmiResponsesToWait() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ || awaiting_tts_stop_speaking_response_; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc index b709d13958..1b8eebe7d7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + AlertResponse::AlertResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,7 +59,7 @@ AlertResponse::AlertResponse( AlertResponse::~AlertResponse() {} void AlertResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc index 6873cb7bf1..27020f2719 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc @@ -41,6 +41,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + CancelInteractionRequest::CancelInteractionRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ CancelInteractionRequest::CancelInteractionRequest( CancelInteractionRequest::~CancelInteractionRequest() {} void CancelInteractionRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto function_id = static_cast<mobile_apis::FunctionID::eType>( (*message_)[strings::msg_params][strings::func_id].asInt()); @@ -69,7 +71,7 @@ void CancelInteractionRequest::Run() { mobile_apis::FunctionID::SubtleAlertID, mobile_apis::FunctionID::ScrollableMessageID, mobile_apis::FunctionID::SliderID)) { - LOG4CXX_ERROR(logger_, "Bad function ID" << function_id); + SDL_LOG_ERROR("Bad function ID " << function_id); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -87,10 +89,10 @@ void CancelInteractionRequest::Run() { } void CancelInteractionRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (event.id() != hmi_apis::FunctionID::UI_CancelInteraction) { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc index af73e72a6f..9adec06c9f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc @@ -37,6 +37,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + CancelInteractionResponse::CancelInteractionResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,9 +54,9 @@ CancelInteractionResponse::CancelInteractionResponse( CancelInteractionResponse::~CancelInteractionResponse() {} void CancelInteractionResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } } // namespace commands -} // namespace sdl_rpc_plugin
\ No newline at end of file +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc index 27cac83fad..8e13110515 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc @@ -59,6 +59,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ChangeRegistrationRequest::ChangeRegistrationRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -144,19 +146,18 @@ void ChangeRegistrationRequest::SendUIRequest( } void ChangeRegistrationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace smart_objects; ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if (IsWhiteSpaceExist()) { - LOG4CXX_INFO(logger_, - "Incoming request contains \t\n \\t \\n or whitespace"); + SDL_LOG_INFO("Incoming request contains \t\n \\t \\n or whitespace"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -176,14 +177,14 @@ void ChangeRegistrationRequest::Run() { if (false == (IsLanguageSupportedByUI(hmi_language) && IsLanguageSupportedByVR(language) && IsLanguageSupportedByTTS(language))) { - LOG4CXX_ERROR(logger_, "Language is not supported"); + SDL_LOG_ERROR("Language is not supported"); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); return; } if (msg_params.keyExists(strings::app_name) && !IsNicknameAllowed(msg_params[strings::app_name].asCustomString())) { - LOG4CXX_ERROR(logger_, "Nickname is not allowed."); + SDL_LOG_ERROR("Nickname is not allowed."); SendResponse(false, mobile_apis::Result::DISALLOWED); return; } @@ -195,9 +196,8 @@ void ChangeRegistrationRequest::Run() { MessageHelper::VerifyTtsFiles(tts_name, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return " + << verification_result); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "One or more files needed for tts_name are not present"); @@ -244,14 +244,14 @@ void ChangeRegistrationRequest::Run() { } void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); hmi_apis::FunctionID::eType event_id = event.id(); switch (event_id) { case hmi_apis::FunctionID::UI_ChangeRegistration: { - LOG4CXX_INFO(logger_, "Received UI_ChangeRegistration event"); + SDL_LOG_INFO("Received UI_ChangeRegistration event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); pending_requests_.Remove(event_id); ui_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -260,7 +260,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::VR_ChangeRegistration: { - LOG4CXX_INFO(logger_, "Received VR_ChangeRegistration event"); + SDL_LOG_INFO("Received VR_ChangeRegistration event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); pending_requests_.Remove(event_id); vr_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -269,7 +269,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_ChangeRegistration: { - LOG4CXX_INFO(logger_, "Received TTS_ChangeRegistration event"); + SDL_LOG_INFO("Received TTS_ChangeRegistration event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); pending_requests_.Remove(event_id); tts_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -278,7 +278,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event_id); + SDL_LOG_ERROR("Received unknown event " << event_id); return; } } @@ -288,7 +288,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } @@ -315,9 +315,9 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { response_info.empty() ? NULL : response_info.c_str(), &(message[strings::msg_params])); } else { - LOG4CXX_INFO(logger_, - "There are some pending responses from HMI." - "ChangeRegistrationRequest still waiting."); + SDL_LOG_INFO( + "There are some pending responses from HMI." + "ChangeRegistrationRequest still waiting."); } } @@ -331,7 +331,7 @@ void CheckInfo(std::string& str) { bool ChangeRegistrationRequest::PrepareResponseParameters( mobile_apis::Result::eType& result_code, std::string& response_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; const bool is_tts_succeeded_unsupported = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( @@ -463,7 +463,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI( const auto ui_languages = hmi_capabilities.ui_supported_languages(); if (!ui_languages) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return false; } @@ -473,7 +473,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByUI( } } - LOG4CXX_ERROR(logger_, "Language isn't supported by UI"); + SDL_LOG_ERROR("Language isn't supported by UI"); return false; } @@ -484,7 +484,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR( const auto vr_languages = hmi_capabilities.vr_supported_languages(); if (!vr_languages) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return false; } @@ -494,7 +494,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByVR( } } - LOG4CXX_ERROR(logger_, "Language isn't supported by VR"); + SDL_LOG_ERROR("Language isn't supported by VR"); return false; } @@ -505,7 +505,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByTTS( const auto tts_languages = hmi_capabilities.tts_supported_languages(); if (!tts_languages) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return false; } @@ -516,7 +516,7 @@ bool ChangeRegistrationRequest::IsLanguageSupportedByTTS( } } - LOG4CXX_ERROR(logger_, "Language isn't supported by TTS"); + SDL_LOG_ERROR("Language isn't supported by TTS"); return false; } @@ -526,7 +526,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::app_name)) { str = (*message_)[strings::msg_params][strings::app_name].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid app_name syntax check failed"); + SDL_LOG_ERROR("Invalid app_name syntax check failed"); return true; } } @@ -541,7 +541,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { for (; it_tn != it_tn_end; ++it_tn) { str = (*it_tn)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tts_name syntax check failed"); + SDL_LOG_ERROR("Invalid tts_name syntax check failed"); return true; } } @@ -552,8 +552,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name] .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid ngn_media_screen_app_name syntax check failed"); + SDL_LOG_ERROR("Invalid ngn_media_screen_app_name syntax check failed"); return true; } } @@ -568,7 +567,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { for (; it_vs != it_vs_end; ++it_vs) { str = (*it_vs).asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_synonyms syntax check failed"); + SDL_LOG_ERROR("Invalid vr_synonyms syntax check failed"); return true; } } @@ -578,7 +577,7 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() { mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence( const connection_handler::DeviceHandle& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -610,7 +609,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence( const auto& cur_name = app->name(); if (msg_params.keyExists(strings::app_name)) { if (app_name.CompareIgnoreCase(cur_name)) { - LOG4CXX_ERROR(logger_, "Application name is known already."); + SDL_LOG_ERROR("Application name is known already."); return mobile_apis::Result::DUPLICATE_NAME; } const auto vr = app->vr_synonyms(); @@ -619,7 +618,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence( CoincidencePredicateVR v(app_name); if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { - LOG4CXX_ERROR(logger_, "Application name is known already."); + SDL_LOG_ERROR("Application name is known already."); return mobile_apis::Result::DUPLICATE_NAME; } } @@ -631,7 +630,7 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence( CoincidencePredicateVR v(cur_name); if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { - LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name ."); + SDL_LOG_ERROR("vr_synonyms duplicated with app_name ."); return mobile_apis::Result::DUPLICATE_NAME; } } // End vr check @@ -646,11 +645,9 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence( tts_curr->end(), compare_tts_name); if (it_tts != tts_array->end()) { - LOG4CXX_ERROR( - logger_, - "TTS name: " - << (*it_tts)[strings::text].asCustomString().AsMBString() - << " is known already"); + SDL_LOG_ERROR("TTS name: " + << (*it_tts)[strings::text].asCustomString().AsMBString() + << " is known already"); return mobile_apis::Result::DUPLICATE_NAME; } } // End tts check @@ -661,13 +658,12 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence( bool ChangeRegistrationRequest::IsNicknameAllowed( const custom_str::CustomString& app_name) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR( - logger_, - "Can't find appication with connection key " << connection_key()); + SDL_LOG_ERROR("Can't find appication with connection key " + << connection_key()); return false; } @@ -680,9 +676,8 @@ bool ChangeRegistrationRequest::IsNicknameAllowed( policy_app_id, &app_nicknames, &app_hmi_types); if (!init_result) { - LOG4CXX_ERROR(logger_, - "Error during getting of nickname list for application " - << policy_app_id); + SDL_LOG_ERROR("Error during getting of nickname list for application " + << policy_app_id); return false; } @@ -691,8 +686,7 @@ bool ChangeRegistrationRequest::IsNicknameAllowed( policy::StringArray::const_iterator it = std::find_if(app_nicknames.begin(), app_nicknames.end(), compare); if (app_nicknames.end() == it) { - LOG4CXX_WARN(logger_, - "Application name was not found in nicknames list."); + SDL_LOG_WARN("Application name was not found in nicknames list."); usage_statistics::AppCounter count_of_rejections_nickname_mismatch( policy_handler_.GetStatisticManager(), diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc index 78c60bc746..58bf5f4caa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ChangeRegistrationResponse::ChangeRegistrationResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ ChangeRegistrationResponse::ChangeRegistrationResponse( ChangeRegistrationResponse::~ChangeRegistrationResponse() {} void ChangeRegistrationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc index 275f1d82a6..b4a09844f2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc @@ -39,6 +39,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + CloseApplicationRequest::CloseApplicationRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,11 +56,11 @@ CloseApplicationRequest::CloseApplicationRequest( CloseApplicationRequest::~CloseApplicationRequest() {} void CloseApplicationRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (app.use_count() == 0) { - LOG4CXX_ERROR(logger_, "Application does not exist"); + SDL_LOG_ERROR("Application does not exist"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -71,7 +73,7 @@ void CloseApplicationRequest::Run() { } void CloseApplicationRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); auto msg_params = message[strings::msg_params]; @@ -89,7 +91,7 @@ void CloseApplicationRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (app.use_count() == 0) { - LOG4CXX_ERROR(logger_, "Application does not exist"); + SDL_LOG_ERROR("Application does not exist"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc index 934804e1b1..a03c7a64f4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc @@ -38,6 +38,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + CloseApplicationResponse::CloseApplicationResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ CloseApplicationResponse::CloseApplicationResponse( CloseApplicationResponse::~CloseApplicationResponse() {} void CloseApplicationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc index 258aefd63f..6b7e1d917d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc @@ -47,6 +47,8 @@ const char* kInvalidImageWarningInfo = "Requested image(s) not found."; namespace sdl_rpc_plugin { namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + using namespace application_manager; CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest( @@ -68,16 +70,16 @@ CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest( , is_timed_out_(false) {} CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void CreateInteractionChoiceSetRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis; ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -105,7 +107,7 @@ void CreateInteractionChoiceSetRequest::Run() { } if (verification_result_image == Result::INVALID_DATA || verification_result_secondary_image == Result::INVALID_DATA) { - LOG4CXX_ERROR(logger_, "Image verification failed."); + SDL_LOG_ERROR("Image verification failed."); SendResponse(false, Result::INVALID_DATA); return; } else if (verification_result_image == Result::WARNINGS || @@ -120,8 +122,7 @@ void CreateInteractionChoiceSetRequest::Run() { .asInt(); if (app->FindChoiceSet(choice_set_id_)) { - LOG4CXX_ERROR(logger_, - "Choice set with id " << choice_set_id_ << " is not found."); + SDL_LOG_ERROR("Choice set with id " << choice_set_id_ << " is not found."); SendResponse(false, Result::INVALID_ID); return; } @@ -160,7 +161,7 @@ void CreateInteractionChoiceSetRequest::Run() { mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( ApplicationConstSharedPtr app) { using namespace smart_objects; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::set<uint32_t> choice_id_set; @@ -175,15 +176,14 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet( choice_id_set.insert( (*current_choice_set_it)[strings::choice_id].asInt()); if (!ins_res.second) { - LOG4CXX_ERROR(logger_, - "Choice with ID " - << (*current_choice_set_it)[strings::choice_id].asInt() - << " already exists"); + SDL_LOG_ERROR("Choice with ID " + << (*current_choice_set_it)[strings::choice_id].asInt() + << " already exists"); return mobile_apis::Result::INVALID_ID; } if (IsWhiteSpaceExist(*current_choice_set_it)) { - LOG4CXX_ERROR(logger_, "Incoming choice set has contains \t\n \\t \\n"); + SDL_LOG_ERROR("Incoming choice set has contains \t\n \\t \\n"); return mobile_apis::Result::INVALID_DATA; } for (next_choice_set_it = current_choice_set_it + 1; @@ -218,9 +218,8 @@ bool CreateInteractionChoiceSetRequest::compareSynonyms( CreateInteractionChoiceSetRequest::compareStr); if (it != vr_cmds_1->end()) { - LOG4CXX_INFO( - logger_, - "Incoming choice set has duplicated VR synonyms " << it->asString()); + SDL_LOG_INFO("Incoming choice set has duplicated VR synonyms " + << it->asString()); return true; } @@ -235,19 +234,19 @@ bool CreateInteractionChoiceSetRequest::compareStr( bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( const smart_objects::SmartObject& choice_set) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; str = choice_set[strings::menu_name].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid menu_name syntax check failed"); + SDL_LOG_ERROR("Invalid menu_name syntax check failed"); return true; } if (choice_set.keyExists(strings::secondary_text)) { str = choice_set[strings::secondary_text].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid secondary_text syntax check failed"); + SDL_LOG_ERROR("Invalid secondary_text syntax check failed"); return true; } } @@ -255,7 +254,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( if (choice_set.keyExists(strings::tertiary_text)) { str = choice_set[strings::tertiary_text].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tertiary_text syntax check failed"); + SDL_LOG_ERROR("Invalid tertiary_text syntax check failed"); return true; } } @@ -266,7 +265,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( for (size_t i = 0; i < len; ++i) { str = choice_set[strings::vr_commands][i].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed"); + SDL_LOG_ERROR("Invalid vr_commands syntax check failed"); return true; } } @@ -275,7 +274,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( if (choice_set.keyExists(strings::image)) { str = choice_set[strings::image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid image value syntax check failed"); + SDL_LOG_ERROR("Invalid image value syntax check failed"); return true; } } @@ -283,9 +282,9 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( if (choice_set.keyExists(strings::secondary_image)) { str = choice_set[strings::secondary_image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid secondary_image value. " - "Syntax check failed"); + SDL_LOG_ERROR( + "Invalid secondary_image value. " + "Syntax check failed"); return true; } } @@ -294,7 +293,7 @@ bool CreateInteractionChoiceSetRequest::IsWhiteSpaceExist( void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& choice_set = (*message_)[strings::msg_params]; smart_objects::SmartObject msg_params = @@ -311,8 +310,7 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( { sync_primitives::AutoLock error_lock(error_from_hmi_lock_); if (error_from_hmi_) { - LOG4CXX_WARN(logger_, - "Error from HMI received. Stop sending VRCommands"); + SDL_LOG_WARN("Error from HMI received. Stop sending VRCommands"); break; } } @@ -332,19 +330,17 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( VRCommandInfo vr_command(vr_cmd_id); sent_commands_map_[vr_corr_id] = vr_command; - LOG4CXX_DEBUG( - logger_, - "VR_command sent corr_id " << vr_corr_id << " cmd_id " << vr_corr_id); + SDL_LOG_DEBUG("VR_command sent corr_id " << vr_corr_id << " cmd_id " + << vr_corr_id); } expected_chs_count_ = chs_num; - LOG4CXX_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_); + SDL_LOG_DEBUG("expected_chs_count_ = " << expected_chs_count_); } void CreateInteractionChoiceSetRequest::ProcessHmiError( const hmi_apis::Common_Result::eType vr_result) { - LOG4CXX_DEBUG(logger_, - "Hmi response is not Success: " - << vr_result << ". Stop sending VRAddCommand requests"); + SDL_LOG_DEBUG("Hmi response is not Success: " + << vr_result << ". Stop sending VRAddCommand requests"); if (!error_from_hmi_) { error_from_hmi_ = true; std::string info = @@ -359,7 +355,7 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse( const uint32_t corr_id) { SentCommandsMap::iterator it = sent_commands_map_.find(corr_id); if (sent_commands_map_.end() == it) { - LOG4CXX_WARN(logger_, "HMI response for unknown VR command received"); + SDL_LOG_WARN("HMI response for unknown VR command received"); return false; } VRCommandInfo& vr_command = it->second; @@ -369,14 +365,13 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse( void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() { received_chs_count_++; - LOG4CXX_DEBUG(logger_, - "Got VR.AddCommand response, there are " - << expected_chs_count_ - received_chs_count_ - << " more to wait."); + SDL_LOG_DEBUG("Got VR.AddCommand response, there are " + << expected_chs_count_ - received_chs_count_ + << " more to wait."); if (received_chs_count_ < expected_chs_count_) { application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); - LOG4CXX_DEBUG(logger_, "Timeout for request was updated"); + SDL_LOG_DEBUG("Timeout for request was updated"); } else { OnAllHMIResponsesReceived(); } @@ -386,7 +381,7 @@ void CreateInteractionChoiceSetRequest::on_event( const event_engine::Event& event) { using namespace hmi_apis; using namespace helpers; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); const Common_Result::eType result = static_cast<Common_Result::eType>( @@ -412,7 +407,7 @@ void CreateInteractionChoiceSetRequest::on_event( } void CreateInteractionChoiceSetRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!error_from_hmi_) { SendResponse(false, mobile_apis::Result::GENERIC_ERROR); @@ -434,12 +429,12 @@ bool CreateInteractionChoiceSetRequest::Init() { } void CreateInteractionChoiceSetRequest::DeleteChoices() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } application->RemoveChoiceSet(choice_set_id_); @@ -455,16 +450,15 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() { msg_param[strings::cmd_id] = vr_command_info.cmd_id_; SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_param); } else { - LOG4CXX_WARN(logger_, - "succesful response has not been received for cmd_id = " - << vr_command_info.cmd_id_); + SDL_LOG_WARN("succesful response has not been received for cmd_id = " + << vr_command_info.cmd_id_); } } sent_commands_map_.clear(); } void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!error_from_hmi_ && should_send_warnings_) { SendResponse(true, mobile_apis::Result::WARNINGS, kInvalidImageWarningInfo); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc index 43dba2f238..5b274adeb3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,12 +58,12 @@ CreateInteractionChoiceSetResponse::CreateInteractionChoiceSetResponse( CreateInteractionChoiceSetResponse::~CreateInteractionChoiceSetResponse() {} void CreateInteractionChoiceSetResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // check if response false if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOG4CXX_ERROR(logger_, "Success = false"); + SDL_LOG_ERROR("Success = false"); SendResponse(false); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc index b69b0ee801..2a0ca4ddb3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc @@ -45,6 +45,8 @@ using app_mngr::ApplicationSharedPtr; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + CreateWindowRequest::CreateWindowRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -64,17 +66,15 @@ bool CreateWindowRequest::CheckWindowName( const app_mngr::WindowID window_id, const std::string& window_name) const { if (mobile_apis::PredefinedWindows::PRIMARY_WIDGET == window_id) { - LOG4CXX_DEBUG(logger_, - "Window name check is ignored for the primary widgets"); + SDL_LOG_DEBUG("Window name check is ignored for the primary widgets"); return true; } const bool names_are_equal = window_name == app->name().c_str(); if (names_are_equal && mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) { - LOG4CXX_ERROR(logger_, - "Regular widget can't have the same name as application: " - << window_name); + SDL_LOG_ERROR("Regular widget can't have the same name as application: " + << window_name); return false; } @@ -132,12 +132,12 @@ app_mngr::WindowID CreateWindowRequest::window_id() const { } void CreateWindowRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -145,8 +145,7 @@ void CreateWindowRequest::Run() { const auto window_id = (*message_)[strings::msg_params][strings::window_id].asInt(); if (application->WindowIdExists(window_id)) { - LOG4CXX_ERROR(logger_, - "Window with id #" << window_id << " does already exist"); + SDL_LOG_ERROR("Window with id #" << window_id << " does already exist"); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -155,7 +154,7 @@ void CreateWindowRequest::Run() { (*message_)[strings::msg_params][strings::window_type].asInt(); if (mobile_apis::WindowType::eType::MAIN == window_type) { - LOG4CXX_ERROR(logger_, "MAIN application window already exists"); + SDL_LOG_ERROR("MAIN application window already exists"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -167,8 +166,7 @@ void CreateWindowRequest::Run() { [strings::duplicate_updates_from_window_id] .asInt(); if (!application->WindowIdExists(duplicate_updates_from_window_id)) { - LOG4CXX_ERROR(logger_, - "Window with id #" << duplicate_updates_from_window_id + SDL_LOG_ERROR("Window with id #" << duplicate_updates_from_window_id << " does not exist"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; @@ -178,8 +176,7 @@ void CreateWindowRequest::Run() { const std::string window_name = (*message_)[strings::msg_params][strings::window_name].asString(); if (!CheckWindowName(application, window_id, window_name)) { - LOG4CXX_ERROR(logger_, - "Window name \"" << window_name + SDL_LOG_ERROR("Window name \"" << window_name << "\" is disallowed for window #" << window_id); SendResponse(false, mobile_apis::Result::DUPLICATE_NAME); @@ -198,22 +195,22 @@ void CreateWindowRequest::Run() { } void CreateWindowRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (hmi_apis::FunctionID::UI_CreateWindow != event.id()) { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } auto application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } - LOG4CXX_INFO(logger_, "Received CreateWindow event"); + SDL_LOG_INFO("Received CreateWindow event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); const smart_objects::SmartObject& response_message = event.smart_object(); @@ -226,7 +223,7 @@ void CreateWindowRequest::on_event(const event_engine::Event& event) { GetInfo(response_message, response_info); if (!is_success) { - LOG4CXX_ERROR(logger_, "CreateWindow request has failed on HMI side"); + SDL_LOG_ERROR("CreateWindow request has failed on HMI side"); SendResponse(is_success, result_code, response_info.empty() ? nullptr : response_info.c_str()); @@ -247,7 +244,7 @@ bool CreateWindowRequest::Init() { bool CreateWindowRequest::IsWindowForAssociatedServiceCreated( app_mngr::ApplicationSharedPtr app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto window_optional_params_map = app->window_optional_params_map().GetData(); @@ -266,8 +263,7 @@ bool CreateWindowRequest::IsWindowForAssociatedServiceCreated( window_optional_params_map.end(), [&associated_service_type]( const std::pair<WindowID, smart_objects::SmartObjectSPtr>& element) { - LOG4CXX_DEBUG(logger_, - "Searching for " << associated_service_type + SDL_LOG_DEBUG("Searching for " << associated_service_type << " in window info for id " << element.first); if (element.second->keyExists(strings::associated_service_type) && @@ -285,7 +281,7 @@ bool CreateWindowRequest::IsWindowForAssociatedServiceCreated( bool CreateWindowRequest::DoesExceedMaxAllowedWindows( app_mngr::ApplicationSharedPtr app) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto get_current_number_of_windows = [&app](const mobile_apis::WindowType::eType window_type) -> size_t { @@ -298,7 +294,7 @@ bool CreateWindowRequest::DoesExceedMaxAllowedWindows( } default: { - LOG4CXX_WARN(logger_, "Unknown window type"); + SDL_LOG_WARN("Unknown window type"); return 0u; } } @@ -313,7 +309,7 @@ bool CreateWindowRequest::DoesExceedMaxAllowedWindows( } if (!display_capabilities) { - LOG4CXX_WARN(logger_, "Application has no capabilities"); + SDL_LOG_WARN("Application has no capabilities"); return false; } @@ -337,7 +333,7 @@ bool CreateWindowRequest::DoesExceedMaxAllowedWindows( }); if (find_res == windowTypeSupported->end()) { - LOG4CXX_WARN(logger_, "Requested Window Type is not supported by the HMI"); + SDL_LOG_WARN("Requested Window Type is not supported by the HMI"); return true; } @@ -351,11 +347,11 @@ bool CreateWindowRequest::DoesExceedMaxAllowedWindows( bool CreateWindowRequest::ValidateWindowCreation( app_mngr::ApplicationSharedPtr app, const WindowID window_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (DoesExceedMaxAllowedWindows(app)) { std::string info("Maximum allowed amount of windows is exceeded"); - LOG4CXX_WARN(logger_, info); + SDL_LOG_WARN(info); SendResponse(false, mobile_apis::Result::REJECTED, info.c_str()); return false; } @@ -363,7 +359,7 @@ bool CreateWindowRequest::ValidateWindowCreation( if (IsWindowForAssociatedServiceCreated(app)) { std::string info( "Window for this associated service type is already created"); - LOG4CXX_WARN(logger_, info); + SDL_LOG_WARN(info); SendResponse(false, mobile_apis::Result::REJECTED, info.c_str()); return false; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc index 0d9bbc2815..830539b355 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + CreateWindowResponse::CreateWindowResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ CreateWindowResponse::CreateWindowResponse( CreateWindowResponse::~CreateWindowResponse() {} void CreateWindowResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc index 363b14f92f..6b6f500602 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc @@ -44,6 +44,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DeleteCommandRequest::DeleteCommandRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -65,13 +67,13 @@ DeleteCommandRequest::DeleteCommandRequest( DeleteCommandRequest::~DeleteCommandRequest() {} void DeleteCommandRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -82,7 +84,7 @@ void DeleteCommandRequest::Run() { smart_objects::SmartObject* command = application->FindCommand(cmd_id); if (!command) { - LOG4CXX_ERROR(logger_, "Command with id " << cmd_id << " is not found."); + SDL_LOG_ERROR("Command with id " << cmd_id << " is not found."); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -142,17 +144,17 @@ bool DeleteCommandRequest::PrepareResponseParameters( ui_delete_info, ui_info_, vr_delete_info, vr_info_); if (is_vr_or_ui_warning && !ui_delete_info.is_unsupported_resource && !vr_delete_info.is_unsupported_resource) { - LOG4CXX_DEBUG(logger_, "VR or UI result is warning"); + SDL_LOG_DEBUG("VR or UI result is warning"); result_code = mobile_apis::Result::WARNINGS; return result; } result_code = PrepareResultCodeForResponse(ui_delete_info, vr_delete_info); - LOG4CXX_DEBUG(logger_, "Result is " << (result ? "true" : "false")); + SDL_LOG_DEBUG("Result is " << (result ? "true" : "false")); return result; } void DeleteCommandRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -161,9 +163,8 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - LOG4CXX_DEBUG(logger_, - "Received UI_DeleteCommand event with result " - << MessageHelper::HMIResultToString(ui_result_)); + SDL_LOG_DEBUG("Received UI_DeleteCommand event with result " + << MessageHelper::HMIResultToString(ui_result_)); GetInfo(message, ui_info_); break; } @@ -172,20 +173,19 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { is_vr_received_ = true; vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); - LOG4CXX_DEBUG(logger_, - "Received VR_DeleteCommand event with result " - << MessageHelper::HMIResultToString(vr_result_)); + SDL_LOG_DEBUG("Received VR_DeleteCommand event with result " + << MessageHelper::HMIResultToString(vr_result_)); GetInfo(message, vr_info_); break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } if (IsPendingResponseExist()) { - LOG4CXX_DEBUG(logger_, "Still awaiting for other responses."); + SDL_LOG_DEBUG("Still awaiting for other responses."); return; } @@ -193,7 +193,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); return; } smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -203,8 +203,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { smart_objects::SmartObject* command = application->FindCommand(cmd_id); if (!command) { - LOG4CXX_ERROR(logger_, - "Command id " << cmd_id + SDL_LOG_ERROR("Command id " << cmd_id << " not found for " "application with connection key " << connection_key()); @@ -227,7 +226,7 @@ bool DeleteCommandRequest::Init() { } bool DeleteCommandRequest::IsPendingResponseExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return is_ui_send_ != is_ui_received_ || is_vr_send_ != is_vr_received_; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc index 919385ee50..80497241e3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DeleteCommandResponse::DeleteCommandResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ DeleteCommandResponse::DeleteCommandResponse( DeleteCommandResponse::~DeleteCommandResponse() {} void DeleteCommandResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc index 46af8353b7..127843813c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DeleteFileRequest::DeleteFileRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,14 +59,14 @@ DeleteFileRequest::DeleteFileRequest( DeleteFileRequest::~DeleteFileRequest() {} void DeleteFileRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); return; } @@ -75,8 +77,7 @@ void DeleteFileRequest::Run() { application->delete_file_in_none_count())) { // If application is in the HMI_NONE level the quantity of allowed // DeleteFile request is limited by the configuration profile - LOG4CXX_ERROR(logger_, - "Too many requests from the app with HMILevel HMI_NONE "); + SDL_LOG_ERROR("Too many requests from the app with HMILevel HMI_NONE"); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -86,7 +87,7 @@ void DeleteFileRequest::Run() { if (!file_system::IsFileNameValid(sync_file_name)) { const std::string err_msg = "Sync file name contains forbidden symbols."; - LOG4CXX_ERROR(logger_, err_msg); + SDL_LOG_ERROR(err_msg); SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc index 732a1e56b5..7f9181e29a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DeleteFileResponse::DeleteFileResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,12 +57,12 @@ DeleteFileResponse::DeleteFileResponse( DeleteFileResponse::~DeleteFileResponse() {} void DeleteFileResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application not registered"); + SDL_LOG_ERROR("Application not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc index 7950595b1c..6c52d60007 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -43,6 +43,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -58,14 +60,13 @@ DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest( DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {} void DeleteInteractionChoiceSetRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR( - logger_, - "No application associated with connection key " << connection_key()); + SDL_LOG_ERROR("No application associated with connection key " + << connection_key()); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -75,14 +76,13 @@ void DeleteInteractionChoiceSetRequest::Run() { .asInt(); if (!app->FindChoiceSet(choice_set_id)) { - LOG4CXX_ERROR(logger_, - "Choice set with id " << choice_set_id << " is not found."); + SDL_LOG_ERROR("Choice set with id " << choice_set_id << " is not found."); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } if (ChoiceSetInUse(app)) { - LOG4CXX_ERROR(logger_, "Choice set currently in use."); + SDL_LOG_ERROR("Choice set currently in use."); SendResponse(false, mobile_apis::Result::IN_USE); return; } @@ -108,7 +108,7 @@ bool DeleteInteractionChoiceSetRequest::Init() { bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( ApplicationConstSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!app->is_perform_interaction_active()) { return false; } @@ -126,8 +126,7 @@ bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( PerformChoice::const_iterator choice_it = choice.begin(); for (; choice.end() != choice_it; ++choice_it) { if (choice_it->first == choice_set_id) { - LOG4CXX_ERROR(logger_, - "Choice set with id " << choice_set_id << " is in use."); + SDL_LOG_ERROR("Choice set with id " << choice_set_id << " is in use."); return true; } } @@ -137,7 +136,7 @@ bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand( application_manager::ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint32_t choice_set_id = (*message_)[strings::msg_params][strings::interaction_choice_set_id] @@ -146,8 +145,7 @@ void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand( smart_objects::SmartObject* choice_set = app->FindChoiceSet(choice_set_id); if (!choice_set) { - LOG4CXX_ERROR(logger_, - "Choice set with id " << choice_set_id << " is not found."); + SDL_LOG_ERROR("Choice set with id " << choice_set_id << " is not found."); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc index cf5ad3a2c2..5aaa896b02 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,12 +59,12 @@ DeleteInteractionChoiceSetResponse::DeleteInteractionChoiceSetResponse( DeleteInteractionChoiceSetResponse::~DeleteInteractionChoiceSetResponse() {} void DeleteInteractionChoiceSetResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // check if response false if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOG4CXX_ERROR(logger_, "Success = false"); + SDL_LOG_ERROR("Success = false"); SendResponse(false); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc index 383daa9b83..b4a1d7f0c1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc @@ -44,6 +44,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DeleteSubMenuRequest::DeleteSubMenuRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -59,13 +61,13 @@ DeleteSubMenuRequest::DeleteSubMenuRequest( DeleteSubMenuRequest::~DeleteSubMenuRequest() {} void DeleteSubMenuRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); return; } @@ -73,7 +75,7 @@ void DeleteSubMenuRequest::Run() { (*message_)[strings::msg_params][strings::menu_id].asInt(); if (!app->FindSubMenu(menu_id)) { - LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found."); + SDL_LOG_ERROR("Menu with id " << menu_id << " is not found."); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -92,13 +94,13 @@ void DeleteSubMenuRequest::Run() { void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app, uint32_t parentID, const SubMenuMap& subMenus) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SubMenuMap::const_iterator it = subMenus.begin(); - LOG4CXX_DEBUG(logger_, "Delete Submenus with Parent ID: " << parentID); + SDL_LOG_DEBUG("Delete Submenus with Parent ID: " << parentID); while (subMenus.end() != it) { if (!(*it->second).keyExists(strings::parent_id)) { - LOG4CXX_ERROR(logger_, "parent ID does not exist"); + SDL_LOG_ERROR("parent ID does not exist"); ++it; continue; } @@ -114,7 +116,7 @@ void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app, msg_params[strings::app_id] = app->app_id(); SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params); ++it; - LOG4CXX_DEBUG(logger_, "Removing submenuID: " << menuID); + SDL_LOG_DEBUG("Removing submenuID: " << menuID); app->RemoveSubMenu(menuID); } else { ++it; @@ -124,7 +126,7 @@ void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app, void DeleteSubMenuRequest::DeleteSubMenuVRCommands( ApplicationConstSharedPtr app, uint32_t parentID) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const DataAccessor<CommandsMap> accessor = app->commands_map(); const CommandsMap& commands = accessor.GetData(); @@ -151,15 +153,16 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands( void DeleteSubMenuRequest::DeleteSubMenuUICommands( ApplicationSharedPtr const app, uint32_t parentID) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Delete UI Commands with Parent ID: " << parentID); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Delete UI Commands with Parent ID: " << parentID); + const DataAccessor<CommandsMap> accessor(app->commands_map()); const CommandsMap& commands = accessor.GetData(); CommandsMap::const_iterator it = commands.begin(); while (commands.end() != it) { if (!(*it->second).keyExists(strings::menu_params)) { - LOG4CXX_ERROR(logger_, "menu_params not exist"); + SDL_LOG_ERROR("menu_params not exist"); ++it; continue; } @@ -171,7 +174,7 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands( const uint32_t cmd_id = (*it->second)[strings::cmd_id].asUInt(); msg_params[strings::app_id] = app->app_id(); msg_params[strings::cmd_id] = cmd_id; - LOG4CXX_DEBUG(logger_, "Removing UI Command: " << cmd_id); + SDL_LOG_DEBUG("Removing UI Command: " << cmd_id); app->RemoveCommand(cmd_id); app->help_prompt_manager().OnVrCommandDeleted(cmd_id, false); it = commands.begin(); // Can not relay on @@ -185,7 +188,7 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands( } void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -203,7 +206,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } @@ -227,7 +230,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc index 3cefef5c38..25c4dc7cb9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DeleteSubMenuResponse::DeleteSubMenuResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ DeleteSubMenuResponse::DeleteSubMenuResponse( DeleteSubMenuResponse::~DeleteSubMenuResponse() {} void DeleteSubMenuResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc index 7f253e25fd..214a9c2bab 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DeleteWindowRequest::DeleteWindowRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -58,13 +60,12 @@ bool DeleteWindowRequest::CheckWindowId( const WindowID window_id = (*message_)[strings::msg_params][strings::window_id].asInt(); if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) { - LOG4CXX_ERROR(logger_, "Main application window can't be deleted"); + SDL_LOG_ERROR("Main application window can't be deleted"); return false; } if (!app->WindowIdExists(window_id)) { - LOG4CXX_ERROR(logger_, - "Window with id #" << window_id << " does not exist"); + SDL_LOG_ERROR("Window with id #" << window_id << " does not exist"); return false; } @@ -85,13 +86,13 @@ void DeleteWindowRequest::DeleteWindow( } void DeleteWindowRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -109,10 +110,10 @@ void DeleteWindowRequest::Run() { } void DeleteWindowRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (hmi_apis::FunctionID::UI_DeleteWindow != event.id()) { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } @@ -120,12 +121,12 @@ void DeleteWindowRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } - LOG4CXX_INFO(logger_, "Received DeleteWindow event"); + SDL_LOG_INFO("Received DeleteWindow event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); const smart_objects::SmartObject& response_message = event.smart_object(); @@ -138,7 +139,7 @@ void DeleteWindowRequest::on_event(const event_engine::Event& event) { GetInfo(response_message, response_info); if (!is_success) { - LOG4CXX_ERROR(logger_, "DeleteWindow request has failed on HMI side"); + SDL_LOG_ERROR("DeleteWindow request has failed on HMI side"); SendResponse(is_success, result_code, response_info.empty() ? nullptr : response_info.c_str()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc index f9ac9a46d6..1703623a38 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DeleteWindowResponse::DeleteWindowResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ DeleteWindowResponse::DeleteWindowResponse( DeleteWindowResponse::~DeleteWindowResponse() {} void DeleteWindowResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc index 1de7a3ea03..f0ef2e0028 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DialNumberRequest::DialNumberRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ DialNumberRequest::DialNumberRequest( DialNumberRequest::~DialNumberRequest() {} bool DialNumberRequest::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); default_timeout_ = 0; @@ -64,13 +66,13 @@ bool DialNumberRequest::Init() { } void DialNumberRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -78,15 +80,14 @@ void DialNumberRequest::Run() { std::string number = (*message_)[strings::msg_params][strings::number].asString(); if (!CheckSyntax(number)) { - LOG4CXX_ERROR(logger_, "Invalid incoming data"); + SDL_LOG_ERROR("Invalid incoming data"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } StripNumberParam(number); if (number.empty()) { - LOG4CXX_ERROR(logger_, - "After strip number param is empty. Invalid incoming data"); + SDL_LOG_ERROR("After strip number param is empty. Invalid incoming data"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -102,12 +103,12 @@ void DialNumberRequest::Run() { } void DialNumberRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } @@ -115,7 +116,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) { mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; switch (event.id()) { case hmi_apis::FunctionID::BasicCommunication_DialNumber: { - LOG4CXX_INFO(logger_, "Received DialNumber event"); + SDL_LOG_INFO("Received DialNumber event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); result_code = CommandRequestImpl::GetMobileResultCode( static_cast<hmi_apis::Common_Result::eType>( @@ -123,7 +124,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc index 4385b3fe90..4bbe5e2eb7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DialNumberResponse::DialNumberResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ DialNumberResponse::DialNumberResponse( DialNumberResponse::~DialNumberResponse() {} void DialNumberResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc index 66ff7b48d5..f5506503e9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + EndAudioPassThruRequest::EndAudioPassThruRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,14 +56,14 @@ EndAudioPassThruRequest::EndAudioPassThruRequest( EndAudioPassThruRequest::~EndAudioPassThruRequest() {} void EndAudioPassThruRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_EndAudioPassThru, NULL, true); } void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -89,7 +91,7 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc index 6c9bd05e09..8e5672bfd9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + EndAudioPassThruResponse::EndAudioPassThruResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ EndAudioPassThruResponse::EndAudioPassThruResponse( EndAudioPassThruResponse::~EndAudioPassThruResponse() {} void EndAudioPassThruResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc index c5e94da378..585636bfa8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc @@ -6,6 +6,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -21,11 +23,11 @@ GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest( GetCloudAppPropertiesRequest::~GetCloudAppPropertiesRequest() {} void GetCloudAppPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -83,7 +85,7 @@ void GetCloudAppPropertiesRequest::Run() { void GetCloudAppPropertiesRequest::on_event( const app_mngr::event_engine::Event& event) { - LOG4CXX_INFO(logger_, "GetCloudAppPropertiesRequest on_event"); + SDL_LOG_INFO("GetCloudAppPropertiesRequest on_event"); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc index f50897303a..35bdaaeb44 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc @@ -7,6 +7,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetCloudAppPropertiesResponse::GetCloudAppPropertiesResponse( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -22,7 +24,7 @@ GetCloudAppPropertiesResponse::GetCloudAppPropertiesResponse( GetCloudAppPropertiesResponse::~GetCloudAppPropertiesResponse() {} void GetCloudAppPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc index 75263494c2..620d901f3c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc @@ -59,6 +59,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetFileRequest::GetFileRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -85,8 +87,7 @@ bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) { if ((*message_)[strings::msg_params].keyExists(strings::app_service_id)) { std::string service_id = (*message_)[strings::msg_params][strings::app_service_id].asString(); - LOG4CXX_DEBUG(logger_, - "Finding storage directory for service id: " << service_id); + SDL_LOG_DEBUG("Finding storage directory for service id: " << service_id); AppService* app_service_info = application_manager_.GetAppServiceManager().FindServiceByID(service_id); @@ -101,7 +102,7 @@ bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) { return false; } } else { - LOG4CXX_DEBUG(logger_, "Using current storage directory"); + SDL_LOG_DEBUG("Using current storage directory"); } ApplicationSharedPtr app = application_manager_.application(connect_key); @@ -110,15 +111,15 @@ bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) { } void GetFileRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_INFO(logger_, "Received GetFile request"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_INFO("Received GetFile request"); ApplicationSharedPtr app = application_manager_.application(connection_key()); smart_objects::SmartObject response_params = smart_objects::SmartObject(smart_objects::SmartType_Map); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -126,8 +127,7 @@ void GetFileRequest::Run() { file_name_ = (*message_)[strings::msg_params][strings::file_name].asString(); if (!file_system::IsFileNameValid(file_name_)) { - LOG4CXX_ERROR(logger_, - "File name " << file_name_ << " contains forbidden symbols."); + SDL_LOG_ERROR("File name " << file_name_ << " contains forbidden symbols."); SendResponse(false, mobile_apis::Result::INVALID_DATA, "File name contains forbidden symbols", @@ -136,7 +136,7 @@ void GetFileRequest::Run() { } // Initialize other params with default values. If exists overwrite the values - LOG4CXX_DEBUG(logger_, "Intialize non manadatory params with default values"); + SDL_LOG_DEBUG("Intialize non manadatory params with default values"); if ((*message_)[strings::msg_params].keyExists(strings::file_type)) { file_type_ = static_cast<mobile_apis::FileType::eType>( @@ -145,13 +145,13 @@ void GetFileRequest::Run() { // Check if file exists on system (may have to use app service id to get the // correct app folder) - LOG4CXX_DEBUG(logger_, "Check if file exists on system"); + SDL_LOG_DEBUG("Check if file exists on system"); std::string file_path; bool forward_to_hmi; if (GetFilePath(file_path, forward_to_hmi)) { if (forward_to_hmi) { - LOG4CXX_DEBUG(logger_, "Forwarding GetFile request to HMI"); + SDL_LOG_DEBUG("Forwarding GetFile request to HMI"); application_manager_.IncreaseForwardedRequestTimeout(connection_key(), correlation_id()); SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_GetFilePath, @@ -160,7 +160,7 @@ void GetFileRequest::Run() { return; } } else { - LOG4CXX_ERROR(logger_, "Could not get file path"); + SDL_LOG_ERROR("Could not get file path"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Could not get file path", @@ -170,7 +170,7 @@ void GetFileRequest::Run() { const std::string full_path = file_path + "/" + file_name_; if (!file_system::FileExists(full_path)) { - LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist"); + SDL_LOG_ERROR("File " << full_path << " does not exist"); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "File does not exist", @@ -179,7 +179,7 @@ void GetFileRequest::Run() { } // Handle offset - LOG4CXX_DEBUG(logger_, "Handle offset and length parameters"); + SDL_LOG_DEBUG("Handle offset and length parameters"); const uint64_t file_size = file_system::FileSize(full_path); if ((*message_)[strings::msg_params].keyExists(strings::offset)) { @@ -195,9 +195,8 @@ void GetFileRequest::Run() { } if (offset_ > file_size) { - LOG4CXX_ERROR( - logger_, - "Offset " << offset_ << " greater than file size " << file_size); + SDL_LOG_ERROR("Offset " << offset_ << " greater than file size " + << file_size); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Offset greater than file size", @@ -205,8 +204,7 @@ void GetFileRequest::Run() { return; } if (length_ > file_size - offset_) { - LOG4CXX_ERROR(logger_, - "Length " << length_ << " greater than file size - offset" + SDL_LOG_ERROR("Length " << length_ << " greater than file size - offset" << file_size); SendResponse(false, mobile_apis::Result::INVALID_DATA, @@ -216,10 +214,10 @@ void GetFileRequest::Run() { } // Load data from file as binary data - LOG4CXX_DEBUG(logger_, "Load binary data from file"); + SDL_LOG_DEBUG("Load binary data from file"); std::vector<uint8_t> bin_data; if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) { - LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path); + SDL_LOG_ERROR("Failed to read from file: " << full_path); SendResponse(false, mobile_apis::Result::GENERIC_ERROR, "Unable to read from file", @@ -248,7 +246,7 @@ void GetFileRequest::Run() { } void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (hmi_apis::FunctionID::BasicCommunication_GetFilePath != event.id()) { return; @@ -287,7 +285,7 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) { event_message[strings::msg_params][strings::file_path].asString(); if (!file_system::FileExists(full_path)) { - LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist"); + SDL_LOG_ERROR("File " << full_path << " does not exist"); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "File does not exist", @@ -309,9 +307,8 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) { } if (offset_ > file_size) { - LOG4CXX_ERROR( - logger_, - "Offset " << offset_ << " greater than file size " << file_size); + SDL_LOG_ERROR("Offset " << offset_ << " greater than file size " + << file_size); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Offset greater than file size", @@ -319,8 +316,7 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) { return; } if (length_ > file_size - offset_) { - LOG4CXX_ERROR(logger_, - "Length " << length_ << " greater than file size - offset" + SDL_LOG_ERROR("Length " << length_ << " greater than file size - offset" << file_size); SendResponse(false, mobile_apis::Result::INVALID_DATA, @@ -329,7 +325,7 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) { return; } if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) { - LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path); + SDL_LOG_ERROR("Failed to read from file: " << full_path); SendResponse(false, mobile_apis::Result::GENERIC_ERROR, "Failed to read from file", @@ -341,7 +337,7 @@ void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) { response_params[strings::crc32_check_sum] = crc_calculated; } else { - LOG4CXX_ERROR(logger_, "HMI did not return a file path: "); + SDL_LOG_ERROR("HMI did not return a file path: "); SendResponse(false, mobile_apis::Result::INVALID_DATA, "HMI did not return a file path", diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc index 2ea8dde02a..55f6e0b8a0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc @@ -39,6 +39,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetFileResponse::GetFileResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,8 +56,8 @@ GetFileResponse::GetFileResponse( GetFileResponse::~GetFileResponse() {} void GetFileResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_INFO(logger_, "Sending GetFile response"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_INFO("Sending GetFile response"); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index 8b557efc5d..1cd4806f7e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetSystemCapabilityRequest::GetSystemCapabilityRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,18 +59,18 @@ GetSystemCapabilityRequest::GetSystemCapabilityRequest( GetSystemCapabilityRequest::~GetSystemCapabilityRequest() {} void GetSystemCapabilityRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if ((*message_)[strings::msg_params].empty()) { - LOG4CXX_ERROR(logger_, strings::msg_params << " is empty."); + SDL_LOG_ERROR(strings::msg_params << " is empty."); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -181,7 +183,7 @@ void GetSystemCapabilityRequest::Run() { if (!capabilities) { SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE); - LOG4CXX_INFO(logger_, "system_display_capabilities are not available"); + SDL_LOG_INFO("system_display_capabilities are not available"); return; } @@ -202,12 +204,10 @@ void GetSystemCapabilityRequest::Run() { auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); if ((*message_)[app_mngr::strings::msg_params][strings::subscribe] .asBool() == true) { - LOG4CXX_DEBUG(logger_, - "Subscribe to system capability: " << response_type); + SDL_LOG_DEBUG("Subscribe to system capability: " << response_type); ext.SubscribeTo(response_type); } else { - LOG4CXX_DEBUG(logger_, - "Unsubscribe from system capability: " << response_type); + SDL_LOG_DEBUG("Unsubscribe from system capability: " << response_type); ext.UnsubscribeFrom(response_type); } } @@ -224,7 +224,7 @@ void GetSystemCapabilityRequest::Run() { } void GetSystemCapabilityRequest::on_event(const event_engine::Event& event) { - LOG4CXX_INFO(logger_, "GetSystemCapabilityRequest on_event"); + SDL_LOG_INFO("GetSystemCapabilityRequest on_event"); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc index 5df0c72607..e20ea00a7b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetSystemCapabilityResponse::GetSystemCapabilityResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ GetSystemCapabilityResponse::GetSystemCapabilityResponse( GetSystemCapabilityResponse::~GetSystemCapabilityResponse() {} void GetSystemCapabilityResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc index cd7d7a37b7..33d3479941 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetWayPointsRequest::GetWayPointsRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,14 +58,13 @@ GetWayPointsRequest::GetWayPointsRequest( GetWayPointsRequest::~GetWayPointsRequest() {} void GetWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); + SDL_LOG_ERROR("An application with connection key " + << connection_key() << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -79,17 +80,17 @@ void GetWayPointsRequest::Run() { } void GetWayPointsRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event"); + SDL_LOG_INFO("Received UI_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::Navigation_GetWayPoints: { - LOG4CXX_INFO(logger_, "Received Navigation_GetWayPoints event"); + SDL_LOG_INFO("Received Navigation_GetWayPoints event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( @@ -105,7 +106,7 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); break; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc index e481c926b8..cbb9607d0d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetWayPointsResponse::GetWayPointsResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ GetWayPointsResponse::GetWayPointsResponse( GetWayPointsResponse::~GetWayPointsResponse() {} void GetWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc index b8714b4784..9262466e34 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc @@ -44,6 +44,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ListFilesRequest::ListFilesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -59,14 +61,14 @@ ListFilesRequest::ListFilesRequest( ListFilesRequest::~ListFilesRequest() {} void ListFilesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); return; } @@ -77,8 +79,7 @@ void ListFilesRequest::Run() { application->list_files_in_none_count())) { // If application is in the HMI_NONE level the quantity of allowed // DeleteFile request is limited by the configuration profile - LOG4CXX_ERROR(logger_, - "Too many requests from the app with HMILevel HMI_NONE "); + SDL_LOG_ERROR("Too many requests from the app with HMILevel HMI_NONE "); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -97,11 +98,10 @@ void ListFilesRequest::Run() { std::vector<std::string>::const_iterator it = persistent_files.begin(); for (; it != persistent_files.end(); ++it) { if (i < application_manager_.get_settings().list_files_response_size()) { - LOG4CXX_DEBUG(logger_, "File " + *it + " added to ListFiles response"); + SDL_LOG_DEBUG("File " + *it + " added to ListFiles response"); (*message_)[strings::msg_params][strings::filenames][i++] = *it; } else { - LOG4CXX_DEBUG(logger_, - "File " + *it + " not added to ListFiles response"); + SDL_LOG_DEBUG("File " + *it + " not added to ListFiles response"); } } (*message_)[strings::params][strings::message_type] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc index ffa8a443d5..e71c2de316 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ListFilesResponse::ListFilesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ ListFilesResponse::ListFilesResponse( ListFilesResponse::~ListFilesResponse() {} void ListFilesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc index 30d9853d97..96045552a0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc @@ -39,6 +39,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAppInterfaceUnregisteredNotification::OnAppInterfaceUnregisteredNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnAppInterfaceUnregisteredNotification:: ~OnAppInterfaceUnregisteredNotification() {} void OnAppInterfaceUnregisteredNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool final_message = IsFinalMessage(); SendNotification(final_message); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc index 3088c7df33..21a20c38c1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc @@ -37,6 +37,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnAudioPassThruNotification::OnAudioPassThruNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -52,7 +54,7 @@ OnAudioPassThruNotification::OnAudioPassThruNotification( OnAudioPassThruNotification::~OnAudioPassThruNotification() {} void OnAudioPassThruNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc index 9c4be847a1..14787d0a08 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc @@ -43,6 +43,8 @@ namespace commands { namespace mobile { +SDL_CREATE_LOG_VARIABLE("Commands") + OnButtonEventNotification::OnButtonEventNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -58,7 +60,7 @@ OnButtonEventNotification::OnButtonEventNotification( OnButtonEventNotification::~OnButtonEventNotification() {} void OnButtonEventNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint32_t btn_id = static_cast<uint32_t>( (*message_)[strings::msg_params][hmi_response::button_name].asInt()); @@ -71,7 +73,7 @@ void OnButtonEventNotification::Run() { if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { // app_id is mandatory for CUSTOM_BUTTON notification if (!is_app_id_exists) { - LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonEvent without app_id."); + SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonEvent without app_id."); return; } @@ -81,13 +83,12 @@ void OnButtonEventNotification::Run() { // custom_button_id is mandatory for CUSTOM_BUTTON notification if (false == (*message_)[strings::msg_params].keyExists( hmi_response::custom_button_id)) { - LOG4CXX_ERROR(logger_, - "CUSTOM_BUTTON OnButtonEvent without custom_button_id."); + SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonEvent without custom_button_id."); return; } if (!app) { - LOG4CXX_ERROR(logger_, "Application doesn't exist."); + SDL_LOG_ERROR("Application doesn't exist."); return; } @@ -97,8 +98,7 @@ void OnButtonEventNotification::Run() { .asUInt(); if (false == app->IsSubscribedToSoftButton(custom_btn_id)) { - LOG4CXX_ERROR(logger_, - "Application doesn't subscribed to this custom_button_id."); + SDL_LOG_ERROR("Application doesn't subscribed to this custom_button_id."); return; } @@ -106,9 +106,9 @@ void OnButtonEventNotification::Run() { (*message_)[strings::msg_params][strings::window_id] = window_id; const auto window_hmi_level = app->hmi_level(window_id); if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) { - LOG4CXX_WARN(logger_, - "CUSTOM_BUTTON OnButtonEvent notification is not allowed in " - "NONE hmi level"); + SDL_LOG_WARN( + "CUSTOM_BUTTON OnButtonEvent notification is not allowed in " + "NONE hmi level"); return; } @@ -124,7 +124,7 @@ void OnButtonEventNotification::Run() { for (; subscribed_apps.end() != it; ++it) { ApplicationSharedPtr subscribed_app = *it; if (!subscribed_app) { - LOG4CXX_WARN(logger_, "Null pointer to subscribed app."); + SDL_LOG_WARN("Null pointer to subscribed app."); continue; } @@ -134,9 +134,8 @@ void OnButtonEventNotification::Run() { mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) && (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) { - LOG4CXX_WARN(logger_, - "OnButtonEvent notification is allowed only" - << "in FULL or LIMITED hmi level"); + SDL_LOG_WARN("OnButtonEvent notification is allowed only" + << "in FULL or LIMITED hmi level"); continue; } // if OK button and "app_id" absent send notification only in HMI_FULL mode @@ -150,7 +149,7 @@ void OnButtonEventNotification::Run() { void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { if (!app) { - LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer"); + SDL_LOG_ERROR("OnButtonEvent NULL pointer"); return; } @@ -158,7 +157,7 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { std::make_shared<smart_objects::SmartObject>(); if (!on_btn_event) { - LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer"); + SDL_LOG_ERROR("OnButtonEvent NULL pointer"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc index 87d16e87e6..4444f0d156 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc @@ -44,6 +44,8 @@ namespace commands { namespace mobile { +SDL_CREATE_LOG_VARIABLE("Commands") + OnButtonPressNotification::OnButtonPressNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -59,7 +61,7 @@ OnButtonPressNotification::OnButtonPressNotification( OnButtonPressNotification::~OnButtonPressNotification() {} void OnButtonPressNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint32_t btn_id = static_cast<uint32_t>( (*message_)[strings::msg_params][hmi_response::button_name].asInt()); @@ -76,20 +78,19 @@ void OnButtonPressNotification::Run() { if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { // app_id is mandatory for CUSTOM_BUTTON notification if (!is_app_id_exists) { - LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonPress without app_id."); + SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonPress without app_id."); return; } // custom_button_id is mandatory for CUSTOM_BUTTON notification if (false == (*message_)[strings::msg_params].keyExists( hmi_response::custom_button_id)) { - LOG4CXX_ERROR(logger_, - "CUSTOM_BUTTON OnButtonPress without custom_button_id."); + SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonPress without custom_button_id."); return; } if (!app) { - LOG4CXX_ERROR(logger_, "Application doesn't exist."); + SDL_LOG_ERROR("Application doesn't exist."); return; } @@ -99,8 +100,7 @@ void OnButtonPressNotification::Run() { .asUInt(); if (false == app->IsSubscribedToSoftButton(custom_btn_id)) { - LOG4CXX_ERROR(logger_, - "Application doesn't subscribed to this custom_button_id."); + SDL_LOG_ERROR("Application doesn't subscribed to this custom_button_id."); return; } @@ -110,9 +110,9 @@ void OnButtonPressNotification::Run() { (*message_)[strings::msg_params][strings::window_id] = window_id; const auto window_hmi_level = app->hmi_level(window_id); if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) { - LOG4CXX_WARN(logger_, - "CUSTOM_BUTTON OnButtonPress notification is not allowed in " - "NONE hmi level"); + SDL_LOG_WARN( + "CUSTOM_BUTTON OnButtonPress notification is not allowed in " + "NONE hmi level"); return; } @@ -128,7 +128,7 @@ void OnButtonPressNotification::Run() { for (; subscribed_apps.end() != it; ++it) { ApplicationSharedPtr subscribed_app = *it; if (!subscribed_app) { - LOG4CXX_WARN(logger_, "Null pointer to subscribed app."); + SDL_LOG_WARN("Null pointer to subscribed app."); continue; } @@ -138,9 +138,8 @@ void OnButtonPressNotification::Run() { mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) && (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) { - LOG4CXX_WARN(logger_, - "OnButtonPress notification is allowed only" - << "in FULL or LIMITED hmi level"); + SDL_LOG_WARN("OnButtonPress notification is allowed only " + << "in FULL or LIMITED hmi level"); continue; } // if "appID" is present, send it to named app only if its FULL or @@ -160,7 +159,7 @@ void OnButtonPressNotification::Run() { void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { if (!app) { - LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer"); + SDL_LOG_ERROR("OnButtonPress NULL pointer"); return; } @@ -168,7 +167,7 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { std::make_shared<smart_objects::SmartObject>(); if (!on_btn_press) { - LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer"); + SDL_LOG_ERROR("OnButtonPress NULL pointer"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc index 9c7edf74e6..afd73e7e4a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnCommandNotification::OnCommandNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,13 +57,13 @@ OnCommandNotification::OnCommandNotification( OnCommandNotification::~OnCommandNotification() {} void OnCommandNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::msg_params][strings::app_id].asInt()); if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); + SDL_LOG_ERROR("No application associated with session key"); return; } @@ -69,7 +71,7 @@ void OnCommandNotification::Run() { (*message_)[strings::msg_params][strings::cmd_id].asUInt(); if (!app->FindCommand(cmd_id)) { - LOG4CXX_ERROR(logger_, " No applications found for the command " << cmd_id); + SDL_LOG_ERROR("No applications found for the command " << cmd_id); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc index 42a1928f2e..960f9d9630 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc @@ -43,6 +43,8 @@ namespace commands { namespace mobile { +SDL_CREATE_LOG_VARIABLE("Commands") + OnDriverDistractionNotification::OnDriverDistractionNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -58,7 +60,7 @@ OnDriverDistractionNotification::OnDriverDistractionNotification( OnDriverDistractionNotification::~OnDriverDistractionNotification() {} void OnDriverDistractionNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc index c2ce2550b9..873e9f1788 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc @@ -45,6 +45,8 @@ namespace commands { namespace mobile { +SDL_CREATE_LOG_VARIABLE("Commands") + OnHashChangeNotification::OnHashChangeNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -60,7 +62,7 @@ OnHashChangeNotification::OnHashChangeNotification( OnHashChangeNotification::~OnHashChangeNotification() {} void OnHashChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); @@ -72,8 +74,7 @@ void OnHashChangeNotification::Run() { (*message_)[strings::msg_params][strings::hash_id] = app->curHash(); SendNotification(); } else { - LOG4CXX_WARN(logger_, - "Application with app_id " << app_id << " does not exist"); + SDL_LOG_WARN("Application with app_id " << app_id << " does not exist"); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc index df3bce0154..66a0fbb3f6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc @@ -41,6 +41,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnHMIStatusNotification::OnHMIStatusNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,20 +58,20 @@ OnHMIStatusNotification::OnHMIStatusNotification( OnHMIStatusNotification::~OnHMIStatusNotification() {} void OnHMIStatusNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (app.use_count() == 0) { - LOG4CXX_ERROR(logger_, "OnHMIStatusNotification application doesn't exist"); + SDL_LOG_ERROR("OnHMIStatusNotification application doesn't exist"); return; } // If the response has no hmi level, return and don't send the notification if (!(*message_)[strings::msg_params].keyExists(strings::hmi_level)) { // our notification clearly isn't well-formed - LOG4CXX_ERROR(logger_, "OnHMIStatusNotification has no hmiLevel field"); + SDL_LOG_ERROR("OnHMIStatusNotification has no hmiLevel field"); return; } @@ -82,8 +84,7 @@ void OnHMIStatusNotification::Run() { (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) { if (!(app->tts_properties_in_full())) { app->set_tts_properties_in_full(true); - LOG4CXX_INFO(logger_, - "OnHMIStatusNotification AddAppToTTSGlobalPropertiesList"); + SDL_LOG_INFO("OnHMIStatusNotification AddAppToTTSGlobalPropertiesList"); application_manager_.AddAppToTTSGlobalPropertiesList(app->app_id()); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc index 28325a40f5..2263e4b989 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc @@ -39,6 +39,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,15 +56,15 @@ OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile( OnHMIStatusNotificationFromMobile::~OnHMIStatusNotificationFromMobile() {} void OnHMIStatusNotificationFromMobile::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (app.use_count() == 0) { - LOG4CXX_ERROR( - logger_, "OnHMIStatusNotificationFromMobile application doesn't exist"); + SDL_LOG_ERROR( + "OnHMIStatusNotificationFromMobile application doesn't exist"); return; } @@ -79,9 +81,8 @@ void OnHMIStatusNotificationFromMobile::Run() { bool is_apps_requested_before = application_manager_.IsAppsQueriedFrom(handle); - LOG4CXX_DEBUG(logger_, - "Mobile HMI state notication came for connection key:" - << connection_key() << " and handle: " << handle); + SDL_LOG_DEBUG("Mobile HMI state notification came for connection key: " + << connection_key() << " and handle: " << handle); if (!is_apps_requested_before && Message::is_sufficient_version( @@ -96,10 +97,10 @@ void OnHMIStatusNotificationFromMobile::Run() { } if (is_apps_requested_before) { - LOG4CXX_DEBUG(logger_, - "Remote apps list had been requested already " - " for handle: " - << handle); + SDL_LOG_DEBUG( + "Remote apps list had been requested already " + "for handle: " + << handle); if (Message::is_sufficient_version( protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc index 1c0609e17d..38f346ac5c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc @@ -43,6 +43,8 @@ namespace commands { namespace mobile { +SDL_CREATE_LOG_VARIABLE("Commands") + OnKeyBoardInputNotification::OnKeyBoardInputNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -58,7 +60,7 @@ OnKeyBoardInputNotification::OnKeyBoardInputNotification( OnKeyBoardInputNotification::~OnKeyBoardInputNotification() {} void OnKeyBoardInputNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app_to_notify; @@ -70,15 +72,14 @@ void OnKeyBoardInputNotification::Run() { if (app->is_perform_interaction_active() && (*it)->perform_interaction_layout() == mobile_apis::LayoutMode::KEYBOARD) { - LOG4CXX_INFO(logger_, - "There is application with active PerformInteraction"); + SDL_LOG_INFO("There is application with active PerformInteraction"); app_to_notify = app; break; } if (mobile_apis::HMILevel::eType::HMI_FULL == app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) { - LOG4CXX_INFO(logger_, "There is application in HMI_FULL level"); + SDL_LOG_INFO("There is application in HMI_FULL level"); app_to_notify = app; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc index 9605fd6074..363ea9bbc3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnLanguageChangeNotification::OnLanguageChangeNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnLanguageChangeNotification::OnLanguageChangeNotification( OnLanguageChangeNotification::~OnLanguageChangeNotification() {} void OnLanguageChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc index f64ca34bf2..7c0c27040d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnPermissionsChangeNotification::OnPermissionsChangeNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ OnPermissionsChangeNotification::OnPermissionsChangeNotification( OnPermissionsChangeNotification::~OnPermissionsChangeNotification() {} void OnPermissionsChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_subtle_alert_pressed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_subtle_alert_pressed_notification.cc index ce1d1b16d1..6cbd391070 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_subtle_alert_pressed_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_subtle_alert_pressed_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSubtleAlertPressedNotification::OnSubtleAlertPressedNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,13 +55,13 @@ OnSubtleAlertPressedNotification::OnSubtleAlertPressedNotification( OnSubtleAlertPressedNotification::~OnSubtleAlertPressedNotification() {} void OnSubtleAlertPressedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::msg_params][strings::app_id].asInt()); if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); + SDL_LOG_ERROR("No application associated with session key"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc index cc6ab7b65b..6c16e1156e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -13,6 +13,8 @@ using namespace application_manager; namespace commands { namespace mobile { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSystemCapabilityUpdatedNotification::OnSystemCapabilityUpdatedNotification( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -29,7 +31,7 @@ OnSystemCapabilityUpdatedNotification:: ~OnSystemCapabilityUpdatedNotification() {} void OnSystemCapabilityUpdatedNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; const auto system_capability_type = @@ -117,9 +119,8 @@ void OnSystemCapabilityUpdatedNotification::Run() { app_services->end(), matching_service_predicate); if (it != app_services->end()) { - LOG4CXX_DEBUG( - logger_, - "Replacing updated record with service_id " << service_id); + SDL_LOG_DEBUG("Replacing updated record with service_id " + << service_id); app_services->erase(it); } app_services->push_back(updated_capabilities[i]); @@ -136,11 +137,10 @@ void OnSystemCapabilityUpdatedNotification::Run() { } default: { - LOG4CXX_ERROR(logger_, - "Unknown system capability type: " - << msg_params[strings::system_capability] - [strings::system_capability_type] - .asInt()); + SDL_LOG_ERROR("Unknown system capability type: " + << msg_params[strings::system_capability] + [strings::system_capability_type] + .asInt()); return; } } @@ -159,8 +159,7 @@ void OnSystemCapabilityUpdatedNotification::Run() { DCHECK_OR_RETURN(app, false); auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); if (!ext.IsSubscribedTo(system_capability_type)) { - LOG4CXX_DEBUG(logger_, - "App " << app->app_id() + SDL_LOG_DEBUG("App " << app->app_id() << " is not subscribed to this capability type"); return false; } @@ -168,14 +167,12 @@ void OnSystemCapabilityUpdatedNotification::Run() { if (mobile_apis::SystemCapabilityType::DISPLAYS == system_capability_type && initial_connection_key > 0) { - LOG4CXX_DEBUG(logger_, - "Display capabilities notification for app " - << initial_connection_key << " only"); + SDL_LOG_DEBUG("Display capabilities notification for app " + << initial_connection_key << " only"); return app->app_id() == initial_connection_key; } - LOG4CXX_DEBUG(logger_, - "App " << app->app_id() + SDL_LOG_DEBUG("App " << app->app_id() << " is subscribed to specified capability type"); return true; }; @@ -183,8 +180,7 @@ void OnSystemCapabilityUpdatedNotification::Run() { const std::vector<ApplicationSharedPtr>& applications = FindAllApps( application_manager_.applications(), subscribed_to_capability_predicate); - LOG4CXX_DEBUG(logger_, - "Number of Notifications to be sent: " << applications.size()); + SDL_LOG_DEBUG("Number of Notifications to be sent: " << applications.size()); std::vector<ApplicationSharedPtr>::const_iterator app_it = applications.begin(); @@ -194,31 +190,28 @@ void OnSystemCapabilityUpdatedNotification::Run() { if (system_capability_type == mobile_apis::SystemCapabilityType::REMOTE_CONTROL && !app->is_remote_control_supported()) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "App with connection key: " - << app->app_id() - << " was subcribed to REMOTE_CONTROL system capabilities, but " - "does not have RC permissions. Unsubscribing"); + << app->app_id() + << " was subcribed to REMOTE_CONTROL system capabilities, but " + "does not have RC permissions. Unsubscribing"); auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app); ext.UnsubscribeFrom(system_capability_type); continue; } if (mobile_apis::SystemCapabilityType::DISPLAYS == system_capability_type) { - LOG4CXX_DEBUG(logger_, "Using common display capabilities"); + SDL_LOG_DEBUG("Using common display capabilities"); auto capabilities = hmi_capabilities_.system_display_capabilities(); if (app->is_resuming() && app->is_app_data_resumption_allowed()) { - LOG4CXX_DEBUG(logger_, - "Application " - << app->app_id() - << " is resuming. Providing cached capabilities"); + SDL_LOG_DEBUG("Application " + << app->app_id() + << " is resuming. Providing cached capabilities"); auto display_caps = app->display_capabilities_builder().display_capabilities(); capabilities = display_caps; } else if (app->display_capabilities()) { - LOG4CXX_DEBUG(logger_, - "Application " << app->app_id() + SDL_LOG_DEBUG("Application " << app->app_id() << " has specific display capabilities"); const WindowID window_id = msg_params[strings::system_capability] @@ -229,8 +222,7 @@ void OnSystemCapabilityUpdatedNotification::Run() { } if (!capabilities) { - LOG4CXX_WARN(logger_, - "No available display capabilities for sending. Skipping"); + SDL_LOG_WARN("No available display capabilities for sending. Skipping"); continue; } @@ -238,8 +230,7 @@ void OnSystemCapabilityUpdatedNotification::Run() { *capabilities; } - LOG4CXX_INFO(logger_, - "Sending OnSystemCapabilityUpdated " << capability_type_string + SDL_LOG_INFO("Sending OnSystemCapabilityUpdated " << capability_type_string << " application id " << app->app_id()); (*message_)[strings::params][strings::connection_key] = app->app_id(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc index 9c868172f5..90ed038b89 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc @@ -48,6 +48,8 @@ namespace commands { namespace mobile { +SDL_CREATE_LOG_VARIABLE("Commands") + OnSystemRequestNotification::OnSystemRequestNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -63,7 +65,7 @@ OnSystemRequestNotification::OnSystemRequestNotification( OnSystemRequestNotification::~OnSystemRequestNotification() {} void OnSystemRequestNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace application_manager; using namespace mobile_apis; using namespace helpers; @@ -71,8 +73,7 @@ void OnSystemRequestNotification::Run() { ApplicationSharedPtr app = application_manager_.application(connection_key()); if (app.use_count() == 0) { - LOG4CXX_ERROR(logger_, - "Application with connection key " << connection_key() + SDL_LOG_ERROR("Application with connection key " << connection_key() << " is not registered."); return; } @@ -88,8 +89,7 @@ void OnSystemRequestNotification::Run() { if (!policy_handler.IsRequestTypeAllowed( app->device(), app->policy_app_id(), request_type)) { - LOG4CXX_WARN(logger_, - "Request type " << stringified_request_type + SDL_LOG_WARN("Request type " << stringified_request_type << " is not allowed by policies"); return; } @@ -101,15 +101,13 @@ void OnSystemRequestNotification::Run() { (*message_)[strings::msg_params][strings::request_subtype].asString(); if (!policy_handler.IsRequestSubTypeAllowed(app->policy_app_id(), request_subtype)) { - LOG4CXX_ERROR(logger_, - "Request subtype: " << request_subtype + SDL_LOG_ERROR("Request subtype: " << request_subtype << " is DISALLOWED by policies"); return; } } - LOG4CXX_DEBUG(logger_, - "Processing Request type : " << stringified_request_type); + SDL_LOG_DEBUG("Processing Request type : " << stringified_request_type); const bool binary_data_is_required = Compare<mobile_apis::RequestType::eType, EQ, ONE>( @@ -154,8 +152,7 @@ void OnSystemRequestNotification::Run() { } else if (mobile_apis::RequestType::LOCK_SCREEN_ICON_URL == request_type) { if (!(*message_)[strings::msg_params].keyExists(strings::url) || (*message_)[strings::msg_params][strings::url].empty()) { - LOG4CXX_ERROR(logger_, - "discarding LOCK_SCREEN_ICON_URL request without URL"); + SDL_LOG_ERROR("discarding LOCK_SCREEN_ICON_URL request without URL"); return; } } @@ -165,7 +162,7 @@ void OnSystemRequestNotification::Run() { #ifdef PROPRIETARY_MODE void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint32_t timeout = policy_handler_.TimeoutExchangeSec(); size_t content_length; @@ -223,8 +220,8 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const { message.clear(); message.assign(header.begin(), header.end()); - LOG4CXX_DEBUG( - logger_, "Header added: " << std::string(message.begin(), message.end())); + SDL_LOG_DEBUG( + "Header added: " << std::string(message.begin(), message.end())); } size_t OnSystemRequestNotification::ParsePTString( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc index 0a8420b6a3..944fb0c148 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnTBTClientStateNotification::OnTBTClientStateNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ OnTBTClientStateNotification::OnTBTClientStateNotification( OnTBTClientStateNotification::~OnTBTClientStateNotification() {} void OnTBTClientStateNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc index 6ceb381d2e..02ec1be53f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc @@ -42,6 +42,8 @@ namespace commands { namespace mobile { +SDL_CREATE_LOG_VARIABLE("Commands") + OnTouchEventNotification::OnTouchEventNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,7 +59,7 @@ OnTouchEventNotification::OnTouchEventNotification( OnTouchEventNotification::~OnTouchEventNotification() {} void OnTouchEventNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::vector<ApplicationSharedPtr>& applications_with_navi = application_manager_.applications_with_navi(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_file_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_file_notification.cc index 171772a549..d3257844ec 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_file_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_file_notification.cc @@ -39,6 +39,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUpdateFileNotification::OnUpdateFileNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ OnUpdateFileNotification::OnUpdateFileNotification( OnUpdateFileNotification::~OnUpdateFileNotification() {} void OnUpdateFileNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_sub_menu_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_sub_menu_notification.cc index 0e598cf475..05ff9fc8e5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_sub_menu_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_update_sub_menu_notification.cc @@ -39,6 +39,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnUpdateSubMenuNotification::OnUpdateSubMenuNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ OnUpdateSubMenuNotification::OnUpdateSubMenuNotification( OnUpdateSubMenuNotification::~OnUpdateSubMenuNotification() {} void OnUpdateSubMenuNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc index 39e0735013..33413f805d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc @@ -38,6 +38,8 @@ namespace sdl_rpc_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnWayPointChangeNotification::OnWayPointChangeNotification( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ OnWayPointChangeNotification::OnWayPointChangeNotification( OnWayPointChangeNotification::~OnWayPointChangeNotification() {} void OnWayPointChangeNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::set<uint32_t> subscribed_for_way_points = application_manager_.GetAppsSubscribedForWayPoints(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc index 2f3d38f0b0..5918c05f2d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -43,6 +43,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + namespace str = strings; PerformAudioPassThruRequest::PerformAudioPassThruRequest( @@ -64,7 +66,7 @@ PerformAudioPassThruRequest::PerformAudioPassThruRequest( PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {} void PerformAudioPassThruRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FinishTTSSpeak(); CommandRequestImpl::onTimeOut(); @@ -77,28 +79,28 @@ bool PerformAudioPassThruRequest::Init() { } void PerformAudioPassThruRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); + SDL_LOG_ERROR("APPLICATION_NOT_REGISTERED"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if (mobile_api::HMILevel::HMI_NONE == app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) { - LOG4CXX_ERROR(logger_, "application isn't activated"); + SDL_LOG_ERROR("application isn't activated"); SendResponse(false, mobile_apis::Result::REJECTED); return; } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming perform audio pass thru has contains " - "\\t\\n \\\\t \\\\n" - " text contains only whitespace in initialPrompt"); + SDL_LOG_ERROR( + "Incoming perform audio pass thru has contains " + "\\t\\n \\\\t \\\\n" + " text contains only whitespace in initialPrompt"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -114,9 +116,8 @@ void PerformAudioPassThruRequest::Run() { initial_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return " + << verification_result); SendResponse( false, mobile_apis::Result::FILE_NOT_FOUND, @@ -135,14 +136,14 @@ void PerformAudioPassThruRequest::Run() { } void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_PerformAudioPassThru: { - LOG4CXX_TRACE(logger_, "Received UI_PerformAudioPassThru"); + SDL_LOG_TRACE("Received UI_PerformAudioPassThru"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); result_ui_ = static_cast<hmi_apis::Common_Result::eType>( @@ -151,7 +152,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { // in case perform audio is started by other request skip stopping if (hmi_apis::Common_Result::REJECTED == result_ui_) { - LOG4CXX_ERROR(logger_, "Request was rejected"); + SDL_LOG_ERROR("Request was rejected"); SendResponse(false, MessageHelper::HMIToMobileResult(result_ui_), NULL, @@ -162,7 +163,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_Speak: { - LOG4CXX_INFO(logger_, "Received TTS_Speak event"); + SDL_LOG_INFO("Received TTS_Speak event"); result_tts_speak_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt()); GetInfo(message, tts_info_); @@ -188,14 +189,14 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event"); + SDL_LOG_INFO("Received TTS_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } @@ -214,7 +215,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { const PerformAudioPassThruRequest::ResponseParams& PerformAudioPassThruRequest::PrepareResponseParameters() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::commands::ResponseInfo ui_perform_info( result_ui_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); @@ -252,7 +253,7 @@ PerformAudioPassThruRequest::PrepareResponseParameters() { } void PerformAudioPassThruRequest::SendSpeakRequest() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis; using namespace smart_objects; @@ -274,7 +275,7 @@ void PerformAudioPassThruRequest::SendSpeakRequest() { } void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -321,7 +322,7 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() { } void PerformAudioPassThruRequest::SendRecordStartNotification() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -331,7 +332,7 @@ void PerformAudioPassThruRequest::SendRecordStartNotification() { } void PerformAudioPassThruRequest::StartMicrophoneRecording() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t app_id = connection_key(); application_manager_.BeginAudioPassThru(app_id); @@ -346,7 +347,7 @@ void PerformAudioPassThruRequest::StartMicrophoneRecording() { } bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) { @@ -359,7 +360,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { for (; it_ip != it_ip_end; ++it_ip) { str = (*it_ip)[strings::text].asCharArray(); if (std::strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid initial_prompt syntax check failed"); + SDL_LOG_ERROR("Invalid initial_prompt syntax check failed"); return true; } } @@ -370,8 +371,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::audio_pass_display_text1] .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Invalid audio_pass_display_text1 value syntax check failed"); return true; } @@ -382,8 +382,7 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::audio_pass_display_text2] .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Invalid audio_pass_display_text2 value syntax check failed"); return true; } @@ -392,14 +391,14 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() { } void PerformAudioPassThruRequest::FinishTTSSpeak() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t app_id = connection_key(); if (application_manager_.EndAudioPassThru(app_id)) { - LOG4CXX_DEBUG(logger_, "Stop AudioPassThru."); + SDL_LOG_DEBUG("Stop AudioPassThru."); application_manager_.StopAudioPassThru(app_id); } if (!IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS)) { - LOG4CXX_WARN(logger_, "TTS Speak is inactive."); + SDL_LOG_WARN("TTS Speak is inactive."); return; } SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL); @@ -446,7 +445,7 @@ PerformAudioPassThruRequest::PrepareAudioPassThruResultCodeForResponse( } bool PerformAudioPassThruRequest::IsWaitingHMIResponse() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) || IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc index 5dae6327eb..8712eae150 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + PerformAudioPassThruResponse::PerformAudioPassThruResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ PerformAudioPassThruResponse::PerformAudioPassThruResponse( PerformAudioPassThruResponse::~PerformAudioPassThruResponse() {} void PerformAudioPassThruResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc index 881c838c1a..3e25a4b094 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc @@ -56,6 +56,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + namespace custom_str = utils::custom_string; uint32_t PerformInteractionRequest::pi_requests_count_ = 0; @@ -108,18 +110,18 @@ bool PerformInteractionRequest::Init() { } void PerformInteractionRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if (app->is_perform_interaction_active()) { - LOG4CXX_DEBUG(logger_, "Application has active PerformInteraction"); + SDL_LOG_DEBUG("Application has active PerformInteraction"); app_pi_was_active_before_ = true; } @@ -134,9 +136,9 @@ void PerformInteractionRequest::Run() { if ((mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) && (mobile_apis::LayoutMode::KEYBOARD == interaction_layout)) { - LOG4CXX_ERROR(logger_, - "PerformInteraction contains InteractionMode" - "=VR_ONLY and interactionLayout=KEYBOARD"); + SDL_LOG_ERROR( + "PerformInteraction contains InteractionMode" + "=VR_ONLY and interactionLayout=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -147,17 +149,17 @@ void PerformInteractionRequest::Run() { if (0 == choice_set_id_list_length) { if (mobile_apis::LayoutMode::KEYBOARD == interaction_layout) { if (mobile_apis::InteractionMode::BOTH == interaction_mode_) { - LOG4CXX_ERROR(logger_, - "interactionChoiceSetIDList is empty," - " InteractionMode=BOTH and" - " interactionLayout=KEYBOARD"); + SDL_LOG_ERROR( + "interactionChoiceSetIDList is empty," + " InteractionMode=BOTH and" + " interactionLayout=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } } else { - LOG4CXX_ERROR(logger_, - "interactionChoiceSetIDList is empty" - " and interactionLayout!=KEYBOARD"); + SDL_LOG_ERROR( + "interactionChoiceSetIDList is empty" + " and interactionLayout!=KEYBOARD"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -167,9 +169,9 @@ void PerformInteractionRequest::Run() { app, choice_set_id_list_length, msg_params[strings::interaction_choice_set_id_list])) { - LOG4CXX_ERROR(logger_, - "PerformInteraction has choice sets with " - "duplicated IDs or application does not have choice sets"); + SDL_LOG_ERROR( + "PerformInteraction has choice sets with " + "duplicated IDs or application does not have choice sets"); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -178,23 +180,21 @@ void PerformInteractionRequest::Run() { if (mobile_apis::Result::INVALID_DATA == MessageHelper::VerifyImageVrHelpItems( msg_params[strings::vr_help], app, application_manager_)) { - LOG4CXX_ERROR(logger_, - "Verification of " << strings::vr_help << " failed."); + SDL_LOG_ERROR("Verification of " << strings::vr_help << " failed."); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming perform interaction has contains \t\n \\t \\n"); + SDL_LOG_ERROR("Incoming perform interaction has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } switch (interaction_mode_) { case mobile_apis::InteractionMode::BOTH: { - LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH"); + SDL_LOG_DEBUG("Interaction Mode: BOTH"); if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) || !CheckVrHelpItemPositions(app) || !CheckChoiceSetListVRCommands(app)) { @@ -203,7 +203,7 @@ void PerformInteractionRequest::Run() { break; } case mobile_apis::InteractionMode::MANUAL_ONLY: { - LOG4CXX_DEBUG(logger_, "Interaction Mode: MANUAL_ONLY"); + SDL_LOG_DEBUG("Interaction Mode: MANUAL_ONLY"); if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) || !CheckVrHelpItemPositions(app)) { return; @@ -211,7 +211,7 @@ void PerformInteractionRequest::Run() { break; } case mobile_apis::InteractionMode::VR_ONLY: { - LOG4CXX_DEBUG(logger_, "Interaction Mode: VR_ONLY"); + SDL_LOG_DEBUG("Interaction Mode: VR_ONLY"); if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app) || !CheckChoiceSetListVRCommands(app)) { return; @@ -219,7 +219,7 @@ void PerformInteractionRequest::Run() { break; } default: { - LOG4CXX_ERROR(logger_, "Unknown interaction mode"); + SDL_LOG_ERROR("Unknown interaction mode"); return; } } @@ -234,18 +234,18 @@ void PerformInteractionRequest::Run() { } void PerformInteractionRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOG4CXX_DEBUG(logger_, "Received UI_OnResetTimeout event"); + SDL_LOG_DEBUG("Received UI_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::UI_PerformInteraction: { - LOG4CXX_DEBUG(logger_, "Received UI_PerformInteraction event"); + SDL_LOG_DEBUG("Received UI_PerformInteraction event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); ui_response_received_ = true; @@ -257,7 +257,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::VR_PerformInteraction: { - LOG4CXX_DEBUG(logger_, "Received VR_PerformInteraction"); + SDL_LOG_DEBUG("Received VR_PerformInteraction"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); vr_response_received_ = true; @@ -271,15 +271,14 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); break; } } if (!HasHMIResponsesToWait()) { - LOG4CXX_DEBUG(logger_, - "Send response in interaction mode " - << static_cast<int32_t>(interaction_mode_)); + SDL_LOG_DEBUG("Send response in interaction mode " + << static_cast<int32_t>(interaction_mode_)); if (SetChoiceIdToResponseMsgParams(response_msg_params)) { SendBothModeResponse(response_msg_params); } else { @@ -292,11 +291,11 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { } void PerformInteractionRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); switch (interaction_mode_) { case mobile_apis::InteractionMode::BOTH: { - LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH"); + SDL_LOG_DEBUG("Interaction Mode: BOTH"); if (true == vr_response_received_) { unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); DisablePerformInteraction(); @@ -308,21 +307,21 @@ void PerformInteractionRequest::onTimeOut() { break; } case mobile_apis::InteractionMode::VR_ONLY: { - LOG4CXX_DEBUG(logger_, "Interaction Mode: VR_ONLY"); + SDL_LOG_DEBUG("Interaction Mode: VR_ONLY"); unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); DisablePerformInteraction(); CommandRequestImpl::onTimeOut(); break; } case mobile_apis::InteractionMode::MANUAL_ONLY: { - LOG4CXX_DEBUG(logger_, "InteractionMode: MANUAL_ONLY"); + SDL_LOG_DEBUG("InteractionMode: MANUAL_ONLY"); unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); DisablePerformInteraction(); CommandRequestImpl::onTimeOut(); break; } default: { - LOG4CXX_ERROR(logger_, "INVALID ENUM"); + SDL_LOG_ERROR("INVALID ENUM"); return; } }; @@ -331,7 +330,7 @@ void PerformInteractionRequest::onTimeOut() { bool PerformInteractionRequest::ProcessVRResponse( const smart_objects::SmartObject& message, smart_objects::SmartObject& msg_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis; using namespace mobile_apis; using namespace smart_objects; @@ -340,7 +339,7 @@ bool PerformInteractionRequest::ProcessVRResponse( ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return false; } @@ -351,14 +350,14 @@ bool PerformInteractionRequest::ProcessVRResponse( vr_result_code_, Common_Result::ABORTED, Common_Result::TIMED_OUT); if (is_vr_aborted_timeout) { - LOG4CXX_DEBUG(logger_, "VR response aborted"); + SDL_LOG_DEBUG("VR response aborted"); if (InteractionMode::VR_ONLY == interaction_mode_) { - LOG4CXX_DEBUG(logger_, "Aborted or Timeout Send Close Popup"); + SDL_LOG_DEBUG("Aborted or Timeout Send Close Popup"); TerminatePerformInteraction(); SendResponse(false, MessageHelper::HMIToMobileResult(vr_result_code_)); return true; } - LOG4CXX_DEBUG(logger_, "Update timeout for UI"); + SDL_LOG_DEBUG("Update timeout for UI"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout_); return false; @@ -373,7 +372,7 @@ bool PerformInteractionRequest::ProcessVRResponse( if (hmi_msg_params.keyExists(strings::choice_id)) { const int choice_id = hmi_msg_params[strings::choice_id].asInt(); if (!CheckChoiceIDFromResponse(app, choice_id)) { - LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI"); + SDL_LOG_ERROR("Wrong choiceID was received from HMI"); TerminatePerformInteraction(); SendResponse( false, Result::GENERIC_ERROR, "Wrong choiceID was received from HMI"); @@ -384,7 +383,7 @@ bool PerformInteractionRequest::ProcessVRResponse( if (mobile_apis::InteractionMode::BOTH == interaction_mode_ || mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) { - LOG4CXX_DEBUG(logger_, "Update timeout for UI"); + SDL_LOG_DEBUG("Update timeout for UI"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout_); } @@ -394,9 +393,8 @@ bool PerformInteractionRequest::ProcessVRResponse( if (is_vr_result_success && InteractionMode::MANUAL_ONLY == interaction_mode_) { - LOG4CXX_DEBUG(logger_, - "VR response is successfull in MANUAL_ONLY mode " - << "Wait for UI response"); + SDL_LOG_DEBUG("VR response is successfull in MANUAL_ONLY mode " + << "Wait for UI response"); // in case MANUAL_ONLY mode VR.PI SUCCESS just return return false; } @@ -407,13 +405,13 @@ bool PerformInteractionRequest::ProcessVRResponse( void PerformInteractionRequest::ProcessUIResponse( const smart_objects::SmartObject& message, smart_objects::SmartObject& msg_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; using namespace smart_objects; ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } @@ -476,7 +474,7 @@ void PerformInteractionRequest::ProcessUIResponse( void PerformInteractionRequest::SendUIPerformInteractionRequest( application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& choice_set_id_list = (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; @@ -562,7 +560,7 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest( void PerformInteractionRequest::SendVRPerformInteractionRequest( application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -584,7 +582,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( smart_objects::SmartObject* choice_set = app->FindChoiceSet(choice_list[i].asInt()); if (!choice_set) { - LOG4CXX_WARN(logger_, "Couldn't found choiceset"); + SDL_LOG_WARN("Couldn't found choiceset"); continue; } msg_params[strings::grammar_id][grammar_id_index++] = @@ -600,9 +598,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_WARN( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_WARN("MessageHelper::VerifyTtsFiles return " + << verification_result); invalid_params.push_back("help_prompt"); } else { msg_params[strings::help_prompt] = help_prompt; @@ -635,7 +632,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( } } } else { - LOG4CXX_ERROR(logger_, "Can't found choiceSet!"); + SDL_LOG_ERROR("Can't found choiceSet!"); } } } @@ -648,9 +645,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( timeout_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_WARN( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_WARN("MessageHelper::VerifyTtsFiles return " + << verification_result); invalid_params.push_back("timeout_prompt"); } else { msg_params[strings::timeout_prompt] = timeout_prompt; @@ -669,9 +665,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( initial_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_WARN( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_WARN("MessageHelper::VerifyTtsFiles return " + << verification_result); invalid_params.push_back("initial_prompt"); } else { msg_params[strings::initial_prompt] = initial_prompt; @@ -703,7 +698,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( bool PerformInteractionRequest::CheckChoiceSetMenuNames( application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& choice_list = (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; @@ -723,7 +718,7 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( } if (!i_choice_set || !j_choice_set) { - LOG4CXX_ERROR(logger_, "Invalid ID"); + SDL_LOG_ERROR("Invalid ID"); SendResponse(false, mobile_apis::Result::INVALID_ID); return false; } @@ -740,7 +735,7 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( .asString(); if (ii_menu_name == jj_menu_name) { - LOG4CXX_ERROR(logger_, "Choice set has duplicated menu name"); + SDL_LOG_ERROR("Choice set has duplicated menu name"); SendResponse(false, mobile_apis::Result::DUPLICATE_NAME, "Choice set has duplicated menu name"); @@ -756,7 +751,7 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames( bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& choice_list = (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; @@ -776,7 +771,7 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( } if ((!i_choice_set) || (!j_choice_set)) { - LOG4CXX_ERROR(logger_, "Invalid ID"); + SDL_LOG_ERROR("Invalid ID"); SendResponse(false, mobile_apis::Result::INVALID_ID); return false; } @@ -789,9 +784,9 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( strings::vr_commands) && (*j_choice_set)[strings::choice_set][jj].keyExists( strings::vr_commands))) { - LOG4CXX_DEBUG(logger_, - "One or both sets has missing vr commands, skipping " - "synonym check"); + SDL_LOG_DEBUG( + "One or both sets has missing vr commands, skipping " + "synonym check"); return true; } // choice_set pointer contains SmartObject msg_params @@ -808,7 +803,7 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( const custom_str::CustomString& vr_cmd_j = jj_vr_commands[jjj].asCustomString(); if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) { - LOG4CXX_ERROR(logger_, "Choice set has duplicated VR synonym"); + SDL_LOG_ERROR("Choice set has duplicated VR synonym"); SendResponse(false, mobile_apis::Result::DUPLICATE_NAME, "Choice set has duplicated VR synonym"); @@ -825,10 +820,10 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms( bool PerformInteractionRequest::CheckVrHelpItemPositions( application_manager::ApplicationSharedPtr const app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!(*message_)[strings::msg_params].keyExists(strings::vr_help)) { - LOG4CXX_DEBUG(logger_, strings::vr_help << " is omitted."); + SDL_LOG_DEBUG(strings::vr_help << " is omitted."); return true; } @@ -838,7 +833,7 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions( int32_t position = 1; for (size_t i = 0; i < vr_help.length(); ++i) { if (position != vr_help[i][strings::position].asInt()) { - LOG4CXX_ERROR(logger_, "Non-sequential vrHelp item position"); + SDL_LOG_ERROR("Non-sequential vrHelp item position"); SendResponse(false, mobile_apis::Result::REJECTED, "Non-sequential vrHelp item position"); @@ -850,11 +845,11 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions( } void PerformInteractionRequest::DisablePerformInteraction() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } @@ -870,12 +865,12 @@ void PerformInteractionRequest::DisablePerformInteraction() { } bool PerformInteractionRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; str = (*message_)[strings::msg_params][strings::initial_text].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid initial_text syntax check failed"); + SDL_LOG_ERROR("Invalid initial_text syntax check failed"); return true; } @@ -889,7 +884,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { for (; it_ip != it_ip_end; ++it_ip) { str = (*it_ip)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid initial_prompt syntax check failed"); + SDL_LOG_ERROR("Invalid initial_prompt syntax check failed"); return true; } } @@ -905,7 +900,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { for (; it_hp != it_hp_end; ++it_hp) { str = (*it_hp)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid help_prompt syntax check failed"); + SDL_LOG_ERROR("Invalid help_prompt syntax check failed"); return true; } } @@ -921,7 +916,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { for (; it_tp != it_tp_end; ++it_tp) { str = (*it_tp)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid timeout_prompt syntax check failed"); + SDL_LOG_ERROR("Invalid timeout_prompt syntax check failed"); return true; } } @@ -937,15 +932,14 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { for (; it_vh != it_vh_end; ++it_vh) { str = (*it_vh)[strings::text].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_help syntax check failed"); + SDL_LOG_ERROR("Invalid vr_help syntax check failed"); return true; } if ((*it_vh).keyExists(strings::image)) { str = (*it_vh)[strings::image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid vr_help image value syntax check failed"); + SDL_LOG_ERROR("Invalid vr_help image value syntax check failed"); return true; } } @@ -955,7 +949,7 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { } void PerformInteractionRequest::TerminatePerformInteraction() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendClosePopupRequestToHMI(); DisablePerformInteraction(); @@ -970,7 +964,7 @@ void PerformInteractionRequest::SendClosePopupRequestToHMI() { bool PerformInteractionRequest::CheckChoiceIDFromResponse( ApplicationSharedPtr app, const int32_t choice_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const DataAccessor<PerformChoiceSetMap> accessor = app->performinteraction_choice_set_map(); const PerformChoiceSetMap& choice_set_map = accessor.GetData(); @@ -998,7 +992,7 @@ bool PerformInteractionRequest::CheckChoiceIDFromResponse( bool PerformInteractionRequest::CheckChoiceSetListVRCommands( ApplicationSharedPtr app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& choice_set_id_list = (*message_)[strings::msg_params][strings::interaction_choice_set_id_list]; @@ -1010,8 +1004,7 @@ bool PerformInteractionRequest::CheckChoiceSetListVRCommands( // this should never ever happen since this was already checked if (choice_set == nullptr) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Couldn't find choiceset_id = " << choice_set_id_list[i].asInt()); SendResponse(false, mobile_apis::Result::INVALID_ID); return false; @@ -1023,9 +1016,9 @@ bool PerformInteractionRequest::CheckChoiceSetListVRCommands( // if not all choices have vr commands if (vr_status != MessageHelper::ChoiceSetVRCommandsStatus::ALL) { - LOG4CXX_ERROR(logger_, - "PerformInteraction has choice sets with " - "missing vrCommands, not in MANUAL_ONLY mode"); + SDL_LOG_ERROR( + "PerformInteraction has choice sets with " + "missing vrCommands, not in MANUAL_ONLY mode"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Some choices don't contain VR commands."); @@ -1039,7 +1032,7 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( ApplicationSharedPtr app, const size_t choice_set_id_list_length, const smart_objects::SmartObject& choice_set_id_list) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); size_t choice_list_length = 0; std::set<uint32_t> choice_id_set; @@ -1049,8 +1042,7 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( for (size_t i = 0; i < choice_set_id_list_length; ++i) { choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt()); if (!choice_set) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Couldn't find choiceset_id = " << choice_set_id_list[i].asInt()); return false; } @@ -1062,10 +1054,9 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( ins_res = choice_id_set.insert(choices_list[k][strings::choice_id].asInt()); if (!ins_res.second) { - LOG4CXX_ERROR(logger_, - "choice with ID " - << choices_list[k][strings::choice_id].asInt() - << " already exists"); + SDL_LOG_ERROR("choice with ID " + << choices_list[k][strings::choice_id].asInt() + << " already exists"); return false; } } @@ -1074,13 +1065,13 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( } const bool PerformInteractionRequest::HasHMIResponsesToWait() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return !ui_response_received_ || !vr_response_received_; } void PerformInteractionRequest::SendBothModeResponse( const smart_objects::SmartObject& msg_param) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); mobile_apis::Result::eType perform_interaction_result_code = mobile_apis::Result::INVALID_ENUM; app_mngr::commands::ResponseInfo ui_perform_info( @@ -1108,8 +1099,8 @@ mobile_apis::Result::eType PerformInteractionRequest::PrepareResultCodeForResponse( const app_mngr::commands::ResponseInfo& ui_response, const app_mngr::commands::ResponseInfo& vr_response) { - LOG4CXX_DEBUG( - logger_, "InteractionMode = " << static_cast<int32_t>(interaction_mode_)); + SDL_LOG_DEBUG( + "InteractionMode = " << static_cast<int32_t>(interaction_mode_)); auto mobile_vr_result_code = MessageHelper::HMIToMobileResult(vr_result_code_); @@ -1159,7 +1150,7 @@ bool PerformInteractionRequest::PrepareResultForMobileResponse( bool PerformInteractionRequest::SetChoiceIdToResponseMsgParams( ns_smart_device_link::ns_smart_objects::SmartObject& msg_param) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool ui_choice_id_valid = INVALID_CHOICE_ID != ui_choice_id_received_; const bool vr_choice_id_valid = INVALID_CHOICE_ID != vr_choice_id_received_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc index fa02641c2b..c72d851b0e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + PerformInteractionResponse::PerformInteractionResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ PerformInteractionResponse::PerformInteractionResponse( PerformInteractionResponse::~PerformInteractionResponse() {} void PerformInteractionResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc index e25215fb48..50ff392e33 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc @@ -61,6 +61,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + PutFileRequest::PutFileRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -81,7 +83,7 @@ PutFileRequest::PutFileRequest( PutFileRequest::~PutFileRequest() {} void PutFileRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); @@ -89,7 +91,7 @@ void PutFileRequest::Run() { smart_objects::SmartObject(smart_objects::SmartType_Map); if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -101,8 +103,7 @@ void PutFileRequest::Run() { application->put_file_in_none_count()) { // If application is in the HMI_NONE level the quantity of allowed // PutFile request is limited by the configuration profile - LOG4CXX_ERROR(logger_, - "Too many requests from the app with HMILevel HMI_NONE "); + SDL_LOG_ERROR("Too many requests from the app with HMILevel HMI_NONE "); SendResponse(false, mobile_apis::Result::REJECTED, "Too many requests from the app with HMILevel HMI_NONE", @@ -111,7 +112,7 @@ void PutFileRequest::Run() { } if (!(*message_)[strings::params].keyExists(strings::binary_data)) { - LOG4CXX_ERROR(logger_, "Binary data empty"); + SDL_LOG_ERROR("Binary data empty"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Binary data empty", @@ -120,7 +121,7 @@ void PutFileRequest::Run() { } if (!(*message_)[strings::msg_params].keyExists(strings::sync_file_name)) { - LOG4CXX_ERROR(logger_, "No file name"); + SDL_LOG_ERROR("No file name"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "No file name", @@ -129,7 +130,7 @@ void PutFileRequest::Run() { } if (!(*message_)[strings::msg_params].keyExists(strings::file_type)) { - LOG4CXX_ERROR(logger_, "No file type"); + SDL_LOG_ERROR("No file type"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "No file type", @@ -141,7 +142,7 @@ void PutFileRequest::Run() { if (!file_system::IsFileNameValid(sync_file_name_)) { const std::string err_msg = "Sync file name contains forbidden symbols."; - LOG4CXX_ERROR(logger_, err_msg); + SDL_LOG_ERROR(err_msg); SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str(), @@ -196,7 +197,7 @@ void PutFileRequest::Run() { response_params[strings::space_available] = static_cast<uint32_t>(space_available); - LOG4CXX_ERROR(logger_, "Out of memory"); + SDL_LOG_ERROR("Out of memory"); SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY, "Out of memory", @@ -206,7 +207,7 @@ void PutFileRequest::Run() { } if (!file_system::CreateDirectoryRecursively(file_path)) { - LOG4CXX_ERROR(logger_, "Can't create folder"); + SDL_LOG_ERROR("Can't create folder"); SendResponse(false, mobile_apis::Result::GENERIC_ERROR, "Can't create folder.", @@ -216,12 +217,12 @@ void PutFileRequest::Run() { const std::string full_path = file_path + "/" + sync_file_name_; if ((*message_)[strings::msg_params].keyExists(strings::crc32_check_sum)) { - LOG4CXX_TRACE(logger_, "Binary Data Size: " << binary_data.size()); + SDL_LOG_TRACE("Binary Data Size: " << binary_data.size()); const uint32_t crc_received = (*message_)[strings::msg_params][strings::crc32_check_sum].asUInt(); - LOG4CXX_TRACE(logger_, "CRC32 SUM Received: " << crc_received); + SDL_LOG_TRACE("CRC32 SUM Received: " << crc_received); const uint32_t crc_calculated = GetCrc32CheckSum(binary_data); - LOG4CXX_TRACE(logger_, "CRC32 SUM Calculated: " << crc_calculated); + SDL_LOG_TRACE("CRC32 SUM Calculated: " << crc_calculated); if (crc_calculated != crc_received) { SendResponse(false, mobile_apis::Result::CORRUPTED_DATA, @@ -232,16 +233,14 @@ void PutFileRequest::Run() { } } - LOG4CXX_DEBUG(logger_, - "Writing " << binary_data.size() << " bytes to " << full_path + SDL_LOG_DEBUG("Writing " << binary_data.size() << " bytes to " << full_path << " (current size is" << file_system::FileSize(full_path) << ")"); mobile_apis::Result::eType save_result = application_manager_.SaveBinary( binary_data, file_path, sync_file_name_, offset_); - LOG4CXX_DEBUG(logger_, - "New size of " << full_path << " is " + SDL_LOG_DEBUG("New size of " << full_path << " is " << file_system::FileSize(full_path) << " bytes"); if (!is_system_file) { response_params[strings::space_available] = @@ -251,7 +250,7 @@ void PutFileRequest::Run() { sync_file_name_ = file_path + "/" + sync_file_name_; switch (save_result) { case mobile_apis::Result::SUCCESS: { - LOG4CXX_INFO(logger_, "PutFile is successful"); + SDL_LOG_INFO("PutFile is successful"); if (!is_system_file) { AppFile file(sync_file_name_, is_persistent_file_, @@ -259,15 +258,14 @@ void PutFileRequest::Run() { file_type_); if (0 == offset_) { - LOG4CXX_INFO(logger_, "New file downloading"); + SDL_LOG_INFO("New file downloading"); if (!application->AddFile(file)) { - LOG4CXX_INFO(logger_, - "Couldn't add file to application (File already Exist" - << " in application and was rewritten on FS)"); + SDL_LOG_INFO("Couldn't add file to application (File already Exist" + << " in application and was rewritten on FS)"); /* It can be first part of new big file, so we need to update information about it's downloading status and persistence */ if (!application->UpdateFile(file)) { - LOG4CXX_ERROR(logger_, "Couldn't update file"); + SDL_LOG_ERROR("Couldn't update file"); /* If it is impossible to update file, application doesn't know about existing this file */ SendResponse(false, @@ -290,15 +288,14 @@ void PutFileRequest::Run() { break; } default: - LOG4CXX_WARN(logger_, - "PutFile is unsuccessful. Result = " << save_result); + SDL_LOG_WARN("PutFile is unsuccessful. Result = " << save_result); SendResponse(false, save_result, "Can't save file", &response_params); break; } } void PutFileRequest::SendOnPutFileNotification(bool is_system_file) { - LOG4CXX_INFO(logger_, "SendOnPutFileNotification"); + SDL_LOG_INFO("SendOnPutFileNotification"); smart_objects::SmartObjectSPtr notification = std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc index f9ddbf7717..493efbd11c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + PutFileResponse::PutFileResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,12 +57,12 @@ PutFileResponse::PutFileResponse( PutFileResponse::~PutFileResponse() {} void PutFileResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "Application not registered"); + SDL_LOG_ERROR("Application not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index bd36f060ed..2b7ceefa66 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -178,6 +178,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + RegisterAppInterfaceRequest::RegisterAppInterfaceRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -195,14 +197,14 @@ RegisterAppInterfaceRequest::RegisterAppInterfaceRequest( RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {} bool RegisterAppInterfaceRequest::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return true; } void RegisterAppInterfaceRequest::Run() { using namespace helpers; - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Connection key is " << connection_key()); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Connection key is " << connection_key()); // Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA. // Flag conditional compilation specific to customer is used in order to @@ -213,12 +215,10 @@ void RegisterAppInterfaceRequest::Run() { // wait till HMI started while (!application_manager_.IsStopping() && !application_manager_.IsHMICooperating()) { - LOG4CXX_DEBUG(logger_, - "Waiting for the HMI... conn_key=" - << connection_key() - << ", correlation_id=" << correlation_id() - << ", default_timeout=" << default_timeout() - << ", thread=" << pthread_self()); + SDL_LOG_DEBUG("Waiting for the HMI... conn_key=" + << connection_key() << ", correlation_id=" << correlation_id() + << ", default_timeout=" << default_timeout() + << ", thread=" << pthread_self()); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); sleep(1); @@ -226,7 +226,7 @@ void RegisterAppInterfaceRequest::Run() { } if (application_manager_.IsStopping()) { - LOG4CXX_WARN(logger_, "The ApplicationManager is stopping!"); + SDL_LOG_WARN("The ApplicationManager is stopping!"); return; } @@ -247,9 +247,8 @@ void RegisterAppInterfaceRequest::Run() { return; } - LOG4CXX_DEBUG( - logger_, - "device_handle: " << device_handle_ << " device_id: " << device_id_); + SDL_LOG_DEBUG("device_handle: " << device_handle_ + << " device_id: " << device_id_); if (IsApplicationSwitched()) { return; @@ -304,8 +303,7 @@ void RegisterAppInterfaceRequest::Run() { std::vector<ApplicationSharedPtr> duplicate_apps; if (GetDuplicateNames(duplicate_apps)) { - LOG4CXX_ERROR(logger_, - "Found duplicate app names, checking for hybrid apps."); + SDL_LOG_ERROR("Found duplicate app names, checking for hybrid apps."); // Default preference to BOTH mobile_apis::HybridAppPreference::eType preference = mobile_apis::HybridAppPreference::BOTH; @@ -344,8 +342,7 @@ void RegisterAppInterfaceRequest::Run() { preference == mobile_apis::HybridAppPreference::CLOUD) { // Unregister mobile application and allow cloud application to // register in it's place - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Unregistering app because a preferred version is registered."); application_manager_.UnregisterApplication( duplicate_app->app_id(), @@ -371,14 +368,13 @@ void RegisterAppInterfaceRequest::Run() { } if (mobile_apis::Result::SUCCESS != coincidence_result) { - LOG4CXX_ERROR(logger_, "Coincidence check failed."); + SDL_LOG_ERROR("Coincidence check failed."); SendResponse(false, coincidence_result); return; } if (IsWhiteSpaceExist()) { - LOG4CXX_INFO(logger_, - "Incoming register app interface has contains \t\n \\t \\n"); + SDL_LOG_INFO("Incoming register app interface has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -399,15 +395,14 @@ void RegisterAppInterfaceRequest::Run() { minimum_major_version, minimum_minor_version, minimum_patch_version); if (mobile_version < min_module_version) { - LOG4CXX_WARN(logger_, - "Application RPC Version does not meet minimum requirement"); + SDL_LOG_WARN("Application RPC Version does not meet minimum requirement"); SendResponse(false, mobile_apis::Result::REJECTED); } application = application_manager_.RegisterApplication(message_); if (!application) { - LOG4CXX_ERROR(logger_, "Application hasn't been registered!"); + SDL_LOG_ERROR("Application hasn't been registered!"); return; } @@ -446,9 +441,8 @@ void RegisterAppInterfaceRequest::Run() { tts_name, application, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_WARN( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_WARN("MessageHelper::VerifyTtsFiles return " + << verification_result); response_info_ = "One or more files needed for tts_name are not present"; result_code_ = mobile_apis::Result::WARNINGS; } @@ -517,9 +511,8 @@ void RegisterAppInterfaceRequest::Run() { NULL, &dev_params.device_mac_address, &dev_params.device_connection_type)) { - LOG4CXX_ERROR( - logger_, - "Failed to extract information for device " << application->device()); + SDL_LOG_ERROR("Failed to extract information for device " + << application->device()); } policy::DeviceInfo device_info; device_info.AdoptDeviceType(dev_params.device_connection_type); @@ -690,7 +683,7 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params, void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( ApplicationType app_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject response_params(smart_objects::SmartType_Map); mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; @@ -703,9 +696,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( resumption::ResumeCtrl& resumer = application_manager_.resume_controller(); if (!application) { - LOG4CXX_ERROR(logger_, - "There is no application for such connection key" << key); - LOG4CXX_DEBUG(logger_, "Need to start resume data persistent timer"); + SDL_LOG_ERROR("There is no application for such connection key " << key); + SDL_LOG_DEBUG("Need to start resume data persistent timer"); resumer.OnAppRegistrationEnd(); return; } @@ -726,19 +718,17 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( hmi_capabilities.active_vr_language() || msg_params[strings::hmi_display_language_desired].asInt() != hmi_capabilities.active_ui_language()) { - LOG4CXX_WARN(logger_, - "Wrong language on registering application " - << application->name().c_str()); - - LOG4CXX_ERROR( - logger_, - "VR language desired code is " - << msg_params[strings::language_desired].asInt() - << " , active VR language code is " - << hmi_capabilities.active_vr_language() << ", UI language code is " - << msg_params[strings::hmi_display_language_desired].asInt() - << " , active UI language code is " - << hmi_capabilities.active_ui_language()); + SDL_LOG_WARN("Wrong language on registering application " + << application->name().c_str()); + + SDL_LOG_ERROR("VR language desired code is " + << msg_params[strings::language_desired].asInt() + << " , active VR language code is " + << hmi_capabilities.active_vr_language() + << ", UI language code is " + << msg_params[strings::hmi_display_language_desired].asInt() + << " , active UI language code is " + << hmi_capabilities.active_ui_language()); result_code = mobile_apis::Result::WRONG_LANGUAGE; } @@ -821,9 +811,9 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( } if (ApplicationType::kSwitchedApplicationWrongHashId == app_type) { - LOG4CXX_DEBUG(logger_, - "Application has been switched from another transport, " - "but doesn't have correct hashID."); + SDL_LOG_DEBUG( + "Application has been switched from another transport, " + "but doesn't have correct hashID."); application_manager::DeleteApplicationData(application, application_manager_); @@ -834,9 +824,9 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( } if (ApplicationType::kSwitchedApplicationHashOk == app_type) { - LOG4CXX_DEBUG(logger_, - "Application has been switched from another transport " - "and has correct hashID."); + SDL_LOG_DEBUG( + "Application has been switched from another transport " + "and has correct hashID."); SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); return; } @@ -852,13 +842,12 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( std::string add_info; if (resumption) { if (!resumer.CheckApplicationHash(application, hash_id)) { - LOG4CXX_WARN(logger_, - "Hash from RAI does not match to saved resume data."); + SDL_LOG_WARN("Hash from RAI does not match to saved resume data."); result_code = mobile_apis::Result::RESUME_FAILED; add_info = "Hash from RAI does not match to saved resume data."; need_restore_vr = false; } else if (!resumer.CheckPersistenceFilesForResumption(application)) { - LOG4CXX_WARN(logger_, "Persistent data is missing."); + SDL_LOG_WARN("Persistent data is missing."); result_code = mobile_apis::Result::RESUME_FAILED; add_info = "Persistent data is missing."; need_restore_vr = false; @@ -962,7 +951,7 @@ void RegisterAppInterfaceRequest::SendChangeRegistration( msg_params[strings::app_id] = app_id; SendHMIRequest(function_id, &msg_params); } else { - LOG4CXX_DEBUG(logger_, "Interface " << interface << "is not avaliable"); + SDL_LOG_DEBUG("Interface " << interface << " is not available"); } } @@ -982,7 +971,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( using namespace smart_objects; SmartObjectSPtr notification = std::make_shared<SmartObject>(SmartType_Map); if (!notification) { - LOG4CXX_ERROR(logger_, "Failed to create smart object"); + SDL_LOG_ERROR("Failed to create smart object"); return; } @@ -1032,7 +1021,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( } mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -1054,7 +1043,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { // Name check const auto& cur_name = app->name(); if (app_name.CompareIgnoreCase(cur_name)) { - LOG4CXX_ERROR(logger_, "Application name is known already."); + SDL_LOG_ERROR("Application name is known already."); return mobile_apis::Result::DUPLICATE_NAME; } const auto vr = app->vr_synonyms(); @@ -1063,7 +1052,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { CoincidencePredicateVR v(app_name); if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) { - LOG4CXX_ERROR(logger_, "Application name is known already."); + SDL_LOG_ERROR("Application name is known already."); return mobile_apis::Result::DUPLICATE_NAME; } } @@ -1074,7 +1063,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { CoincidencePredicateVR v(cur_name); if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) { - LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name ."); + SDL_LOG_ERROR("vr_synonyms duplicated with app_name ."); return mobile_apis::Result::DUPLICATE_NAME; } } // End vr check @@ -1089,11 +1078,9 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { tts_curr->end(), compare_tts_name); if (it_tts != tts_array->end()) { - LOG4CXX_ERROR( - logger_, - "TTS name: " - << (*it_tts)[strings::text].asCustomString().AsMBString() - << " is known already"); + SDL_LOG_ERROR("TTS name: " + << (*it_tts)[strings::text].asCustomString().AsMBString() + << " is known already"); return mobile_apis::Result::DUPLICATE_NAME; } } // End tts check @@ -1105,7 +1092,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() { bool RegisterAppInterfaceRequest::GetDuplicateNames( std::vector<ApplicationSharedPtr>& out_duplicate_apps) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -1139,7 +1126,7 @@ bool RegisterAppInterfaceRequest::GetDuplicateNames( } mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO(AOleynik): Check is necessary to allow register application in case // of disabled policy // Remove this check, when HMI will support policy @@ -1157,7 +1144,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { mobile_app_id, &app_nicknames, &app_hmi_types_in_policy); if (!init_result) { - LOG4CXX_ERROR(logger_, "Error during initial application data check."); + SDL_LOG_ERROR("Error during initial application data check."); return mobile_apis::Result::INVALID_DATA; } @@ -1167,8 +1154,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { policy::StringArray::const_iterator it = std::find_if(app_nicknames.begin(), app_nicknames.end(), compare); if (app_nicknames.end() == it) { - LOG4CXX_WARN(logger_, - "Application name was not found in nicknames list."); + SDL_LOG_WARN("Application name was not found in nicknames list."); // App should be unregistered, if its name is not present in nicknames // list usage_statistics::AppCounter count_of_rejections_nickname_mismatch( @@ -1191,7 +1177,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() { response_info_ = "WEB_VIEW AppHmiType is absent in application policies, because they " "are empty"; - LOG4CXX_DEBUG(logger_, response_info_); + SDL_LOG_DEBUG(response_info_); return result; } } @@ -1238,7 +1224,7 @@ void RegisterAppInterfaceRequest::FillDeviceInfo( } bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const custom_string::CustomString mobile_app_id( application_manager_.GetCorrectMobileIDFromMessage(message_)); @@ -1248,12 +1234,11 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { for (const auto& app : applications) { if (mobile_app_id.CompareIgnoreCase(app->policy_app_id().c_str())) { if (app->device() != device_handle_) { - LOG4CXX_DEBUG(logger_, - "These policy_app_id equal, but applications have " - "different device id" - << " mobile_app_id: " << mobile_app_id.c_str() - << " device_handle: " << device_handle_ - << " device_handle: " << app->device()); + SDL_LOG_DEBUG( + "These policy_app_id equal, but applications have " + "different device id" + << " mobile_app_id: " << mobile_app_id.c_str() << " device_handle: " + << device_handle_ << " device_handle: " << app->device()); continue; } return true; @@ -1264,12 +1249,12 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() { } bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; str = (*message_)[strings::msg_params][strings::app_name].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid app_name syntax check failed"); + SDL_LOG_ERROR("Invalid app_name syntax check failed"); return true; } @@ -1283,7 +1268,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { for (; it_tn != it_tn_end; ++it_tn) { str = (*it_tn)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tts_name syntax check failed"); + SDL_LOG_ERROR("Invalid tts_name syntax check failed"); return true; } } @@ -1294,8 +1279,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid ngn_media_screen_app_name syntax check failed"); + SDL_LOG_ERROR("Invalid ngn_media_screen_app_name syntax check failed"); return true; } } @@ -1310,7 +1294,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { for (; it_vs != it_vs_end; ++it_vs) { str = (*it_vs).asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_synonyms syntax check failed"); + SDL_LOG_ERROR("Invalid vr_synonyms syntax check failed"); return true; } } @@ -1319,7 +1303,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::hash_id)) { str = (*message_)[strings::msg_params][strings::hash_id].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid hash_id syntax check failed"); + SDL_LOG_ERROR("Invalid hash_id syntax check failed"); return true; } } @@ -1331,8 +1315,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { [strings::hardware] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid device_info hardware syntax check failed"); + SDL_LOG_ERROR("Invalid device_info hardware syntax check failed"); return true; } } @@ -1343,8 +1326,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { [strings::firmware_rev] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid device_info firmware_rev syntax check failed"); + SDL_LOG_ERROR("Invalid device_info firmware_rev syntax check failed"); return true; } } @@ -1354,7 +1336,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::device_info][strings::os] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid device_info os syntax check failed"); + SDL_LOG_ERROR("Invalid device_info os syntax check failed"); return true; } } @@ -1365,8 +1347,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { [strings::os_version] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid device_info os_version syntax check failed"); + SDL_LOG_ERROR("Invalid device_info os_version syntax check failed"); return true; } } @@ -1377,8 +1358,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { [strings::carrier] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid device_info carrier syntax check failed"); + SDL_LOG_ERROR("Invalid device_info carrier syntax check failed"); return true; } } @@ -1387,7 +1367,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::app_id)) { str = (*message_)[strings::msg_params][strings::app_id].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid app_id syntax check failed"); + SDL_LOG_ERROR("Invalid app_id syntax check failed"); return true; } } @@ -1397,7 +1377,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::full_app_id].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid app_id syntax check failed"); + SDL_LOG_ERROR("Invalid app_id syntax check failed"); return true; } } @@ -1413,8 +1393,7 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam( using namespace hmi_response; if (!vehicle_type.keyExists(param) || vehicle_type[param].empty()) { if (!backup_value.empty()) { - LOG4CXX_DEBUG(logger_, - param << " is missing." + SDL_LOG_DEBUG(param << " is missing." "Will be replaced with policy table value."); vehicle_type[param] = backup_value; } else { @@ -1437,30 +1416,27 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() { const std::string& policy_app_id = application_manager_.GetCorrectMobileIDFromMessage(message_); - LOG4CXX_DEBUG(logger_, "Looking for application id " << policy_app_id); + SDL_LOG_DEBUG("Looking for application id " << policy_app_id); auto app = application_manager_.reregister_application_by_policy_id(policy_app_id); if (!app) { - LOG4CXX_DEBUG( - logger_, - "Application with policy id " << policy_app_id << " is not found."); + SDL_LOG_DEBUG("Application with policy id " << policy_app_id + << " is not found."); return false; } - LOG4CXX_DEBUG(logger_, - "Application with policy id " << policy_app_id << " is found."); + SDL_LOG_DEBUG("Application with policy id " << policy_app_id << " is found."); const auto app_device_handle = app->device(); if (app_device_handle == device_handle_) { - LOG4CXX_DEBUG(logger_, - "Application " << policy_app_id + SDL_LOG_DEBUG("Application " << policy_app_id << " is already registered from this device."); SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY); return true; } - LOG4CXX_DEBUG(logger_, "Application is found in reconnection list."); + SDL_LOG_DEBUG("Application is found in reconnection list."); auto app_type = ApplicationType::kSwitchedApplicationWrongHashId; if ((*message_)[strings::msg_params].keyExists(strings::hash_id)) { @@ -1490,12 +1466,12 @@ bool RegisterAppInterfaceRequest::GetDataOnSessionKey( const uint32_t key, connection_handler::DeviceHandle* device_id, std::string* mac_address) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if ((nullptr == mac_address) && (nullptr == device_id)) { - LOG4CXX_ERROR(logger_, - "Can't get data on session key because device id and mac " - "address are empty."); + SDL_LOG_ERROR( + "Can't get data on session key because device id and mac " + "address are empty."); return false; } @@ -1506,8 +1482,7 @@ bool RegisterAppInterfaceRequest::GetDataOnSessionKey( connection_key(), nullptr, nullptr, &device_handle); if (result) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Failed to get device info for connection key: " << connection_key()); return false; } @@ -1518,9 +1493,8 @@ bool RegisterAppInterfaceRequest::GetDataOnSessionKey( } if (result) { - LOG4CXX_DEBUG(logger_, - "Failed get unique address info for connection key: " - << connection_key()); + SDL_LOG_DEBUG("Failed get unique address info for connection key: " + << connection_key()); return false; } @@ -1582,7 +1556,7 @@ RegisterAppInterfaceRequest::ProcessingAppHMITypesPolicies( if (mobile_apis::Result::DISALLOWED == result) { response_info_ = "WEB_VIEW AppHmiType is absent in application policies"; - LOG4CXX_DEBUG(logger_, response_info_); + SDL_LOG_DEBUG(response_info_); return result; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc index b5683c62cb..f0e885f54c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc @@ -42,8 +42,10 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + void RegisterAppInterfaceResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS; bool success = (*message_)[strings::msg_params][strings::success].asBool(); @@ -102,8 +104,7 @@ void RegisterAppInterfaceResponse::Run() { // Add registered application to the policy db right after response sent to // mobile to be able to check all other API according to app permissions if (!app) { - LOG4CXX_ERROR(logger_, - "Application with connection key " << connection_key() + SDL_LOG_ERROR("Application with connection key " << connection_key() << " is not registered."); return; } @@ -113,7 +114,7 @@ void RegisterAppInterfaceResponse::Run() { void RegisterAppInterfaceResponse::SetHeartBeatTimeout( uint32_t connection_key, const std::string& mobile_app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy::PolicyHandlerInterface& policy_handler = policy_handler_; if (policy_handler.PolicyEnabled()) { const uint32_t timeout = policy_handler.HeartBeatTimeout(mobile_app_id); @@ -122,7 +123,7 @@ void RegisterAppInterfaceResponse::SetHeartBeatTimeout( connection_key, timeout); } } else { - LOG4CXX_INFO(logger_, "Policy is turn off"); + SDL_LOG_INFO("Policy is turn off"); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc index a0e178d0e2..48ca41a0e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc @@ -44,6 +44,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -61,14 +63,14 @@ ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest( ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() {} void ResetGlobalPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); + SDL_LOG_ERROR("No application associated with session key"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -77,7 +79,7 @@ void ResetGlobalPropertiesRequest::Run() { (*message_)[strings::msg_params][strings::properties].length(); // if application waits for sending ttsGlobalProperties need to remove this // application from tts_global_properties_app_list_ - LOG4CXX_INFO(logger_, "RemoveAppFromTTSGlobalPropertiesList"); + SDL_LOG_INFO("RemoveAppFromTTSGlobalPropertiesList"); application_manager_.RemoveAppFromTTSGlobalPropertiesList(app_id); bool helpt_promt = false; @@ -194,7 +196,7 @@ void ResetGlobalPropertiesRequest::Run() { bool ResetGlobalPropertiesRequest::ResetHelpPromt( application_manager::ApplicationSharedPtr app) { if (!app) { - LOG4CXX_ERROR(logger_, "Null pointer"); + SDL_LOG_ERROR("Null pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } @@ -220,7 +222,7 @@ bool ResetGlobalPropertiesRequest::ResetHelpPromt( bool ResetGlobalPropertiesRequest::ResetTimeoutPromt( application_manager::ApplicationSharedPtr const app) { if (!app) { - LOG4CXX_ERROR(logger_, "Null pointer"); + SDL_LOG_ERROR("Null pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } @@ -247,7 +249,7 @@ bool ResetGlobalPropertiesRequest::ResetTimeoutPromt( bool ResetGlobalPropertiesRequest::ResetVrHelpTitleItems( application_manager::ApplicationSharedPtr const app) { if (!app) { - LOG4CXX_ERROR(logger_, "Null pointer"); + SDL_LOG_ERROR("Null pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } @@ -266,12 +268,12 @@ bool ResetGlobalPropertiesRequest::ResetVrHelpTitleItems( } void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); + SDL_LOG_INFO("Received UI_SetGlobalProperties event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -279,7 +281,7 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event"); + SDL_LOG_INFO("Received TTS_SetGlobalProperties event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -287,13 +289,13 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } if (IsPendingResponseExist()) { - LOG4CXX_DEBUG(logger_, "Waiting for remaining responses"); + SDL_LOG_DEBUG("Waiting for remaining responses"); return; } @@ -315,7 +317,7 @@ bool ResetGlobalPropertiesRequest::Init() { bool ResetGlobalPropertiesRequest::PrepareResponseParameters( mobile_apis::Result::eType& out_result_code, std::string& out_response_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; bool result = false; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc index 07aa23d9c9..ef1ba4f77a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ ResetGlobalPropertiesResponse::ResetGlobalPropertiesResponse( ResetGlobalPropertiesResponse::~ResetGlobalPropertiesResponse() {} void ResetGlobalPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc index 90dbb91b5f..89e77d9d19 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc @@ -46,6 +46,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ScrollableMessageRequest::ScrollableMessageRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -73,12 +75,12 @@ bool ScrollableMessageRequest::Init() { } void ScrollableMessageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -92,7 +94,7 @@ void ScrollableMessageRequest::Run() { application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "Wrong soft buttons parameters!"); + SDL_LOG_ERROR("Wrong soft buttons parameters!"); SendResponse(false, processing_result); return; } @@ -125,18 +127,18 @@ void ScrollableMessageRequest::Run() { } void ScrollableMessageRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event"); + SDL_LOG_INFO("Received UI_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::UI_ScrollableMessage: { - LOG4CXX_INFO(logger_, "Received UI_ScrollableMessage event"); + SDL_LOG_INFO("Received UI_ScrollableMessage event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); hmi_apis::Common_Result::eType result_code = @@ -155,7 +157,7 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); break; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc index 6236506c00..a6f980b9ba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ScrollableMessageResponse::ScrollableMessageResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ ScrollableMessageResponse::ScrollableMessageResponse( policy_handler) {} void ScrollableMessageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( (*message_)[strings::msg_params][strings::result_code].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc index 6e745fe0db..aa5e1077ca 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + namespace custom_str = utils::custom_string; SendHapticDataRequest::SendHapticDataRequest( @@ -55,14 +57,14 @@ SendHapticDataRequest::SendHapticDataRequest( SendHapticDataRequest::~SendHapticDataRequest() {} void SendHapticDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -77,7 +79,7 @@ void SendHapticDataRequest::Run() { } void SendHapticDataRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -97,7 +99,7 @@ void SendHapticDataRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc index 79a0516928..57e63dbb7c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SendHapticDataResponse::SendHapticDataResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,7 +55,7 @@ SendHapticDataResponse::SendHapticDataResponse( SendHapticDataResponse::~SendHapticDataResponse() {} void SendHapticDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc index 805c0f0e41..37d43a354b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SendLocationRequest::SendLocationRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -57,14 +59,13 @@ SendLocationRequest::~SendLocationRequest() {} void SendLocationRequest::Run() { using namespace hmi_apis; using smart_objects::SmartObject; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); + SDL_LOG_ERROR("An application with connection key " + << connection_key() << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -98,7 +99,7 @@ void SendLocationRequest::Run() { } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, "Strings contain invalid characters"); + SDL_LOG_ERROR("Strings contain invalid characters"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -112,7 +113,7 @@ void SendLocationRequest::Run() { } if (!CheckFieldsCompatibility()) { - LOG4CXX_ERROR(logger_, "CheckFieldsCompatibility failed"); + SDL_LOG_ERROR("CheckFieldsCompatibility failed"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -125,7 +126,7 @@ void SendLocationRequest::Run() { app, application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { - LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); + SDL_LOG_ERROR("VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); return; } @@ -140,11 +141,11 @@ void SendLocationRequest::Run() { } void SendLocationRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis; const smart_objects::SmartObject& message = event.smart_object(); if (hmi_apis::FunctionID::Navigation_SendLocation == event.id()) { - LOG4CXX_INFO(logger_, "Received Navigation_SendLocation event"); + SDL_LOG_INFO("Received Navigation_SendLocation event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const Common_Result::eType result_code = static_cast<Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -158,7 +159,7 @@ void SendLocationRequest::on_event(const event_engine::Event& event) { &(message[strings::params])); return; } - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); } bool SendLocationRequest::CheckFieldsCompatibility() { @@ -172,14 +173,12 @@ bool SendLocationRequest::CheckFieldsCompatibility() { const bool address_exist = msg_params.keyExists(strings::address); if (latitude_degrees_exist ^ longitude_degrees_exist) { - LOG4CXX_DEBUG(logger_, - "latitude and longitude should be provided only in pair"); + SDL_LOG_DEBUG("latitude and longitude should be provided only in pair"); return false; } if (!address_exist && !longitude_degrees_exist && !latitude_degrees_exist) { - LOG4CXX_DEBUG(logger_, - "address or latitude/longtitude should should be provided"); + SDL_LOG_DEBUG("address or latitude/longtitude should should be provided"); return false; } return true; @@ -194,7 +193,7 @@ void insert_if_contains( } bool SendLocationRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<utils::custom_string::CustomString> fields_to_check; const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; @@ -232,8 +231,7 @@ bool SendLocationRequest::IsWhiteSpaceExist() { for (; it != fields_to_check.end(); ++it) { const std::string& str = it->AsMBString(); if (!CheckSyntax(str, false)) { - LOG4CXX_ERROR(logger_, - "string '" << str << "'' contains invalid characters"); + SDL_LOG_ERROR("string '" << str << "'' contains invalid characters"); return true; } } @@ -250,7 +248,7 @@ bool SendLocationRequest::CheckHMICapabilities( const HMICapabilities& hmi_capabilities = hmi_capabilities_; if (!hmi_capabilities.is_ui_cooperating()) { - LOG4CXX_ERROR(logger_, "UI is not supported."); + SDL_LOG_ERROR("UI is not supported."); return false; } @@ -273,7 +271,7 @@ bool SendLocationRequest::CheckHMICapabilities( } if (!fields_names.empty()) { - LOG4CXX_ERROR(logger_, "Some fields are not supported by capabilities"); + SDL_LOG_ERROR("Some fields are not supported by capabilities"); return false; } return true; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc index 934008b816..fcf1a0f406 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SendLocationResponse::SendLocationResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ SendLocationResponse::SendLocationResponse( SendLocationResponse::~SendLocationResponse() {} void SendLocationResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc index ed77d8a550..9f30478111 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc @@ -46,6 +46,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SetAppIconRequest::SetAppIconRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -62,9 +64,9 @@ SetAppIconRequest::SetAppIconRequest( application_manager_.get_settings().app_icons_folder(); if (!file_system::DirectoryExists(path)) { - LOG4CXX_WARN(logger_, "App icons folder doesn't exist."); + SDL_LOG_WARN("App icons folder doesn't exist."); if (!file_system::CreateDirectoryRecursively(path)) { - LOG4CXX_ERROR(logger_, "Unable to create app icons directory: " << path); + SDL_LOG_ERROR("Unable to create app icons directory: " << path); } } @@ -75,12 +77,12 @@ SetAppIconRequest::SetAppIconRequest( SetAppIconRequest::~SetAppIconRequest() {} void SetAppIconRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -90,7 +92,7 @@ void SetAppIconRequest::Run() { if (!file_system::IsFileNameValid(sync_file_name)) { const std::string err_msg = "Sync file name contains forbidden symbols."; - LOG4CXX_ERROR(logger_, err_msg); + SDL_LOG_ERROR(err_msg); SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); return; } @@ -102,7 +104,7 @@ void SetAppIconRequest::Run() { full_file_path += sync_file_name; if (!file_system::FileExists(full_file_path)) { - LOG4CXX_ERROR(logger_, "No such file " << full_file_path); + SDL_LOG_ERROR("No such file " << full_file_path); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -129,19 +131,18 @@ void SetAppIconRequest::Run() { void SetAppIconRequest::CopyToIconStorage( const std::string& policy_app_id, const std::string& path_to_file) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!(application_manager_.protocol_handler() .get_settings() .max_supported_protocol_version() >= protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4)) { - LOG4CXX_WARN(logger_, - "Icon copying skipped, since protocol ver. 4 is not enabled."); + SDL_LOG_WARN("Icon copying skipped, since protocol ver. 4 is not enabled."); return; } std::vector<uint8_t> file_content; if (!file_system::ReadBinaryFile(path_to_file, file_content)) { - LOG4CXX_ERROR(logger_, "Can't read icon file: " << path_to_file); + SDL_LOG_ERROR("Can't read icon file: " << path_to_file); return; } @@ -152,13 +153,12 @@ void SetAppIconRequest::CopyToIconStorage( const uint64_t file_size = file_system::FileSize(path_to_file); if (0 == file_size) { - LOG4CXX_ERROR(logger_, "Can't get the icon file size: " << path_to_file); + SDL_LOG_ERROR("Can't get the icon file size: " << path_to_file); return; } if (storage_max_size < file_size) { - LOG4CXX_ERROR(logger_, - "Icon size (" << file_size + SDL_LOG_ERROR("Icon size (" << file_size << ") is bigger, than " " icons storage maximum size (" << storage_max_size @@ -175,9 +175,9 @@ void SetAppIconRequest::CopyToIconStorage( application_manager_.get_settings().app_icons_amount_to_remove(); if (!icons_amount) { - LOG4CXX_DEBUG(logger_, - "No icons will be deleted, since amount icons to remove " - "is zero. Icon saving skipped."); + SDL_LOG_DEBUG( + "No icons will be deleted, since amount icons to remove " + "is zero. Icon saving skipped."); return; } @@ -189,17 +189,16 @@ void SetAppIconRequest::CopyToIconStorage( const std::string icon_path = icon_storage + "/" + policy_app_id; if (!file_system::CreateFile(icon_path)) { - LOG4CXX_ERROR(logger_, "Can't create icon: " << icon_path); + SDL_LOG_ERROR("Can't create icon: " << icon_path); return; } if (!file_system::WriteBinaryFile(icon_path, file_content)) { - LOG4CXX_ERROR(logger_, "Can't write icon: " << icon_path); + SDL_LOG_ERROR("Can't write icon: " << icon_path); return; } - LOG4CXX_DEBUG(logger_, - "Icon was successfully copied from :" << path_to_file << " to " + SDL_LOG_DEBUG("Icon was successfully copied from :" << path_to_file << " to " << icon_path); return; @@ -227,17 +226,16 @@ void SetAppIconRequest::RemoveOldestIcons(const std::string& storage, for (size_t counter = 0; counter < icons_amount; ++counter) { if (!icon_modification_time.size()) { - LOG4CXX_ERROR(logger_, "No more icons left for deletion."); + SDL_LOG_ERROR("No more icons left for deletion."); return; } const std::string file_name = icon_modification_time.begin()->second; const std::string file_path = storage + "/" + file_name; if (!file_system::DeleteFile(file_path)) { - LOG4CXX_DEBUG(logger_, "Error while deleting icon " << file_path); + SDL_LOG_DEBUG("Error while deleting icon " << file_path); } icon_modification_time.erase(icon_modification_time.begin()); - LOG4CXX_DEBUG(logger_, - "Old icon " << file_path << " was deleted successfully."); + SDL_LOG_DEBUG("Old icon " << file_path << " was deleted successfully."); } } @@ -252,7 +250,7 @@ bool SetAppIconRequest::IsEnoughSpaceForIcon(const uint64_t icon_size) const { } void SetAppIconRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -270,8 +268,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Can't get application for connection key: " << connection_key()); return; } @@ -283,8 +280,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { app->set_app_icon_path(full_file_path_for_hmi_); - LOG4CXX_INFO(logger_, - "Icon path was set to '" << app->app_icon_path() << "'"); + SDL_LOG_INFO("Icon path was set to '" << app->app_icon_path() << "'"); } SendResponse(result, @@ -294,7 +290,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc index 55255920d0..350d120f10 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SetAppIconResponse::SetAppIconResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ SetAppIconResponse::SetAppIconResponse( SetAppIconResponse::~SetAppIconResponse() {} void SetAppIconResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc index 680429d3b6..45ff0078fb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc @@ -7,6 +7,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -22,11 +24,11 @@ SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest( SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {} void SetCloudAppPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -58,7 +60,7 @@ void SetCloudAppPropertiesRequest::Run() { void SetCloudAppPropertiesRequest::on_event( const app_mngr::event_engine::Event& event) { - LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event"); + SDL_LOG_INFO("SetCloudAppPropertiesRequest on_event"); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc index 39d2ea7f90..1529788544 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc @@ -7,6 +7,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SetCloudAppPropertiesResponse::SetCloudAppPropertiesResponse( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -22,7 +24,7 @@ SetCloudAppPropertiesResponse::SetCloudAppPropertiesResponse( SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse() {} void SetCloudAppPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc index 0cd9f6635c..b2ca3e6cfa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SetDisplayLayoutRequest::SetDisplayLayoutRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,11 +58,11 @@ SetDisplayLayoutRequest::SetDisplayLayoutRequest( SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {} void SetDisplayLayoutRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -77,11 +79,10 @@ void SetDisplayLayoutRequest::Run() { if (new_layout != old_layout && !new_layout.empty()) { // Template switched, hence allow any color change - LOG4CXX_DEBUG(logger_, - "SetDisplayLayoutRequest New Layout: " << new_layout); + SDL_LOG_DEBUG("SetDisplayLayoutRequest New Layout: " << new_layout); app->set_display_layout(new_layout); } else { - LOG4CXX_DEBUG(logger_, "SetDisplayLayoutRequest No Layout Change"); + SDL_LOG_DEBUG("SetDisplayLayoutRequest No Layout Change"); // Template layout is the same as previous layout // Reject message if colors are set if (msg_params.keyExists(strings::day_color_scheme) && @@ -89,7 +90,7 @@ void SetDisplayLayoutRequest::Run() { msg_params[strings::day_color_scheme] != app->day_color_scheme()) { // Color scheme param exists and has been previously set, // hence do not allow color change - LOG4CXX_DEBUG(logger_, "Reject Day Color Scheme Change"); + SDL_LOG_DEBUG("Reject Day Color Scheme Change"); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -99,19 +100,19 @@ void SetDisplayLayoutRequest::Run() { msg_params[strings::night_color_scheme] != app->night_color_scheme()) { // Color scheme param exists and has been previously set, // hence do not allow color change - LOG4CXX_DEBUG(logger_, "Reject Night Color Scheme Change"); + SDL_LOG_DEBUG("Reject Night Color Scheme Change"); SendResponse(false, mobile_apis::Result::REJECTED); return; } } if (msg_params.keyExists(strings::day_color_scheme)) { - LOG4CXX_DEBUG(logger_, "Allow Day Color Scheme Change"); + SDL_LOG_DEBUG("Allow Day Color Scheme Change"); app->set_day_color_scheme(msg_params[strings::day_color_scheme]); } if (msg_params.keyExists(strings::night_color_scheme)) { - LOG4CXX_DEBUG(logger_, "Allow Night Color Scheme Change"); + SDL_LOG_DEBUG("Allow Night Color Scheme Change"); app->set_night_color_scheme(msg_params[strings::night_color_scheme]); } @@ -123,12 +124,12 @@ void SetDisplayLayoutRequest::Run() { } void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -136,7 +137,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_SetDisplayLayout: { - LOG4CXX_INFO(logger_, "Received UI_SetDisplayLayout event"); + SDL_LOG_INFO("Received UI_SetDisplayLayout event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( @@ -182,7 +183,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc index 0999b596b5..8a5367ecd4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SetDisplayLayoutResponse::SetDisplayLayoutResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ SetDisplayLayoutResponse::SetDisplayLayoutResponse( SetDisplayLayoutResponse::~SetDisplayLayoutResponse() {} void SetDisplayLayoutResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc index a567d1b32f..9ed43b105b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc @@ -46,6 +46,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + namespace { bool IsResultCodeWarning(const app_mngr::commands::ResponseInfo& first, const app_mngr::commands::ResponseInfo& second, @@ -88,16 +90,15 @@ SetGlobalPropertiesRequest::SetGlobalPropertiesRequest( SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {} void SetGlobalPropertiesRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR( - logger_, - "No application associated with connection key " << connection_key()); + SDL_LOG_ERROR("No application associated with connection key " + << connection_key()); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -115,8 +116,8 @@ void SetGlobalPropertiesRequest::Run() { verification_result = MessageHelper::VerifyImage( msg_params[strings::menu_icon], app, application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { - LOG4CXX_ERROR( - logger_, "MessageHelper::VerifyImage return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyImage return " + << verification_result); SendResponse(false, verification_result); return; } @@ -126,7 +127,7 @@ void SetGlobalPropertiesRequest::Run() { if (mobile_apis::Result::INVALID_DATA == MessageHelper::VerifyImageVrHelpItems( msg_params[strings::vr_help], app, application_manager_)) { - LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!"); + SDL_LOG_ERROR("MessageHelper::VerifyImage return INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -137,7 +138,7 @@ void SetGlobalPropertiesRequest::Run() { strings::auto_complete_list) && msg_params[strings::keyboard_properties].keyExists( strings::auto_complete_text)) { - LOG4CXX_ERROR(logger_, "Replacing deprecated autoCompleteText property"); + SDL_LOG_ERROR("Replacing deprecated autoCompleteText property"); msg_params[strings::keyboard_properties][strings::auto_complete_list][0] = msg_params[strings::keyboard_properties][strings::auto_complete_text] .asString(); @@ -146,7 +147,7 @@ void SetGlobalPropertiesRequest::Run() { } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, "White spaces found"); + SDL_LOG_ERROR("White spaces found"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -162,8 +163,7 @@ void SetGlobalPropertiesRequest::Run() { // check VR params if (is_vr_help_title_present ^ is_vr_help_present) { - LOG4CXX_ERROR(logger_, - "Reject because of vr_help or vr_help_title only provided"); + SDL_LOG_ERROR("Reject because of vr_help or vr_help_title only provided"); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -187,12 +187,11 @@ void SetGlobalPropertiesRequest::Run() { is_tts_send_ = true; } if (is_vr_help_title_present && is_vr_help_present) { - LOG4CXX_DEBUG(logger_, "VRHelp params presents"); + SDL_LOG_DEBUG("VRHelp params presents"); if (!CheckVrHelpItemsOrder(msg_params[strings::vr_help])) { - LOG4CXX_ERROR(logger_, - "VR Help Items contains nonsequential positions" - << " (e.g. [1,2,4]) or not started from 1"); + SDL_LOG_ERROR("VR Help Items contains nonsequential positions" + << " (e.g. [1,2,4]) or not started from 1"); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -206,14 +205,14 @@ void SetGlobalPropertiesRequest::Run() { auto& help_prompt_manager = app->help_prompt_manager(); help_prompt_manager.OnSetGlobalPropertiesReceived(params, false); } else { - LOG4CXX_DEBUG(logger_, "VRHelp params does not present"); + SDL_LOG_DEBUG("VRHelp params does not present"); DCHECK_OR_RETURN_VOID(!is_vr_help_title_present && !is_vr_help_present); PrepareUIRequestMenuAndKeyboardData(app, msg_params, params); // Preparing data if (params.empty()) { - LOG4CXX_DEBUG(logger_, "No UI info provided"); + SDL_LOG_DEBUG("No UI info provided"); } else { params[strings::app_id] = app->app_id(); SendUIRequest(params, true); @@ -229,7 +228,7 @@ void SetGlobalPropertiesRequest::Run() { false, mobile_apis::Result::INVALID_DATA, "UserLocation is empty"); return; } - LOG4CXX_DEBUG(logger_, "Userlocation params presents"); + SDL_LOG_DEBUG("Userlocation params presents"); const auto& user_location = msg_params[strings::user_location]; app->set_user_location(user_location); @@ -250,7 +249,7 @@ void SetGlobalPropertiesRequest::Run() { // check TTS params if (is_help_prompt_present || is_timeout_prompt_present) { - LOG4CXX_DEBUG(logger_, "TTS params presents"); + SDL_LOG_DEBUG("TTS params presents"); auto tts_params = smart_objects::SmartObject(smart_objects::SmartType_Map); std::vector<std::string> invalid_params; @@ -261,9 +260,8 @@ void SetGlobalPropertiesRequest::Run() { MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return " + << verification_result); invalid_params.push_back("help_prompt"); } else { app->set_help_prompt(help_prompt); @@ -278,9 +276,8 @@ void SetGlobalPropertiesRequest::Run() { timeout_prompt, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return " + << verification_result); invalid_params.push_back("timeout_prompt"); } else { app->set_timeout_prompt(timeout_prompt); @@ -319,7 +316,7 @@ void SetGlobalPropertiesRequest::Run() { bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder( const smart_objects::SmartObject& vr_help) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(vr_help.getType() == smart_objects::SmartType_Array, false); const size_t vr_help_length = vr_help.length(); DCHECK_OR_RETURN(vr_help_length > 0, false); @@ -329,9 +326,8 @@ bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder( vr_help.getElement(j).getElement(strings::position).asUInt(); // Elements shall start from 1 and increment one by one if (position != (j + 1)) { - LOG4CXX_ERROR(logger_, - "VR help items order is wrong" - << " at " << j << ", position value:" << position); + SDL_LOG_ERROR("VR help items order is wrong" + << " at " << j << ", position value:" << position); return false; } } @@ -339,7 +335,7 @@ bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder( } void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -348,7 +344,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetGlobalProperties: { - LOG4CXX_DEBUG(logger_, "Received UI_SetGlobalProperties event"); + SDL_LOG_DEBUG("Received UI_SetGlobalProperties event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -361,7 +357,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_SetGlobalProperties: { - LOG4CXX_DEBUG(logger_, "Received TTS_SetGlobalProperties event"); + SDL_LOG_DEBUG("Received TTS_SetGlobalProperties event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); is_tts_received_ = true; tts_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -374,7 +370,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::RC_SetGlobalProperties: { - LOG4CXX_DEBUG(logger_, "Received RC_SetGlobalProperties event"); + SDL_LOG_DEBUG("Received RC_SetGlobalProperties event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC); is_rc_received_ = true; rc_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -383,13 +379,13 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } if (IsPendingResponseExist()) { - LOG4CXX_DEBUG(logger_, "Continue waiting for response"); + SDL_LOG_DEBUG("Continue waiting for response"); return; } mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; @@ -420,7 +416,7 @@ bool SetGlobalPropertiesRequest::Init() { bool SetGlobalPropertiesRequest::PrepareResponseParameters( mobile_apis::Result::eType& result_code, std::string& info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; app_mngr::commands::ResponseInfo ui_properties_info( @@ -475,7 +471,7 @@ bool SetGlobalPropertiesRequest::PrepareResultForMobileResponse( const app_mngr::commands::ResponseInfo& first, const app_mngr::commands::ResponseInfo& second, const app_mngr::commands::ResponseInfo& third) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); app_mngr::commands::ResponseInfo both_info; std::vector<hmi_apis::Common_Result::eType> success_result_codes{ @@ -508,7 +504,7 @@ SetGlobalPropertiesRequest::PrepareResultCodeForResponse( const app_mngr::commands::ResponseInfo& first, const app_mngr::commands::ResponseInfo& second, const app_mngr::commands::ResponseInfo& third) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; if (IsResultCodeUnsupported(first, second, third) || IsResultCodeUnsupported(second, third, first) || @@ -599,7 +595,7 @@ void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData( const ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params, smart_objects::SmartObject& out_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); app->set_vr_help_title(msg_params.getElement(strings::vr_help_title)); @@ -613,7 +609,7 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData( const ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params, smart_objects::SmartObject& out_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(app); const bool is_menu_title_present = @@ -641,7 +637,7 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData( void SetGlobalPropertiesRequest::SendTTSRequest( const smart_objects::SmartObject& params, bool use_events) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_tts_send_ = true; StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); SendHMIRequest( @@ -650,7 +646,7 @@ void SetGlobalPropertiesRequest::SendTTSRequest( void SetGlobalPropertiesRequest::SendUIRequest( const smart_objects::SmartObject& params, bool use_events) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_ui_send_ = true; StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest( @@ -660,7 +656,7 @@ void SetGlobalPropertiesRequest::SendUIRequest( void SetGlobalPropertiesRequest::SendRCRequest( const ns_smart_device_link::ns_smart_objects::SmartObject& params, bool use_events) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_rc_send_ = true; StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC); SendHMIRequest( @@ -674,7 +670,7 @@ bool SetGlobalPropertiesRequest::IsPendingResponseExist() { bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters( const smart_objects::SmartObject& params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return params.keyExists(strings::help_prompt) || params.keyExists(strings::timeout_prompt) || params.keyExists(strings::vr_help_title) || @@ -687,7 +683,7 @@ bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters( } bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str; const smart_objects::SmartObject& msg_params = @@ -703,7 +699,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { for (; it_hp != it_hp_end; ++it_hp) { str = (*it_hp)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid help_prompt syntax check failed"); + SDL_LOG_ERROR("Invalid help_prompt syntax check failed"); return true; } } @@ -719,7 +715,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { for (; it_tp != it_tp_end; ++it_tp) { str = (*it_tp)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid timeout_prompt syntax check failed"); + SDL_LOG_ERROR("Invalid timeout_prompt syntax check failed"); return true; } } @@ -735,15 +731,14 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { for (; it_vh != it_vh_end; ++it_vh) { str = (*it_vh)[strings::text].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_help text syntax check failed"); + SDL_LOG_ERROR("Invalid vr_help text syntax check failed"); return true; } if ((*it_vh).keyExists(strings::image)) { str = (*it_vh)[strings::image][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid vr_help image value syntax check failed"); + SDL_LOG_ERROR("Invalid vr_help image value syntax check failed"); return true; } } // if image exists @@ -753,7 +748,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { if (msg_params.keyExists(strings::menu_icon)) { str = msg_params[strings::menu_icon][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid menu_icon value syntax check failed"); + SDL_LOG_ERROR("Invalid menu_icon value syntax check failed"); return true; } } @@ -761,7 +756,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { if (msg_params.keyExists(strings::vr_help_title)) { str = msg_params[strings::vr_help_title].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid vr_help_title value syntax check failed"); + SDL_LOG_ERROR("Invalid vr_help_title value syntax check failed"); return true; } } @@ -769,7 +764,7 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { if (msg_params.keyExists(strings::menu_title)) { str = msg_params[strings::menu_title].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid menu_title value syntax check failed"); + SDL_LOG_ERROR("Invalid menu_title value syntax check failed"); return true; } } @@ -788,9 +783,9 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { for (; it_lcl != it_lcl_end; ++it_lcl) { str = (*it_lcl).asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid keyboard_properties " - "limited_character_list syntax check failed"); + SDL_LOG_ERROR( + "Invalid keyboard_properties " + "limited_character_list syntax check failed"); return true; } } @@ -807,9 +802,9 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() { for (; it != acl_array->end(); ++it) { str = it->asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid keyboard_properties " - "auto_complete_list syntax check failed"); + SDL_LOG_ERROR( + "Invalid keyboard_properties " + "auto_complete_list syntax check failed"); return true; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc index 1de2b97d3a..03c649a02d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SetGlobalPropertiesResponse::SetGlobalPropertiesResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ SetGlobalPropertiesResponse::SetGlobalPropertiesResponse( SetGlobalPropertiesResponse::~SetGlobalPropertiesResponse() {} void SetGlobalPropertiesResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc index d610090aa4..b7b8fc27ad 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc @@ -43,6 +43,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SetMediaClockRequest::SetMediaClockRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -58,18 +60,18 @@ SetMediaClockRequest::SetMediaClockRequest( SetMediaClockRequest::~SetMediaClockRequest() {} void SetMediaClockRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); return; } if (!app->is_media_application()) { - LOG4CXX_ERROR(logger_, "Application is not media application"); + SDL_LOG_ERROR("Application is not media application"); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -90,7 +92,7 @@ void SetMediaClockRequest::Run() { } void SetMediaClockRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -111,7 +113,7 @@ void SetMediaClockRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } @@ -126,7 +128,7 @@ bool SetMediaClockRequest::isDataValid() { if (update_mode == mobile_apis::UpdateMode::COUNTUP || update_mode == mobile_apis::UpdateMode::COUNTDOWN) { if (!msg_params.keyExists(strings::start_time)) { - LOG4CXX_INFO(logger_, "Invalid data"); + SDL_LOG_INFO("Invalid data"); return false; } @@ -151,13 +153,13 @@ bool SetMediaClockRequest::isDataValid() { (update_mode == mobile_apis::UpdateMode::COUNTDOWN)) || ((end_time_in_seconds < start_time_in_seconds) && (update_mode == mobile_apis::UpdateMode::COUNTUP))) { - LOG4CXX_INFO(logger_, "Invalid data"); + SDL_LOG_INFO("Invalid data"); return false; } } } - LOG4CXX_INFO(logger_, "Data is valid"); + SDL_LOG_INFO("Data is valid"); return true; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc index 948ff84156..0208741795 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SetMediaClockTimerResponse::SetMediaClockTimerResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ SetMediaClockTimerResponse::SetMediaClockTimerResponse( SetMediaClockTimerResponse::~SetMediaClockTimerResponse() {} void SetMediaClockTimerResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc index 36278168dc..c652764f16 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc @@ -40,6 +40,8 @@ namespace app_mngr = application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ShowAppMenuRequest::ShowAppMenuRequest( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -56,14 +58,13 @@ ShowAppMenuRequest::~ShowAppMenuRequest() {} void ShowAppMenuRequest::Run() { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR( - logger_, - "Application with id " << connection_key() << " is not registered."); + SDL_LOG_ERROR("Application with id " << connection_key() + << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -76,9 +77,8 @@ void ShowAppMenuRequest::Run() { app->system_context(mobile_apis::PredefinedWindows::DEFAULT_WINDOW), mobile_apis::SystemContext::SYSCTXT_MAIN, mobile_apis::SystemContext::SYSCTXT_MENU)) { - LOG4CXX_ERROR( - logger_, - "Application with id " << connection_key() << " is not activated."); + SDL_LOG_ERROR("Application with id " << connection_key() + << " is not activated."); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -90,7 +90,7 @@ void ShowAppMenuRequest::Run() { if (received_msg_params.keyExists(strings::menu_id)) { const int32_t menu_id = received_msg_params[strings::menu_id].asInt(); if (!app->FindSubMenu(menu_id)) { - LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found."); + SDL_LOG_ERROR("Menu with id " << menu_id << " is not found."); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -103,7 +103,7 @@ void ShowAppMenuRequest::Run() { void ShowAppMenuRequest::on_event(const app_mngr::event_engine::Event& event) { using namespace app_mngr; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -120,8 +120,7 @@ void ShowAppMenuRequest::on_event(const app_mngr::event_engine::Event& event) { application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "Application with id " << connection_key() + SDL_LOG_ERROR("Application with id " << connection_key() << " is not registered."); return; } @@ -133,7 +132,7 @@ void ShowAppMenuRequest::on_event(const app_mngr::event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event: " << event.id()); + SDL_LOG_ERROR("Received unknown event: " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc index 2b952ea9ac..e93e7b3d4e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc @@ -39,6 +39,8 @@ namespace app_mngr = application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ShowAppMenuResponse::ShowAppMenuResponse( const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -54,7 +56,7 @@ ShowAppMenuResponse::ShowAppMenuResponse( ShowAppMenuResponse::~ShowAppMenuResponse() {} void ShowAppMenuResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc index b439c1cb16..04310bcd58 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc @@ -46,6 +46,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ShowConstantTBTRequest::ShowConstantTBTRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -61,19 +63,19 @@ ShowConstantTBTRequest::ShowConstantTBTRequest( ShowConstantTBTRequest::~ShowConstantTBTRequest() {} void ShowConstantTBTRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); return; } // SDLAQ-CRS-664, VC3.1 if ((*message_)[strings::msg_params].empty()) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); + SDL_LOG_ERROR("INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -83,8 +85,7 @@ void ShowConstantTBTRequest::Run() { msg_params = (*message_)[strings::msg_params]; if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming show constant TBT has contains \t\n \\t \\n"); + SDL_LOG_ERROR("Incoming show constant TBT has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -96,7 +97,7 @@ void ShowConstantTBTRequest::Run() { msg_params, app, policy_handler_, application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); + SDL_LOG_ERROR("INVALID_DATA!"); SendResponse(false, processing_result); return; } @@ -106,7 +107,7 @@ void ShowConstantTBTRequest::Run() { verification_result = MessageHelper::VerifyImage( msg_params[strings::turn_icon], app, application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { - LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); + SDL_LOG_ERROR("VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); return; } @@ -116,7 +117,7 @@ void ShowConstantTBTRequest::Run() { verification_result = MessageHelper::VerifyImage( msg_params[strings::next_turn_icon], app, application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { - LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!"); + SDL_LOG_ERROR("VerifyImage INVALID_DATA!"); SendResponse(false, verification_result); return; } @@ -185,13 +186,13 @@ void ShowConstantTBTRequest::Run() { } void ShowConstantTBTRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis; const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_ShowConstantTBT: { - LOG4CXX_INFO(logger_, "Received Navigation_ShowConstantTBT event"); + SDL_LOG_INFO("Received Navigation_ShowConstantTBT event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const Common_Result::eType result_code = static_cast<Common_Result::eType>( @@ -207,21 +208,21 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); break; } } } bool ShowConstantTBTRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::turn_icon)) { str = (*message_)[strings::msg_params][strings::turn_icon][strings::value] .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid turn_icon value syntax check failed"); + SDL_LOG_ERROR("Invalid turn_icon value syntax check failed"); return true; } } @@ -231,8 +232,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { [strings::value] .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid next_turn_icon value syntax check failed"); + SDL_LOG_ERROR("Invalid next_turn_icon value syntax check failed"); return true; } } @@ -241,8 +241,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::navigation_text_1] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid navigation_text_1 value syntax check failed"); + SDL_LOG_ERROR("Invalid navigation_text_1 value syntax check failed"); return true; } } @@ -251,8 +250,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::navigation_text_2] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid navigation_text_2 value syntax check failed"); + SDL_LOG_ERROR("Invalid navigation_text_2 value syntax check failed"); return true; } } @@ -260,7 +258,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { if ((*message_)[strings::msg_params].keyExists(strings::eta)) { str = (*message_)[strings::msg_params][strings::eta].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid eta value syntax check failed"); + SDL_LOG_ERROR("Invalid eta value syntax check failed"); return true; } } @@ -269,8 +267,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::total_distance].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid total_distance value syntax check failed"); + SDL_LOG_ERROR("Invalid total_distance value syntax check failed"); return true; } } @@ -280,8 +277,7 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() { str = (*message_)[strings::msg_params][strings::time_to_destination] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid time_to_destination value syntax check failed"); + SDL_LOG_ERROR("Invalid time_to_destination value syntax check failed"); return true; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc index d027daf77d..7d546079e8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ShowConstantTBTResponse::ShowConstantTBTResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ ShowConstantTBTResponse::ShowConstantTBTResponse( ShowConstantTBTResponse::~ShowConstantTBTResponse() {} void ShowConstantTBTResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc index 84d11f8e09..910ab9ef23 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc @@ -44,6 +44,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ShowRequest::ShowRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -83,9 +85,8 @@ void ShowRequest::HandleMetadata(const char* field_id, [hmi_request::field_types][i] = current_tag; } } else { - LOG4CXX_INFO(logger_, - "metadata tag provided with no item for " - << field_id << ", ignoring with warning"); + SDL_LOG_INFO("metadata tag provided with no item for " + << field_id << ", ignoring with warning"); // tag provided with no item, ignore with warning if (mobile_apis::Result::INVALID_ENUM == core_result_code_) { core_result_code_ = mobile_apis::Result::WARNINGS; @@ -94,14 +95,13 @@ void ShowRequest::HandleMetadata(const char* field_id, } } } else { - LOG4CXX_INFO(logger_, - "No metadata tagging provided for field: " << field_id); + SDL_LOG_INFO("No metadata tagging provided for field: " << field_id); } } bool ShowRequest::CheckTemplateConfigurationForApp( application_manager::Application& app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if ((*message_)[strings::msg_params].keyExists(strings::window_id)) { current_window_id_ = @@ -112,21 +112,20 @@ bool ShowRequest::CheckTemplateConfigurationForApp( const auto new_template_layout = template_config_[strings::template_layout].asString(); const auto old_template_layout = app.window_layout(current_window_id_); - LOG4CXX_DEBUG(logger_, "New layout: " << new_template_layout); - LOG4CXX_DEBUG(logger_, "Old layout: " << old_template_layout); + SDL_LOG_DEBUG("New layout: " << new_template_layout); + SDL_LOG_DEBUG("Old layout: " << old_template_layout); const bool layouts_equal = (new_template_layout == old_template_layout); if (!new_template_layout.empty() && !layouts_equal) { // Template switched, hence allow any color change - LOG4CXX_DEBUG(logger_, - "Show Request: Setting new Layout: " << new_template_layout + SDL_LOG_DEBUG("Show Request: Setting new Layout: " << new_template_layout << " for window ID: " << current_window_id_); layout_change_required_ = true; return true; } - LOG4CXX_DEBUG(logger_, "Show Request: No Layout Change"); + SDL_LOG_DEBUG("Show Request: No Layout Change"); return false; }; @@ -140,10 +139,10 @@ bool ShowRequest::CheckTemplateConfigurationForApp( app.day_color_scheme(current_window_id_)) { // Color scheme param exists and has been previously set, // hence do not allow color change - LOG4CXX_DEBUG(logger_, "Day Color Scheme change is rejected"); + SDL_LOG_DEBUG("Day Color Scheme change is rejected"); return false; } - LOG4CXX_DEBUG(logger_, "Day Color Scheme change is allowed"); + SDL_LOG_DEBUG("Day Color Scheme change is allowed"); dcs_change_required_ = true; return true; @@ -159,10 +158,10 @@ bool ShowRequest::CheckTemplateConfigurationForApp( app.night_color_scheme(current_window_id_)) { // Color scheme param exists and has been previously set, // hence do not allow color change - LOG4CXX_DEBUG(logger_, "Night Color Scheme change is rejected"); + SDL_LOG_DEBUG("Night Color Scheme change is rejected"); return false; } - LOG4CXX_DEBUG(logger_, "Night Color Scheme Change is allowed"); + SDL_LOG_DEBUG("Night Color Scheme Change is allowed"); ncs_change_required_ = true; return true; @@ -192,7 +191,7 @@ bool ShowRequest::CheckTemplateConfigurationForApp( void ShowRequest::ApplyTemplateConfigurationForApp( mobile_apis::Result::eType result, application_manager::Application& app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (helpers::Compare<mobile_apis::Result::eType, helpers::EQ, helpers::ONE>( result, mobile_apis::Result::SUCCESS, @@ -200,7 +199,7 @@ void ShowRequest::ApplyTemplateConfigurationForApp( if (layout_change_required_) { const std::string new_layout = template_config_[strings::template_layout].asString(); - LOG4CXX_DEBUG(logger_, "New layout : " << new_layout << " is applied"); + SDL_LOG_DEBUG("New layout : " << new_layout << " is applied"); app.set_window_layout(current_window_id_, new_layout); if (template_config_.keyExists(strings::day_color_scheme)) { @@ -217,13 +216,13 @@ void ShowRequest::ApplyTemplateConfigurationForApp( } if (dcs_change_required_) { - LOG4CXX_DEBUG(logger_, "New day color scheme is applied"); + SDL_LOG_DEBUG("New day color scheme is applied"); app.set_day_color_scheme(current_window_id_, template_config_[strings::day_color_scheme]); } if (ncs_change_required_) { - LOG4CXX_DEBUG(logger_, "New night color scheme is applied"); + SDL_LOG_DEBUG("New night color scheme is applied"); app.set_night_color_scheme(current_window_id_, template_config_[strings::night_color_scheme]); } @@ -231,24 +230,24 @@ void ShowRequest::ApplyTemplateConfigurationForApp( } void ShowRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } // SDLAQ-CRS-494, VC3.1 if ((*message_)[strings::msg_params].empty()) { - LOG4CXX_ERROR(logger_, strings::msg_params << " is empty."); + SDL_LOG_ERROR(strings::msg_params << " is empty."); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } if (!CheckStringsOfShowRequest()) { - LOG4CXX_ERROR(logger_, "Incorrect characters in string"); + SDL_LOG_ERROR("Incorrect characters in string"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -266,7 +265,7 @@ void ShowRequest::Run() { } if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "Processing of soft buttons failed."); + SDL_LOG_ERROR("Processing of soft buttons failed."); SendResponse(false, processing_result); return; } @@ -281,7 +280,7 @@ void ShowRequest::Run() { app, application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { - LOG4CXX_ERROR(logger_, "Image verification failed."); + SDL_LOG_ERROR("Image verification failed."); SendResponse(false, verification_result); return; } @@ -293,7 +292,7 @@ void ShowRequest::Run() { app, application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { - LOG4CXX_ERROR(logger_, "Image verification failed."); + SDL_LOG_ERROR("Image verification failed."); SendResponse(false, verification_result); return; } @@ -421,8 +420,7 @@ void ShowRequest::Run() { const auto window_id = (*message_)[strings::msg_params][strings::window_id].asInt(); if (!app->WindowIdExists(window_id)) { - LOG4CXX_ERROR(logger_, - "Window with id #" << window_id << " does not exist"); + SDL_LOG_ERROR("Window with id #" << window_id << " does not exist"); SendResponse(false, mobile_apis::Result::INVALID_ID); return; } @@ -453,21 +451,21 @@ void ShowRequest::Run() { } void ShowRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } switch (event.id()) { case hmi_apis::FunctionID::UI_Show: { - LOG4CXX_DEBUG(logger_, "Received UI_Show event."); + SDL_LOG_DEBUG("Received UI_Show event."); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); std::string response_info; hmi_apis::Common_Result::eType result_code = @@ -498,41 +496,41 @@ void ShowRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event " << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); break; } } } bool ShowRequest::CheckStringsOfShowRequest() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str; if ((*message_)[strings::msg_params].keyExists(strings::main_field_4)) { str = (*message_)[strings::msg_params][strings::main_field_4].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid main_field_4 syntax check failed"); + SDL_LOG_ERROR("Invalid main_field_4 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::main_field_3)) { str = (*message_)[strings::msg_params][strings::main_field_3].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid main_field_3 syntax check failed"); + SDL_LOG_ERROR("Invalid main_field_3 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::main_field_2)) { str = (*message_)[strings::msg_params][strings::main_field_2].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid main_field_2 syntax check failed"); + SDL_LOG_ERROR("Invalid main_field_2 syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::main_field_1)) { str = (*message_)[strings::msg_params][strings::main_field_1].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid main_field_1 syntax check failed"); + SDL_LOG_ERROR("Invalid main_field_1 syntax check failed"); return false; } } @@ -540,28 +538,28 @@ bool ShowRequest::CheckStringsOfShowRequest() { str = (*message_)[strings::msg_params][strings::template_title].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid templateTitle syntax check failed"); + SDL_LOG_ERROR("Invalid templateTitle syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::status_bar)) { str = (*message_)[strings::msg_params][strings::status_bar].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid status_bar syntax check failed"); + SDL_LOG_ERROR("Invalid status_bar syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::media_clock)) { str = (*message_)[strings::msg_params][strings::media_clock].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid media_clock syntax check failed"); + SDL_LOG_ERROR("Invalid media_clock syntax check failed"); return false; } } if ((*message_)[strings::msg_params].keyExists(strings::media_track)) { str = (*message_)[strings::msg_params][strings::media_track].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid media_track syntax check failed"); + SDL_LOG_ERROR("Invalid media_track syntax check failed"); return false; } } @@ -571,7 +569,7 @@ bool ShowRequest::CheckStringsOfShowRequest() { for (size_t i = 0; i < custom_presets_array.length(); ++i) { str = custom_presets_array[i].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid custom_presets syntax check failed"); + SDL_LOG_ERROR("Invalid custom_presets syntax check failed"); return false; } } @@ -581,7 +579,7 @@ bool ShowRequest::CheckStringsOfShowRequest() { str = (*message_)[strings::msg_params][strings::graphic][strings::value] .asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid graphic value syntax check failed"); + SDL_LOG_ERROR("Invalid graphic value syntax check failed"); return false; } } @@ -591,8 +589,7 @@ bool ShowRequest::CheckStringsOfShowRequest() { [strings::value] .asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, - "Invalid secondary_graphic value syntax check failed"); + SDL_LOG_ERROR("Invalid secondary_graphic value syntax check failed"); return false; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc index f5667189b7..074fcabc7a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ShowResponse::ShowResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ ShowResponse::ShowResponse( ShowResponse::~ShowResponse() {} void ShowResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc index dd7b426b40..15ced6d5a1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc @@ -43,6 +43,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SliderRequest::SliderRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -72,20 +74,20 @@ bool SliderRequest::Init() { } void SliderRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!application) { - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if ((*message_)[strings::msg_params][strings::num_ticks].asInt() < (*message_)[strings::msg_params][strings::position].asInt()) { - LOG4CXX_ERROR(logger_, "INVALID_DATA"); + SDL_LOG_ERROR("INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -94,7 +96,7 @@ void SliderRequest::Run() { if (1 < (*message_)[strings::msg_params][strings::slider_footer].length()) { if ((*message_)[strings::msg_params][strings::num_ticks].asUInt() != (*message_)[strings::msg_params][strings::slider_footer].length()) { - LOG4CXX_ERROR(logger_, "INVALID_DATA"); + SDL_LOG_ERROR("INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -102,7 +104,7 @@ void SliderRequest::Run() { } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, "Incoming slider has contains \t\n \\t \\n"); + SDL_LOG_ERROR("Incoming slider has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -126,7 +128,7 @@ void SliderRequest::Run() { } void SliderRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; using namespace smart_objects; using namespace hmi_apis; @@ -135,18 +137,18 @@ void SliderRequest::on_event(const event_engine::Event& event) { const event_engine::Event::EventID event_id = event.id(); if (event_id == FunctionID::UI_OnResetTimeout) { - LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event"); + SDL_LOG_INFO("Received UI_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); return; } if (event_id != FunctionID::UI_Slider) { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } - LOG4CXX_DEBUG(logger_, "Received UI_Slider event"); + SDL_LOG_DEBUG("Received UI_Slider event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); const Common_Result::eType response_code = static_cast<Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -163,8 +165,7 @@ void SliderRequest::on_event(const event_engine::Event& event) { response_msg_params[strings::slider_position] = message[strings::params][strings::data][strings::slider_position]; } else { - LOG4CXX_ERROR(logger_, - strings::slider_position << " field is absent" + SDL_LOG_ERROR(strings::slider_position << " field is absent" " in response."); response_msg_params[strings::slider_position] = 0; } @@ -181,12 +182,12 @@ void SliderRequest::on_event(const event_engine::Event& event) { } bool SliderRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; str = (*message_)[strings::msg_params][strings::slider_header].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid slider_header value syntax check failed"); + SDL_LOG_ERROR("Invalid slider_header value syntax check failed"); return true; } @@ -200,7 +201,7 @@ bool SliderRequest::IsWhiteSpaceExist() { for (; it_sf != it_sf_end; ++it_sf) { str = (*it_sf).asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid slider_footer syntax check failed"); + SDL_LOG_ERROR("Invalid slider_footer syntax check failed"); return true; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc index 4ac96a272e..72b0003d8d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SliderResponse::SliderResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ SliderResponse::SliderResponse( SliderResponse::~SliderResponse() {} void SliderResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc index 0730a8730f..b8de053853 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc @@ -43,6 +43,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SpeakRequest::SpeakRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -60,20 +62,20 @@ SpeakRequest::SpeakRequest( SpeakRequest::~SpeakRequest() {} void SpeakRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming speak has contains \\t\\n \\\\t \\\\n " - " text contains only whitespace in ttsChunks"); + SDL_LOG_ERROR( + "Incoming speak has contains \\t\\n \\\\t \\\\n " + " text contains only whitespace in ttsChunks"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -84,9 +86,8 @@ void SpeakRequest::Run() { MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return " + << verification_result); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "One or more files needed for tts_chunks are not present"); @@ -103,23 +104,23 @@ void SpeakRequest::Run() { } void SpeakRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); switch (event.id()) { case hmi_apis::FunctionID::TTS_Speak: { - LOG4CXX_INFO(logger_, "Received TTS_Speak event"); + SDL_LOG_INFO("Received TTS_Speak event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); ProcessTTSSpeakResponse(event.smart_object()); break; } case hmi_apis::FunctionID::TTS_OnResetTimeout: { - LOG4CXX_INFO(logger_, "Received TTS_OnResetTimeout event"); + SDL_LOG_INFO("Received TTS_OnResetTimeout event"); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); break; } } @@ -127,14 +128,14 @@ void SpeakRequest::on_event(const event_engine::Event& event) { void SpeakRequest::ProcessTTSSpeakResponse( const smart_objects::SmartObject& message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; ApplicationSharedPtr application = application_manager_.application(connection_key()); if (!application) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } @@ -158,7 +159,7 @@ void SpeakRequest::ProcessTTSSpeakResponse( } bool SpeakRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) { @@ -171,7 +172,7 @@ bool SpeakRequest::IsWhiteSpaceExist() { for (; it_tc != it_tc_end; ++it_tc) { str = (*it_tc)[strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed"); + SDL_LOG_ERROR("Invalid tts_chunks syntax check failed"); return true; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc index 69b04977ef..3f9c49ac50 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SpeakResponse::SpeakResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,7 +58,7 @@ SpeakResponse::SpeakResponse( SpeakResponse::~SpeakResponse() {} void SpeakResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc index 3797913f5b..42cb3c60c9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc @@ -41,6 +41,8 @@ namespace commands { namespace str = strings; +SDL_CREATE_LOG_VARIABLE("Commands") + SubscribeButtonRequest::SubscribeButtonRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -56,12 +58,12 @@ SubscribeButtonRequest::SubscribeButtonRequest( SubscribeButtonRequest::~SubscribeButtonRequest() {} void SubscribeButtonRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); + SDL_LOG_ERROR("APPLICATION_NOT_REGISTERED"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -71,8 +73,7 @@ void SubscribeButtonRequest::Run() { (*message_)[str::msg_params][str::button_name].asInt()); if (!IsSubscriptionAllowed(app, btn_id)) { - LOG4CXX_ERROR(logger_, - "Subscribe on button " << btn_id << " isn't allowed"); + SDL_LOG_ERROR("Subscribe on button " << btn_id << " isn't allowed"); SendResponse(false, mobile_apis::Result::REJECTED); return; } @@ -83,23 +84,22 @@ void SubscribeButtonRequest::Run() { bool play_pause_supported = CheckHMICapabilities(mobile_apis::ButtonName::PLAY_PAUSE); if (play_pause_supported) { - LOG4CXX_DEBUG(logger_, "Converting Legacy OK button to PLAY_PAUSE"); + SDL_LOG_DEBUG("Converting Legacy OK button to PLAY_PAUSE"); btn_id = mobile_apis::ButtonName::PLAY_PAUSE; (*message_)[str::msg_params][str::button_name] = btn_id; } else if (!ok_supported) { - LOG4CXX_ERROR(logger_, "OK button isn't allowed by HMI capabilities"); + SDL_LOG_ERROR("OK button isn't allowed by HMI capabilities"); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); } } else if (!CheckHMICapabilities(btn_id)) { - LOG4CXX_ERROR(logger_, - "Subscribe on button " - << btn_id << " isn't allowed by HMI capabilities"); + SDL_LOG_ERROR("Subscribe on button " + << btn_id << " isn't allowed by HMI capabilities"); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); return; } if (app->IsSubscribedToButton(btn_id)) { - LOG4CXX_ERROR(logger_, "Already subscribed to button " << btn_id); + SDL_LOG_ERROR("Already subscribed to button " << btn_id); SendResponse(false, mobile_apis::Result::IGNORED); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc index e584f84f4c..216d1e186d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SubscribeButtonResponse::SubscribeButtonResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -53,12 +55,12 @@ SubscribeButtonResponse::SubscribeButtonResponse( SubscribeButtonResponse::~SubscribeButtonResponse() {} void SubscribeButtonResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // check if response false if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOG4CXX_ERROR(logger_, "Success = false"); + SDL_LOG_ERROR("Success = false"); SendResponse(false); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc index 2ee7771833..6afa462f39 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SubscribeWayPointsRequest::SubscribeWayPointsRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,14 +56,13 @@ SubscribeWayPointsRequest::SubscribeWayPointsRequest( SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {} void SubscribeWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); + SDL_LOG_ERROR("An application with connection key " + << connection_key() << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -83,12 +84,12 @@ void SubscribeWayPointsRequest::Run() { } void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: { - LOG4CXX_INFO(logger_, "Received Navigation_SubscribeWayPoints event"); + SDL_LOG_INFO("Received Navigation_SubscribeWayPoints event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( @@ -107,7 +108,7 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); break; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc index 45486792d7..ab3fc0a4b8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SubscribeWayPointsResponse::SubscribeWayPointsResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ SubscribeWayPointsResponse::SubscribeWayPointsResponse( SubscribeWayPointsResponse::~SubscribeWayPointsResponse() {} void SubscribeWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc index 23604a6b93..502290328a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SubtleAlertRequest::SubtleAlertRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -75,9 +77,9 @@ bool SubtleAlertRequest::Init() { // If soft buttons are present, SDL will not use initiate timeout tracking for // response. if (msg_params.keyExists(strings::soft_buttons)) { - LOG4CXX_INFO(logger_, - "Request contains soft buttons - request timeout " - "will be set to 0."); + SDL_LOG_INFO( + "Request contains soft buttons - request timeout " + "will be set to 0."); default_timeout_ = 0; } @@ -85,7 +87,7 @@ bool SubtleAlertRequest::Init() { } void SubtleAlertRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asInt(); @@ -112,24 +114,24 @@ void SubtleAlertRequest::Run() { } void SubtleAlertRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::TTS_OnResetTimeout: case hmi_apis::FunctionID::UI_OnResetTimeout: { - LOG4CXX_INFO(logger_, - "Received UI_OnResetTimeout event " - " or TTS_OnResetTimeout event" - << awaiting_tts_speak_response_ << " " - << awaiting_tts_stop_speaking_response_ << " " - << awaiting_ui_subtle_alert_response_); + SDL_LOG_INFO( + "Received UI_OnResetTimeout event " + " or TTS_OnResetTimeout event" + << awaiting_tts_speak_response_ << " " + << awaiting_tts_stop_speaking_response_ << " " + << awaiting_ui_subtle_alert_response_); application_manager_.updateRequestTimeout( connection_key(), correlation_id(), default_timeout()); break; } case hmi_apis::FunctionID::UI_SubtleAlert: { - LOG4CXX_INFO(logger_, "Received UI_SubtleAlert event"); + SDL_LOG_INFO("Received UI_SubtleAlert event"); // Unsubscribe from event to avoid unwanted messages EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); unsubscribe_from_event(hmi_apis::FunctionID::UI_SubtleAlert); @@ -154,7 +156,7 @@ void SubtleAlertRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_Speak: { - LOG4CXX_INFO(logger_, "Received TTS_Speak event"); + SDL_LOG_INFO("Received TTS_Speak event"); // Unsubscribe from event to avoid unwanted messages EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); unsubscribe_from_event(hmi_apis::FunctionID::TTS_Speak); @@ -165,7 +167,7 @@ void SubtleAlertRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::TTS_StopSpeaking: { - LOG4CXX_INFO(logger_, "Received TTS_StopSpeaking event"); + SDL_LOG_INFO("Received TTS_StopSpeaking event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); // Unsubscribe from event to avoid unwanted messages unsubscribe_from_event(hmi_apis::FunctionID::TTS_StopSpeaking); @@ -173,7 +175,7 @@ void SubtleAlertRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event" << event.id()); return; } } @@ -249,11 +251,11 @@ bool SubtleAlertRequest::PrepareResponseParameters( } bool SubtleAlertRequest::Validate(uint32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(app_id); if (!app) { - LOG4CXX_ERROR(logger_, "No application associated with session key"); + SDL_LOG_ERROR("No application associated with session key"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return false; } @@ -263,7 +265,7 @@ bool SubtleAlertRequest::Validate(uint32_t app_id) { app->AreCommandLimitsExceeded( static_cast<mobile_apis::FunctionID::eType>(function_id()), application_manager::TLimitSource::POLICY_TABLE)) { - LOG4CXX_ERROR(logger_, "SubtleAlert frequency is too high."); + SDL_LOG_ERROR("SubtleAlert frequency is too high."); SendResponse(false, mobile_apis::Result::REJECTED, "SubtleAlert frequency is too high."); @@ -284,7 +286,7 @@ bool SubtleAlertRequest::Validate(uint32_t app_id) { application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); + SDL_LOG_ERROR("INVALID_DATA!"); SendResponse(false, processing_result); return false; } @@ -293,7 +295,7 @@ bool SubtleAlertRequest::Validate(uint32_t app_id) { if ((!(*message_)[strings::msg_params].keyExists(strings::alert_text1)) && (!(*message_)[strings::msg_params].keyExists(strings::alert_text2)) && (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks))) { - LOG4CXX_ERROR(logger_, "Mandatory parameters are missing"); + SDL_LOG_ERROR("Mandatory parameters are missing"); SendResponse(false, mobile_apis::Result::INVALID_DATA, "Mandatory parameters are missing"); @@ -307,9 +309,8 @@ bool SubtleAlertRequest::Validate(uint32_t app_id) { MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_); if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) { - LOG4CXX_ERROR( - logger_, - "MessageHelper::VerifyTtsFiles return " << verification_result); + SDL_LOG_ERROR("MessageHelper::VerifyTtsFiles return " + << verification_result); SendResponse(false, mobile_apis::Result::FILE_NOT_FOUND, "One or more files needed for tts_chunks are not present"); @@ -321,7 +322,7 @@ bool SubtleAlertRequest::Validate(uint32_t app_id) { } void SubtleAlertRequest::SendSubtleAlertRequest(int32_t app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(app_id); smart_objects::SmartObject msg_params = @@ -369,7 +370,7 @@ void SubtleAlertRequest::SendSubtleAlertRequest(int32_t app_id) { application_manager_); if (mobile_apis::Result::INVALID_DATA == verification_result) { - LOG4CXX_ERROR(logger_, "Image verification failed."); + SDL_LOG_ERROR("Image verification failed."); SendResponse(false, verification_result); return; } @@ -400,7 +401,7 @@ void SubtleAlertRequest::SendSubtleAlertRequest(int32_t app_id) { void SubtleAlertRequest::SendSpeakRequest(int32_t app_id, bool tts_chunks_exists, size_t length_tts_chunks) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace hmi_apis; using namespace smart_objects; // crate HMI speak request @@ -418,13 +419,13 @@ void SubtleAlertRequest::SendSpeakRequest(int32_t app_id, } bool SubtleAlertRequest::CheckStrings() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) { str = (*message_)[strings::msg_params][strings::alert_text1].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid alert_text_1 syntax check failed"); + SDL_LOG_ERROR("Invalid alert_text_1 syntax check failed"); return false; } } @@ -432,7 +433,7 @@ bool SubtleAlertRequest::CheckStrings() { if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) { str = (*message_)[strings::msg_params][strings::alert_text2].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid alert_text_2 syntax check failed"); + SDL_LOG_ERROR("Invalid alert_text_2 syntax check failed"); return false; } } @@ -443,7 +444,7 @@ bool SubtleAlertRequest::CheckStrings() { for (size_t i = 0; i < tts_chunks_array.length(); ++i) { str = tts_chunks_array[i][strings::text].asCharArray(); if (strlen(str) && !CheckSyntax(str)) { - LOG4CXX_ERROR(logger_, "Invalid tts_chunks text syntax check failed"); + SDL_LOG_ERROR("Invalid tts_chunks text syntax check failed"); return false; } } @@ -452,7 +453,7 @@ bool SubtleAlertRequest::CheckStrings() { } bool SubtleAlertRequest::HasHmiResponsesToWait() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return awaiting_ui_subtle_alert_response_ || awaiting_tts_speak_response_ || awaiting_tts_stop_speaking_response_; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_response.cc index ad9252997b..594a967877 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SubtleAlertResponse::SubtleAlertResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ SubtleAlertResponse::SubtleAlertResponse( SubtleAlertResponse::~SubtleAlertResponse() {} void SubtleAlertResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc index 033e70a29c..17e295304c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc @@ -51,7 +51,7 @@ Copyright (c) 2018, Ford Motor Company namespace sdl_rpc_plugin { using namespace application_manager; -CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("Commands") namespace { #ifdef ENABLE_LOG @@ -80,11 +80,10 @@ class QueryAppsDataValidator { : data_(object), manager_(manager) {} bool Validate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!data_.isValid()) { - LOG4CXX_ERROR(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response is not valid."); + SDL_LOG_ERROR(kQueryAppsValidationFailedPrefix + << "QueryApps response is not valid."); return false; } if (!HasResponseKey()) { @@ -96,10 +95,9 @@ class QueryAppsDataValidator { private: bool HasResponseKey() const { if (!data_.keyExists(json::response)) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response does not contain '" - << json::response << "' parameter."); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "QueryApps response does not contain '" << json::response + << "' parameter."); return false; } return true; @@ -109,9 +107,8 @@ class QueryAppsDataValidator { smart_objects::SmartArray* objects_array = data_[json::response].asArray(); if (!objects_array) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response is not array."); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "QueryApps response is not array."); return false; } @@ -125,16 +122,15 @@ class QueryAppsDataValidator { const smart_objects::SmartObject& app_data = *applications_iterator; if (!app_data.isValid()) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "Wrong application data in json file."); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "Wrong application data in json file."); return false; } if (!CheckMandatoryParametersPresent(app_data)) { - LOG4CXX_WARN(logger_, - "Application hasn`t some of mandatory parameters. " - "Application will be skipped."); + SDL_LOG_WARN( + "Application hasn`t some of mandatory parameters. " + "Application will be skipped."); applications_iterator = objects_array->erase(applications_iterator); continue; @@ -153,12 +149,11 @@ class QueryAppsDataValidator { if (json::ios == os_type) { if (app_data[json::ios][json::urlScheme].asString().length() > kUrlSchemaLengthMax) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( kQueryAppsValidationFailedPrefix - << "An urlscheme length exceeds maximum allowed [" - << app_data[json::ios][json::urlScheme].asString().length() - << "]>[" << kUrlSchemaLengthMax << "]"); + << "An urlscheme length exceeds maximum allowed [" + << app_data[json::ios][json::urlScheme].asString().length() + << "]>[" << kUrlSchemaLengthMax << "]"); return false; } } @@ -166,23 +161,20 @@ class QueryAppsDataValidator { if (json::android == os_type) { if (app_data[json::android][json::packageName].asString().length() > kPackageNameLengthMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "Package name length [" - << app_data[json::android][json::packageName] - .asString() - .length() - << "] exceeds max length [" << kPackageNameLengthMax - << "]in json file."); + SDL_LOG_WARN( + kQueryAppsValidationFailedPrefix + << "Package name length [" + << app_data[json::android][json::packageName].asString().length() + << "] exceeds max length [" << kPackageNameLengthMax + << "]in json file."); return false; } } // Languages verification if (!app_data[os_type].keyExists(json::languages)) { - LOG4CXX_WARN( - logger_, - kQueryAppsValidationFailedPrefix << "'languages' doesn't exist"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "'languages' doesn't exist"); return false; } if (!ValidateLanguages(app_data[os_type][json::languages], @@ -199,18 +191,16 @@ class QueryAppsDataValidator { // Verify appid length const std::string app_id(app_data[json::appId].asString()); if (app_id.length() > kAppIdLengthMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "An Object ID length exceeds maximum allowed [" - << app_id.length() << "]>[" << kAppIdLengthMax << "]"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "An Object ID length exceeds maximum allowed [" + << app_id.length() << "]>[" << kAppIdLengthMax << "]"); return false; } // Verify that appid is unique if (applications_id_set_.find(app_id) != applications_id_set_.end()) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "An Object ID is not unigue [" << app_id << "]"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "An Object ID is not unigue [" << app_id << "]"); return false; } applications_id_set_.insert(app_id); @@ -219,18 +209,15 @@ class QueryAppsDataValidator { ApplicationSharedPtr registered_app = manager_.application_by_policy_id(app_id); if (registered_app) { - LOG4CXX_INFO( - logger_, - "Application with the id: " << app_id << " is already registered."); + SDL_LOG_INFO("Application with the id: " << app_id + << " is already registered."); } // And app name length const std::string appName(app_data[json::name].asString()); if (appName.length() > kAppNameLengthMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "Name of application exceeds maximum allowed [" - << appName.length() << "]>[" << kAppNameLengthMax - << "]."); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "Name of application exceeds maximum allowed [" + << appName.length() << "]>[" << kAppNameLengthMax << "]."); return false; } return true; @@ -241,33 +228,29 @@ class QueryAppsDataValidator { bool default_language_found = false; const size_t languages_array_size = languages.length(); if (languages_array_size > kLanguageArraySizeMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "'languages' array exceeds max size [" - << languages_array_size << "]>[" << kLanguageArraySizeMax - << "]"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "'languages' array exceeds max size [" + << languages_array_size << "]>[" << kLanguageArraySizeMax + << "]"); return false; } // Every language has ttsname string and vrsynonyms array for (size_t idx = 0; idx < languages_array_size; ++idx) { const smart_objects::SmartObject& language = languages.getElement(idx); if (smart_objects::SmartType_Map != language.getType()) { - LOG4CXX_WARN( - logger_, - kQueryAppsValidationFailedPrefix << "language is not a map."); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "language is not a map."); return false; } if (language.length() != 1) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "language map size is not equal 1."); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "language map size is not equal 1."); return false; } const std::string language_name = (*language.map_begin()).first; if (!language_name.length()) { - LOG4CXX_WARN( - logger_, - kQueryAppsValidationFailedPrefix << "language name is empty"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "language name is empty"); return false; } // Verify default language defined @@ -280,9 +263,8 @@ class QueryAppsDataValidator { } // ttsName verification if (!language[language_name].keyExists(json::ttsName)) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "'languages.ttsName' doesn't exist"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "'languages.ttsName' doesn't exist"); return false; } const smart_objects::SmartObject& ttsNameObject = @@ -292,17 +274,15 @@ class QueryAppsDataValidator { const std::string ttsName = language[language_name][json::ttsName].asString(); if (ttsName.length() > kTtsNameLengthMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "ttsName string exceeds max length [" - << ttsName.length() << "]>[" << kTtsNameLengthMax - << "]"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "ttsName string exceeds max length [" + << ttsName.length() << "]>[" << kTtsNameLengthMax + << "]"); return false; } } else { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "ttsName is not the string type."); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "ttsName is not the string type."); return false; } @@ -311,9 +291,8 @@ class QueryAppsDataValidator { } } if (!default_language_found) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << " 'languages'.default' doesn't exist"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << " 'languages'.default' doesn't exist"); return false; } return true; @@ -323,34 +302,29 @@ class QueryAppsDataValidator { const std::string& language_name, SynonymsMap& synonyms_map) const { if (!language[language_name].keyExists(json::vrSynonyms)) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "'languages.vrSynonyms' doesn't exist"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "'languages.vrSynonyms' doesn't exist"); return false; } const smart_objects::SmartArray* synonyms_array = language[language_name][json::vrSynonyms].asArray(); if (!synonyms_array) { - LOG4CXX_WARN( - logger_, - kQueryAppsValidationFailedPrefix << "vrSynonyms is not array."); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "vrSynonyms is not array."); return false; } const size_t synonyms_array_size = synonyms_array->size(); if (synonyms_array_size < kVrArraySizeMin) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSynomyms array has [" << synonyms_array_size - << "] size < allowed min size [" << kVrArraySizeMin - << "]"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "vrSynomyms array has [" << synonyms_array_size + << "] size < allowed min size [" << kVrArraySizeMin << "]"); return false; } if (synonyms_array_size > kVrArraySizeMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSynomyms array size [" << synonyms_array_size - << "] exceeds maximum allowed size [" << kVrArraySizeMax - << "]"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "vrSynomyms array size [" << synonyms_array_size + << "] exceeds maximum allowed size [" << kVrArraySizeMax + << "]"); return false; } @@ -358,19 +332,17 @@ class QueryAppsDataValidator { const smart_objects::SmartObject& synonym = (*synonyms_array)[idx]; const std::string vrSynonym = synonym.asString(); if (vrSynonym.length() > kVrSynonymLengthMax) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSYnomym item [" << idx - << "] exceeds max length [" << vrSynonym.length() - << "]>[" << kVrSynonymLengthMax << "]"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "vrSYnomym item [" << idx << "] exceeds max length [" + << vrSynonym.length() << "]>[" << kVrSynonymLengthMax + << "]"); return false; } if (vrSynonym.length() < kVrSynonymLengthMin) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSYnomym item [" << idx << "] length [" - << vrSynonym.length() << "] is less then min length [" - << kVrSynonymLengthMin << "] allowed."); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "vrSYnomym item [" << idx << "] length [" + << vrSynonym.length() << "] is less then min length [" + << kVrSynonymLengthMin << "] allowed."); return false; } // Verify duplicates @@ -378,11 +350,10 @@ class QueryAppsDataValidator { synonyms_map.find(language_name); if (synonyms_map_iter != synonyms_map.end()) { if (!(*synonyms_map_iter).second.insert(vrSynonym).second) { - LOG4CXX_WARN(logger_, - kQueryAppsValidationFailedPrefix - << "vrSYnomym item already defined [" - << vrSynonym.c_str() << "] for language [" - << language_name << "]"); + SDL_LOG_WARN(kQueryAppsValidationFailedPrefix + << "vrSYnomym item already defined [" + << vrSynonym.c_str() << "] for language [" + << language_name << "]"); return false; } } @@ -449,13 +420,13 @@ SystemRequest::SystemRequest( SystemRequest::~SystemRequest() {} void SystemRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = application_manager_.application(connection_key()); if (application.use_count() == 0) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -473,14 +444,12 @@ void SystemRequest::Run() { if (!policy_handler.IsRequestTypeAllowed( application->device(), application->policy_app_id(), request_type)) { - LOG4CXX_ERROR(logger_, - "RequestType " << stringified_request_type + SDL_LOG_ERROR("RequestType " << stringified_request_type << " is DISALLOWED by policies"); SendResponse(false, mobile_apis::Result::DISALLOWED); return; } - LOG4CXX_TRACE(logger_, - "RequestType " << stringified_request_type << " is ALLOWED"); + SDL_LOG_TRACE("RequestType " << stringified_request_type << " is ALLOWED"); const bool request_subtype_present = (*message_)[strings::msg_params].keyExists(strings::request_subtype); @@ -489,14 +458,12 @@ void SystemRequest::Run() { (*message_)[strings::msg_params][strings::request_subtype].asString(); if (!policy_handler.IsRequestSubTypeAllowed(application->policy_app_id(), request_subtype)) { - LOG4CXX_ERROR(logger_, - "Request subtype: " << request_subtype + SDL_LOG_ERROR("Request subtype: " << request_subtype << " is DISALLOWED by policies"); SendResponse(false, mobile_apis::Result::DISALLOWED); return; } - LOG4CXX_TRACE(logger_, - "Request subtype: " << request_subtype << " is ALLOWED"); + SDL_LOG_TRACE("Request subtype: " << request_subtype << " is ALLOWED"); } std::string file_name = kSYNC; @@ -507,8 +474,7 @@ void SystemRequest::Run() { } if (!CheckSyntax(file_name)) { - LOG4CXX_ERROR(logger_, - "Incoming request contains \t\n \\t \\n or whitespace"); + SDL_LOG_ERROR("Incoming request contains \t\n \\t \\n or whitespace"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -516,7 +482,7 @@ void SystemRequest::Run() { if (!file_system::IsFileNameValid(file_name) && mobile_apis::RequestType::ICON_URL != request_type) { const std::string err_msg = "Sync file name contains forbidden symbols."; - LOG4CXX_ERROR(logger_, err_msg); + SDL_LOG_ERROR(err_msg); SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); return; } @@ -547,7 +513,7 @@ void SystemRequest::Run() { SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str()); return; } - LOG4CXX_DEBUG(logger_, "Got ICON_URL Request. File name: " << file_name); + SDL_LOG_DEBUG("Got ICON_URL Request. File name: " << file_name); } else { binary_data_folder = application_manager_.get_settings().system_files_path(); @@ -566,13 +532,12 @@ void SystemRequest::Run() { file_dst_path += file_name; if ((*message_)[strings::params].keyExists(strings::binary_data)) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Binary data is present. Trying to save it to: " << binary_data_folder); if (mobile_apis::Result::SUCCESS != (application_manager_.SaveBinary( binary_data, binary_data_folder, file_name, 0))) { - LOG4CXX_DEBUG(logger_, "Binary data can't be saved."); + SDL_LOG_DEBUG("Binary data can't be saved."); SendResponse(false, mobile_apis::Result::GENERIC_ERROR); return; } @@ -580,23 +545,22 @@ void SystemRequest::Run() { std::string app_full_file_path = binary_data_folder; app_full_file_path += file_name; - LOG4CXX_DEBUG(logger_, - "Binary data is not present. Trying to find file " - << file_name << " within previously saved app file in " - << binary_data_folder); + SDL_LOG_DEBUG("Binary data is not present. Trying to find file " + << file_name << " within previously saved app file in " + << binary_data_folder); const application_manager::AppFile* file = application->GetFile(app_full_file_path); if (!file || !file->is_download_complete || !file_system::MoveFile(app_full_file_path, file_dst_path)) { - LOG4CXX_DEBUG(logger_, "Binary data not found."); + SDL_LOG_DEBUG("Binary data not found."); SendResponse(false, mobile_apis::Result::REJECTED); return; } processing_file_ = file_dst_path; } - LOG4CXX_DEBUG(logger_, "Binary data ok."); + SDL_LOG_DEBUG("Binary data ok."); if (mobile_apis::RequestType::ICON_URL == request_type) { application_manager_.SetIconFileFromSystemRequest(file_name); @@ -620,7 +584,7 @@ void SystemRequest::Run() { Json::Value root; if (!reader.parse(json, &root)) { - LOG4CXX_DEBUG(logger_, "Unable to parse query_app json file. "); + SDL_LOG_DEBUG("Unable to parse query_app json file. "); return; } @@ -662,7 +626,7 @@ void SystemRequest::Run() { } void SystemRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); @@ -683,7 +647,7 @@ void SystemRequest::on_event(const event_engine::Event& event) { application_manager_.application(connection_key()); if (application.use_count() == 0) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); return; } @@ -696,7 +660,7 @@ void SystemRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } @@ -705,16 +669,14 @@ void SystemRequest::on_event(const event_engine::Event& event) { bool SystemRequest::ValidateQueryAppData( smart_objects::SmartObject& data) const { if (!data.isValid()) { - LOG4CXX_ERROR( - logger_, - kQueryAppsValidationFailedPrefix << "QueryApps response is not valid."); + SDL_LOG_ERROR(kQueryAppsValidationFailedPrefix + << "QueryApps response is not valid."); return false; } if (!data.keyExists(json::response)) { - LOG4CXX_ERROR(logger_, - kQueryAppsValidationFailedPrefix - << "QueryApps response does not contain '" - << json::response << "' parameter."); + SDL_LOG_ERROR(kQueryAppsValidationFailedPrefix + << "QueryApps response does not contain '" << json::response + << "' parameter."); return false; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc index 428901a1c5..00b0cd3b5e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SystemResponse::SystemResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ SystemResponse::SystemResponse( SystemResponse::~SystemResponse() {} void SystemResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc index 3ba0513aeb..10f808b771 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc @@ -40,12 +40,14 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + void UnregisterAppInterfaceRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!application_manager_.application(connection_key())) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc index 7c90639968..28d05bef73 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc @@ -38,8 +38,10 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + void UnregisterAppInterfaceResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendResponse((*message_)[strings::msg_params][strings::success].asBool()); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc index ec8de68c9e..69f85568eb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc @@ -41,6 +41,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + namespace str = strings; UnsubscribeButtonRequest::UnsubscribeButtonRequest( @@ -58,12 +60,12 @@ UnsubscribeButtonRequest::UnsubscribeButtonRequest( UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {} void UnsubscribeButtonRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED"); + SDL_LOG_ERROR("APPLICATION_NOT_REGISTERED"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -78,23 +80,22 @@ void UnsubscribeButtonRequest::Run() { bool play_pause_supported = CheckHMICapabilities(mobile_apis::ButtonName::PLAY_PAUSE); if (play_pause_supported) { - LOG4CXX_DEBUG(logger_, "Converting Legacy OK button to PLAY_PAUSE"); + SDL_LOG_DEBUG("Converting Legacy OK button to PLAY_PAUSE"); btn_id = mobile_apis::ButtonName::PLAY_PAUSE; (*message_)[str::msg_params][str::button_name] = btn_id; } else if (!ok_supported) { - LOG4CXX_ERROR(logger_, "OK button isn't allowed by HMI capabilities"); + SDL_LOG_ERROR("OK button isn't allowed by HMI capabilities"); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); } } else if (!CheckHMICapabilities(btn_id)) { - LOG4CXX_ERROR(logger_, - "Button " << btn_id << " isn't allowed by HMI capabilities"); + SDL_LOG_ERROR("Button " << btn_id << " isn't allowed by HMI capabilities"); SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); return; } if (!app->UnsubscribeFromButton( static_cast<mobile_apis::ButtonName::eType>(btn_id))) { - LOG4CXX_ERROR(logger_, "App doesn't subscribe to button " << btn_id); + SDL_LOG_ERROR("App doesn't subscribe to button " << btn_id); SendResponse(false, mobile_apis::Result::IGNORED); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc index c69d49bca1..8321840899 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UnsubscribeButtonResponse::UnsubscribeButtonResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,12 +56,12 @@ UnsubscribeButtonResponse::UnsubscribeButtonResponse( UnsubscribeButtonResponse::~UnsubscribeButtonResponse() {} void UnsubscribeButtonResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // check if response false if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOG4CXX_ERROR(logger_, "Success = false"); + SDL_LOG_ERROR("Success = false"); SendResponse(false); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc index 17326a99a0..b15bbc5c56 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UnsubscribeWayPointsRequest::UnsubscribeWayPointsRequest( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,14 +56,13 @@ UnsubscribeWayPointsRequest::UnsubscribeWayPointsRequest( UnsubscribeWayPointsRequest::~UnsubscribeWayPointsRequest() {} void UnsubscribeWayPointsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, - "An application with connection key " - << connection_key() << " is not registered."); + SDL_LOG_ERROR("An application with connection key " + << connection_key() << " is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -88,12 +89,12 @@ void UnsubscribeWayPointsRequest::Run() { } void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: { - LOG4CXX_INFO(logger_, "Received Navigation_UnsubscribeWayPoints event"); + SDL_LOG_INFO("Received Navigation_UnsubscribeWayPoints event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( @@ -112,7 +113,7 @@ void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); break; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc index a7a180fb46..beb7ef695d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UnsubscribeWayPointsResponse::UnsubscribeWayPointsResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,7 +56,7 @@ UnsubscribeWayPointsResponse::UnsubscribeWayPointsResponse( UnsubscribeWayPointsResponse::~UnsubscribeWayPointsResponse() {} void UnsubscribeWayPointsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc index 8c2cce9765..824d1150b3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc @@ -46,6 +46,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + namespace custom_str = utils::custom_string; UpdateTurnListRequest::UpdateTurnListRequest( @@ -63,20 +65,19 @@ UpdateTurnListRequest::UpdateTurnListRequest( UpdateTurnListRequest::~UpdateTurnListRequest() {} void UpdateTurnListRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); - LOG4CXX_ERROR(logger_, "Application is not registered"); + SDL_LOG_ERROR("Application is not registered"); return; } if (IsWhiteSpaceExist()) { - LOG4CXX_ERROR(logger_, - "Incoming update turn list has contains \t\n \\t \\n"); + SDL_LOG_ERROR("Incoming update turn list has contains \t\n \\t \\n"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -90,7 +91,7 @@ void UpdateTurnListRequest::Run() { application_manager_); if (mobile_apis::Result::SUCCESS != processing_result) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); + SDL_LOG_ERROR("INVALID_DATA!"); SendResponse(false, processing_result); return; } @@ -104,8 +105,7 @@ void UpdateTurnListRequest::Run() { MessageHelper::VerifyImage(turn_list_array[i][strings::turn_icon], app, application_manager_))) { - LOG4CXX_ERROR(logger_, - "MessageHelper::VerifyImage return INVALID_DATA"); + SDL_LOG_ERROR("MessageHelper::VerifyImage return INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -118,7 +118,7 @@ void UpdateTurnListRequest::Run() { if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) { if (!CheckTurnListArray()) { - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); + SDL_LOG_ERROR("INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -152,18 +152,18 @@ void UpdateTurnListRequest::Run() { hmi_apis::FunctionID::Navigation_UpdateTurnList, &msg_params, true); } else { // conditional mandatory - LOG4CXX_ERROR(logger_, "INVALID_DATA!"); + SDL_LOG_ERROR("INVALID_DATA!"); SendResponse(false, mobile_apis::Result::INVALID_DATA); } } void UpdateTurnListRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::Navigation_UpdateTurnList: { - LOG4CXX_INFO(logger_, "Received Navigation_UpdateTurnList event"); + SDL_LOG_INFO("Received Navigation_UpdateTurnList event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( @@ -179,7 +179,7 @@ void UpdateTurnListRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); break; } } @@ -204,7 +204,7 @@ bool UpdateTurnListRequest::CheckTurnListArray() { } bool UpdateTurnListRequest::IsWhiteSpaceExist() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* str = NULL; if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) { @@ -218,8 +218,7 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() { if ((*it_tl).keyExists(strings::navigation_text)) { str = (*it_tl)[strings::navigation_text].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Invalid turn_list navigation_text text syntax check failed"); return true; } @@ -228,8 +227,8 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() { if ((*it_tl).keyExists(strings::turn_icon)) { str = (*it_tl)[strings::turn_icon][strings::value].asCharArray(); if (!CheckSyntax(str)) { - LOG4CXX_ERROR( - logger_, "Invalid turn_list turn_icon value syntax check failed"); + SDL_LOG_ERROR( + "Invalid turn_list turn_icon value syntax check failed"); return true; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc index eca9e3703c..bedf91b45c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UpdateTurnListResponse::UpdateTurnListResponse( const application_manager::commands::MessageSharedPtr& message, ApplicationManager& application_manager, @@ -55,7 +57,7 @@ UpdateTurnListResponse::UpdateTurnListResponse( UpdateTurnListResponse::~UpdateTurnListResponse() {} void UpdateTurnListResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc index 5ffbbd83bb..9fb6d63273 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc @@ -1,7 +1,7 @@ #include "sdl_rpc_plugin/extensions/system_capability_app_extension.h" namespace sdl_rpc_plugin { -CREATE_LOGGERPTR_GLOBAL(logger_, "GetSystemCapabilitiesAppExtension") +SDL_CREATE_LOG_VARIABLE("GetSystemCapabilitiesAppExtension") namespace app_mngr_ = application_manager; const app_mngr_::AppExtensionUID @@ -18,16 +18,14 @@ SystemCapabilityAppExtension::~SystemCapabilityAppExtension() {} bool SystemCapabilityAppExtension::SubscribeTo( const SystemCapabilityType system_capability_type) { - LOG4CXX_INFO(logger_, - "Subscribing to System Capability " << system_capability_type); + SDL_LOG_INFO("Subscribing to System Capability " << system_capability_type); return subscribed_data_.insert(system_capability_type).second; } bool SystemCapabilityAppExtension::UnsubscribeFrom( const SystemCapabilityType system_capability_type) { - LOG4CXX_INFO( - logger_, - "Unsubscribing from System Capability " << system_capability_type); + SDL_LOG_INFO("Unsubscribing from System Capability " + << system_capability_type); auto it = subscribed_data_.find(system_capability_type); if (it != subscribed_data_.end()) { subscribed_data_.erase(it); @@ -37,13 +35,13 @@ bool SystemCapabilityAppExtension::UnsubscribeFrom( } void SystemCapabilityAppExtension::UnsubscribeFromAll() { - LOG4CXX_INFO(logger_, "Unsubscribing from ALL System Capabilities"); + SDL_LOG_INFO("Unsubscribing from ALL System Capabilities"); subscribed_data_.clear(); } bool SystemCapabilityAppExtension::IsSubscribedTo( const SystemCapabilityType system_capability_type) const { - LOG4CXX_DEBUG(logger_, system_capability_type); + SDL_LOG_DEBUG(system_capability_type); return subscribed_data_.find(system_capability_type) != subscribed_data_.end(); } @@ -54,7 +52,7 @@ SystemCapabilitySubscriptions SystemCapabilityAppExtension::Subscriptions() { void SystemCapabilityAppExtension::SaveResumptionData( ns_smart_device_link::ns_smart_objects::SmartObject& resumption_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* application_system_capability = "systemCapability"; resumption_data[application_system_capability] = @@ -69,7 +67,7 @@ void SystemCapabilityAppExtension::SaveResumptionData( void SystemCapabilityAppExtension::ProcessResumption( const smart_objects::SmartObject& resumption_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const char* application_system_capability = "systemCapability"; if (resumption_data.keyExists(application_system_capability)) { @@ -85,7 +83,7 @@ void SystemCapabilityAppExtension::ProcessResumption( SystemCapabilityAppExtension& SystemCapabilityAppExtension::ExtractExtension( app_mngr_::Application& app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto ext_ptr = app.QueryInterface( SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID); DCHECK(ext_ptr); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index a22fad1d3b..570a4ce12e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc @@ -270,7 +270,7 @@ namespace sdl_rpc_plugin { using namespace application_manager; -CREATE_LOGGERPTR_GLOBAL(logger_, "HMICommandFactory") +SDL_CREATE_LOG_VARIABLE("HMICommandFactory") HMICommandFactory::HMICommandFactory( ApplicationManager& application_manager, @@ -288,20 +288,20 @@ CommandSharedPtr HMICommandFactory::CreateCommand( const hmi_apis::FunctionID::eType function_id = static_cast<hmi_apis::FunctionID::eType>( (*message)[strings::params][strings::function_id].asInt()); - LOG4CXX_DEBUG( - logger_, "HMICommandFactory::CreateCommand function_id: " << function_id); + SDL_LOG_DEBUG( + "HMICommandFactory::CreateCommand function_id: " << function_id); const hmi_apis::messageType::eType message_type = static_cast<hmi_apis::messageType::eType>( (*message)[strings::params][strings::message_type].asInt()); if (hmi_apis::messageType::response == message_type) { - LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand response"); + SDL_LOG_DEBUG("HMICommandFactory::CreateCommand response"); } else if ((*message)[strings::params][strings::message_type] == hmi_apis::messageType::error_response) { - LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand error response"); + SDL_LOG_DEBUG("HMICommandFactory::CreateCommand error response"); } else { - LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand request"); + SDL_LOG_DEBUG("HMICommandFactory::CreateCommand request"); } return get_creator_factory(function_id, message_type, source).create(message); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc index a585f4cecf..d2f1325c82 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc @@ -149,7 +149,7 @@ #include "sdl_rpc_plugin/commands/mobile/update_turn_list_request.h" #include "sdl_rpc_plugin/commands/mobile/update_turn_list_response.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") +SDL_CREATE_LOG_VARIABLE("ApplicationManager") namespace sdl_rpc_plugin { using namespace application_manager; @@ -560,8 +560,7 @@ CommandSharedPtr MobileCommandFactory::CreateCommand( static_cast<mobile_apis::FunctionID::eType>( (*message)[strings::params][strings::function_id].asInt()); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "MobileCommandFactory::CreateCommand function_id: " << function_id); return get_creator_factory(function_id, message_type, source).create(message); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc index 2a1261f643..17fbfe9598 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc @@ -39,7 +39,7 @@ namespace sdl_rpc_plugin { namespace app_mngr = application_manager; namespace plugins = application_manager::plugin_manager; -CREATE_LOGGERPTR_GLOBAL(logger_, "SdlRPCPlugin") +SDL_CREATE_LOG_VARIABLE("SdlRPCPlugin") bool SDLRPCPlugin::Init(app_mngr::ApplicationManager& app_manager, app_mngr::rpc_service::RPCService& rpc_service, @@ -90,7 +90,7 @@ void SDLRPCPlugin::OnApplicationEvent( // Processing automatic subscription to SystemCapabilities for DISPLAY type const auto capability_type = mobile_apis::SystemCapabilityType::eType::DISPLAYS; - LOG4CXX_DEBUG(logger_, "Subscription to DISPLAYS capability is enabled"); + SDL_LOG_DEBUG("Subscription to DISPLAYS capability is enabled"); sys_cap_ext_ptr->SubscribeTo(capability_type); } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) { ClearSubscriptions(application); @@ -106,12 +106,12 @@ void SDLRPCPlugin::ClearSubscriptions(app_mngr::ApplicationSharedPtr app) { extern "C" __attribute__((visibility("default"))) application_manager::plugin_manager::RPCPlugin* -Create() { +Create(logger::Logger* logger_instance) { + logger::Logger::instance(logger_instance); return new sdl_rpc_plugin::SDLRPCPlugin(); } extern "C" __attribute__((visibility("default"))) void Delete( application_manager::plugin_manager::RPCPlugin* data) { delete data; - DELETE_THREAD_LOGGER(sdl_rpc_plugin::logger_); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h index 80336b6967..6e804d470e 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h @@ -90,6 +90,7 @@ class VehicleInfoPlugin : public plugins::RPCPlugin { }; } // namespace vehicle_info_plugin -extern "C" application_manager::plugin_manager::RPCPlugin* Create(); +extern "C" application_manager::plugin_manager::RPCPlugin* Create( + logger::Logger* logger_instances); extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data); #endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_PLUGIN_H diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc index b8d1b3a100..88884e365a 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVIVehicleDataNotification::OnVIVehicleDataNotification( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -50,7 +52,7 @@ OnVIVehicleDataNotification::OnVIVehicleDataNotification( OnVIVehicleDataNotification::~OnVIVehicleDataNotification() {} void OnVIVehicleDataNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // prepare SmartObject for mobile factory (*message_)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc index ae64c74f26..95999c76f9 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIDiagnosticMessageRequest::VIDiagnosticMessageRequest( const app_mngr::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -49,7 +51,7 @@ VIDiagnosticMessageRequest::VIDiagnosticMessageRequest( VIDiagnosticMessageRequest::~VIDiagnosticMessageRequest() {} void VIDiagnosticMessageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc index 6482d97d10..4ee6e1e495 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIDiagnosticMessageResponse::VIDiagnosticMessageResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -50,7 +52,7 @@ VIDiagnosticMessageResponse::VIDiagnosticMessageResponse( VIDiagnosticMessageResponse::~VIDiagnosticMessageResponse() {} void VIDiagnosticMessageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc index 620ee4c3e4..6b312c826d 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIGetDTCsRequest::VIGetDTCsRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -49,7 +51,7 @@ VIGetDTCsRequest::VIGetDTCsRequest( VIGetDTCsRequest::~VIGetDTCsRequest() {} void VIGetDTCsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc index 64e948a4e1..b84e67d7c5 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIGetDTCsResponse::VIGetDTCsResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -50,7 +52,7 @@ VIGetDTCsResponse::VIGetDTCsResponse( VIGetDTCsResponse::~VIGetDTCsResponse() {} void VIGetDTCsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetDTCs); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc index eded6c685b..a3e3a83f62 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIGetVehicleDataRequest::VIGetVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -51,7 +53,7 @@ VIGetVehicleDataRequest::VIGetVehicleDataRequest( VIGetVehicleDataRequest::~VIGetVehicleDataRequest() {} void VIGetVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data(); auto& msg_params = (*message_)[strings::msg_params]; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc index 763ddf1cfa..0ef6a97e91 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc @@ -39,6 +39,8 @@ namespace vehicle_info_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIGetVehicleDataResponse::VIGetVehicleDataResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -51,7 +53,7 @@ VIGetVehicleDataResponse::VIGetVehicleDataResponse( VIGetVehicleDataResponse::~VIGetVehicleDataResponse() {} void VIGetVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc index e8df12ca5c..26a9990079 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIGetVehicleTypeRequest::VIGetVehicleTypeRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -49,13 +51,13 @@ VIGetVehicleTypeRequest::VIGetVehicleTypeRequest( VIGetVehicleTypeRequest::~VIGetVehicleTypeRequest() {} void VIGetVehicleTypeRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } void VIGetVehicleTypeRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VehicleInfo_GetVehicleType); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc index dcc73d26f3..dbd1b48033 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIGetVehicleTypeResponse::VIGetVehicleTypeResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -48,7 +50,7 @@ VIGetVehicleTypeResponse::VIGetVehicleTypeResponse( VIGetVehicleTypeResponse::~VIGetVehicleTypeResponse() {} void VIGetVehicleTypeResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto result_code = static_cast<hmi_apis::Common_Result::eType>( (*message_)[strings::params][hmi_response::code].asInt()); @@ -57,8 +59,7 @@ void VIGetVehicleTypeResponse::Run() { hmi_apis::FunctionID::VehicleInfo_GetVehicleType); if (hmi_apis::Common_Result::SUCCESS != result_code) { - LOG4CXX_DEBUG(logger_, - "Request was not successful. Don't change HMI capabilities"); + SDL_LOG_DEBUG("Request was not successful. Don't change HMI capabilities"); return; } @@ -70,8 +71,8 @@ void VIGetVehicleTypeResponse::Run() { hmi_interface::vehicle_info, sections_to_update, message_->getSchema())) { - LOG4CXX_ERROR( - logger_, "Failed to save VehicleInfo.GetVehicleType response to cache"); + SDL_LOG_ERROR( + "Failed to save VehicleInfo.GetVehicleType response to cache"); } } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc index 3525be059d..578f650e98 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIIsReadyRequest::VIIsReadyRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -55,18 +57,18 @@ VIIsReadyRequest::VIIsReadyRequest( VIIsReadyRequest::~VIIsReadyRequest() {} void VIIsReadyRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); subscribe_on_event(hmi_apis::FunctionID::VehicleInfo_IsReady, correlation_id()); SendRequest(); } void VIIsReadyRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::VehicleInfo_IsReady: { - LOG4CXX_DEBUG(logger_, "VehicleInfo_IsReady event"); + SDL_LOG_DEBUG("VehicleInfo_IsReady event"); unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_IsReady); const bool is_available = app_mngr::commands::ChangeInterfaceState( application_manager_, @@ -78,8 +80,7 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) { policy_handler_.OnVIIsReady(); if (!app_mngr::commands::CheckAvailabilityHMIInterfaces( application_manager_, HmiInterfaces::HMI_INTERFACE_VehicleInfo)) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( "HmiInterfaces::HMI_INTERFACE_VehicleInfo isn't available"); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VehicleInfo_GetVehicleType); @@ -90,7 +91,7 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc index 349a1137ce..b40ecc51db 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc @@ -36,6 +36,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIIsReadyResponse::VIIsReadyResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -48,7 +50,7 @@ VIIsReadyResponse::VIIsReadyResponse( VIIsReadyResponse::~VIIsReadyResponse() {} void VIIsReadyResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_IsReady); event.set_smart_object(*message_); event.raise(application_manager_.event_dispatcher()); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc index 47373bb4bf..529ed248d0 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIReadDIDRequest::VIReadDIDRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -49,7 +51,7 @@ VIReadDIDRequest::VIReadDIDRequest( VIReadDIDRequest::~VIReadDIDRequest() {} void VIReadDIDRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendRequest(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc index 7c2db1e875..09abb3c9fc 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc @@ -37,6 +37,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIReadDIDResponse::VIReadDIDResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -49,7 +51,7 @@ VIReadDIDResponse::VIReadDIDResponse( VIReadDIDResponse::~VIReadDIDResponse() {} void VIReadDIDResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_ReadDID); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc index 4c5f067d0d..12a938fe08 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VISubscribeVehicleDataRequest::VISubscribeVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -51,7 +53,7 @@ VISubscribeVehicleDataRequest::VISubscribeVehicleDataRequest( VISubscribeVehicleDataRequest::~VISubscribeVehicleDataRequest() {} void VISubscribeVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data(); auto& msg_params = (*message_)[strings::msg_params]; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc index 061e13c766..5fbd9a7f82 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc @@ -37,6 +37,8 @@ namespace vehicle_info_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VISubscribeVehicleDataResponse::VISubscribeVehicleDataResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -49,7 +51,7 @@ VISubscribeVehicleDataResponse::VISubscribeVehicleDataResponse( VISubscribeVehicleDataResponse::~VISubscribeVehicleDataResponse() {} void VISubscribeVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc index aa24ac7375..d9c9b0729a 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc @@ -38,6 +38,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIUnsubscribeVehicleDataRequest::VIUnsubscribeVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -51,7 +53,7 @@ VIUnsubscribeVehicleDataRequest::VIUnsubscribeVehicleDataRequest( VIUnsubscribeVehicleDataRequest::~VIUnsubscribeVehicleDataRequest() {} void VIUnsubscribeVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data(); auto& msg_params = (*message_)[strings::msg_params]; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc index 01fc521b10..ea1ab16d0d 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc @@ -37,6 +37,8 @@ namespace vehicle_info_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + VIUnsubscribeVehicleDataResponse::VIUnsubscribeVehicleDataResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -49,7 +51,7 @@ VIUnsubscribeVehicleDataResponse::VIUnsubscribeVehicleDataResponse( VIUnsubscribeVehicleDataResponse::~VIUnsubscribeVehicleDataResponse() {} void VIUnsubscribeVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); event_engine::Event event( hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData); event.set_smart_object(*message_); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc index ef6c284faf..762528c51b 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc @@ -44,6 +44,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DiagnosticMessageRequest::DiagnosticMessageRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -56,12 +58,12 @@ DiagnosticMessageRequest::DiagnosticMessageRequest( DiagnosticMessageRequest::~DiagnosticMessageRequest() {} void DiagnosticMessageRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "Application is not registered."); + SDL_LOG_ERROR("Application is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -77,8 +79,7 @@ void DiagnosticMessageRequest::Run() { if (supported_diag_modes.end() == std::find(supported_diag_modes.begin(), supported_diag_modes.end(), msg_diagnostic_mode)) { - LOG4CXX_ERROR(logger_, - "Received diagnostic mode " << msg_diagnostic_mode + SDL_LOG_ERROR("Received diagnostic mode " << msg_diagnostic_mode << " is not supported."); SendResponse(false, mobile_apis::Result::REJECTED, @@ -96,7 +97,7 @@ void DiagnosticMessageRequest::Run() { } void DiagnosticMessageRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -116,7 +117,7 @@ void DiagnosticMessageRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc index f5ccc4d0a7..5448d8c48b 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + DiagnosticMessageResponse::DiagnosticMessageResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -51,7 +53,7 @@ DiagnosticMessageResponse::DiagnosticMessageResponse( DiagnosticMessageResponse::~DiagnosticMessageResponse() {} void DiagnosticMessageResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc index dfa1cf305b..2f236dd8b2 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc @@ -42,6 +42,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetDTCsRequest::GetDTCsRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -54,13 +56,13 @@ GetDTCsRequest::GetDTCsRequest( GetDTCsRequest::~GetDTCsRequest() {} void GetDTCsRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application( (*message_)[strings::params][strings::connection_key].asUInt()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -83,7 +85,7 @@ void GetDTCsRequest::Run() { } void GetDTCsRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -105,7 +107,7 @@ void GetDTCsRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc index 33945a2f00..6631274c0d 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetDTCsResponse::GetDTCsResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -51,7 +53,7 @@ GetDTCsResponse::GetDTCsResponse( GetDTCsResponse::~GetDTCsResponse() {} void GetDTCsResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc index d15cf6a580..e5656d60c5 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc @@ -47,6 +47,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + namespace str = strings; GetVehicleDataRequest::GetVehicleDataRequest( @@ -62,12 +64,12 @@ GetVehicleDataRequest::GetVehicleDataRequest( GetVehicleDataRequest::~GetVehicleDataRequest() {} void GetVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "No such application : " << connection_key()); + SDL_LOG_ERROR("No such application : " << connection_key()); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -110,7 +112,7 @@ void GetVehicleDataRequest::Run() { } void GetVehicleDataRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject message = event.smart_object(); switch (event.id()) { @@ -178,7 +180,7 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } @@ -188,7 +190,7 @@ bool GetVehicleDataRequest::CheckFrequency(Application& app) { if (app.AreCommandLimitsExceeded( static_cast<mobile_apis::FunctionID::eType>(function_id()), application_manager::TLimitSource::CONFIG_FILE)) { - LOG4CXX_ERROR(logger_, "GetVehicleData frequency is too high."); + SDL_LOG_ERROR("GetVehicleData frequency is too high."); return false; } return true; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc index 60a44745a5..c263acd33f 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc @@ -40,6 +40,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + GetVehicleDataResponse::GetVehicleDataResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -52,7 +54,7 @@ GetVehicleDataResponse::GetVehicleDataResponse( GetVehicleDataResponse::~GetVehicleDataResponse() {} void GetVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc index 79134cae40..e336b778ff 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc @@ -45,6 +45,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + OnVehicleDataNotification::OnVehicleDataNotification( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -58,7 +60,7 @@ OnVehicleDataNotification::OnVehicleDataNotification( OnVehicleDataNotification::~OnVehicleDataNotification() {} void OnVehicleDataNotification::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<ApplicationSharedPtr> notify_apps; std::vector<ApplicationSharedPtr>::iterator notified_app_it = @@ -70,7 +72,7 @@ void OnVehicleDataNotification::Run() { const auto& param_names = (*message_)[strings::msg_params].enumerate(); for (const auto& name : param_names) { - LOG4CXX_DEBUG(logger_, "vehicle_data name: " << name); + SDL_LOG_DEBUG("vehicle_data name: " << name); auto vehicle_data_value = (*message_)[strings::msg_params][name].asInt(); application_manager_.IviInfoUpdated(name, vehicle_data_value); @@ -84,7 +86,7 @@ void OnVehicleDataNotification::Run() { application_manager_.applications(), subscribed_to_ivi_predicate); for (const auto& app : applications) { if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); continue; } notified_app_it = find(notify_apps.begin(), notify_apps.end(), app); @@ -101,14 +103,12 @@ void OnVehicleDataNotification::Run() { } } - LOG4CXX_DEBUG(logger_, - "Number of Notifications to be send: " << notify_apps.size()); + SDL_LOG_DEBUG("Number of Notifications to be send: " << notify_apps.size()); for (size_t idx = 0; idx < notify_apps.size(); idx++) { - LOG4CXX_INFO(logger_, - "Send OnVehicleData PRNDL notification to " - << notify_apps[idx]->name().c_str() << " application id " - << notify_apps[idx]->app_id()); + SDL_LOG_INFO("Send OnVehicleData PRNDL notification to " + << notify_apps[idx]->name().c_str() << " application id " + << notify_apps[idx]->app_id()); (*message_)[strings::params][strings::connection_key] = notify_apps[idx]->app_id(); (*message_)[strings::msg_params] = appSO[idx]; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc index c090df7852..c718d18965 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc @@ -43,6 +43,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ReadDIDRequest::ReadDIDRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -55,19 +57,18 @@ ReadDIDRequest::ReadDIDRequest( ReadDIDRequest::~ReadDIDRequest() {} void ReadDIDRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt(); ApplicationSharedPtr app = application_manager_.application(app_id); - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( "Correlation_id :" - << (*message_)[strings::params][strings::correlation_id].asUInt()); + << (*message_)[strings::params][strings::correlation_id].asUInt()); if (!app) { - LOG4CXX_ERROR(logger_, "An application is not registered."); + SDL_LOG_ERROR("An application is not registered."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -75,13 +76,13 @@ void ReadDIDRequest::Run() { if (app->AreCommandLimitsExceeded( static_cast<mobile_apis::FunctionID::eType>(function_id()), application_manager::TLimitSource::CONFIG_FILE)) { - LOG4CXX_ERROR(logger_, "ReadDID frequency is too high."); + SDL_LOG_ERROR("ReadDID frequency is too high."); SendResponse(false, mobile_apis::Result::REJECTED); return; } if ((*message_)[strings::msg_params][strings::did_location].empty()) { - LOG4CXX_ERROR(logger_, "INVALID_DATA"); + SDL_LOG_ERROR("INVALID_DATA"); SendResponse(false, mobile_apis::Result::INVALID_DATA); return; } @@ -99,7 +100,7 @@ void ReadDIDRequest::Run() { } void ReadDIDRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { @@ -120,7 +121,7 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) { break; } default: { - LOG4CXX_ERROR(logger_, "Received unknown event" << event.id()); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc index 42e7fc1ba9..806aeb611c 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc @@ -39,6 +39,8 @@ using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + ReadDIDResponse::ReadDIDResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -51,7 +53,7 @@ ReadDIDResponse::ReadDIDResponse( ReadDIDResponse::~ReadDIDResponse() {} void ReadDIDResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc index 29818232c0..d51790ea55 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc @@ -42,6 +42,8 @@ namespace vehicle_info_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SubscribeVehicleDataRequest::SubscribeVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, VehicleInfoCommandParams params) @@ -55,12 +57,12 @@ SubscribeVehicleDataRequest::SubscribeVehicleDataRequest( SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() {} void SubscribeVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -90,13 +92,13 @@ void SubscribeVehicleDataRequest::Run() { } void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); if (hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData != event.id()) { - LOG4CXX_ERROR(logger_, "Received unknown event."); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); @@ -104,7 +106,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { application_manager_.application(CommandRequestImpl::connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer."); + SDL_LOG_ERROR("NULL pointer."); return; } @@ -134,7 +136,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { const auto& converted_name = ConvertResponseToRequestName(param); if (vi_waiting_for_subscribe_.end() == vi_waiting_for_subscribe_.find(converted_name)) { - LOG4CXX_DEBUG(logger_, "erase " << converted_name); + SDL_LOG_DEBUG("erase " << converted_name); converted_msg_params.erase(param); } } @@ -184,8 +186,7 @@ bool SubscribeVehicleDataRequest::CheckSubscriptionStatus( std::string vi_name, const smart_objects::SmartObject& msg_params) { const auto subscribed_items = msg_params.enumerate(); if (subscribed_items.end() == subscribed_items.find(vi_name)) { - LOG4CXX_WARN(logger_, - vi_name << " is waiting to be subscribed, but missing in " + SDL_LOG_WARN(vi_name << " is waiting to be subscribed, but missing in " "vehicle response."); return false; } @@ -193,8 +194,7 @@ bool SubscribeVehicleDataRequest::CheckSubscriptionStatus( auto res_code = msg_params[vi_name][strings::result_code].asInt(); if (VD_ResultCode::VDRC_SUCCESS != res_code && VD_ResultCode::VDRC_DATA_ALREADY_SUBSCRIBED != res_code) { - LOG4CXX_WARN(logger_, - "Subscription to " << vi_name << " for " << connection_key() + SDL_LOG_WARN("Subscription to " << vi_name << " for " << connection_key() << " failed."); return false; } @@ -203,7 +203,7 @@ bool SubscribeVehicleDataRequest::CheckSubscriptionStatus( bool SubscribeVehicleDataRequest::SubscribePendingVehicleData( ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) { - LOG4CXX_DEBUG(logger_, "Subscribing to all pending VehicleData"); + SDL_LOG_DEBUG("Subscribing to all pending VehicleData"); std::set<hmi_apis::Common_VehicleDataResultCode::eType> skiped_result_codes( {VD_ResultCode::VDRC_TRUNCATED_DATA, @@ -245,7 +245,7 @@ bool SubscribeVehicleDataRequest::Init() { void SubscribeVehicleDataRequest::AddAlreadySubscribedVI( smart_objects::SmartObject& msg_params) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis; for (const auto& item : vi_already_subscribed_by_this_app_) { @@ -272,7 +272,7 @@ struct SubscribedToIVIPredicate { bool SubscribeVehicleDataRequest::IsSomeoneSubscribedFor( const std::string& param_name) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SubscribedToIVIPredicate finder(param_name); DataAccessor<ApplicationSet> accessor = application_manager_.applications(); ApplicationSetConstIt it = std::find_if( @@ -298,11 +298,10 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions( [this, &out_response_params]( const std::string& key_name, const mobile_apis::VehicleDataType::eType vd_type) { - LOG4CXX_DEBUG( - logger_, - "App with connection key " - << connection_key() - << " is subscribed already for VehicleData: " << key_name); + SDL_LOG_DEBUG("App with connection key " + << connection_key() + << " is subscribed already for VehicleData: " + << key_name); vi_already_subscribed_by_this_app_.insert(key_name); out_response_params[key_name][strings::data_type] = vd_type; out_response_params[key_name][strings::result_code] = @@ -314,21 +313,20 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions( const std::string& key_name, const mobile_apis::VehicleDataType::eType vd_type, vehicle_info_plugin::VehicleInfoAppExtension& ext) { - LOG4CXX_DEBUG(logger_, - "There are apps subscribed already for " - "VehicleDataType: " - << key_name); + SDL_LOG_DEBUG( + "There are apps subscribed already for " + "VehicleDataType: " + << key_name); if (!ext.subscribeToVehicleInfo(key_name)) { - LOG4CXX_ERROR( - logger_, "Unable to subscribe for VehicleDataType: " << key_name); + SDL_LOG_ERROR( + "Unable to subscribe for VehicleDataType: " << key_name); return; } - LOG4CXX_DEBUG( - logger_, - "App with connection key " - << connection_key() - << " have been subscribed for VehicleDataType: " << key_name); + SDL_LOG_DEBUG("App with connection key " + << connection_key() + << " have been subscribed for VehicleDataType: " + << key_name); vi_already_subscribed_by_another_apps_.insert(key_name); out_response_params[key_name][strings::data_type] = vd_type; out_response_params[key_name][strings::result_code] = @@ -341,11 +339,9 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions( out_request_params[vi_name] = (*message_)[strings::msg_params][vi_name]; vi_waiting_for_subscribe_.insert(vi_name); - LOG4CXX_DEBUG( - logger_, - "App with connection key " - << connection_key() - << " will be subscribed for VehicleDataType: " << vi_name); + SDL_LOG_DEBUG("App with connection key " + << connection_key() + << " will be subscribed for VehicleDataType: " << vi_name); ++subscribed_items; return true; }; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc index 8330176af6..0527532acc 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc @@ -40,6 +40,8 @@ namespace vehicle_info_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + SubscribeVehicleDataResponse::SubscribeVehicleDataResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -52,7 +54,7 @@ SubscribeVehicleDataResponse::SubscribeVehicleDataResponse( SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() {} void SubscribeVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc_service_.SendMessageToMobile(message_); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc index fccf56ecf5..8ffeaf922a 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc @@ -47,6 +47,8 @@ namespace vehicle_info_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -60,12 +62,12 @@ UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest( UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() {} void UnsubscribeVehicleDataRequest::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr app = application_manager_.application(connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer"); + SDL_LOG_ERROR("NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } @@ -82,20 +84,19 @@ void UnsubscribeVehicleDataRequest::Run() { std::set<std::string> custom_vehicle_data; auto app_not_subscribed_response = [this](const std::string& key_name) { - LOG4CXX_DEBUG(logger_, - "App with connection key " - << connection_key() - << " is not subscribed for VehicleData: " << key_name); + SDL_LOG_DEBUG("App with connection key " + << connection_key() + << " is not subscribed for VehicleData: " << key_name); vi_already_unsubscribed_by_this_app_.insert(key_name); response_params_[key_name][strings::result_code] = mobile_apis::VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED; }; auto other_app_subscribed_response = [this](const std::string& key_name) { - LOG4CXX_DEBUG(logger_, - "There are apps still subscribed for " - "VehicleDataType: " - << key_name); + SDL_LOG_DEBUG( + "There are apps still subscribed for " + "VehicleDataType: " + << key_name); vi_still_subscribed_by_another_apps_.insert(key_name); response_params_[key_name][strings::result_code] = mobile_apis::VehicleDataResultCode::VDRC_SUCCESS; @@ -117,9 +118,8 @@ void UnsubscribeVehicleDataRequest::Run() { continue; } - LOG4CXX_DEBUG(logger_, - "Unsubscribed app with connection key " - << connection_key() << " from VehicleDataType: " << name); + SDL_LOG_DEBUG("Unsubscribed app with connection key " + << connection_key() << " from VehicleDataType: " << name); ++unsubscribed_items; @@ -177,13 +177,13 @@ void UnsubscribeVehicleDataRequest::Run() { } void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); if (hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData != event.id()) { - LOG4CXX_ERROR(logger_, "Received unknown event."); + SDL_LOG_ERROR("Received unknown event " << event.id()); return; } EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); @@ -192,7 +192,7 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { application_manager_.application(CommandRequestImpl::connection_key()); if (!app) { - LOG4CXX_ERROR(logger_, "NULL pointer."); + SDL_LOG_ERROR("NULL pointer."); return; } @@ -260,7 +260,7 @@ bool UnsubscribeVehicleDataRequest::Init() { bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor( const std::string& param_name) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto conn_key = connection_key(); auto subscribed_to_ivi = [¶m_name, &conn_key](const ApplicationSharedPtr app) { @@ -280,7 +280,7 @@ bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor( void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI( smart_objects::SmartObject& response) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace mobile_apis; for (const auto& item : vi_already_unsubscribed_by_this_app_) { @@ -297,16 +297,14 @@ bool UnsubscribeVehicleDataRequest::CheckSubscriptionStatus( std::string key, const smart_objects::SmartObject& msg_params) { const auto unsubscribed_items = msg_params.enumerate(); if (unsubscribed_items.end() == unsubscribed_items.find(key)) { - LOG4CXX_WARN(logger_, - key << " is waiting to be unsubscribed, but missing in " + SDL_LOG_WARN(key << " is waiting to be unsubscribed, but missing in " "vehicle response."); return false; } auto res_code = msg_params[key][strings::result_code].asInt(); if (hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS != res_code) { - LOG4CXX_WARN(logger_, - "Unubscribing from " << key << " for " << connection_key() + SDL_LOG_WARN("Unubscribing from " << key << " for " << connection_key() << " failed."); return false; } @@ -315,7 +313,7 @@ bool UnsubscribeVehicleDataRequest::CheckSubscriptionStatus( bool UnsubscribeVehicleDataRequest::UnsubscribePendingVehicleData( ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params) { - LOG4CXX_DEBUG(logger_, "Unsubscribing from all pending VehicleData"); + SDL_LOG_DEBUG("Unsubscribing from all pending VehicleData"); for (const auto& vi_name : vi_waiting_for_unsubscribe_) { const auto converted_item = ConvertRequestToResponseName(vi_name); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc index 352239c331..89b5261938 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc @@ -38,6 +38,8 @@ namespace vehicle_info_plugin { using namespace application_manager; namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + UnsubscribeVehicleDataResponse::UnsubscribeVehicleDataResponse( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) @@ -50,12 +52,12 @@ UnsubscribeVehicleDataResponse::UnsubscribeVehicleDataResponse( UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() {} void UnsubscribeVehicleDataResponse::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // check if response false if (true == (*message_)[strings::msg_params].keyExists(strings::success)) { if ((*message_)[strings::msg_params][strings::success].asBool() == false) { - LOG4CXX_ERROR(logger_, "Success = false"); + SDL_LOG_ERROR("Success = false"); SendResponse(false); return; } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc index 9df6d922aa..b85fd5aaaf 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc @@ -45,7 +45,7 @@ #include "utils/helpers.h" #include "utils/optional.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin") +SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin") namespace vehicle_info_plugin { @@ -64,7 +64,7 @@ CustomVehicleDataManagerImpl::CustomVehicleDataManagerImpl( std::string CustomVehicleDataManagerImpl::GetVehicleDataItemType( const std::string& vehicle_data_item_name) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& schema = FindSchemaByNameNonRecursive(vehicle_data_item_name); return schema.is_initialized() ? std::string(schema->type) @@ -86,7 +86,7 @@ bool CustomVehicleDataManagerImpl::IsRemovedCustomVehicleDataName( void CustomVehicleDataManagerImpl::CreateMobileMessageParams( smart_objects::SmartObject& msg_params) { using namespace application_manager; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); typedef std::function<smart_objects::SmartObject( const smart_objects::SmartObject& input_params, @@ -105,7 +105,7 @@ void CustomVehicleDataManagerImpl::CreateMobileMessageParams( ? FindSchemaByKeyRecursive(key) : FindSchemaByKeyNonRecursive(key); if (!schema.is_initialized()) { - LOG4CXX_DEBUG(logger_, "Schema for: " << key << " cannot be found"); + SDL_LOG_DEBUG("Schema for: " << key << " cannot be found"); continue; } @@ -208,7 +208,7 @@ const OptionalDataItem FindSchema( const std::vector<policy_table::VehicleDataItem>& oem_items, SearchMethod search_method, Comparer comparer) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<policy_table::VehicleDataItem> items; for (const auto& item : oem_items) { @@ -495,7 +495,7 @@ void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() { void CustomVehicleDataManagerImpl::OnPolicyEvent( plugin_manager::PolicyEvent policy_event) { using namespace plugin_manager; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); switch (policy_event) { case kApplicationPolicyUpdated: @@ -510,7 +510,7 @@ void CustomVehicleDataManagerImpl::OnPolicyEvent( const OptionalDataItem CustomVehicleDataManagerImpl::FindSchemaByNameNonRecursive( const std::string& name) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto& oem_items = vehicle_data_provider_.GetVehicleDataItems(); auto compare_by_name = [&name](const policy_table::VehicleDataItem& item) { @@ -523,7 +523,7 @@ CustomVehicleDataManagerImpl::FindSchemaByNameNonRecursive( const OptionalDataItem CustomVehicleDataManagerImpl::FindRemovedSchemaByNameNonRecursive( const std::string& name) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto& removed_oem_items = vehicle_data_provider_.GetRemovedVehicleDataItems(); @@ -537,7 +537,7 @@ CustomVehicleDataManagerImpl::FindRemovedSchemaByNameNonRecursive( const OptionalDataItem CustomVehicleDataManagerImpl::FindSchemaByNameRecursive( const std::string& name) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto& oem_items = vehicle_data_provider_.GetVehicleDataItems(); auto compare_by_name = [&name](const policy_table::VehicleDataItem& item) { @@ -550,7 +550,7 @@ const OptionalDataItem CustomVehicleDataManagerImpl::FindSchemaByNameRecursive( const OptionalDataItem CustomVehicleDataManagerImpl::FindSchemaByKeyNonRecursive( const std::string& key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto& oem_items = vehicle_data_provider_.GetVehicleDataItems(); auto compare_by_key = [&key](const policy_table::VehicleDataItem& item) { @@ -562,7 +562,7 @@ CustomVehicleDataManagerImpl::FindSchemaByKeyNonRecursive( const OptionalDataItem CustomVehicleDataManagerImpl::FindSchemaByKeyRecursive( const std::string& key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto& oem_items = vehicle_data_provider_.GetVehicleDataItems(); auto compare_by_key = [&key](const policy_table::VehicleDataItem& item) { diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc index 750da9fa6e..b4ae7aca45 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc @@ -4,7 +4,7 @@ namespace vehicle_info_plugin { #ifdef ENABLE_LOG -CREATE_LOGGERPTR_LOCAL(vehicle_data_logger, "VehicleDataItemSchema"); +SDL_CREATE_LOG_VARIABLE("VehicleDataItemSchema"); #endif // ENABLE_LOG VehicleDataItemSchema::VehicleDataItemSchema(PolicyDataItem& policy_item, @@ -153,7 +153,7 @@ smart_objects::ISchemaItemPtr VehicleDataItemSchema::GetPODTypeSchema( std::string error_msg = std::string("Invalid POD type provided: ") + std::string(policy_item.type); - LOG4CXX_ERROR(vehicle_data_logger, error_msg.c_str()); + SDL_LOG_ERROR(error_msg.c_str()); return nullptr; } @@ -168,7 +168,7 @@ smart_objects::ISchemaItemPtr VehicleDataItemSchema::getEnumSchema( const std::string& type_name) const { auto enum_schema = policy_table::EnumSchemaItemFactory::Get(type_name); if (!enum_schema) { - LOG4CXX_ERROR(vehicle_data_logger, "NULL pointer: " << type_name); + SDL_LOG_ERROR("NULL pointer: " << type_name); } return enum_schema; } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc index 149299d3bb..952f980984 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc @@ -33,7 +33,7 @@ #include "vehicle_info_plugin/vehicle_info_app_extension.h" #include "vehicle_info_plugin/vehicle_info_plugin.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin") +SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin") namespace vehicle_info_plugin { @@ -45,22 +45,22 @@ VehicleInfoAppExtension::VehicleInfoAppExtension( VehicleInfoAppExtension::VehicleInfoAppExtensionUID) , plugin_(plugin) , app_(app) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } VehicleInfoAppExtension::~VehicleInfoAppExtension() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } bool VehicleInfoAppExtension::subscribeToVehicleInfo( const std::string& vehicle_data) { - LOG4CXX_DEBUG(logger_, vehicle_data); + SDL_LOG_DEBUG(vehicle_data); return subscribed_data_.insert(vehicle_data).second; } bool VehicleInfoAppExtension::unsubscribeFromVehicleInfo( const std::string& vehicle_data) { - LOG4CXX_DEBUG(logger_, vehicle_data); + SDL_LOG_DEBUG(vehicle_data); auto it = subscribed_data_.find(vehicle_data); if (it != subscribed_data_.end()) { subscribed_data_.erase(it); @@ -70,13 +70,13 @@ bool VehicleInfoAppExtension::unsubscribeFromVehicleInfo( } void VehicleInfoAppExtension::unsubscribeFromVehicleInfo() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); subscribed_data_.clear(); } bool VehicleInfoAppExtension::isSubscribedToVehicleInfo( const std::string& vehicle_data) const { - LOG4CXX_DEBUG(logger_, vehicle_data); + SDL_LOG_DEBUG(vehicle_data); return subscribed_data_.find(vehicle_data) != subscribed_data_.end(); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc index 52ee9f476d..5bebdf8e2a 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc @@ -32,7 +32,7 @@ #include "vehicle_info_plugin/vehicle_info_command_factory.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin") +SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin") namespace vehicle_info_plugin { @@ -57,7 +57,7 @@ VehicleInfoCommandFactory::VehicleInfoCommandFactory( hmi_capabilities, policy_handler, custom_vehicle_data_manager)) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } VehicleInfoCommandFactory::~VehicleInfoCommandFactory() {} diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc index e8d852b612..3687245066 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc @@ -52,7 +52,7 @@ #include "vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request.h" #include "vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin") +SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin") namespace vehicle_info_plugin { namespace strings = app_mngr::strings; @@ -108,7 +108,7 @@ struct VehicleInfoCommandCreatorFactory { template <typename VehicleInfoCommandType> application_manager::CommandCreator& GetCreator() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); static VehicleInfoCommandCreator<VehicleInfoCommandType> res(params_); return res; } @@ -126,7 +126,7 @@ VehicleInfoHmiCommandFactory::VehicleInfoHmiCommandFactory( , hmi_capabilities_(hmi_capabilities) , policy_handler_(policy_handler) , custom_vehicle_data_manager_(custom_vehicle_data_manager) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } app_mngr::CommandSharedPtr VehicleInfoHmiCommandFactory::CreateCommand( @@ -150,9 +150,8 @@ app_mngr::CommandSharedPtr VehicleInfoHmiCommandFactory::CreateCommand( } UNUSED(message_type_str); - LOG4CXX_DEBUG(logger_, - "HMICommandFactory::CreateCommand function_id: " - << function_id << ", message type: " << message_type_str); + SDL_LOG_DEBUG("HMICommandFactory::CreateCommand function_id: " + << function_id << ", message type: " << message_type_str); return buildCommandCreator(function_id, message_type).create(message); } @@ -212,7 +211,7 @@ app_mngr::CommandCreator& VehicleInfoHmiCommandFactory::buildCommandCreator( ? factory.GetCreator<commands::VIDiagnosticMessageRequest>() : factory.GetCreator<commands::VIDiagnosticMessageResponse>(); default: - LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id); + SDL_LOG_WARN("Unsupported function_id: " << function_id); return factory.GetCreator<VehicleInfoInvalidCommand>(); } } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc index c3c8d9c8d7..b2d7df5d28 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc @@ -52,7 +52,7 @@ #include "vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h" #include "vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_response.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin") +SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin") namespace vehicle_info_plugin { namespace strings = app_mngr::strings; @@ -108,7 +108,7 @@ struct VehicleInfoCommandCreatorFactory { template <typename VehicleInfoCommandType> application_manager::CommandCreator& GetCreator() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); static VehicleInfoCommandCreator<VehicleInfoCommandType> res(params_); return res; } @@ -126,7 +126,7 @@ VehicleInfoMobileCommandFactory::VehicleInfoMobileCommandFactory( , hmi_capabilities_(hmi_capabilities) , policy_handler_(policy_handler) , custom_vehicle_data_manager_(custom_vehicle_data_manager) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } app_mngr::CommandSharedPtr VehicleInfoMobileCommandFactory::CreateCommand( @@ -150,9 +150,8 @@ app_mngr::CommandSharedPtr VehicleInfoMobileCommandFactory::CreateCommand( } UNUSED(message_type_str); - LOG4CXX_DEBUG(logger_, - "HMICommandFactory::CreateCommand function_id: " - << function_id << ", message type: " << message_type_str); + SDL_LOG_DEBUG("HMICommandFactory::CreateCommand function_id: " + << function_id << ", message type: " << message_type_str); return get_creator_factory(function_id, message_type, source).create(message); } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc index 1c553fb84d..18c9b6413e 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc @@ -40,7 +40,7 @@ #include "vehicle_info_plugin/vehicle_info_command_factory.h" namespace vehicle_info_plugin { -CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin") +SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin") namespace strings = application_manager::strings; namespace plugins = application_manager::plugin_manager; @@ -117,7 +117,7 @@ void VehicleInfoPlugin::OnApplicationEvent( } void VehicleInfoPlugin::UnsubscribeFromRemovedVDItems() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); typedef std::vector<std::string> StringsVector; auto get_items_to_unsubscribe = [this]() -> StringsVector { @@ -131,10 +131,9 @@ void VehicleInfoPlugin::UnsubscribeFromRemovedVDItems() { subscription_name)) { ext.unsubscribeFromVehicleInfo(subscription_name); if (!helpers::in_range(output_items_list, subscription_name)) { - LOG4CXX_DEBUG(logger_, - "Vehicle data item " - << subscription_name - << " has been removed by policy"); + SDL_LOG_DEBUG("Vehicle data item " + << subscription_name + << " has been removed by policy"); output_items_list.push_back(subscription_name); } } @@ -146,7 +145,7 @@ void VehicleInfoPlugin::UnsubscribeFromRemovedVDItems() { const StringsVector items_to_unsubscribe = get_items_to_unsubscribe(); if (items_to_unsubscribe.empty()) { - LOG4CXX_DEBUG(logger_, "There is no data to unsubscribe"); + SDL_LOG_DEBUG("There is no data to unsubscribe"); return; } @@ -172,14 +171,14 @@ bool IsOtherAppAlreadySubscribedFor( void VehicleInfoPlugin::ProcessResumptionSubscription( application_manager::Application& app, VehicleInfoAppExtension& ext) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); const auto& subscriptions = ext.Subscriptions(); if (subscriptions.empty()) { - LOG4CXX_DEBUG(logger_, "No vehicle data to subscribe. Exiting"); + SDL_LOG_DEBUG("No vehicle data to subscribe. Exiting"); return; } @@ -216,7 +215,7 @@ application_manager::ApplicationSharedPtr FindAppSubscribedToIVI( smart_objects::SmartObjectSPtr VehicleInfoPlugin::GetUnsubscribeIVIRequest( const std::vector<std::string>& ivi_names) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace smart_objects; auto msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -284,12 +283,12 @@ void VehicleInfoPlugin::DeleteSubscriptions( extern "C" __attribute__((visibility("default"))) application_manager::plugin_manager::RPCPlugin* -Create() { +Create(logger::Logger* logger_instance) { + logger::Logger::instance(logger_instance); return new vehicle_info_plugin::VehicleInfoPlugin(); } extern "C" __attribute__((visibility("default"))) void Delete( application_manager::plugin_manager::RPCPlugin* data) { delete data; - DELETE_THREAD_LOGGER(vehicle_info_plugin::logger_); } 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>( diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc index 9ff2a49686..609fb26031 100644 --- a/src/components/application_manager/test/application_manager_impl_test.cc +++ b/src/components/application_manager/test/application_manager_impl_test.cc @@ -66,9 +66,6 @@ #include "utils/lock.h" #include "encryption/hashing.h" -#ifdef ENABLE_LOG -#include "utils/push_log.h" -#endif namespace test { namespace components { @@ -180,9 +177,6 @@ class ApplicationManagerImplTest NiceMock<usage_statistics_test::MockStatisticsManager> >()) { -#ifdef ENABLE_LOG - logger::create_log_message_loop_thread(); -#endif Mock::VerifyAndClearExpectations(mock_message_helper_); } ~ApplicationManagerImplTest() OVERRIDE { diff --git a/src/components/application_manager/test/resumption/resumption_data_db_test.cc b/src/components/application_manager/test/resumption/resumption_data_db_test.cc index d67c229cc3..ec390e4be0 100644 --- a/src/components/application_manager/test/resumption/resumption_data_db_test.cc +++ b/src/components/application_manager/test/resumption/resumption_data_db_test.cc @@ -61,10 +61,6 @@ using namespace file_system; using namespace resumption; using namespace mobile_apis; -namespace { -const std::string kPath = - file_system::CurrentWorkingDirectory() + "/" + "test_storage"; -} class ResumptionDataDBTest : public ResumptionDataTest { protected: void SetUp() OVERRIDE { @@ -88,10 +84,11 @@ class ResumptionDataDBTest : public ResumptionDataTest { kDatabaseName = "resumption"; if (is_in_file) { path_ = "test_storage"; - CreateDirectory(file_system::CurrentWorkingDirectory() + "/" + path_); - CreateDirectory(kPath); + std::string test_storage_path = + file_system::CurrentWorkingDirectory() + "/" + "test_storage"; + CreateDirectory(test_storage_path); test_db_ = new utils::dbms::SQLDatabase(kDatabaseName); - test_db_->set_path(kPath + "/"); + test_db_->set_path(test_storage_path + "/"); res_db_ = new TestResumptionDataDB(In_File_Storage); } else { res_db_ = new TestResumptionDataDB(In_Memory_Storage); @@ -137,6 +134,7 @@ class ResumptionDataDBTest : public ResumptionDataTest { // Check that db includes tables with given elements void CheckSavedDB(); static const bool is_in_file = false; + const std::string tables_exist = "SELECT COUNT(*) FROM sqlite_master WHERE `type` = 'table';"; const std::string init_last_ign_count = diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc index 024c75de3e..f549f4b915 100644 --- a/src/components/config_profile/src/ini_file.cc +++ b/src/components/config_profile/src/ini_file.cc @@ -55,7 +55,7 @@ namespace profile { -CREATE_LOGGERPTR_GLOBAL(logger_, "Profile") +SDL_CREATE_LOG_VARIABLE("Profile") char* ini_write_inst(const char* fname, uint8_t flag) { FILE* fp = 0; @@ -278,8 +278,8 @@ char ini_write_value(const char* fname, if (0 != rename(temp_fname, fname)) { if (0 != remove(temp_fname)) { - LOG4CXX_WARN_WITH_ERRNO( - logger_, "Unable to remove temp file: " << std::string(temp_fname)); + SDL_LOG_WARN_WITH_ERRNO( + "Unable to remove temp file: " << std::string(temp_fname)); } return FALSE; } diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index 26e5bb0c54..a86d09da94 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -53,15 +53,13 @@ namespace { #define LOG_UPDATED_VALUE(value, key, section) \ { \ - LOG4CXX_INFO(logger_, \ - "Setting value '" << value << "' for key '" << key \ + SDL_LOG_INFO("Setting value '" << value << "' for key '" << key \ << "' in section '" << section << "'."); \ } #define LOG_UPDATED_BOOL_VALUE(value, key, section) \ { \ - LOG4CXX_INFO(logger_, \ - "Setting value '" << std::boolalpha << value << "' for key '" \ + SDL_LOG_INFO("Setting value '" << std::boolalpha << value << "' for key '" \ << key << "' in section '" << section \ << "'."); \ } @@ -445,7 +443,7 @@ const char* kDefaultAOAFilterSerialNumber = "N000000"; namespace profile { -CREATE_LOGGERPTR_GLOBAL(logger_, "Profile") +SDL_CREATE_LOG_VARIABLE("Profile") Profile::Profile() : sdl_version_(kDefaultSDLVersion) @@ -1247,7 +1245,7 @@ const std::string Profile::hmi_origin_id() const { } void Profile::UpdateValues() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // SDL version ReadStringValue( @@ -2853,7 +2851,7 @@ bool Profile::StringToNumber(const std::string& input, uint64_t& output) const { bool Profile::IsRelativePath(const std::string& path) { if (path.empty()) { - LOG4CXX_ERROR(logger_, "Empty path passed."); + SDL_LOG_ERROR("Empty path passed."); return false; } return '/' != path[0]; diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc index 9dcf2540a4..c366496056 100644 --- a/src/components/connection_handler/src/connection.cc +++ b/src/components/connection_handler/src/connection.cc @@ -52,7 +52,7 @@ */ namespace connection_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler") +SDL_CREATE_LOG_VARIABLE("ConnectionHandler") Service* Session::FindService( const protocol_handler::ServiceType& service_type) { @@ -83,7 +83,7 @@ Connection::Connection(ConnectionHandle connection_handle, , connection_device_handle_(connection_device_handle) , primary_connection_handle_(0) , heartbeat_timeout_(heartbeat_timeout) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(connection_handler_); heartbeat_monitor_ = new HeartBeatMonitor(heartbeat_timeout_, this); @@ -93,7 +93,7 @@ Connection::Connection(ConnectionHandle connection_handle, } Connection::~Connection() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); heart_beat_monitor_thread_->Stop(threads::Thread::kThreadSoftStop); delete heartbeat_monitor_; threads::DeleteThread(heart_beat_monitor_thread_); @@ -106,11 +106,9 @@ Connection::~Connection() { sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.begin(); while (session_it != session_map_.end()) { - LOG4CXX_INFO( - logger_, - "Removed Session ID " - << static_cast<int>(session_it->first) - << " from Session/Connection Map in Connection Destructor"); + SDL_LOG_INFO("Removed Session ID " + << static_cast<int>(session_it->first) + << " from Session/Connection Map in Connection Destructor"); connection_handler_->RemoveSession(session_it->first); session_it++; } @@ -120,7 +118,7 @@ Connection::~Connection() { uint32_t Connection::AddNewSession( const transport_manager::ConnectionUID connection_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // NESTED LOCK: make sure to lock session_map_lock_ then ConnectionHandler's // session_connection_map_lock_ptr_ (which will be taken in AddSession) @@ -144,7 +142,7 @@ uint32_t Connection::AddNewSession( } uint32_t Connection::RemoveSession(uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Again, a NESTED lock, but it follows the rules. sync_primitives::AutoLock lock(session_map_lock_); @@ -155,7 +153,7 @@ uint32_t Connection::RemoveSession(uint8_t session_id) { SessionMap::iterator it = session_map_.find(session_id); if (session_map_.end() == it) { - LOG4CXX_WARN(logger_, "Session not found in this connection!"); + SDL_LOG_WARN("Session not found in this connection!"); return 0; } heartbeat_monitor_->RemoveSession(session_id); @@ -171,12 +169,11 @@ bool Connection::AddNewService(uint8_t session_id, // Ignore wrong services if (protocol_handler::kControl == service_type || protocol_handler::kInvalidServiceType == service_type) { - LOG4CXX_WARN(logger_, "Wrong service " << static_cast<int>(service_type)); + SDL_LOG_WARN("Wrong service " << static_cast<int>(service_type)); return false; } - LOG4CXX_DEBUG(logger_, - "Add service " << service_type << " for session " + SDL_LOG_DEBUG("Add service " << service_type << " for session " << static_cast<uint32_t>(session_id) << " using connection ID " << static_cast<uint32_t>(connection_id)); @@ -184,7 +181,7 @@ bool Connection::AddNewService(uint8_t session_id, SessionMap::iterator session_it = session_map_.find(session_id); if (session_it == session_map_.end()) { - LOG4CXX_WARN(logger_, "Session not found in this connection!"); + SDL_LOG_WARN("Session not found in this connection!"); return false; } Session& session = session_it->second; @@ -195,9 +192,9 @@ bool Connection::AddNewService(uint8_t session_id, service_type, protocol_handler::ServiceType::kAudio, protocol_handler::ServiceType::kMobileNav)) { - LOG4CXX_WARN(logger_, - "Audio and video services are disallowed for protocol version " - "2 or lower"); + SDL_LOG_WARN( + "Audio and video services are disallowed for protocol version " + "2 or lower"); return false; } @@ -206,15 +203,13 @@ bool Connection::AddNewService(uint8_t session_id, if (service) { #ifdef ENABLE_SECURITY if (!request_protection) { - LOG4CXX_WARN(logger_, - "Session " << static_cast<int>(session_id) + SDL_LOG_WARN("Session " << static_cast<int>(session_id) << " already has unprotected service " << static_cast<int>(service_type)); return false; } if (service->is_protected_) { - LOG4CXX_WARN(logger_, - "Session " << static_cast<int>(session_id) + SDL_LOG_WARN("Session " << static_cast<int>(session_id) << " already has protected service " << static_cast<int>(service_type)); return false; @@ -247,15 +242,14 @@ bool Connection::RemoveService(uint8_t session_id, protocol_handler::ServiceType service_type) { // Ignore wrong and required for Session services if (is_incorrect_for_remove_service(service_type)) { - LOG4CXX_WARN(logger_, - "Could not remove service " << static_cast<int>(service_type)); + SDL_LOG_WARN("Could not remove service " << static_cast<int>(service_type)); return false; } sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_map_.end() == session_it) { - LOG4CXX_WARN(logger_, "Session not found in this connection!"); + SDL_LOG_WARN("Session not found in this connection!"); return false; } @@ -263,8 +257,7 @@ bool Connection::RemoveService(uint8_t session_id, ServiceList::iterator service_it = find(service_list.begin(), service_list.end(), service_type); if (service_list.end() == service_it) { - LOG4CXX_WARN(logger_, - "Session " << session_id + SDL_LOG_WARN("Session " << session_id << " didn't established" " service " << service_type); @@ -277,14 +270,13 @@ bool Connection::RemoveService(uint8_t session_id, uint8_t Connection::RemoveSecondaryServices( transport_manager::ConnectionUID secondary_connection_handle, std::list<protocol_handler::ServiceType>& removed_services_list) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint8_t found_session_id = 0; sync_primitives::AutoLock lock(session_map_lock_); - LOG4CXX_INFO(logger_, - "RemoveSecondaryServices looking for services on Connection ID " - << static_cast<int>(secondary_connection_handle)); + SDL_LOG_INFO("RemoveSecondaryServices looking for services on Connection ID " + << static_cast<int>(secondary_connection_handle)); // Walk the SessionMap in the primary connection, and for each // Session, we walk its ServiceList, looking for all the services @@ -292,9 +284,8 @@ uint8_t Connection::RemoveSecondaryServices( for (SessionMap::iterator session_it = session_map_.begin(); session_map_.end() != session_it; ++session_it) { - LOG4CXX_INFO(logger_, - "RemoveSecondaryServices found session ID " - << static_cast<int>(session_it->first)); + SDL_LOG_INFO("RemoveSecondaryServices found session ID " + << static_cast<int>(session_it->first)); // Now, for each session, walk the its ServiceList, looking for services // that were using secondary)_connection_handle. If we find such a service, @@ -302,17 +293,14 @@ uint8_t Connection::RemoveSecondaryServices( ServiceList& service_list = session_it->second.service_list; ServiceList::iterator service_it = service_list.begin(); for (; service_it != service_list.end();) { - LOG4CXX_INFO(logger_, - "RemoveSecondaryServices found service ID " - << static_cast<int>(service_it->service_type)); + SDL_LOG_INFO("RemoveSecondaryServices found service ID " + << static_cast<int>(service_it->service_type)); if (service_it->connection_id == secondary_connection_handle) { found_session_id = session_it->first; - LOG4CXX_INFO(logger_, - "RemoveSecondaryServices removing Service " - << static_cast<int>(service_it->service_type) - << " in session " - << static_cast<int>(found_session_id)); + SDL_LOG_INFO("RemoveSecondaryServices removing Service " + << static_cast<int>(service_it->service_type) + << " in session " << static_cast<int>(found_session_id)); removed_services_list.push_back(service_it->service_type); service_it = service_list.erase(service_it); @@ -337,7 +325,7 @@ int Connection::SetSSLContext(uint8_t session_id, sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_it == session_map_.end()) { - LOG4CXX_WARN(logger_, "Session not found in this connection!"); + SDL_LOG_WARN("Session not found in this connection!"); return security_manager::SecurityManager::ERROR_INTERNAL; } Session& session = session_it->second; @@ -348,11 +336,11 @@ int Connection::SetSSLContext(uint8_t session_id, security_manager::SSLContext* Connection::GetSSLContext( const uint8_t session_id, const protocol_handler::ServiceType& service_type) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(session_map_lock_); SessionMap::const_iterator session_it = session_map_.find(session_id); if (session_it == session_map_.end()) { - LOG4CXX_WARN(logger_, "Session not found in this connection!"); + SDL_LOG_WARN("Session not found in this connection!"); return NULL; } const Session& session = session_it->second; @@ -361,29 +349,29 @@ security_manager::SSLContext* Connection::GetSSLContext( return session.ssl_context; const Service* service = session.FindService(service_type); if (!service) { - LOG4CXX_WARN(logger_, "Service not found in this session!"); + SDL_LOG_WARN("Service not found in this session!"); return NULL; } if (!service->is_protected_) return NULL; - LOG4CXX_TRACE(logger_, "SSLContext is " << session.ssl_context); + SDL_LOG_TRACE("SSLContext is " << session.ssl_context); return session.ssl_context; } void Connection::SetProtectionFlag( const uint8_t session_id, const protocol_handler::ServiceType& service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_it == session_map_.end()) { - LOG4CXX_WARN(logger_, "Session not found in this connection!"); + SDL_LOG_WARN("Session not found in this connection!"); return; } Session& session = session_it->second; Service* service = session.FindService(service_type); if (!service) { - LOG4CXX_WARN(logger_, "Service not found in this session!"); + SDL_LOG_WARN("Service not found in this session!"); return; } service->is_protected_ = true; @@ -404,12 +392,12 @@ void Connection::SetProtectionFlag( bool Connection::SessionServiceExists( const uint8_t session_id, const protocol_handler::ServiceType& service_type) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(session_map_lock_); SessionMap::const_iterator session_it = session_map_.find(session_id); if (session_it == session_map_.end()) { - LOG4CXX_WARN(logger_, "Session not found in this connection!"); + SDL_LOG_WARN("Session not found in this connection!"); return false; } @@ -449,7 +437,7 @@ void Connection::UpdateProtocolVersionSession(uint8_t session_id, sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_map_.end() == session_it) { - LOG4CXX_WARN(logger_, "Session not found in this connection!"); + SDL_LOG_WARN("Session not found in this connection!"); return; } Session& session = session_it->second; @@ -457,11 +445,11 @@ void Connection::UpdateProtocolVersionSession(uint8_t session_id, } bool Connection::SupportHeartBeat(uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_map_.end() == session_it) { - LOG4CXX_WARN(logger_, "Session not found in this connection!"); + SDL_LOG_WARN("Session not found in this connection!"); return false; } Session& session = session_it->second; @@ -472,11 +460,11 @@ bool Connection::SupportHeartBeat(uint8_t session_id) { bool Connection::ProtocolVersion(uint8_t session_id, uint8_t& protocol_version) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); if (session_map_.end() == session_it) { - LOG4CXX_WARN(logger_, "Session not found in this connection!"); + SDL_LOG_WARN("Session not found in this connection!"); return false; } protocol_version = (session_it->second).protocol_version; diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index d2b00448e3..a57f7c73e0 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -50,7 +50,7 @@ */ namespace connection_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler") +SDL_CREATE_LOG_VARIABLE("ConnectionHandler") ConnectionHandle HandleFromConnectionUID(transport_manager::ConnectionUID uid) { return ConnectionHandle(uid); @@ -78,11 +78,11 @@ ConnectionHandlerImpl::ConnectionHandlerImpl( , ending_connection_(NULL) {} ConnectionHandlerImpl::~ConnectionHandlerImpl() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void ConnectionHandlerImpl::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ConnectionList::iterator itr = connection_list_.begin(); while (itr != connection_list_.end()) { RemoveConnection(itr->second->connection_handle()); @@ -95,30 +95,28 @@ void ConnectionHandlerImpl::Stop() { void ConnectionHandlerImpl::set_connection_handler_observer( ConnectionHandlerObserver* observer) { - LOG4CXX_DEBUG( - logger_, - "ConnectionHandlerImpl::set_connection_handler_observer() " << observer); + SDL_LOG_DEBUG("ConnectionHandlerImpl::set_connection_handler_observer() " + << observer); sync_primitives::AutoWriteLock write_lock(connection_handler_observer_lock_); if (!observer) { - LOG4CXX_WARN(logger_, "Set Null pointer to observer."); + SDL_LOG_WARN("Set Null pointer to observer."); } connection_handler_observer_ = observer; } void ConnectionHandlerImpl::set_protocol_handler( protocol_handler::ProtocolHandler* protocol_handler) { - LOG4CXX_DEBUG( - logger_, - "ConnectionHandlerImpl::set_protocol_handler()" << protocol_handler); + SDL_LOG_DEBUG("ConnectionHandlerImpl::set_protocol_handler() " + << protocol_handler); if (!protocol_handler) { - LOG4CXX_WARN(logger_, "Set Null pointer to protocol handler."); + SDL_LOG_WARN("Set Null pointer to protocol handler."); } protocol_handler_ = protocol_handler; } void ConnectionHandlerImpl::OnDeviceListUpdated( const std::vector<transport_manager::DeviceInfo>&) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); sync_primitives::AutoReadLock lock(device_list_lock_); if (connection_handler_observer_) { @@ -135,16 +133,15 @@ void ConnectionHandlerImpl::OnFindNewApplicationsRequest() { void ConnectionHandlerImpl::OnDeviceFound( const transport_manager::DeviceInfo&) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void ConnectionHandlerImpl::OnDeviceAdded( const transport_manager::DeviceInfo& device_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto handle = device_info.device_handle(); - LOG4CXX_DEBUG(logger_, - "OnDeviceAdded!!!: " << handle << " " << device_info.name() + SDL_LOG_DEBUG("OnDeviceAdded!!!: " << handle << " " << device_info.name() << " " << device_info.mac_address() << " " << device_info.connection_type()); @@ -158,8 +155,7 @@ void ConnectionHandlerImpl::OnDeviceAdded( auto result = device_list_.insert(std::make_pair(handle, device)); if (!result.second) { - LOG4CXX_ERROR(logger_, - "Device with handle " << handle + SDL_LOG_ERROR("Device with handle " << handle << " is known already. " "Information won't be updated."); return; @@ -173,7 +169,7 @@ void ConnectionHandlerImpl::OnDeviceAdded( void ConnectionHandlerImpl::OnDeviceRemoved( const transport_manager::DeviceInfo& device_info) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Device has been removed. Perform all needed actions. // 1. Delete all the connections and sessions of this device // 2. Delete device from a list @@ -252,12 +248,12 @@ void ConnectionHandlerImpl::OnDeviceSwitchingStart( } void ConnectionHandlerImpl::OnScanDevicesFinished() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void ConnectionHandlerImpl::OnScanDevicesFailed( const transport_manager::SearchDeviceError& error) { - LOG4CXX_WARN(logger_, "Scan devices failed. " << error.text()); + SDL_LOG_WARN("Scan devices failed. " << error.text()); } void ConnectionHandlerImpl::OnConnectionStatusUpdated() { @@ -267,9 +263,8 @@ void ConnectionHandlerImpl::OnConnectionStatusUpdated() { void ConnectionHandlerImpl::OnConnectionPending( const transport_manager::DeviceInfo& device_info, const transport_manager::ConnectionUID connection_id) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "OnConnectionPending!!!: " << device_info.device_handle() << " " + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("OnConnectionPending!!!: " << device_info.device_handle() << " " << device_info.name() << " " << device_info.mac_address() << " " << device_info.connection_type()); @@ -278,12 +273,11 @@ void ConnectionHandlerImpl::OnConnectionPending( auto it = device_list_.find(device_info.device_handle()); if (device_list_.end() == it) { - LOG4CXX_ERROR(logger_, "Unknown device!"); + SDL_LOG_ERROR("Unknown device!"); return; } } - LOG4CXX_DEBUG(logger_, - "Add Pending Connection #" << connection_id << " to the list."); + SDL_LOG_DEBUG("Add Pending Connection #" << connection_id << " to the list."); std::string endpoint = device_info.mac_address(); cloud_app_id_map_lock_.Acquire(); @@ -321,23 +315,21 @@ void ConnectionHandlerImpl::OnConnectionPending( void ConnectionHandlerImpl::OnConnectionEstablished( const transport_manager::DeviceInfo& device_info, const transport_manager::ConnectionUID connection_id) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "OnConnectionEstablished!!!: " - << device_info.device_handle() << " " << device_info.name() - << " " << device_info.mac_address() << " " - << device_info.connection_type()); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("OnConnectionEstablished!!!: " + << device_info.device_handle() << " " << device_info.name() + << " " << device_info.mac_address() << " " + << device_info.connection_type()); { sync_primitives::AutoReadLock lock(device_list_lock_); auto it = device_list_.find(device_info.device_handle()); if (device_list_.end() == it) { - LOG4CXX_ERROR(logger_, "Unknown device!"); + SDL_LOG_ERROR("Unknown device!"); return; } } - LOG4CXX_DEBUG(logger_, - "Add Connection #" << connection_id << " to the list."); + SDL_LOG_DEBUG("Add Connection #" << connection_id << " to the list."); sync_primitives::AutoWriteLock lock(connection_list_lock_); if (connection_list_.find(connection_id) == connection_list_.end()) { connection_list_.insert(ConnectionList::value_type( @@ -353,12 +345,12 @@ void ConnectionHandlerImpl::OnConnectionFailed( const transport_manager::DeviceInfo& device_info, const transport_manager::ConnectError& error) { // TODO(PV): implement - LOG4CXX_ERROR(logger_, "Failed connecting."); + SDL_LOG_ERROR("Failed connecting."); } void ConnectionHandlerImpl::OnConnectionClosed( transport_manager::ConnectionUID connection_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); OnConnectionEnded(connection_id); } @@ -367,13 +359,13 @@ void ConnectionHandlerImpl::OnConnectionClosedFailure( transport_manager::ConnectionUID connection_id, const transport_manager::DisconnectError& error) { // TODO(PV): implement - LOG4CXX_ERROR(logger_, "ConnectionHandlerImpl::OnConnectionClosedFailure"); + SDL_LOG_ERROR("ConnectionHandlerImpl::OnConnectionClosedFailure"); } void ConnectionHandlerImpl::OnUnexpectedDisconnect( transport_manager::ConnectionUID connection_id, const transport_manager::CommunicationError& error) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); OnConnectionEnded(connection_id); } @@ -382,19 +374,19 @@ void ConnectionHandlerImpl::OnDeviceConnectionLost( const transport_manager::DeviceHandle& device, const transport_manager::DisconnectDeviceError& error) { // TODO(PV): implement - LOG4CXX_ERROR(logger_, "Lost connection with device " << device); + SDL_LOG_ERROR("Lost connection with device " << device); } void ConnectionHandlerImpl::OnDisconnectFailed( const transport_manager::DeviceHandle& device, const transport_manager::DisconnectDeviceError& error) { // TODO(PV): implement - LOG4CXX_ERROR(logger_, "Trying to Disconnect device failed."); + SDL_LOG_ERROR("Trying to Disconnect device failed."); } void ConnectionHandlerImpl::RemoveConnection( const ConnectionHandle connection_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); OnConnectionEnded(connection_handle); } @@ -403,7 +395,7 @@ void ConnectionHandlerImpl::RemoveConnection( bool AllowProtection(const ConnectionHandlerSettings& settings, const protocol_handler::ServiceType& service_type, const bool is_protected) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::vector<int>& force_unprotected_list = is_protected ? settings.force_unprotected_service() : settings.force_protected_service(); @@ -411,13 +403,12 @@ bool AllowProtection(const ConnectionHandlerSettings& settings, if (std::find(force_unprotected_list.begin(), force_unprotected_list.end(), service_type) != force_unprotected_list.end()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Service " << static_cast<int>(service_type) << " shall be protected"); return false; } - LOG4CXX_DEBUG(logger_, - "Service " << static_cast<int>(service_type) << " allowed"); + SDL_LOG_DEBUG("Service " << static_cast<int>(service_type) << " allowed"); return true; } #endif // ENABLE_SECURITY @@ -428,7 +419,7 @@ void ConnectionHandlerImpl::OnSessionStartedCallback( const protocol_handler::ServiceType& service_type, const bool is_protected, const BsonObject* params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<std::string> rejected_params; @@ -442,17 +433,16 @@ void ConnectionHandlerImpl::OnSessionStartedCallback( SessionTransports st = GetSessionTransports(session_id); if (session_id != 0) { if (st.primary_transport == 0) { - LOG4CXX_WARN(logger_, - "OnSessionStartedCallback could not find Session in the " - "Session/Connection Map!"); + SDL_LOG_WARN( + "OnSessionStartedCallback could not find Session in the " + "Session/Connection Map!"); } else { - LOG4CXX_INFO(logger_, - "OnSessionStartedCallback found session " - << static_cast<int>(session_id) - << " with primary connection " - << static_cast<int>(st.primary_transport) - << " and secondary connection " - << static_cast<int>(st.secondary_transport)); + SDL_LOG_INFO("OnSessionStartedCallback found session " + << static_cast<int>(session_id) + << " with primary connection " + << static_cast<int>(st.primary_transport) + << " and secondary connection " + << static_cast<int>(st.secondary_transport)); primary_connection_handle = st.primary_transport; } } @@ -475,7 +465,7 @@ void ConnectionHandlerImpl::OnSessionStartedCallback( ConnectionList::iterator it = connection_list_.find(primary_connection_handle); if (connection_list_.end() == it) { - LOG4CXX_ERROR(logger_, "Unknown connection!"); + SDL_LOG_ERROR("Unknown connection!"); protocol_handler_->NotifySessionStarted(context, rejected_params); return; } @@ -488,7 +478,7 @@ void ConnectionHandlerImpl::OnSessionStartedCallback( context.new_session_id_ = connection->AddNewSession(primary_connection_handle); if (0 == context.new_session_id_) { - LOG4CXX_ERROR(logger_, "Couldn't start new session!"); + SDL_LOG_ERROR("Couldn't start new session!"); protocol_handler_->NotifySessionStarted(context, rejected_params); return; } @@ -497,13 +487,12 @@ void ConnectionHandlerImpl::OnSessionStartedCallback( } else { // Could be create new service or protected exists one if (!connection->AddNewService( session_id, service_type, is_protected, connection_handle)) { - LOG4CXX_ERROR(logger_, - "Couldn't establish " + SDL_LOG_ERROR("Couldn't establish " #ifdef ENABLE_SECURITY - << (is_protected ? "protected" : "non-protected") + << (is_protected ? "protected" : "non-protected") #endif // ENABLE_SECURITY - << " service " << static_cast<int>(service_type) - << " for session " << static_cast<int>(session_id)); + << " service " << static_cast<int>(service_type) + << " for session " << static_cast<int>(session_id)); protocol_handler_->NotifySessionStarted(context, rejected_params); return; } @@ -541,14 +530,14 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult( uint32_t session_key, bool result, std::vector<std::string>& rejected_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); protocol_handler::SessionContext context; { sync_primitives::AutoLock auto_lock(start_service_context_map_lock_); auto it = start_service_context_map_.find(session_key); if (it == start_service_context_map_.end()) { - LOG4CXX_ERROR(logger_, "context for start service not found!"); + SDL_LOG_ERROR("context for start service not found!"); return; } context = it->second; @@ -563,15 +552,14 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult( ConnectionList::iterator it = connection_list_.find(context.primary_connection_id_); if (connection_list_.end() == it) { - LOG4CXX_ERROR(logger_, "connection not found"); + SDL_LOG_ERROR("connection not found"); return; } connection = it->second; } if (!result) { - LOG4CXX_WARN(logger_, - "Service starting forbidden by connection_handler_observer"); + SDL_LOG_WARN("Service starting forbidden by connection_handler_observer"); if (protocol_handler::kRpc == context.service_type_) { connection->RemoveSession(context.new_session_id_); } else { @@ -588,7 +576,7 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult( void ConnectionHandlerImpl::OnApplicationFloodCallBack( const uint32_t& connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; @@ -601,22 +589,21 @@ void ConnectionHandlerImpl::OnApplicationFloodCallBack( if (session_id != 0) { SessionTransports st = GetSessionTransports(session_id); if (st.primary_transport == 0) { - LOG4CXX_WARN(logger_, - "OnApplicationFloodCallBack could not find Session in the " - "Session/Connection Map!"); + SDL_LOG_WARN( + "OnApplicationFloodCallBack could not find Session in the " + "Session/Connection Map!"); } else { - LOG4CXX_INFO(logger_, - "OnApplicationFloodCallBack found session " - << static_cast<int>(session_id) - << " with primary connection " - << static_cast<int>(st.primary_transport) - << " and secondary connection " - << static_cast<int>(st.secondary_transport)); + SDL_LOG_INFO("OnApplicationFloodCallBack found session " + << static_cast<int>(session_id) + << " with primary connection " + << static_cast<int>(st.primary_transport) + << " and secondary connection " + << static_cast<int>(st.secondary_transport)); connection_handle = st.primary_transport; } } - LOG4CXX_INFO(logger_, "Disconnect flooding application"); + SDL_LOG_INFO("Disconnect flooding application"); if (session_id != 0) { CloseSession(connection_handle, session_id, kFlood); } else { @@ -627,7 +614,7 @@ void ConnectionHandlerImpl::OnApplicationFloodCallBack( void ConnectionHandlerImpl::OnMalformedMessageCallback( const uint32_t& connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; @@ -640,22 +627,21 @@ void ConnectionHandlerImpl::OnMalformedMessageCallback( if (session_id != 0) { SessionTransports st = GetSessionTransports(session_id); if (st.primary_transport == 0) { - LOG4CXX_WARN(logger_, - "OnMalformedMessageCallback could not find Session in the " - "Session/Connection Map!"); + SDL_LOG_WARN( + "OnMalformedMessageCallback could not find Session in the " + "Session/Connection Map!"); } else { - LOG4CXX_INFO(logger_, - "OnMalformedMessageCallback found session " - << static_cast<int>(session_id) - << " with primary connection " - << static_cast<int>(st.primary_transport) - << " and secondary connection " - << static_cast<int>(st.secondary_transport)); + SDL_LOG_INFO("OnMalformedMessageCallback found session " + << static_cast<int>(session_id) + << " with primary connection " + << static_cast<int>(st.primary_transport) + << " and secondary connection " + << static_cast<int>(st.secondary_transport)); connection_handle = st.primary_transport; } } - LOG4CXX_INFO(logger_, "Disconnect malformed messaging application"); + SDL_LOG_INFO("Disconnect malformed messaging application"); CloseConnectionSessions(connection_handle, kMalformed); CloseConnection(connection_handle); } @@ -665,7 +651,7 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( const uint8_t session_id, uint32_t* hashCode, const protocol_handler::ServiceType& service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // In case this is a Session running on a Secondary Transport, we need to // find the Sessions's primary transport. In this case, "connection_handle" @@ -677,17 +663,16 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( if (session_id != 0) { SessionTransports st = GetSessionTransports(session_id); if (st.primary_transport == 0) { - LOG4CXX_WARN(logger_, - "OnSessionEndedCallback could not find Session in the " - "Session/Connection Map!"); + SDL_LOG_WARN( + "OnSessionEndedCallback could not find Session in the " + "Session/Connection Map!"); } else { - LOG4CXX_INFO(logger_, - "OnSessionEndedCallback found session " - << static_cast<int>(session_id) - << " with primary connection " - << static_cast<int>(st.primary_transport) - << " and secondary connection " - << static_cast<int>(st.secondary_transport)); + SDL_LOG_INFO("OnSessionEndedCallback found session " + << static_cast<int>(session_id) + << " with primary connection " + << static_cast<int>(st.primary_transport) + << " and secondary connection " + << static_cast<int>(st.secondary_transport)); primary_connection_handle = st.primary_transport; } } @@ -696,7 +681,7 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( ConnectionList::iterator it = connection_list_.find(primary_connection_handle); if (connection_list_.end() == it) { - LOG4CXX_WARN(logger_, "Unknown connection!"); + SDL_LOG_WARN("Unknown connection!"); connection_list_lock_.Release(); return 0; } @@ -708,33 +693,32 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( KeyFromPair(primary_connection_handle, session_id); if (protocol_handler::kRpc == service_type) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "Session " << static_cast<uint32_t>(session_id) << " to be removed"); // old version of protocol doesn't support hash if (protocol_handler::HASH_ID_NOT_SUPPORTED != *hashCode) { if (protocol_handler::HASH_ID_WRONG == *hashCode || session_key != *hashCode) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Wrong hash_id for session " << static_cast<uint32_t>(session_id)); *hashCode = protocol_handler::HASH_ID_WRONG; return 0; } } if (!connection->RemoveSession(session_id)) { - LOG4CXX_WARN( - logger_, - "Couldn't remove session " << static_cast<uint32_t>(session_id)); + SDL_LOG_WARN("Couldn't remove session " + << static_cast<uint32_t>(session_id)); return 0; } } else { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "Service " << static_cast<uint32_t>(service_type) << " to be removed"); if (!connection->RemoveService(session_id, service_type)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Couldn't remove service " << static_cast<uint32_t>(service_type)); return 0; } @@ -752,10 +736,10 @@ bool ConnectionHandlerImpl::OnSecondaryTransportStarted( transport_manager::ConnectionUID& primary_connection_handle, const transport_manager::ConnectionUID secondary_connection_handle, const uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (session_id == 0) { - LOG4CXX_WARN(logger_, "Session id for secondary transport is invalid"); + SDL_LOG_WARN("Session id for secondary transport is invalid"); return false; } @@ -766,8 +750,7 @@ bool ConnectionHandlerImpl::OnSecondaryTransportStarted( ConnectionList::iterator it = connection_list_.find(secondary_connection_handle); if (connection_list_.end() == it) { - LOG4CXX_WARN(logger_, - "Unknown connection " << secondary_connection_handle); + SDL_LOG_WARN("Unknown connection " << secondary_connection_handle); return false; } @@ -780,8 +763,7 @@ bool ConnectionHandlerImpl::OnSecondaryTransportStarted( SetSecondaryTransportID(session_id, secondary_connection_handle); primary_connection_handle = st.primary_transport; if (st.secondary_transport != secondary_connection_handle) { - LOG4CXX_WARN(logger_, - "Failed setting the session's secondary transport ID"); + SDL_LOG_WARN("Failed setting the session's secondary transport ID"); return false; } @@ -792,9 +774,9 @@ bool ConnectionHandlerImpl::OnSecondaryTransportStarted( sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_) { - LOG4CXX_TRACE(logger_, - "Calling Connection Handler Observer's " - "OnSecondaryTransportStartedCallback"); + SDL_LOG_TRACE( + "Calling Connection Handler Observer's " + "OnSecondaryTransportStartedCallback"); connection_handler_observer_->OnSecondaryTransportStartedCallback( device_handle, session_key); } @@ -805,18 +787,17 @@ bool ConnectionHandlerImpl::OnSecondaryTransportStarted( void ConnectionHandlerImpl::OnSecondaryTransportEnded( const transport_manager::ConnectionUID primary_connection_handle, const transport_manager::ConnectionUID secondary_connection_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); - LOG4CXX_INFO(logger_, - "Secondary Transport: " - << static_cast<int32_t>(secondary_connection_handle) - << " ended. Cleaning up services from primary connection ID " - << static_cast<int32_t>(primary_connection_handle)); + SDL_LOG_INFO("Secondary Transport: " + << static_cast<int32_t>(secondary_connection_handle) + << " ended. Cleaning up services from primary connection ID " + << static_cast<int32_t>(primary_connection_handle)); connection_list_lock_.AcquireForReading(); ConnectionList::iterator itr = connection_list_.find(primary_connection_handle); if (connection_list_.end() == itr) { - LOG4CXX_ERROR(logger_, "Primary Connection not found!"); + SDL_LOG_ERROR("Primary Connection not found!"); connection_list_lock_.Release(); return; } @@ -877,12 +858,12 @@ void ConnectionHandlerImpl::CreateWebEngineDevice() { const std::string ConnectionHandlerImpl::TransportTypeProfileStringFromConnHandle( transport_manager::ConnectionUID connection_handle) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoReadLock lock(connection_list_lock_); ConnectionList::const_iterator it = connection_list_.find(connection_handle); if (connection_list_.end() == it) { - LOG4CXX_WARN(logger_, "Unknown connection " << connection_handle); + SDL_LOG_WARN("Unknown connection " << connection_handle); return std::string(); } else { DeviceHandle device_handle = it->second->connection_device_handle(); @@ -898,7 +879,7 @@ ConnectionHandlerImpl::TransportTypeProfileStringFromDeviceHandle( sync_primitives::AutoReadLock lock(device_list_lock_); auto it = device_list_.find(device_handle); if (device_list_.end() == it) { - LOG4CXX_ERROR(logger_, "Device not found!"); + SDL_LOG_ERROR("Device not found!"); } else { connection_type = it->second.connection_type(); } @@ -929,7 +910,7 @@ ConnectionHandlerImpl::TransportTypeProfileStringFromDeviceHandle( return std::string("BTMAC"); #endif } else { - LOG4CXX_WARN(logger_, "Unknown transport type string: " << connection_type); + SDL_LOG_WARN("Unknown transport type string: " << connection_type); return std::string(); } } @@ -938,15 +919,14 @@ uint32_t ConnectionHandlerImpl::KeyFromPair( transport_manager::ConnectionUID connection_handle, uint8_t session_id) const { const uint32_t key = connection_handle | (session_id << 16); - LOG4CXX_DEBUG(logger_, - "Key for ConnectionHandle:" - << static_cast<uint32_t>(connection_handle) - << " Session:" << static_cast<uint32_t>(session_id) - << " is: 0x" << std::hex << static_cast<uint32_t>(key)); + SDL_LOG_DEBUG("Key for ConnectionHandle:" + << static_cast<uint32_t>(connection_handle) + << " Session:" << static_cast<uint32_t>(session_id) << " is: 0x" + << std::hex << static_cast<uint32_t>(key)); if (protocol_handler::HASH_ID_WRONG == key) { - LOG4CXX_ERROR(logger_, - "Connection key is WRONG_HASH_ID " - "(session id shall be greater 0)"); + SDL_LOG_ERROR( + "Connection key is WRONG_HASH_ID " + "(session id shall be greater 0)"); } return key; } @@ -957,8 +937,8 @@ void ConnectionHandlerImpl::PairFromKey( uint8_t* session_id) const { *connection_handle = key & 0xFF00FFFF; *session_id = key >> 16; - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "ConnectionHandle:" << static_cast<int32_t>(*connection_handle) << " Session:" << static_cast<int32_t>(*session_id) << " for key:" << static_cast<int32_t>(key)); @@ -969,7 +949,7 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey( uint32_t* app_id, std::list<int32_t>* sessions_list, connection_handler::DeviceHandle* device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const int32_t error_result = -1; transport_manager::ConnectionUID conn_handle = 0; @@ -978,16 +958,15 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey( ConnectionList::const_iterator it = connection_list_.find(conn_handle); if (connection_list_.end() == it) { - LOG4CXX_ERROR(logger_, "Connection not found for key: " << key); + SDL_LOG_ERROR("Connection not found for key: " << key); return error_result; } const Connection& connection = *it->second; const SessionMap session_map = connection.session_map(); if (0 == session_id || session_map.end() == session_map.find(session_id)) { - LOG4CXX_ERROR(logger_, - "Session not found in connection: " - << static_cast<int32_t>(conn_handle)); + SDL_LOG_ERROR("Session not found in connection: " + << static_cast<int32_t>(conn_handle)); return error_result; } @@ -1006,8 +985,7 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey( } } - LOG4CXX_INFO(logger_, - "Connection " << static_cast<int32_t>(conn_handle) << " has " + SDL_LOG_INFO("Connection " << static_cast<int32_t>(conn_handle) << " has " << session_map.size() << " sessions."); return 0; } @@ -1041,13 +1019,12 @@ uint32_t findGap(const std::map<unsigned char, T>& map) { uint32_t ConnectionHandlerImpl::AddSession( const transport_manager::ConnectionUID primary_transport_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_); const uint32_t session_id = findGap(session_connection_map_); if (session_id > 0) { - LOG4CXX_INFO(logger_, - "New session ID " << session_id << " and Connection Id " + SDL_LOG_INFO("New session ID " << session_id << " and Connection Id " << static_cast<int>(primary_transport_id) << " added to Session/Connection Map"); SessionTransports st; @@ -1055,25 +1032,23 @@ uint32_t ConnectionHandlerImpl::AddSession( st.secondary_transport = 0; session_connection_map_[session_id] = st; } else { - LOG4CXX_WARN(logger_, - "Session/Connection Map could not create a new session ID!!!"); + SDL_LOG_WARN("Session/Connection Map could not create a new session ID!!!"); } return session_id; } bool ConnectionHandlerImpl::RemoveSession(uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_); SessionConnectionMap::iterator itr = session_connection_map_.find(session_id); if (session_connection_map_.end() == itr) { - LOG4CXX_WARN(logger_, "Session not found in Session/Connection Map!"); + SDL_LOG_WARN("Session not found in Session/Connection Map!"); return false; } - LOG4CXX_INFO(logger_, - "Removed Session ID " << static_cast<int>(session_id) + SDL_LOG_INFO("Removed Session ID " << static_cast<int>(session_id) << " from Session/Connection Map"); session_connection_map_.erase(session_id); return true; @@ -1093,10 +1068,9 @@ SessionTransports ConnectionHandlerImpl::SetSecondaryTransportID( sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_); SessionConnectionMap::iterator it = session_connection_map_.find(session_id); if (session_connection_map_.end() == it) { - LOG4CXX_WARN(logger_, - "SetSecondaryTransportID: session ID " - << static_cast<int>(session_id) - << " not found in Session/Connection map"); + SDL_LOG_WARN("SetSecondaryTransportID: session ID " + << static_cast<int>(session_id) + << " not found in Session/Connection map"); st.primary_transport = 0; st.secondary_transport = 0; } else { @@ -1110,12 +1084,11 @@ SessionTransports ConnectionHandlerImpl::SetSecondaryTransportID( if (st.secondary_transport != 0 && secondary_transport_id != kDisabledSecondary && secondary_transport_id != 0) { - LOG4CXX_WARN(logger_, - "SetSecondaryTransportID: session ID " - << static_cast<int>(session_id) - << " already has a secondary connection " - << static_cast<int>(st.secondary_transport) - << " in the Session/Connection map"); + SDL_LOG_WARN("SetSecondaryTransportID: session ID " + << static_cast<int>(session_id) + << " already has a secondary connection " + << static_cast<int>(st.secondary_transport) + << " in the Session/Connection map"); } else { st.secondary_transport = secondary_transport_id; session_connection_map_[session_id] = st; @@ -1152,22 +1125,19 @@ const uint8_t ConnectionHandlerImpl::GetSessionIdFromSecondaryTransport( } } - LOG4CXX_ERROR(logger_, - "Could not find secondary transport ID " - << static_cast<int>(secondary_transport_id) - << " in the Session/Connection map"); + SDL_LOG_ERROR("Could not find secondary transport ID " + << static_cast<int>(secondary_transport_id) + << " in the Session/Connection map"); return 0; } Connection* ConnectionHandlerImpl::GetPrimaryConnection( const ConnectionHandle connection_handle) const { - LOG4CXX_DEBUG(logger_, - "Getting primary connection for ID " << connection_handle); + SDL_LOG_DEBUG("Getting primary connection for ID " << connection_handle); ConnectionList::const_iterator it = connection_list_.find(connection_handle); if (connection_list_.end() == it) { - LOG4CXX_ERROR( - logger_, - "Connection with ID " << connection_handle << " was not found"); + SDL_LOG_ERROR("Connection with ID " << connection_handle + << " was not found"); return nullptr; } @@ -1220,7 +1190,7 @@ int32_t ConnectionHandlerImpl::GetDataOnDeviceID( std::list<uint32_t>* applications_list, std::string* mac_address, std::string* connection_type) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); int32_t result = -1; @@ -1228,7 +1198,7 @@ int32_t ConnectionHandlerImpl::GetDataOnDeviceID( auto it = device_list_.find(device_handle); if (device_list_.end() == it) { - LOG4CXX_ERROR(logger_, "Device not found for handle " << device_handle); + SDL_LOG_ERROR("Device not found for handle " << device_handle); return result; } @@ -1283,7 +1253,7 @@ void ConnectionHandlerImpl::GetConnectedDevicesMAC( #ifdef ENABLE_SECURITY int ConnectionHandlerImpl::SetSSLContext( const uint32_t& key, security_manager::SSLContext* context) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; PairFromKey(key, &connection_handle, &session_id); @@ -1299,7 +1269,7 @@ int ConnectionHandlerImpl::SetSSLContext( security_manager::SSLContext* ConnectionHandlerImpl::GetSSLContext( const uint32_t& key, const protocol_handler::ServiceType& service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; PairFromKey(key, &connection_handle, &session_id); @@ -1315,7 +1285,7 @@ security_manager::SSLContext* ConnectionHandlerImpl::GetSSLContext( void ConnectionHandlerImpl::SetProtectionFlag( const uint32_t& key, const protocol_handler::ServiceType& service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; PairFromKey(key, &connection_handle, &session_id); @@ -1350,7 +1320,7 @@ ConnectionHandlerImpl::GetHandshakeContext(uint32_t key) const { bool ConnectionHandlerImpl::SessionServiceExists( const uint32_t connection_key, const protocol_handler::ServiceType& service_type) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager::ConnectionUID connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); @@ -1358,7 +1328,7 @@ bool ConnectionHandlerImpl::SessionServiceExists( sync_primitives::AutoReadLock lock(connection_list_lock_); ConnectionList::const_iterator it = connection_list_.find(connection_handle); if (connection_list_.end() == it) { - LOG4CXX_ERROR(logger_, "Unknown connection!"); + SDL_LOG_ERROR("Unknown connection!"); return false; } const Connection& connection = *it->second; @@ -1366,7 +1336,7 @@ bool ConnectionHandlerImpl::SessionServiceExists( } void ConnectionHandlerImpl::StartDevicesDiscovery() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager_.SearchDevices(); sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); @@ -1382,13 +1352,12 @@ void ConnectionHandlerImpl::ConnectToDevice( sync_primitives::AutoReadLock lock(device_list_lock_); it_in = device_list_.find(device_handle); if (device_list_.end() != it_in) { - LOG4CXX_INFO(logger_, "Connecting to device with handle " << device_handle); + SDL_LOG_INFO("Connecting to device with handle " << device_handle); if (transport_manager::E_SUCCESS != transport_manager_.ConnectDevice(device_handle)) { - LOG4CXX_WARN(logger_, "Can't connect to device"); + SDL_LOG_WARN("Can't connect to device"); } else { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Application Manager wanted to connect to non-existing device"); } } @@ -1411,7 +1380,7 @@ void ConnectionHandlerImpl::RunAppOnDevice(const std::string& device_mac, return; } } - LOG4CXX_WARN(logger_, "No apps found on device " << device_mac); + SDL_LOG_WARN("No apps found on device " << device_mac); } void ConnectionHandlerImpl::ConnectToAllDevices() { @@ -1420,7 +1389,7 @@ void ConnectionHandlerImpl::ConnectToAllDevices() { ++i) { if (transport_manager::webengine_constants::kWebEngineDeviceName == i->second.user_friendly_name()) { - LOG4CXX_DEBUG(logger_, "No need to connect to web engine device"); + SDL_LOG_DEBUG("No need to connect to web engine device"); continue; } ConnectToDevice(i->first); @@ -1443,13 +1412,13 @@ void ConnectionHandlerImpl::RemoveCloudAppDevice(const DeviceHandle device_id) { } void ConnectionHandlerImpl::StartTransportManager() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager_.PerformActionOnClients( transport_manager::TransportAction::kVisibilityOn); } void ConnectionHandlerImpl::CloseRevokedConnection(uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t connection_handle = 0; uint8_t session_id = 0; @@ -1460,7 +1429,7 @@ void ConnectionHandlerImpl::CloseRevokedConnection(uint32_t connection_key) { void ConnectionHandlerImpl::CloseConnection( ConnectionHandle connection_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager::ConnectionUID connection_uid = ConnectionUIDFromHandle(connection_handle); transport_manager_.DisconnectForce(connection_uid); @@ -1476,7 +1445,7 @@ void ConnectionHandlerImpl::CloseConnection( uint32_t ConnectionHandlerImpl::GetConnectionSessionsCount( uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); @@ -1503,9 +1472,8 @@ void ConnectionHandlerImpl::CloseSession(uint32_t key, void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle, uint8_t session_id, CloseSessionReason close_reason) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "Closing session with id: " << static_cast<int>(session_id)); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Closing session with id: " << static_cast<int>(session_id)); // In case of malformed message the connection should be broke up without // any other notification to mobile. @@ -1526,15 +1494,14 @@ void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle, session_map = connection_list_itr->second->session_map(); connection_list_itr->second->RemoveSession(session_id); } else { - LOG4CXX_ERROR(logger_, - "Connection with id: " << connection_id << " not found"); + SDL_LOG_ERROR("Connection with id: " << connection_id << " not found"); return; } } sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (!connection_handler_observer_) { - LOG4CXX_ERROR(logger_, "Connection handler observer not found"); + SDL_LOG_ERROR("Connection handler observer not found"); return; } @@ -1553,24 +1520,23 @@ void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle, session_key, service_type, close_reason); } } else { - LOG4CXX_ERROR(logger_, "Session with id: " << session_id << " not found"); + SDL_LOG_ERROR("Session with id: " << session_id << " not found"); return; } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Session with id: " << session_id << " has been closed successfully"); } void ConnectionHandlerImpl::CloseConnectionSessions( ConnectionHandle connection_handle, CloseSessionReason close_reason) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager::ConnectionUID connection_id = ConnectionUIDFromHandle(connection_handle); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Closing all sessions for connection with id: " << connection_id); typedef std::vector<uint8_t> SessionIdVector; @@ -1588,8 +1554,7 @@ void ConnectionHandlerImpl::CloseConnectionSessions( session_id_vector.push_back(session_map_itr->first); } } else { - LOG4CXX_ERROR(logger_, - "Connection with id: " << connection_id << " not found"); + SDL_LOG_ERROR("Connection with id: " << connection_id << " not found"); return; } } @@ -1599,13 +1564,12 @@ void ConnectionHandlerImpl::CloseConnectionSessions( } session_id_vector.clear(); - LOG4CXX_DEBUG(logger_, - "All sessions for connection with id: " - << connection_id << " have been closed successfully"); + SDL_LOG_DEBUG("All sessions for connection with id: " + << connection_id << " have been closed successfully"); } void ConnectionHandlerImpl::SendEndService(uint32_t key, uint8_t service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (protocol_handler_) { uint32_t connection_handle = 0; uint8_t session_id = 0; @@ -1615,17 +1579,16 @@ void ConnectionHandlerImpl::SendEndService(uint32_t key, uint8_t service_type) { // that transport from the SessionConnection Map SessionTransports st = GetSessionTransports(session_id); if (st.primary_transport == 0) { - LOG4CXX_WARN(logger_, - "SendEndService could not find Session in the " - "Session/Connection Map!"); + SDL_LOG_WARN( + "SendEndService could not find Session in the " + "Session/Connection Map!"); } else { - LOG4CXX_INFO(logger_, - "SendEndService found session " - << static_cast<int>(session_id) - << " with primary connection " - << static_cast<int>(st.primary_transport) - << " and secondary connection " - << static_cast<int>(st.secondary_transport)); + SDL_LOG_INFO("SendEndService found session " + << static_cast<int>(session_id) + << " with primary connection " + << static_cast<int>(st.primary_transport) + << " and secondary connection " + << static_cast<int>(st.secondary_transport)); sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_); auto it = std::find(st.secondary_transport_services.begin(), st.secondary_transport_services.end(), @@ -1641,7 +1604,7 @@ void ConnectionHandlerImpl::SendEndService(uint32_t key, uint8_t service_type) { } void ConnectionHandlerImpl::StartSessionHeartBeat(uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); @@ -1655,7 +1618,7 @@ void ConnectionHandlerImpl::StartSessionHeartBeat(uint32_t connection_key) { void ConnectionHandlerImpl::SetHeartBeatTimeout(uint32_t connection_key, uint32_t timeout) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); @@ -1677,7 +1640,7 @@ void ConnectionHandlerImpl::SendHeartBeat(ConnectionHandle connection_handle, void ConnectionHandlerImpl::KeepConnectionAlive(uint32_t connection_key, uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoReadLock lock(connection_list_lock_); ConnectionList::iterator it = connection_list_.find(connection_key); if (connection_list_.end() != it) { @@ -1687,13 +1650,12 @@ void ConnectionHandlerImpl::KeepConnectionAlive(uint32_t connection_key, void ConnectionHandlerImpl::OnConnectionEnded( const transport_manager::ConnectionUID connection_id) { - LOG4CXX_INFO(logger_, - "Delete Connection: " << static_cast<int32_t>(connection_id) + SDL_LOG_INFO("Delete Connection: " << static_cast<int32_t>(connection_id) << " from the list."); connection_list_lock_.AcquireForWriting(); ConnectionList::iterator itr = connection_list_.find(connection_id); if (connection_list_.end() == itr) { - LOG4CXX_ERROR(logger_, "Connection not found!"); + SDL_LOG_ERROR("Connection not found!"); connection_list_lock_.Release(); return; } @@ -1741,7 +1703,7 @@ void ConnectionHandlerImpl::OnConnectionEnded( void ConnectionHandlerImpl::BindProtocolVersionWithSession( uint32_t connection_key, uint8_t protocol_version) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint32_t connection_handle = 0; uint8_t session_id = 0; PairFromKey(connection_key, &connection_handle, &session_id); @@ -1756,7 +1718,7 @@ void ConnectionHandlerImpl::BindProtocolVersionWithSession( bool ConnectionHandlerImpl::IsHeartBeatSupported( transport_manager::ConnectionUID connection_handle, uint8_t session_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoReadLock lock(connection_list_lock_); const uint32_t connection_id = static_cast<uint32_t>(connection_handle); auto connection = GetPrimaryConnection(connection_id); @@ -1772,7 +1734,7 @@ bool ConnectionHandlerImpl::ProtocolVersionUsed( uint32_t connection_id, uint8_t session_id, uint8_t& protocol_version) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoReadLock lock(connection_list_lock_); auto connection = GetPrimaryConnection(connection_id); diff --git a/src/components/connection_handler/src/device.cc b/src/components/connection_handler/src/device.cc index 515304778b..c831c0b2d2 100644 --- a/src/components/connection_handler/src/device.cc +++ b/src/components/connection_handler/src/device.cc @@ -43,7 +43,7 @@ */ namespace connection_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler") +SDL_CREATE_LOG_VARIABLE("ConnectionHandler") Device::Device(DeviceHandle device_handle, const std::string& user_friendly_name, @@ -54,8 +54,8 @@ Device::Device(DeviceHandle device_handle, , mac_address_(mac_address) , connection_type_(connection_type) { mac_address_ = encryption::MakeHash(mac_address); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Device: MAC address - " << mac_address << ", hash - " << mac_address_); } diff --git a/src/components/connection_handler/src/heartbeat_monitor.cc b/src/components/connection_handler/src/heartbeat_monitor.cc index 2b50f1ce1b..e53e914b0a 100644 --- a/src/components/connection_handler/src/heartbeat_monitor.cc +++ b/src/components/connection_handler/src/heartbeat_monitor.cc @@ -41,7 +41,7 @@ namespace connection_handler { using namespace sync_primitives; -CREATE_LOGGERPTR_GLOBAL(logger_, "HeartBeatMonitor") +SDL_CREATE_LOG_VARIABLE("HeartBeatMonitor") HeartBeatMonitor::HeartBeatMonitor(uint32_t heartbeat_timeout_mseconds, Connection* connection) @@ -57,7 +57,7 @@ void HeartBeatMonitor::Process() { if (state.HasTimeoutElapsed()) { const uint8_t session_id = it->first; if (state.IsReadyToClose()) { - LOG4CXX_WARN(logger_, "Will close session"); + SDL_LOG_WARN("Will close session"); sessions_list_lock_.Release(); RemoveSession(session_id); connection_->CloseSession(session_id); @@ -65,9 +65,8 @@ void HeartBeatMonitor::Process() { it = sessions_.begin(); continue; } else { - LOG4CXX_DEBUG(logger_, - "Send heart beat into session with id " - << static_cast<int32_t>(session_id)); + SDL_LOG_DEBUG("Send heart beat into session with id " + << static_cast<int32_t>(session_id)); state.PrepareToClose(); connection_->SendHeartBeat(it->first); } @@ -79,8 +78,8 @@ void HeartBeatMonitor::Process() { void HeartBeatMonitor::threadMain() { AutoLock main_lock(main_thread_lock_); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Start heart beat monitor. Timeout is " << default_heartbeat_timeout_); while (run_) { heartbeat_monitor_.WaitFor(main_lock, kDefaultCycleTimeout); @@ -91,42 +90,37 @@ void HeartBeatMonitor::threadMain() { void HeartBeatMonitor::AddSession(uint8_t session_id) { const uint32_t converted_session_id = static_cast<int32_t>(session_id); UNUSED(converted_session_id); - LOG4CXX_DEBUG(logger_, "Add session with id " << converted_session_id); + SDL_LOG_DEBUG("Add session with id " << converted_session_id); AutoLock auto_lock(sessions_list_lock_); if (sessions_.end() != sessions_.find(session_id)) { - LOG4CXX_WARN( - logger_, - "Session with id: " << converted_session_id << " already exists"); + SDL_LOG_WARN("Session with id: " << converted_session_id + << " already exists"); return; } sessions_.insert( std::make_pair(session_id, SessionState(default_heartbeat_timeout_))); - LOG4CXX_INFO(logger_, - "Start heartbeat for session: " << converted_session_id); + SDL_LOG_INFO("Start heartbeat for session: " << converted_session_id); } void HeartBeatMonitor::RemoveSession(uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); AutoLock auto_lock(sessions_list_lock_); - LOG4CXX_DEBUG(logger_, - "Remove session with id " << static_cast<int>(session_id)); + SDL_LOG_DEBUG("Remove session with id " << static_cast<int>(session_id)); if (sessions_.erase(session_id) == 0) { - LOG4CXX_WARN(logger_, - "Remove session with id " << static_cast<int>(session_id) + SDL_LOG_WARN("Remove session with id " << static_cast<int>(session_id) << " was unsuccessful"); } } void HeartBeatMonitor::KeepAlive(uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); AutoLock auto_lock(sessions_list_lock_); if (sessions_.end() != sessions_.find(session_id)) { - LOG4CXX_INFO(logger_, - "Resetting heart beat timer for session with id " - << static_cast<int32_t>(session_id)); + SDL_LOG_INFO("Resetting heart beat timer for session with id " + << static_cast<int32_t>(session_id)); sessions_[session_id].KeepAlive(); } @@ -136,7 +130,7 @@ void HeartBeatMonitor::exitThreadMain() { // FIXME (dchmerev@luxoft.com): thread requested to stop should stop as soon // as possible, // not running one more iteration before actual stop - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); AutoLock main_lock(main_thread_lock_); run_ = false; heartbeat_monitor_.NotifyOne(); @@ -144,8 +138,7 @@ void HeartBeatMonitor::exitThreadMain() { void HeartBeatMonitor::set_heartbeat_timeout_milliseconds(uint32_t timeout, uint8_t session_id) { - LOG4CXX_DEBUG(logger_, - "Set new heart beat timeout " << timeout + SDL_LOG_DEBUG("Set new heart beat timeout " << timeout << "For session: " << session_id); AutoLock session_locker(sessions_list_lock_); @@ -158,12 +151,12 @@ HeartBeatMonitor::SessionState::SessionState( uint32_t heartbeat_timeout_mseconds) : heartbeat_timeout_mseconds_(heartbeat_timeout_mseconds) , is_heartbeat_sent_(false) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); RefreshExpiration(); } void HeartBeatMonitor::SessionState::RefreshExpiration() { - LOG4CXX_DEBUG(logger_, "Refresh expiration: " << heartbeat_timeout_mseconds_); + SDL_LOG_DEBUG("Refresh expiration: " << heartbeat_timeout_mseconds_); using namespace date_time; date_time::TimeDuration time = getCurrentTime(); AddMilliseconds(time, heartbeat_timeout_mseconds_); @@ -172,15 +165,14 @@ void HeartBeatMonitor::SessionState::RefreshExpiration() { void HeartBeatMonitor::SessionState::UpdateTimeout( uint32_t heartbeat_timeout_mseconds) { - LOG4CXX_DEBUG(logger_, - "Update timout with value " << heartbeat_timeout_mseconds_); + SDL_LOG_DEBUG("Update timout with value " << heartbeat_timeout_mseconds_); heartbeat_timeout_mseconds_ = heartbeat_timeout_mseconds; RefreshExpiration(); } void HeartBeatMonitor::SessionState::PrepareToClose() { is_heartbeat_sent_ = true; - LOG4CXX_DEBUG(logger_, "Prepare to close"); + SDL_LOG_DEBUG("Prepare to close"); RefreshExpiration(); } @@ -189,7 +181,7 @@ bool HeartBeatMonitor::SessionState::IsReadyToClose() const { } void HeartBeatMonitor::SessionState::KeepAlive() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_heartbeat_sent_ = false; RefreshExpiration(); } diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h b/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h index b4c03fd760..6e0ad66199 100644 --- a/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h +++ b/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h @@ -58,8 +58,6 @@ using namespace boost::beast::websocket; namespace hmi_message_handler { -CREATE_LOGGERPTR_GLOBAL(mb_logger_, "HMIMessageHandler") - enum ErrorCode { CONTROLLER_EXISTS = -32000, SUBSCRIBTION_EXISTS = -32001, diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h b/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h index 08d1b55aaf..67a46aca56 100644 --- a/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h +++ b/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h @@ -83,8 +83,6 @@ typedef std::shared_ptr<std::string> Message; namespace hmi_message_handler { -CREATE_LOGGERPTR_GLOBAL(ws_logger_, "HMIMessageHandler") - class CMessageBrokerController; class WebsocketSession : public std::enable_shared_from_this<WebsocketSession> { @@ -203,4 +201,4 @@ class WebsocketSession : public std::enable_shared_from_this<WebsocketSession> { } // namespace hmi_message_handler -#endif /* WEBSOCKET_SESSION_H */
\ No newline at end of file +#endif /* WEBSOCKET_SESSION_H */ diff --git a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc index 70865f7771..93ba433d3e 100644 --- a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc +++ b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc @@ -35,7 +35,7 @@ namespace hmi_message_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler") +SDL_CREATE_LOG_VARIABLE("HMIMessageHandler") HMIMessageHandlerImpl::HMIMessageHandlerImpl( const HMIMessageHandlerSettings& settings) @@ -51,47 +51,47 @@ HMIMessageHandlerImpl::HMIMessageHandlerImpl( threads::ThreadOptions(get_settings().thread_min_stack_size())) {} HMIMessageHandlerImpl::~HMIMessageHandlerImpl() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); messages_to_hmi_.Shutdown(); messages_from_hmi_.Shutdown(); set_message_observer(NULL); } void HMIMessageHandlerImpl::OnMessageReceived(MessageSharedPointer message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(observer_locker_); if (!observer_) { - LOG4CXX_WARN(logger_, "No HMI message observer set!"); + SDL_LOG_WARN("No HMI message observer set!"); return; } messages_from_hmi_.PostMessage(impl::MessageFromHmi(message)); } void HMIMessageHandlerImpl::SendMessageToHMI(MessageSharedPointer message) { - LOG4CXX_INFO(logger_, "SendMessageToHMI"); + SDL_LOG_INFO("SendMessageToHMI"); messages_to_hmi_.PostMessage(impl::MessageToHmi(message)); } void HMIMessageHandlerImpl::set_message_observer(HMIMessageObserver* observer) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(observer_locker_); observer_ = observer; } void HMIMessageHandlerImpl::OnErrorSending(MessageSharedPointer message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(observer_locker_); if (!observer_) { - LOG4CXX_WARN(logger_, "No HMI message observer set!"); + SDL_LOG_WARN("No HMI message observer set!"); return; } observer_->OnErrorSending(message); } void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter* adapter) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!adapter) { - LOG4CXX_WARN(logger_, "HMIMessageAdapter is not valid!"); + SDL_LOG_WARN("HMIMessageAdapter is not valid!"); return; } sync_primitives::AutoLock lock(message_adapters_locker_); @@ -100,9 +100,9 @@ void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter* adapter) { void HMIMessageHandlerImpl::RemoveHMIMessageAdapter( HMIMessageAdapter* adapter) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!adapter) { - LOG4CXX_WARN(logger_, "HMIMessageAdapter is not valid!"); + SDL_LOG_WARN("HMIMessageAdapter is not valid!"); return; } sync_primitives::AutoLock lock(message_adapters_locker_); @@ -114,15 +114,15 @@ const HMIMessageHandlerSettings& HMIMessageHandlerImpl::get_settings() const { } void HMIMessageHandlerImpl::Handle(const impl::MessageFromHmi message) { - LOG4CXX_INFO(logger_, "Received message from hmi"); + SDL_LOG_INFO("Received message from hmi"); sync_primitives::AutoLock lock(observer_locker_); if (!observer_) { - LOG4CXX_ERROR(logger_, "Observer is not set for HMIMessageHandler"); + SDL_LOG_ERROR("Observer is not set for HMIMessageHandler"); return; } observer_->OnMessageReceived(message); - LOG4CXX_INFO(logger_, "Message from hmi given away."); + SDL_LOG_INFO("Message from hmi given away."); } void HMIMessageHandlerImpl::Handle(const impl::MessageToHmi message) { sync_primitives::AutoLock lock(message_adapters_locker_); diff --git a/src/components/hmi_message_handler/src/mb_controller.cc b/src/components/hmi_message_handler/src/mb_controller.cc index cfc05647da..681e57906a 100644 --- a/src/components/hmi_message_handler/src/mb_controller.cc +++ b/src/components/hmi_message_handler/src/mb_controller.cc @@ -33,6 +33,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace boost::beast::websocket; namespace hmi_message_handler { +SDL_CREATE_LOG_VARIABLE("HMIMessageHandler") + CMessageBrokerController::CMessageBrokerController(const std::string& address, uint16_t port, std::string name, @@ -59,26 +61,26 @@ bool CMessageBrokerController::StartListener() { acceptor_.open(endpoint_.protocol(), error); if (error) { std::string str_err = "ErrorOpen: " + error.message(); - LOG4CXX_ERROR(mb_logger_, str_err); + SDL_LOG_ERROR(str_err); return false; } acceptor_.set_option(boost::asio::socket_base::reuse_address(true), error); if (error) { std::string str_err = "ErrorSetOption: " + error.message(); - LOG4CXX_ERROR(mb_logger_, str_err); + SDL_LOG_ERROR(str_err); return false; } acceptor_.bind(endpoint_, error); if (error) { std::string str_err = "ErrorBind: " + error.message(); - LOG4CXX_ERROR(mb_logger_, str_err); + SDL_LOG_ERROR(str_err); return false; } acceptor_.listen(boost::asio::socket_base::max_listen_connections, error); if (error) { std::string str_err = "ErrorListen: " + error.message(); - LOG4CXX_ERROR(mb_logger_, str_err); + SDL_LOG_ERROR(str_err); return false; } return true; @@ -107,7 +109,7 @@ void CMessageBrokerController::WaitForConnection() { void CMessageBrokerController::StartSession(boost::system::error_code ec) { if (ec) { - LOG4CXX_ERROR(mb_logger_, "ErrorMessage: " << ec.message()); + SDL_LOG_ERROR("ErrorMessage: " << ec.message()); CloseConnection(); return; } @@ -143,7 +145,7 @@ void CMessageBrokerController::sendNotification(Json::Value& message) { (*it)->sendJsonMessage(message); } } else { - LOG4CXX_ERROR(mb_logger_, ("No subscribers for this property!\n")); + SDL_LOG_ERROR(("No subscribers for this property!\n")); } } @@ -255,7 +257,7 @@ bool CMessageBrokerController::addController(WebsocketSession* ws_session, std::map<std::string, WebsocketSession*>::value_type(name, ws_session)); result = true; } else { - LOG4CXX_ERROR(mb_logger_, ("Controller already exists!\n")); + SDL_LOG_ERROR(("Controller already exists!\n")); } return result; } @@ -325,7 +327,7 @@ bool CMessageBrokerController::addSubscriber(WebsocketSession* ws_session, for (itr = p.first; itr != p.second; ++itr) { if (ws_session == itr->second) { result = false; - LOG4CXX_ERROR(mb_logger_, ("Subscriber already exists!\n")); + SDL_LOG_ERROR(("Subscriber already exists!\n")); } } } @@ -489,17 +491,17 @@ void CMessageBrokerController::CloseConnection() { acceptor_.cancel(ec); if (ec) { - LOG4CXX_ERROR(mb_logger_, "Acceptor cancel error: " << ec.message()); + SDL_LOG_ERROR("Acceptor cancel error: " << ec.message()); } acceptor_.close(ec); if (ec) { - LOG4CXX_ERROR(mb_logger_, "Acceptor close error: " << ec.message()); + SDL_LOG_ERROR("Acceptor close error: " << ec.message()); } socket_.close(ec); if (ec) { - LOG4CXX_ERROR(mb_logger_, "Socket close error : " << ec.message()); + SDL_LOG_ERROR("Socket close error : " << ec.message()); } ioc_.stop(); diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc index 13e6dfeca1..ca3d03dd91 100644 --- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc +++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc @@ -38,7 +38,7 @@ namespace hmi_message_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler") +SDL_CREATE_LOG_VARIABLE("HMIMessageHandler") typedef hmi_message_handler::CMessageBrokerController MessageBrokerController; @@ -47,17 +47,17 @@ MessageBrokerAdapter::MessageBrokerAdapter(HMIMessageHandler* handler_param, uint16_t port) : HMIMessageAdapterImpl(handler_param) , MessageBrokerController(server_address, port, "SDL", 8) { - LOG4CXX_TRACE(logger_, "Created MessageBrokerAdapter"); + SDL_LOG_TRACE("Created MessageBrokerAdapter"); } MessageBrokerAdapter::~MessageBrokerAdapter() {} void MessageBrokerAdapter::SendMessageToHMI( hmi_message_handler::MessageSharedPointer message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (message.use_count() == 0) { - LOG4CXX_ERROR(logger_, "Can`t send not valid message"); + SDL_LOG_ERROR("Can`t send not valid message"); return; } @@ -66,7 +66,7 @@ void MessageBrokerAdapter::SendMessageToHMI( const std::string str = message->json_message(); if (!reader.parse(str, &json_value)) { - LOG4CXX_ERROR(logger_, "Received invalid json string. "); + SDL_LOG_ERROR("Received invalid json string. "); return; } @@ -75,22 +75,22 @@ void MessageBrokerAdapter::SendMessageToHMI( void MessageBrokerAdapter::processResponse(std::string method, Json::Value& root) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessRecievedFromMB(root); } void MessageBrokerAdapter::processRequest(Json::Value& root) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessRecievedFromMB(root); } void MessageBrokerAdapter::processNotification(Json::Value& root) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessRecievedFromMB(root); } void MessageBrokerAdapter::SubscribeTo() { - LOG4CXX_INFO(logger_, "MessageBrokerAdapter::subscribeTo"); + SDL_LOG_INFO("MessageBrokerAdapter::subscribeTo"); MessageBrokerController::subscribeTo("Buttons.OnButtonEvent"); MessageBrokerController::subscribeTo("Buttons.OnButtonPress"); MessageBrokerController::subscribeTo("UI.OnCommand"); @@ -146,7 +146,7 @@ void MessageBrokerAdapter::SubscribeTo() { MessageBrokerController::subscribeTo("UI.OnUpdateFile"); MessageBrokerController::subscribeTo("UI.OnUpdateSubMenu"); - LOG4CXX_INFO(logger_, "Subscribed to notifications."); + SDL_LOG_INFO("Subscribed to notifications."); } void* MessageBrokerAdapter::SubscribeAndBeginReceiverThread(void* param) { @@ -159,8 +159,8 @@ void* MessageBrokerAdapter::SubscribeAndBeginReceiverThread(void* param) { } void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_INFO(logger_, "MB_Adapter: " << root); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_INFO("MB_Adapter: " << root); if (root.isNull()) { // LOG return; @@ -186,12 +186,12 @@ void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) { protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI); if (!handler()) { - LOG4CXX_WARN(logger_, "handler is NULL"); + SDL_LOG_WARN("handler is NULL"); return; } handler()->OnMessageReceived(message); - LOG4CXX_INFO(logger_, "Successfully sent to observer"); + SDL_LOG_INFO("Successfully sent to observer"); } } // namespace hmi_message_handler diff --git a/src/components/hmi_message_handler/src/websocket_session.cc b/src/components/hmi_message_handler/src/websocket_session.cc index b58c118e3d..f2cb265770 100644 --- a/src/components/hmi_message_handler/src/websocket_session.cc +++ b/src/components/hmi_message_handler/src/websocket_session.cc @@ -36,6 +36,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace boost::beast::websocket; namespace hmi_message_handler { +SDL_CREATE_LOG_VARIABLE("HMIMessageHandler") + WebsocketSession::WebsocketSession(boost::asio::ip::tcp::socket socket, CMessageBrokerController* controller) : ws_(std::move(socket)) @@ -80,7 +82,7 @@ void WebsocketSession::Recv(boost::system::error_code ec) { if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR(ws_logger_, str_err); + SDL_LOG_ERROR(str_err); shutdown_ = true; thread_delegate_->SetShutdown(); controller_->deleteController(this); @@ -121,7 +123,7 @@ void WebsocketSession::Read(boost::system::error_code ec, boost::ignore_unused(bytes_transferred); if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR(ws_logger_, str_err); + SDL_LOG_ERROR(str_err); shutdown_ = true; thread_delegate_->SetShutdown(); controller_->deleteController(this); @@ -136,7 +138,7 @@ void WebsocketSession::Read(boost::system::error_code ec, Json::Value root; if (!reader.parse(data, &root)) { - LOG4CXX_ERROR(ws_logger_, "Invalid JSON Message."); + SDL_LOG_ERROR("Invalid JSON Message."); return; } @@ -179,8 +181,7 @@ void WebsocketSession::onMessageReceived(Json::Value message) { if (message.isMember("result") && message["result"].isInt()) { mControllersIdStart = message["result"].asInt(); } else { - LOG4CXX_ERROR(ws_logger_, - "Not possible to initialize mControllersIdStart!"); + SDL_LOG_ERROR("Not possible to initialize mControllersIdStart!"); } } else if ("MB.subscribeTo" == method || "MB.unregisterComponent" == method || @@ -190,8 +191,7 @@ void WebsocketSession::onMessageReceived(Json::Value message) { controller_->processResponse(method, message); } } else { - LOG4CXX_ERROR(ws_logger_, - "Request with id: " + id + " has not been found!"); + SDL_LOG_ERROR("Request with id: " + id + " has not been found!"); } } else { std::string method = message["method"].asString(); @@ -205,7 +205,7 @@ void WebsocketSession::onMessageReceived(Json::Value message) { } } } else { - LOG4CXX_ERROR(ws_logger_, "Message contains wrong data!\n"); + SDL_LOG_ERROR("Message contains wrong data!\n"); sendJsonMessage(error); } } @@ -314,8 +314,7 @@ void WebsocketSession::LoopThreadDelegate::DrainQueue() { boost::system::error_code ec; handler_.ws_.write(boost::asio::buffer(*message_ptr), ec); if (ec) { - LOG4CXX_ERROR(ws_logger_, - "A system error has occurred: " << ec.message()); + SDL_LOG_ERROR("A system error has occurred: " << ec.message()); } } } diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h index 3086a7dfb8..9d4ad5ea57 100644 --- a/src/components/include/policy/policy_external/policy/policy_manager.h +++ b/src/components/include/policy/policy_external/policy/policy_manager.h @@ -881,7 +881,8 @@ class PolicyManager : public usage_statistics::StatisticsManager, } // namespace policy -extern "C" policy::PolicyManager* CreateManager(); +extern "C" policy::PolicyManager* CreateManager( + logger::Logger* logger_instance); extern "C" void DeleteManager(policy::PolicyManager*); #endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_MANAGER_H_ diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h index 4db05ccb38..c90006928a 100644 --- a/src/components/include/policy/policy_regular/policy/policy_manager.h +++ b/src/components/include/policy/policy_regular/policy/policy_manager.h @@ -842,7 +842,8 @@ class PolicyManager : public usage_statistics::StatisticsManager, } // namespace policy -extern "C" policy::PolicyManager* CreateManager(); +extern "C" policy::PolicyManager* CreateManager( + logger::Logger* logger_instance); extern "C" void DeleteManager(policy::PolicyManager*); #endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_ diff --git a/src/components/include/utils/auto_trace.h b/src/components/include/utils/auto_trace.h index 36ff3be281..d975d1ae42 100644 --- a/src/components/include/utils/auto_trace.h +++ b/src/components/include/utils/auto_trace.h @@ -33,20 +33,19 @@ #ifndef SRC_COMPONENTS_INCLUDE_UTILS_AUTO_TRACE_H_ #define SRC_COMPONENTS_INCLUDE_UTILS_AUTO_TRACE_H_ -#include <log4cxx/logger.h> #include <string> +#include "utils/ilogger.h" namespace logger { class AutoTrace { public: - AutoTrace(log4cxx::LoggerPtr logger, - const log4cxx::spi::LocationInfo& location); + AutoTrace(const std::string& component, const LocationInfo& location); ~AutoTrace(); private: - log4cxx::LoggerPtr logger_; - log4cxx::spi::LocationInfo location_; + std::string component_; + LocationInfo location_; }; } // namespace logger diff --git a/src/components/utils/src/log_message_loop_thread.cc b/src/components/include/utils/ilogger.h index 182eb64534..ba2f93df9b 100644 --- a/src/components/utils/src/log_message_loop_thread.cc +++ b/src/components/include/utils/ilogger.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Ford Motor Company + * Copyright (c) 2020, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,27 +30,61 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "utils/log_message_loop_thread.h" -#include "utils/logger_status.h" +#pragma once + +#include <chrono> +#include <string> +#include <thread> namespace logger { -void LogMessageLoopThread::Handle(const LogMessage message) { - message.logger->forcedLog(message.level, - message.entry, - message.timeStamp, - message.location, - message.threadName); -} +enum class LogLevel { + TRACE_LEVEL, + DEBUG_LEVEL, + INFO_LEVEL, + WARNING_LEVEL, + ERROR_LEVEL, + FATAL_LEVEL +}; + +struct LocationInfo { + std::string file_name; + std::string function_name; + int line_number; +}; + +typedef std::chrono::high_resolution_clock::time_point TimePoint; + +struct LogMessage { + std::string component_; // <- component_name + LogLevel log_level_; + std::string log_event_; + TimePoint timestamp_; + LocationInfo location_; + std::thread::id thread_id_; +}; -LogMessageLoopThread::LogMessageLoopThread() - : LogMessageLoopThreadTemplate("Logger", this) {} +class Logger { + public: + virtual bool IsEnabledFor(const std::string& component, + LogLevel log_level) const = 0; + virtual void DeInit() = 0; + virtual void Flush() = 0; + virtual void PushLog(const LogMessage& log_message) = 0; + static Logger& instance(Logger* pre_init = nullptr); +}; -LogMessageLoopThread::~LogMessageLoopThread() { - // we'll have to drop messages - // while deleting logger thread - logger_status = DeletingLoggerThread; - LogMessageLoopThreadTemplate::Shutdown(); -} +class ThirdPartyLoggerInterface { + public: + virtual void Init() = 0; + virtual void DeInit() = 0; + virtual bool IsEnabledFor(const std::string& component, + LogLevel log_level) const = 0; + virtual void PushLog(const LogMessage& log_message) = 0; +}; +class LoggerInitializer { + public: + virtual void Init(std::unique_ptr<ThirdPartyLoggerInterface>&& impl) = 0; +}; } // namespace logger diff --git a/src/components/include/utils/logger.h b/src/components/include/utils/logger.h index d492cfcb1b..197b2ec5d9 100644 --- a/src/components/include/utils/logger.h +++ b/src/components/include/utils/logger.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Ford Motor Company + * Copyright (c) 2020, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,151 +33,107 @@ #ifndef SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_H_ #define SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_H_ +#include "utils/ilogger.h" + #ifdef ENABLE_LOG -#include <errno.h> -#include <log4cxx/propertyconfigurator.h> -#include <log4cxx/spi/loggingevent.h> -#include <string.h> #include <sstream> +#include <string> + #include "utils/auto_trace.h" #include "utils/logger_status.h" -#include "utils/push_log.h" -#endif // ENABLE_LOG -#ifdef ENABLE_LOG - -#define CREATE_LOGGERPTR_GLOBAL(logger_var, logger_name) \ - namespace { \ - CREATE_LOGGERPTR_LOCAL(logger_var, logger_name); \ +#define SDL_CREATE_LOG_VARIABLE(component_name) \ + namespace { \ + static std::string logger_(component_name); \ } -#define CREATE_LOGGERPTR_LOCAL(logger_var, logger_name) \ - log4cxx::LoggerPtr logger_var = \ - log4cxx::LoggerPtr(log4cxx::Logger::getLogger(logger_name)); +#define SDL_CREATE_LOCAL_LOG_VARIABLE(component_name) \ + std::string logger_(component_name); -#define INIT_LOGGER(file_name, logs_enabled) \ - log4cxx::PropertyConfigurator::configure(file_name); \ - logger::set_logs_enabled(logs_enabled); +// special macros to dump logs from queue +// it's needed, for example, when crash happened +#define SDL_FLUSH_LOGGER() logger::Logger::instance().Flush(); // Logger deinitilization function and macro, need to stop log4cxx writing // without this deinitilization log4cxx threads continue using some instances // destroyed by exit() -void deinit_logger(); -#define DEINIT_LOGGER() deinit_logger() - -// Logger thread deinitilization macro that need to stop the thread of handling -// messages for the log4cxx -#define DELETE_THREAD_LOGGER(logger_var) \ - logger::delete_log_message_loop_thread(logger_var) - -// special macros to dump logs from queue -// it's need, for example, when crash happend -#define FLUSH_LOGGER() logger::flush_logger() - -#define LOG4CXX_IS_TRACE_ENABLED(logger) logger->isTraceEnabled() - -log4cxx_time_t time_now(); - -#define LOG_WITH_LEVEL(loggerPtr, logLevel, logEvent) \ - do { \ - if (logger::logs_enabled()) { \ - if (logger::logger_status != logger::DeletingLoggerThread) { \ - if (loggerPtr->isEnabledFor(logLevel)) { \ - std::stringstream accumulator; \ - accumulator << logEvent; \ - logger::push_log( \ - loggerPtr, \ - logLevel, \ - accumulator.str(), \ - time_now(), \ - LOG4CXX_LOCATION, \ - ::log4cxx::spi::LoggingEvent::getCurrentThreadName()); \ - } \ - } \ - } \ +#define SDL_DEINIT_LOGGER() logger::Logger::instance().DeInit(); + +#define LOG_WITH_LEVEL(logLevel, logEvent) \ + do { \ + if (logger::logger_status != logger::DeletingLoggerThread) { \ + if (logger::Logger::instance().IsEnabledFor(logger_, logLevel)) { \ + std::stringstream accumulator; \ + accumulator << logEvent; \ + logger::LogMessage message{ \ + logger_, \ + logLevel, \ + accumulator.str(), \ + std::chrono::high_resolution_clock::now(), \ + logger::LocationInfo{__FILE__, __PRETTY_FUNCTION__, __LINE__}, \ + std::this_thread::get_id()}; \ + logger::Logger::instance().PushLog(message); \ + } \ + } \ } while (false) -#undef LOG4CXX_TRACE -#define LOG4CXX_TRACE(loggerPtr, logEvent) \ - LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getTrace(), logEvent) +#define SDL_LOG_TRACE(logEvent) \ + LOG_WITH_LEVEL(logger::LogLevel::TRACE_LEVEL, logEvent) -#define LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, auto_trace) \ - logger::AutoTrace auto_trace(loggerPtr, LOG4CXX_LOCATION) -#define LOG4CXX_AUTO_TRACE(loggerPtr) \ - LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, SDL_local_auto_trace_object) +#define SDL_LOG_AUTO_TRACE() \ + logger::AutoTrace auto_trace( \ + logger_, logger::LocationInfo{__FILE__, __PRETTY_FUNCTION__, __LINE__}) -#undef LOG4CXX_DEBUG -#define LOG4CXX_DEBUG(loggerPtr, logEvent) \ - LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getDebug(), logEvent) +#define SDL_LOG_DEBUG(logEvent) \ + LOG_WITH_LEVEL(logger::LogLevel::DEBUG_LEVEL, logEvent) -#undef LOG4CXX_INFO -#define LOG4CXX_INFO(loggerPtr, logEvent) \ - LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getInfo(), logEvent) +#define SDL_LOG_INFO(logEvent) \ + LOG_WITH_LEVEL(logger::LogLevel::INFO_LEVEL, logEvent) -#undef LOG4CXX_WARN -#define LOG4CXX_WARN(loggerPtr, logEvent) \ - LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getWarn(), logEvent) +#define SDL_LOG_WARN(logEvent) \ + LOG_WITH_LEVEL(logger::LogLevel::WARNING_LEVEL, logEvent) -#undef LOG4CXX_ERROR -#define LOG4CXX_ERROR(loggerPtr, logEvent) \ - LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getError(), logEvent) +#define SDL_LOG_ERROR(logEvent) \ + LOG_WITH_LEVEL(logger::LogLevel::ERROR_LEVEL, logEvent) -#undef LOG4CXX_FATAL -#define LOG4CXX_FATAL(loggerPtr, logEvent) \ - LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getFatal(), logEvent) +#define SDL_LOG_FATAL(logEvent) \ + LOG_WITH_LEVEL(logger::LogLevel::FATAL_LEVEL, logEvent) -#define LOG4CXX_ERROR_WITH_ERRNO(loggerPtr, message) \ - LOG4CXX_ERROR( \ - loggerPtr, \ - message << ", error code " << errno << " (" << strerror(errno) << ")") +#define SDL_LOG_ERROR_WITH_ERRNO(message) \ + SDL_LOG_ERROR(message << ", error code " << errno << " (" << strerror(errno) \ + << ")") -#define LOG4CXX_WARN_WITH_ERRNO(loggerPtr, message) \ - LOG4CXX_WARN( \ - loggerPtr, \ - message << ", error code " << errno << " (" << strerror(errno) << ")") +#define SDL_LOG_WARN_WITH_ERRNO(message) \ + SDL_LOG_WARN(message << ", error code " << errno << " (" << strerror(errno) \ + << ")") #else // ENABLE_LOG is OFF +#define SDL_CREATE_LOG_VARIABLE(x) -#define CREATE_LOGGERPTR_GLOBAL(logger_var, logger_name) - -#define CREATE_LOGGERPTR_LOCAL(logger_var, logger_name) - -#define INIT_LOGGER(file_name, logs_enabled) - -#define DEINIT_LOGGER() +#define SDL_CREATE_LOCAL_LOG_VARIABLE(x) -#define DELETE_THREAD_LOGGER(logger_var) +#define SDL_DEINIT_LOGGER() -#define FLUSH_LOGGER() +#define SDL_FLUSH_LOGGER() -#define LOG4CXX_IS_TRACE_ENABLED(logger) false +#define SDL_LOG_TRACE(x) -#undef LOG4CXX_TRACE -#define LOG4CXX_TRACE(x, y) +#define SDL_LOG_AUTO_TRACE() -#define LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, auto_trace) -#define LOG4CXX_AUTO_TRACE(loggerPtr) +#define SDL_LOG_DEBUG(x) -#undef LOG4CXX_DEBUG -#define LOG4CXX_DEBUG(x, y) +#define SDL_LOG_INFO(x) -#undef LOG4CXX_INFO -#define LOG4CXX_INFO(x, y) +#define SDL_LOG_WARN(x) -#undef LOG4CXX_WARN -#define LOG4CXX_WARN(x, y) +#define SDL_LOG_ERROR(x) -#undef LOG4CXX_ERROR -#define LOG4CXX_ERROR(x, y) +#define SDL_LOG_ERROR_WITH_ERRNO(x) -#undef LOG4CXX_ERROR_WITH_ERRNO -#define LOG4CXX_ERROR_WITH_ERRNO(x, y) +#define SDL_LOG_WARN_WITH_ERRNO(x) -#undef LOG4CXX_WARN_WITH_ERRNO -#define LOG4CXX_WARN_WITH_ERRNO(x, y) +#define SDL_LOG_FATAL(x) -#undef LOG4CXX_FATAL -#define LOG4CXX_FATAL(x, y) #endif // ENABLE_LOG #endif // SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_H_ diff --git a/src/components/include/utils/logger_status.h b/src/components/include/utils/logger_status.h index 17fa0562c2..b16920704a 100644 --- a/src/components/include/utils/logger_status.h +++ b/src/components/include/utils/logger_status.h @@ -39,7 +39,8 @@ typedef enum { LoggerThreadNotCreated, CreatingLoggerThread, LoggerThreadCreated, - DeletingLoggerThread + DeletingLoggerThread, + LoggerThreadIsNotUsed } LoggerStatus; // this variable is only changed when creating and deleting logger thread diff --git a/src/components/include/utils/macro.h b/src/components/include/utils/macro.h index 00298f690e..7c39bbd356 100644 --- a/src/components/include/utils/macro.h +++ b/src/components/include/utils/macro.h @@ -60,9 +60,9 @@ #ifdef DEBUG #define ASSERT(condition) \ - FLUSH_LOGGER(); \ + SDL_FLUSH_LOGGER(); \ do { \ - DEINIT_LOGGER(); \ + SDL_DEINIT_LOGGER(); \ assert(condition); \ } while (false) #else // RELEASE @@ -76,9 +76,8 @@ #define DCHECK(condition) \ if (!(condition)) { \ - CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \ - LOG4CXX_FATAL(logger_, \ - "DCHECK failed with \"" << #condition << "\" [" \ + SDL_CREATE_LOCAL_LOG_VARIABLE("Utils"); \ + SDL_LOG_FATAL("DCHECK failed with \"" << #condition << "\" [" \ << __FUNCTION__ << "][" << __FILE__ \ << ':' << __LINE__ << ']'); \ ASSERT((condition)); \ @@ -90,9 +89,8 @@ */ #define DCHECK_OR_RETURN(condition, return_value) \ if (!(condition)) { \ - CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \ - LOG4CXX_FATAL(logger_, \ - "DCHECK failed with \"" << #condition << "\" [" \ + SDL_CREATE_LOCAL_LOG_VARIABLE("Utils"); \ + SDL_LOG_FATAL("DCHECK failed with \"" << #condition << "\" [" \ << __FUNCTION__ << "][" << __FILE__ \ << ':' << __LINE__ << ']'); \ ASSERT((condition)); \ @@ -104,9 +102,8 @@ */ #define DCHECK_OR_RETURN_VOID(condition) \ if (!(condition)) { \ - CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \ - LOG4CXX_FATAL(logger_, \ - "DCHECK failed with \"" << #condition << "\" [" \ + SDL_CREATE_LOCAL_LOG_VARIABLE("Utils"); \ + SDL_LOG_FATAL("DCHECK failed with \"" << #condition << "\" [" \ << __FUNCTION__ << "][" << __FILE__ \ << ':' << __LINE__ << ']'); \ ASSERT((condition)); \ diff --git a/src/components/include/utils/messagemeter.h b/src/components/include/utils/messagemeter.h index fb70839640..a5ede6057f 100644 --- a/src/components/include/utils/messagemeter.h +++ b/src/components/include/utils/messagemeter.h @@ -41,7 +41,7 @@ namespace utils { -CREATE_LOGGERPTR_GLOBAL(logger_, "MessageMeter") +SDL_CREATE_LOG_VARIABLE("MessageMeter") /** @brief The MessageMeter class need to count message frequency Default time range value is 1 second @@ -105,13 +105,13 @@ MessageMeter<Id>::MessageMeter() { template <class Id> size_t MessageMeter<Id>::TrackMessage(const Id& id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return TrackMessages(id, 1); } template <class Id> size_t MessageMeter<Id>::TrackMessages(const Id& id, const size_t count) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(timing_map_lock_); Timings& timings = timing_map_[id]; const date_time::TimeDuration current_time = date_time::getCurrentTime(); @@ -124,14 +124,14 @@ size_t MessageMeter<Id>::TrackMessages(const Id& id, const size_t count) { template <class Id> size_t MessageMeter<Id>::Frequency(const Id& id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(timing_map_lock_); return FrequencyImpl(id); } template <class Id> size_t MessageMeter<Id>::FrequencyImpl(const Id& id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); typename TimingMap::iterator it = timing_map_.find(id); if (it == timing_map_.end()) { return 0u; @@ -148,27 +148,27 @@ size_t MessageMeter<Id>::FrequencyImpl(const Id& id) { template <class Id> void MessageMeter<Id>::RemoveIdentifier(const Id& id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(timing_map_lock_); timing_map_.erase(id); } template <class Id> void MessageMeter<Id>::ClearIdentifiers() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(timing_map_lock_); timing_map_.clear(); } template <class Id> void MessageMeter<Id>::set_time_range(const size_t time_range_msecs) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); time_range_ = date_time::milliseconds(time_range_msecs); } template <class Id> void MessageMeter<Id>::set_time_range( const date_time::TimeDuration& time_range) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); time_range_ = time_range; } template <class Id> diff --git a/src/components/include/utils/threads/message_loop_thread.h b/src/components/include/utils/threads/message_loop_thread.h index b1a6714be1..6dea86696b 100644 --- a/src/components/include/utils/threads/message_loop_thread.h +++ b/src/components/include/utils/threads/message_loop_thread.h @@ -132,6 +132,8 @@ size_t MessageLoopThread<Q>::GetMessageQueueSize() const { return message_queue_.size(); } +SDL_CREATE_LOG_VARIABLE("Utils") + template <class Q> MessageLoopThread<Q>::MessageLoopThread(const std::string& name, Handler* handler, @@ -140,8 +142,7 @@ MessageLoopThread<Q>::MessageLoopThread(const std::string& name, , thread_(threads::CreateThread(name.c_str(), thread_delegate_)) { const bool started = thread_->Start(thread_opts); if (!started) { - CREATE_LOGGERPTR_LOCAL(logger_, "Utils") - LOG4CXX_ERROR(logger_, "Failed to start thread " << name); + SDL_LOG_ERROR("Failed to start thread " << name); } } @@ -178,8 +179,7 @@ MessageLoopThread<Q>::LoopThreadDelegate::LoopThreadDelegate( template <class Q> void MessageLoopThread<Q>::LoopThreadDelegate::threadMain() { - CREATE_LOGGERPTR_LOCAL(logger_, "Utils") - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); while (!message_queue_.IsShuttingDown()) { DrainQue(); message_queue_.wait(); diff --git a/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc b/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc index 86c3a322eb..b9cdf55482 100644 --- a/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc +++ b/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc @@ -43,7 +43,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOG_VARIABLE("MediaManager") const static size_t BUFSIZE = 32; @@ -85,8 +85,8 @@ A2DPSourcePlayerAdapter::~A2DPSourcePlayerAdapter() { } void A2DPSourcePlayerAdapter::StartActivity(int32_t application_key) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "Starting a2dp playing music for " << application_key << " application."); if (application_key != current_application_) { current_application_ = application_key; @@ -110,9 +110,8 @@ void A2DPSourcePlayerAdapter::StartActivity(int32_t application_key) { } void A2DPSourcePlayerAdapter::StopActivity(int32_t application_key) { - LOG4CXX_INFO( - logger_, - "Stopping 2dp playing for " << application_key << " application."); + SDL_LOG_INFO("Stopping 2dp playing for " << application_key + << " application."); if (application_key != current_application_) { return; } @@ -142,7 +141,7 @@ A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::A2DPSourcePlayerThread( : threads::ThreadDelegate(), device_(device) {} void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::freeStreams() { - LOG4CXX_INFO(logger_, "Free streams in A2DPSourcePlayerThread."); + SDL_LOG_INFO("Free streams in A2DPSourcePlayerThread."); if (s_in) { pa_simple_free(s_in); } @@ -158,7 +157,7 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::exitThreadMain() { } void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() { - LOG4CXX_INFO(logger_, "Main thread of A2DPSourcePlayerThread."); + SDL_LOG_INFO("Main thread of A2DPSourcePlayerThread."); { sync_primitives::AutoLock auto_lock(should_be_stopped_lock_); @@ -169,9 +168,9 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() { const char* a2dpSource = device_.c_str(); - LOG4CXX_DEBUG(logger_, device_); + SDL_LOG_DEBUG(device_); - LOG4CXX_DEBUG(logger_, "Creating streams"); + SDL_LOG_DEBUG("Creating streams"); /* Create a new playback stream */ if (!(s_out = pa_simple_new(NULL, @@ -183,7 +182,7 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() { NULL, NULL, &error))) { - LOG4CXX_ERROR(logger_, "pa_simple_new() failed: " << pa_strerror(error)); + SDL_LOG_ERROR("pa_simple_new() failed: " << pa_strerror(error)); freeStreams(); return; } @@ -197,12 +196,12 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() { NULL, NULL, &error))) { - LOG4CXX_ERROR(logger_, "pa_simple_new() failed: " << pa_strerror(error)); + SDL_LOG_ERROR("pa_simple_new() failed: " << pa_strerror(error)); freeStreams(); return; } - LOG4CXX_DEBUG(logger_, "Entering main loop"); + SDL_LOG_DEBUG("Entering main loop"); for (;;) { uint8_t buf[BUFSIZE]; @@ -210,30 +209,27 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() { pa_usec_t latency; if ((latency = pa_simple_get_latency(s_in, &error)) == (pa_usec_t)-1) { - LOG4CXX_ERROR(logger_, - "pa_simple_get_latency() failed: " << pa_strerror(error)); + SDL_LOG_ERROR("pa_simple_get_latency() failed: " << pa_strerror(error)); break; } - // LOG4CXX_INFO(logger_, "In: " << static_cast<float>(latency)); + // SDL_LOG_INFO( "In: " << static_cast<float>(latency)); if ((latency = pa_simple_get_latency(s_out, &error)) == (pa_usec_t)-1) { - LOG4CXX_ERROR(logger_, - "pa_simple_get_latency() failed: " << pa_strerror(error)); + SDL_LOG_ERROR("pa_simple_get_latency() failed: " << pa_strerror(error)); break; } - // LOG4CXX_INFO(logger_, "Out: " << static_cast<float>(latency)); + // SDL_LOG_INFO( "Out: " << static_cast<float>(latency)); if (pa_simple_read(s_in, buf, sizeof(buf), &error) < 0) { - LOG4CXX_ERROR(logger_, "read() failed: " << strerror(error)); + SDL_LOG_ERROR("read() failed: " << strerror(error)); break; } /* ... and play it */ if (pa_simple_write(s_out, buf, sizeof(buf), &error) < 0) { - LOG4CXX_ERROR(logger_, - "pa_simple_write() failed: " << pa_strerror(error)); + SDL_LOG_ERROR("pa_simple_write() failed: " << pa_strerror(error)); break; } @@ -251,7 +247,7 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() { /* Make sure that every single sample was played */ if (pa_simple_drain(s_out, &error) < 0) { - LOG4CXX_ERROR(logger_, "pa_simple_drain() failed: " << pa_strerror(error)); + SDL_LOG_ERROR("pa_simple_drain() failed: " << pa_strerror(error)); freeStreams(); return; } diff --git a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc index 078841f2a4..ea35d61554 100644 --- a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc +++ b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc @@ -70,7 +70,7 @@ const uint32_t kMqueueMessageSize = 4095; // the files. static const uint32_t kRIFFHeaderSize = 44; -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOG_VARIABLE("MediaManager") AudioStreamSenderThread::AudioStreamSenderThread( const std::string& fileName, @@ -83,13 +83,13 @@ AudioStreamSenderThread::AudioStreamSenderThread( , shouldBeStoped_lock_() , shouldBeStoped_cv_() , application_manager_(app_mngr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } AudioStreamSenderThread::~AudioStreamSenderThread() {} void AudioStreamSenderThread::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); offset_ = kRIFFHeaderSize; @@ -101,30 +101,30 @@ void AudioStreamSenderThread::threadMain() { } void AudioStreamSenderThread::sendAudioChunkToMobile() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<uint8_t> binaryData; std::vector<uint8_t>::iterator from; std::vector<uint8_t>::iterator to; if (!file_system::ReadBinaryFile(fileName_, binaryData)) { - LOG4CXX_ERROR(logger_, "Unable to read file." << fileName_); + SDL_LOG_ERROR("Unable to read file." << fileName_); return; } if (binaryData.empty()) { - LOG4CXX_ERROR(logger_, "Binary data is empty."); + SDL_LOG_ERROR("Binary data is empty."); return; } - LOG4CXX_INFO(logger_, "offset = " << offset_); + SDL_LOG_INFO("offset = " << offset_); from = binaryData.begin() + offset_; to = binaryData.end(); if (from < binaryData.end() /*from != binaryData.end()*/) { - LOG4CXX_INFO(logger_, "from != binaryData.end()"); + SDL_LOG_INFO("from != binaryData.end()"); offset_ = offset_ + to - from; std::vector<uint8_t> data(from, to); @@ -140,12 +140,12 @@ void AudioStreamSenderThread::sendAudioChunkToMobile() { void AudioStreamSenderThread::SendAudioPassThroughNotification( uint32_t session_key, std::vector<uint8_t>& binary_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!application_manager_.is_audio_pass_thru_active()) { - LOG4CXX_ERROR(logger_, - "Trying to send PassThroughNotification" - " when PassThrough is not active"); + SDL_LOG_ERROR( + "Trying to send PassThroughNotification" + " when PassThrough is not active"); return; } @@ -157,11 +157,11 @@ void AudioStreamSenderThread::SendAudioPassThroughNotification( std::make_shared<smart_objects::SmartObject>(); if (!on_audio_pass) { - LOG4CXX_ERROR(logger_, "OnAudioPassThru NULL pointer"); + SDL_LOG_ERROR("OnAudioPassThru NULL pointer"); return; } - LOG4CXX_DEBUG(logger_, "Fill smart object"); + SDL_LOG_DEBUG("Fill smart object"); (*on_audio_pass)[strings::params][strings::message_type] = application_manager::MessageType::kNotification; @@ -171,13 +171,13 @@ void AudioStreamSenderThread::SendAudioPassThroughNotification( (*on_audio_pass)[strings::params][strings::function_id] = mobile_apis::FunctionID::OnAudioPassThruID; - LOG4CXX_DEBUG(logger_, "Fill binary data"); + SDL_LOG_DEBUG("Fill binary data"); // binary data (*on_audio_pass)[strings::params][strings::binary_data] = smart_objects::SmartObject(data.binary_data); - LOG4CXX_DEBUG(logger_, "After fill binary data"); - LOG4CXX_DEBUG(logger_, "Send data"); + SDL_LOG_DEBUG("After fill binary data"); + SDL_LOG_DEBUG("Send data"); application_manager_.GetRPCService().ManageMobileCommand( on_audio_pass, application_manager::commands::Command::SOURCE_SDL); } @@ -195,7 +195,7 @@ void AudioStreamSenderThread::setShouldBeStopped(bool should_stop) { } void AudioStreamSenderThread::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); setShouldBeStopped(true); } diff --git a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc index 326bc33719..68018028ae 100644 --- a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc +++ b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc @@ -39,7 +39,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOG_VARIABLE("MediaManager") FromMicRecorderAdapter::FromMicRecorderAdapter() : recorder_thread_(NULL) @@ -51,7 +51,7 @@ FromMicRecorderAdapter::FromMicRecorderAdapter() , duration_(kDefaultDuration) {} FromMicRecorderAdapter::~FromMicRecorderAdapter() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (recorder_thread_) { recorder_thread_->Stop(threads::Thread::kThreadSoftStop); delete recorder_thread_->GetDelegate(); @@ -60,10 +60,9 @@ FromMicRecorderAdapter::~FromMicRecorderAdapter() { } void FromMicRecorderAdapter::StartActivity(int32_t application_key) { - LOG4CXX_DEBUG(logger_, "Start with app " << application_key); + SDL_LOG_DEBUG("Start with app " << application_key); if (application_key == current_application_) { - LOG4CXX_WARN(logger_, - "Running recording from mic for " << current_application_); + SDL_LOG_WARN("Running recording from mic for " << current_application_); return; } @@ -85,11 +84,9 @@ void FromMicRecorderAdapter::StartActivity(int32_t application_key) { } void FromMicRecorderAdapter::StopActivity(int32_t application_key) { - LOG4CXX_INFO(logger_, - "FromMicRecorderAdapter::StopActivity " << application_key); + SDL_LOG_INFO("FromMicRecorderAdapter::StopActivity " << application_key); if (application_key != current_application_) { - LOG4CXX_WARN(logger_, - "Running activity on other app key " << current_application_); + SDL_LOG_WARN("Running activity on other app key " << current_application_); return; } diff --git a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc index a59b3a43f4..377834b05f 100644 --- a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc +++ b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc @@ -37,7 +37,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOG_VARIABLE("MediaManager") FromMicRecorderListener::FromMicRecorderListener( const std::string& file_name, @@ -48,7 +48,7 @@ FromMicRecorderListener::FromMicRecorderListener( , application_manager_(app_mngr) {} FromMicRecorderListener::~FromMicRecorderListener() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (reader_) { reader_->Stop(threads::Thread::kThreadSoftStop); delete reader_->GetDelegate(); @@ -63,9 +63,8 @@ void FromMicRecorderListener::OnErrorReceived(int32_t application_key, const DataForListener& data) {} void FromMicRecorderListener::OnActivityStarted(int32_t application_key) { - LOG4CXX_INFO( - logger_, - "FromMicRecorderListener::OnActivityStarted " << application_key); + SDL_LOG_INFO("FromMicRecorderListener::OnActivityStarted " + << application_key); if (application_key == current_application_) { return; } @@ -81,11 +80,9 @@ void FromMicRecorderListener::OnActivityStarted(int32_t application_key) { } void FromMicRecorderListener::OnActivityEnded(int32_t application_key) { - LOG4CXX_INFO(logger_, - "FromMicRecorderListener::OnActivityEnded " << application_key); + SDL_LOG_INFO("FromMicRecorderListener::OnActivityEnded " << application_key); if (application_key != current_application_) { - LOG4CXX_WARN(logger_, - "Not performing activity on " << application_key << " but on " + SDL_LOG_WARN("Not performing activity on " << application_key << " but on " << current_application_); return; } diff --git a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc index 5599743bd3..d2634214fa 100644 --- a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc +++ b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc @@ -39,7 +39,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOG_VARIABLE("MediaManager") GMainLoop* FromMicToFileRecorderThread::loop = NULL; @@ -61,13 +61,13 @@ FromMicToFileRecorderThread::FromMicToFileRecorderThread( , outputFileName_(output_file) , samplingRate_(sampling_rate) , bitsPerSample_(bits_per_sample) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); set_record_duration(duration); // audio_type is not used as we always employ LPCM } FromMicToFileRecorderThread::~FromMicToFileRecorderThread() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (sleepThread_) { sleepThread_->Stop(threads::Thread::kThreadSoftStop); delete sleepThread_->GetDelegate(); @@ -77,12 +77,12 @@ FromMicToFileRecorderThread::~FromMicToFileRecorderThread() { void FromMicToFileRecorderThread::set_output_file( const std::string& output_file) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); outputFileName_ = output_file; } void FromMicToFileRecorderThread::set_record_duration(int32_t duration) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::stringstream stringStream; stringStream << duration / 1000; @@ -90,7 +90,7 @@ void FromMicToFileRecorderThread::set_record_duration(int32_t duration) { } void FromMicToFileRecorderThread::initArgs() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); argv_ = new gchar*[argc_]; @@ -108,7 +108,7 @@ void FromMicToFileRecorderThread::initArgs() { } void FromMicToFileRecorderThread::deinitArgs() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (argv_) { for (int32_t i = 0; i < argc_; i++) { @@ -120,7 +120,7 @@ void FromMicToFileRecorderThread::deinitArgs() { } void FromMicToFileRecorderThread::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock auto_lock(stopFlagLock_); @@ -186,9 +186,9 @@ void FromMicToFileRecorderThread::threadMain() { g_error("Must supply destination (-d FILE)\n"); } - LOG4CXX_TRACE(logger_, "Reading from device: " << device); - LOG4CXX_TRACE(logger_, "Saving pipeline output to: " << outfile); - LOG4CXX_TRACE(logger_, "Duration set to: " << duration); + SDL_LOG_TRACE("Reading from device: " << device); + SDL_LOG_TRACE("Saving pipeline output to: " << outfile); + SDL_LOG_TRACE("Duration set to: " << duration); // Initialize gstreamer and setup the main loop information gst_init(&argc, &argv); @@ -216,7 +216,7 @@ void FromMicToFileRecorderThread::threadMain() { // Create a capability to specify audio format. It also downmixes the recorded // audio to monaural. std::string caps_string = create_caps_string(); - LOG4CXX_DEBUG(logger_, "Using audio caps: " << caps_string); + SDL_LOG_DEBUG("Using audio caps: " << caps_string); audiocaps = gst_caps_from_string(caps_string.c_str()); // Assert that all the elements were created @@ -248,7 +248,7 @@ void FromMicToFileRecorderThread::threadMain() { gst_element_set_state(pipeline, GST_STATE_PLAYING); - LOG4CXX_TRACE(logger_, "Initializing pipeline ..."); + SDL_LOG_TRACE("Initializing pipeline ..."); while (GST_STATE(pipeline) != GST_STATE_PLAYING) { bool shouldBeStoped; { @@ -266,7 +266,7 @@ void FromMicToFileRecorderThread::threadMain() { return; } } - LOG4CXX_TRACE(logger_, "Pipeline started ...\n"); + SDL_LOG_TRACE("Pipeline started ...\n"); // Start up a timer for the pipeline if (duration > 0) { @@ -285,7 +285,7 @@ void FromMicToFileRecorderThread::threadMain() { gst_element_set_state(pipeline, GST_STATE_NULL); - LOG4CXX_TRACE(logger_, "Deleting pipeline\n"); + SDL_LOG_TRACE("Deleting pipeline\n"); gst_object_unref(GST_OBJECT(pipeline)); g_main_loop_unref(loop); g_option_context_free(context); @@ -296,7 +296,7 @@ void FromMicToFileRecorderThread::threadMain() { } std::string FromMicToFileRecorderThread::create_caps_string() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::stringstream ss; ss << "audio/x-raw"; @@ -343,7 +343,7 @@ FromMicToFileRecorderThread::SleepThreadDelegate::SleepThreadDelegate( : threads::ThreadDelegate(), timeout_(timeout) {} void FromMicToFileRecorderThread::SleepThreadDelegate::threadMain() { - LOG4CXX_TRACE(logger_, "Sleep for " << timeout_.duration << " seconds"); + SDL_LOG_TRACE("Sleep for " << timeout_.duration << " seconds"); sleep(timeout_.duration); @@ -355,21 +355,21 @@ void FromMicToFileRecorderThread::SleepThreadDelegate::threadMain() { } void FromMicToFileRecorderThread::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (NULL != loop) { if (g_main_loop_is_running(loop)) { - LOG4CXX_TRACE(logger_, "Quit loop\n"); + SDL_LOG_TRACE("Quit loop\n"); g_main_loop_quit(loop); } } if (sleepThread_) { - LOG4CXX_DEBUG(logger_, "Stop sleep thread\n"); + SDL_LOG_DEBUG("Stop sleep thread\n"); sleepThread_->stop(); } - LOG4CXX_TRACE(logger_, "Set should be stopped flag\n"); + SDL_LOG_TRACE("Set should be stopped flag\n"); sync_primitives::AutoLock auto_lock(stopFlagLock_); shouldBeStoped_ = true; } diff --git a/src/components/media_manager/src/file_streamer_adapter.cc b/src/components/media_manager/src/file_streamer_adapter.cc index 7761e13601..301b093829 100644 --- a/src/components/media_manager/src/file_streamer_adapter.cc +++ b/src/components/media_manager/src/file_streamer_adapter.cc @@ -36,7 +36,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "FileStreamerAdapter") +SDL_CREATE_LOG_VARIABLE("FileStreamerAdapter") FileStreamerAdapter::FileStreamerAdapter(const std::string& file_name, const std::string& app_storage_folder) @@ -56,24 +56,24 @@ FileStreamerAdapter::FileStreamer::FileStreamer( FileStreamerAdapter::FileStreamer::~FileStreamer() {} bool FileStreamerAdapter::FileStreamer::Connect() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!file_system::CreateDirectoryRecursively(app_storage_folder_)) { - LOG4CXX_ERROR(logger_, "Cannot create app folder"); + SDL_LOG_ERROR("Cannot create app folder"); return false; } file_stream_ = file_system::Open(file_name_); if (!file_stream_) { - LOG4CXX_ERROR(logger_, "Cannot open file stream " << file_name_); + SDL_LOG_ERROR("Cannot open file stream " << file_name_); return false; } - LOG4CXX_INFO(logger_, "File " << file_name_ << " was successfuly opened"); + SDL_LOG_INFO("File " << file_name_ << " was successfuly opened"); return true; } void FileStreamerAdapter::FileStreamer::Disconnect() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (file_stream_) { file_system::Close(file_stream_); delete file_stream_; @@ -84,18 +84,18 @@ void FileStreamerAdapter::FileStreamer::Disconnect() { bool FileStreamerAdapter::FileStreamer::Send( protocol_handler::RawMessagePtr msg) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!file_stream_) { - LOG4CXX_ERROR(logger_, "File stream not found " << file_name_); + SDL_LOG_ERROR("File stream not found " << file_name_); return false; } if (!file_system::Write(file_stream_, msg->data(), msg->data_size())) { - LOG4CXX_ERROR(logger_, "Failed writing data to file " << file_name_); + SDL_LOG_ERROR("Failed writing data to file " << file_name_); return false; } - LOG4CXX_INFO(logger_, "Streamer::sent " << msg->data_size()); + SDL_LOG_INFO("Streamer::sent " << msg->data_size()); return true; } diff --git a/src/components/media_manager/src/media_adapter_impl.cc b/src/components/media_manager/src/media_adapter_impl.cc index cf15a7af97..119a08d88b 100644 --- a/src/components/media_manager/src/media_adapter_impl.cc +++ b/src/components/media_manager/src/media_adapter_impl.cc @@ -35,7 +35,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOG_VARIABLE("MediaManager") MediaAdapterImpl::MediaAdapterImpl() : current_application_(0) {} @@ -44,12 +44,12 @@ MediaAdapterImpl::~MediaAdapterImpl() { } void MediaAdapterImpl::AddListener(const MediaListenerPtr& listener) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); media_listeners_.insert(listener); } void MediaAdapterImpl::RemoveListener(const MediaListenerPtr& listener) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); media_listeners_.erase(listener); } diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc index d7352d0025..ce80cc3c50 100644 --- a/src/components/media_manager/src/media_manager_impl.cc +++ b/src/components/media_manager/src/media_manager_impl.cc @@ -57,7 +57,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOG_VARIABLE("MediaManager") MediaManagerImpl::MediaManagerImpl( application_manager::ApplicationManager& application_manager, @@ -117,10 +117,10 @@ void MediaManagerImpl::set_mock_streamer_listener( void MediaManagerImpl::Init() { using namespace protocol_handler; - LOG4CXX_INFO(logger_, "MediaManagerImpl::Init()"); + SDL_LOG_INFO("MediaManagerImpl::Init()"); #if defined(EXTENDED_MEDIA_MODE) - LOG4CXX_INFO(logger_, "Called Init with default configuration."); + SDL_LOG_INFO("Called Init with default configuration."); from_mic_recorder_ = new FromMicRecorderAdapter(); #endif @@ -185,7 +185,7 @@ void MediaManagerImpl::Init() { } void MediaManagerImpl::PlayA2DPSource(int32_t application_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #if defined(EXTENDED_MEDIA_MODE) if (!a2dp_player_ && protocol_handler_) { @@ -200,7 +200,7 @@ void MediaManagerImpl::PlayA2DPSource(int32_t application_key) { } void MediaManagerImpl::StopA2DPSource(int32_t application_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (a2dp_player_) { a2dp_player_->StopActivity(application_key); } @@ -224,8 +224,7 @@ void MediaManagerImpl::StartMicrophoneRecording( mobile_apis::SamplingRate::eType sampling_rate, mobile_apis::BitsPerSample::eType bits_per_sample, mobile_apis::AudioType::eType audio_type) { - LOG4CXX_INFO(logger_, - "MediaManagerImpl::StartMicrophoneRecording to " << output_file); + SDL_LOG_INFO("MediaManagerImpl::StartMicrophoneRecording to " << output_file); application_manager::ApplicationSharedPtr app = application_manager_.application(application_key); std::string file_path = settings().app_storage_folder(); @@ -244,11 +243,11 @@ void MediaManagerImpl::StartMicrophoneRecording( } #else if (file_system::FileExists(file_path)) { - LOG4CXX_INFO(logger_, "File " << output_file << " exists, removing"); + SDL_LOG_INFO("File " << output_file << " exists, removing"); if (file_system::DeleteFile(file_path)) { - LOG4CXX_INFO(logger_, "File " << output_file << " removed"); + SDL_LOG_INFO("File " << output_file << " removed"); } else { - LOG4CXX_WARN(logger_, "Could not remove file " << output_file); + SDL_LOG_WARN("Could not remove file " << output_file); } } const std::string record_file_source = settings().app_resource_folder() + @@ -257,21 +256,20 @@ void MediaManagerImpl::StartMicrophoneRecording( std::vector<uint8_t> buf; if (file_system::ReadBinaryFile(record_file_source, buf)) { if (file_system::Write(file_path, buf)) { - LOG4CXX_INFO( - logger_, - "File " << record_file_source << " copied to " << output_file); + SDL_LOG_INFO("File " << record_file_source << " copied to " + << output_file); } else { - LOG4CXX_WARN(logger_, "Could not write to file " << output_file); + SDL_LOG_WARN("Could not write to file " << output_file); } } else { - LOG4CXX_WARN(logger_, "Could not read file " << record_file_source); + SDL_LOG_WARN("Could not read file " << record_file_source); } #endif from_mic_listener_->OnActivityStarted(application_key); } void MediaManagerImpl::StopMicrophoneRecording(int32_t application_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #if defined(EXTENDED_MEDIA_MODE) if (from_mic_recorder_) { from_mic_recorder_->StopActivity(application_key); @@ -289,7 +287,7 @@ void MediaManagerImpl::StopMicrophoneRecording(int32_t application_key) { void MediaManagerImpl::StartStreaming( int32_t application_key, protocol_handler::ServiceType service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (streamer_[service_type]) { streamer_[service_type]->StartActivity(application_key); @@ -298,7 +296,7 @@ void MediaManagerImpl::StartStreaming( void MediaManagerImpl::StopStreaming( int32_t application_key, protocol_handler::ServiceType service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); stream_data_size_ = 0ull; @@ -317,23 +315,23 @@ void MediaManagerImpl::OnMessageReceived( using namespace protocol_handler; using namespace application_manager; using namespace helpers; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint32_t streaming_app_id = message->connection_key(); const ServiceType service_type = message->service_type(); if (Compare<ServiceType, NEQ, ALL>( service_type, ServiceType::kMobileNav, ServiceType::kAudio)) { - LOG4CXX_DEBUG(logger_, "Unsupported service type in MediaManager"); + SDL_LOG_DEBUG("Unsupported service type in MediaManager"); return; } if (!application_manager_.CanAppStream(streaming_app_id, service_type)) { application_manager_.ForbidStreaming(streaming_app_id, service_type); - LOG4CXX_ERROR(logger_, - "The application is trying to stream when it should not." - " service type: " - << service_type); + SDL_LOG_ERROR( + "The application is trying to stream when it should not." + " service type: " + << service_type); return; } @@ -383,8 +381,7 @@ void MediaManagerImpl::FramesProcessed(int32_t application_key, if (audio_stream.use_count() != 0 && "pipe" == settings().audio_server_type()) { size_t audio_queue_size = audio_stream->GetMsgQueueSize(); - LOG4CXX_DEBUG(logger_, - "# Messages in audio queue = " << audio_queue_size); + SDL_LOG_DEBUG("# Messages in audio queue = " << audio_queue_size); if (audio_queue_size > 0) { app->WakeUpStreaming(protocol_handler::ServiceType::kAudio); } @@ -393,8 +390,7 @@ void MediaManagerImpl::FramesProcessed(int32_t application_key, if (video_stream.use_count() != 0 && "pipe" == settings().video_server_type()) { size_t video_queue_size = video_stream->GetMsgQueueSize(); - LOG4CXX_DEBUG(logger_, - "# Messages in video queue = " << video_queue_size); + SDL_LOG_DEBUG("# Messages in video queue = " << video_queue_size); if (video_queue_size > 0) { app->WakeUpStreaming(protocol_handler::ServiceType::kMobileNav); } diff --git a/src/components/media_manager/src/pipe_streamer_adapter.cc b/src/components/media_manager/src/pipe_streamer_adapter.cc index bda106721f..0759813c04 100644 --- a/src/components/media_manager/src/pipe_streamer_adapter.cc +++ b/src/components/media_manager/src/pipe_streamer_adapter.cc @@ -40,7 +40,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "PipeStreamerAdapter") +SDL_CREATE_LOG_VARIABLE("PipeStreamerAdapter") PipeStreamerAdapter::PipeStreamerAdapter(const std::string& named_pipe_path, const std::string& app_storage_folder) @@ -58,54 +58,52 @@ PipeStreamerAdapter::PipeStreamer::PipeStreamer( , app_storage_folder_(app_storage_folder) , pipe_fd_(0) { if (!file_system::CreateDirectoryRecursively(app_storage_folder_)) { - LOG4CXX_ERROR(logger_, - "Cannot create app storage folder " << app_storage_folder_); + SDL_LOG_ERROR("Cannot create app storage folder " << app_storage_folder_); return; } if ((mkfifo(named_pipe_path_.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) < 0) && (errno != EEXIST)) { - LOG4CXX_ERROR(logger_, "Cannot create pipe " << named_pipe_path_); + SDL_LOG_ERROR("Cannot create pipe " << named_pipe_path_); } else { - LOG4CXX_INFO(logger_, - "Pipe " << named_pipe_path_ << " was successfully created"); + SDL_LOG_INFO("Pipe " << named_pipe_path_ << " was successfully created"); } } PipeStreamerAdapter::PipeStreamer::~PipeStreamer() { if (0 == unlink(named_pipe_path_.c_str())) { - LOG4CXX_INFO(logger_, "Pipe " << named_pipe_path_ << " was removed"); + SDL_LOG_INFO("Pipe " << named_pipe_path_ << " was removed"); } else { - LOG4CXX_ERROR(logger_, "Error removing pipe " << named_pipe_path_); + SDL_LOG_ERROR("Error removing pipe " << named_pipe_path_); } } bool PipeStreamerAdapter::PipeStreamer::Connect() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); pipe_fd_ = open(named_pipe_path_.c_str(), O_RDWR | O_NONBLOCK, 0); if (-1 == pipe_fd_) { - LOG4CXX_ERROR(logger_, "Cannot open pipe for writing " << named_pipe_path_); + SDL_LOG_ERROR("Cannot open pipe for writing " << named_pipe_path_); return false; } - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "Pipe " << named_pipe_path_ << " was successfuly opened for writing"); return true; } void PipeStreamerAdapter::PipeStreamer::Disconnect() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (0 == close(pipe_fd_)) { - LOG4CXX_INFO(logger_, "Pipe " << named_pipe_path_ << " was closed"); + SDL_LOG_INFO("Pipe " << named_pipe_path_ << " was closed"); } else { - LOG4CXX_ERROR(logger_, "Error closing pipe " << named_pipe_path_); + SDL_LOG_ERROR("Error closing pipe " << named_pipe_path_); } } bool PipeStreamerAdapter::PipeStreamer::Send( protocol_handler::RawMessagePtr msg) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); fd_set wfds; FD_ZERO(&wfds); FD_SET(pipe_fd_, &wfds); @@ -118,41 +116,36 @@ bool PipeStreamerAdapter::PipeStreamer::Send( int select_ret = select(pipe_fd_ + 1, NULL, &wfds, NULL, &tv); // Most likely pipe closed, fail stream if (select_ret == -1) { - LOG4CXX_ERROR(logger_, - "Failed writing data to pipe " - << named_pipe_path_ << ". Errno: " << strerror(errno)); + SDL_LOG_ERROR("Failed writing data to pipe " + << named_pipe_path_ << ". Errno: " << strerror(errno)); return false; // Select success, attempt to write } else if (select_ret) { ssize_t temp_ret = write( pipe_fd_, msg->data() + write_ret, msg->data_size() - write_ret); if (-1 == temp_ret) { - LOG4CXX_ERROR(logger_, - "Failed writing data to pipe " - << named_pipe_path_ - << ". Errno: " << strerror(errno)); + SDL_LOG_ERROR("Failed writing data to pipe " + << named_pipe_path_ << ". Errno: " << strerror(errno)); return false; } write_ret += temp_ret; // Select timed out, fail stream. } else { - LOG4CXX_ERROR(logger_, - "Failed writing data to pipe " << named_pipe_path_ + SDL_LOG_ERROR("Failed writing data to pipe " << named_pipe_path_ << ". Error: TIMEOUT"); return false; } // Check that all data was written to the pipe. data_remaining = static_cast<uint32_t>(write_ret) != msg->data_size(); if (data_remaining) { - LOG4CXX_WARN(logger_, - "Couldn't write all the data to pipe " - << named_pipe_path_ << ". " - << msg->data_size() - write_ret << " bytes remaining"); + SDL_LOG_WARN("Couldn't write all the data to pipe " + << named_pipe_path_ << ". " << msg->data_size() - write_ret + << " bytes remaining"); } // Loop to send remaining data if there is any. } while (data_remaining); - LOG4CXX_INFO(logger_, "Streamer::sent " << msg->data_size()); + SDL_LOG_INFO("Streamer::sent " << msg->data_size()); return true; } diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc index 624e388a0c..2f10a29c7d 100644 --- a/src/components/media_manager/src/socket_streamer_adapter.cc +++ b/src/components/media_manager/src/socket_streamer_adapter.cc @@ -42,7 +42,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger, "SocketStreamerAdapter") +SDL_CREATE_LOG_VARIABLE("SocketStreamerAdapter") SocketStreamerAdapter::SocketStreamerAdapter(const std::string& ip, const uint16_t port, @@ -67,17 +67,17 @@ SocketStreamerAdapter::SocketStreamer::SocketStreamer( SocketStreamerAdapter::SocketStreamer::~SocketStreamer() {} bool SocketStreamerAdapter::SocketStreamer::Connect() { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); socket_fd_ = socket(AF_INET, SOCK_STREAM, 0); if (0 >= socket_fd_) { - LOG4CXX_ERROR(logger, "Unable to create socket"); + SDL_LOG_ERROR("Unable to create socket"); return false; } int32_t optval = 1; if (-1 == setsockopt( socket_fd_, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof optval)) { - LOG4CXX_ERROR(logger, "Unable to set sockopt"); + SDL_LOG_ERROR("Unable to set sockopt"); return false; } @@ -88,23 +88,23 @@ bool SocketStreamerAdapter::SocketStreamer::Connect() { if (-1 == bind(socket_fd_, reinterpret_cast<struct sockaddr*>(&serv_addr_), sizeof(serv_addr_))) { - LOG4CXX_ERROR(logger, "Unable to bind"); + SDL_LOG_ERROR("Unable to bind"); return false; } if (-1 == listen(socket_fd_, 5)) { - LOG4CXX_ERROR(logger, "Unable to listen"); + SDL_LOG_ERROR("Unable to listen"); return false; } send_socket_fd_ = accept(socket_fd_, NULL, NULL); if (0 >= send_socket_fd_) { - LOG4CXX_ERROR(logger, "Unable to accept"); + SDL_LOG_ERROR("Unable to accept"); return false; } is_first_frame_ = true; - LOG4CXX_INFO(logger, "Client connected: " << send_socket_fd_); + SDL_LOG_INFO("Client connected: " << send_socket_fd_); return true; } @@ -113,7 +113,7 @@ void SocketStreamerAdapter::SocketStreamer::Close() { } void SocketStreamerAdapter::SocketStreamer::Disconnect() { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); if (0 < send_socket_fd_) { shutdown(send_socket_fd_, SHUT_RDWR); close(send_socket_fd_); @@ -128,12 +128,12 @@ void SocketStreamerAdapter::SocketStreamer::Disconnect() { bool SocketStreamerAdapter::SocketStreamer::Send( protocol_handler::RawMessagePtr msg) { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); ssize_t ret; if (is_first_frame_) { ret = send(send_socket_fd_, header_.c_str(), header_.size(), MSG_NOSIGNAL); if (static_cast<uint32_t>(ret) != header_.size()) { - LOG4CXX_ERROR(logger, "Unable to send data to socket"); + SDL_LOG_ERROR("Unable to send data to socket"); return false; } is_first_frame_ = false; @@ -141,16 +141,15 @@ bool SocketStreamerAdapter::SocketStreamer::Send( ret = send(send_socket_fd_, msg->data(), msg->data_size(), MSG_NOSIGNAL); if (-1 == ret) { - LOG4CXX_ERROR(logger, "Unable to send data to socket"); + SDL_LOG_ERROR("Unable to send data to socket"); return false; } if (static_cast<uint32_t>(ret) != msg->data_size()) { - LOG4CXX_WARN(logger, - "Couldn't send all the data to socket " << send_socket_fd_); + SDL_LOG_WARN("Couldn't send all the data to socket " << send_socket_fd_); } - LOG4CXX_INFO(logger, "Streamer::sent " << msg->data_size()); + SDL_LOG_INFO("Streamer::sent " << msg->data_size()); return true; } diff --git a/src/components/media_manager/src/streamer_adapter.cc b/src/components/media_manager/src/streamer_adapter.cc index 7447929f15..808b9715af 100644 --- a/src/components/media_manager/src/streamer_adapter.cc +++ b/src/components/media_manager/src/streamer_adapter.cc @@ -35,7 +35,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger, "StreamerAdapter") +SDL_CREATE_LOG_VARIABLE("StreamerAdapter") StreamerAdapter::StreamerAdapter(Streamer* const streamer) : current_application_(0), messages_(), streamer_(streamer), thread_(NULL) { @@ -53,10 +53,9 @@ StreamerAdapter::~StreamerAdapter() { } void StreamerAdapter::StartActivity(int32_t application_key) { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); if (is_app_performing_activity(application_key)) { - LOG4CXX_WARN(logger, - "Activity for application: " << application_key + SDL_LOG_WARN("Activity for application: " << application_key << " has been already started"); return; } @@ -79,10 +78,9 @@ size_t StreamerAdapter::GetMsgQueueSize() { } void StreamerAdapter::StopActivity(int32_t application_key) { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); if (!is_app_performing_activity(application_key)) { - LOG4CXX_WARN(logger, - "Activity for application: " << application_key + SDL_LOG_WARN("Activity for application: " << application_key << " has not been started"); return; } @@ -100,10 +98,9 @@ void StreamerAdapter::StopActivity(int32_t application_key) { void StreamerAdapter::SendData(int32_t application_key, const ::protocol_handler::RawMessagePtr msg) { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); if (!is_app_performing_activity(application_key)) { - LOG4CXX_ERROR(logger, - "Activity for application: " << application_key + SDL_LOG_ERROR("Activity for application: " << application_key << " has not been started"); return; } @@ -123,13 +120,13 @@ StreamerAdapter::Streamer::Streamer(StreamerAdapter* const adapter) StreamerAdapter::Streamer::~Streamer() {} void StreamerAdapter::Streamer::threadMain() { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); if (!adapter_) { - LOG4CXX_ERROR(logger, "Null pointer to adapter"); + SDL_LOG_ERROR("Null pointer to adapter"); return; } if (!Connect()) { - LOG4CXX_ERROR(logger, "Unable to connect"); + SDL_LOG_ERROR("Unable to connect"); return; } stop_flag_ = false; @@ -138,25 +135,24 @@ void StreamerAdapter::Streamer::threadMain() { while (!adapter_->messages_.empty()) { protocol_handler::RawMessagePtr msg; if (!adapter_->messages_.pop(msg)) { - LOG4CXX_ERROR(logger, "Empty message queue"); + SDL_LOG_ERROR("Empty message queue"); continue; } if (!msg) { - LOG4CXX_ERROR(logger, "Null pointer message"); + SDL_LOG_ERROR("Null pointer message"); continue; } if (!Send(msg)) { - LOG4CXX_ERROR(logger, "Unable to send. Disconnecting"); + SDL_LOG_ERROR("Unable to send. Disconnecting"); Disconnect(); return; } static int32_t messages_for_session = 0; ++messages_for_session; - LOG4CXX_DEBUG(logger, - "Handling map streaming message. This is " - << messages_for_session << " message for " - << adapter_->current_application_); + SDL_LOG_DEBUG("Handling map streaming message. This is " + << messages_for_session << " message for " + << adapter_->current_application_); std::set<MediaListenerPtr>::iterator it = adapter_->media_listeners_.begin(); for (; adapter_->media_listeners_.end() != it; ++it) { @@ -169,7 +165,7 @@ void StreamerAdapter::Streamer::threadMain() { } void StreamerAdapter::Streamer::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); stop_flag_ = true; if (adapter_) { adapter_->messages_.Shutdown(); diff --git a/src/components/media_manager/src/streamer_listener.cc b/src/components/media_manager/src/streamer_listener.cc index 2d6c3bc984..13f6162e76 100644 --- a/src/components/media_manager/src/streamer_listener.cc +++ b/src/components/media_manager/src/streamer_listener.cc @@ -36,7 +36,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") +SDL_CREATE_LOG_VARIABLE("MediaManager") StreamerListener::StreamerListener(MediaManager& media_manager) : current_application_(0), media_manager_(media_manager) {} @@ -52,24 +52,22 @@ void StreamerListener::OnDataReceived(int32_t application_key, void StreamerListener::OnErrorReceived(int32_t application_key, const DataForListener& data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void StreamerListener::OnActivityStarted(int32_t application_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (current_application_ == application_key) { - LOG4CXX_WARN(logger_, - "Already performing activity for " << application_key); + SDL_LOG_WARN("Already performing activity for " << application_key); return; } current_application_ = application_key; } void StreamerListener::OnActivityEnded(int32_t application_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (current_application_ != application_key) { - LOG4CXX_WARN(logger_, - "Already not performing activity for " << application_key); + SDL_LOG_WARN("Already not performing activity for " << application_key); return; } current_application_ = 0; diff --git a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc index dd5738b2a2..83bcb8662c 100644 --- a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc +++ b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc @@ -37,7 +37,7 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger, "VideoStreamToFileAdapter") +SDL_CREATE_LOG_VARIABLE("VideoStreamToFileAdapter") VideoStreamToFileAdapter::VideoStreamToFileAdapter(const std::string& file_name) : file_name_(file_name) @@ -47,7 +47,7 @@ VideoStreamToFileAdapter::VideoStreamToFileAdapter(const std::string& file_name) } VideoStreamToFileAdapter::~VideoStreamToFileAdapter() { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); if ((0 != current_application_) && (is_ready_)) { StopActivity(current_application_); } @@ -58,21 +58,20 @@ VideoStreamToFileAdapter::~VideoStreamToFileAdapter() { void VideoStreamToFileAdapter::Init() { if (thread_->IsRunning()) { - LOG4CXX_DEBUG(logger, "Start sending thread"); + SDL_LOG_DEBUG("Start sending thread"); const size_t kStackSize = 16384; thread_->Start(threads::ThreadOptions(kStackSize)); } else { - LOG4CXX_WARN(logger, "thread is already running"); + SDL_LOG_WARN("thread is already running"); } } void VideoStreamToFileAdapter::SendData( int32_t application_key, const ::protocol_handler::RawMessagePtr message) { - LOG4CXX_INFO(logger, - "VideoStreamToFileAdapter::SendData " << application_key); + SDL_LOG_INFO("VideoStreamToFileAdapter::SendData " << application_key); if (application_key != current_application_) { - LOG4CXX_WARN(logger, "Wrong application " << application_key); + SDL_LOG_WARN("Wrong application " << application_key); return; } @@ -82,11 +81,10 @@ void VideoStreamToFileAdapter::SendData( } void VideoStreamToFileAdapter::StartActivity(int32_t application_key) { - LOG4CXX_INFO(logger, - "VideoStreamToFileAdapter::StartActivity " << application_key); + SDL_LOG_INFO("VideoStreamToFileAdapter::StartActivity " << application_key); if (application_key == current_application_) { - LOG4CXX_WARN( - logger, "Already running video stream to file for " << application_key); + SDL_LOG_WARN("Already running video stream to file for " + << application_key); return; } @@ -101,11 +99,10 @@ void VideoStreamToFileAdapter::StartActivity(int32_t application_key) { } void VideoStreamToFileAdapter::StopActivity(int32_t application_key) { - LOG4CXX_INFO(logger, - "VideoStreamToFileAdapter::StopActivity " << application_key); + SDL_LOG_INFO("VideoStreamToFileAdapter::StopActivity " << application_key); if (application_key != current_application_) { - LOG4CXX_WARN( - logger, "Performing activity for another key " << current_application_); + SDL_LOG_WARN("Performing activity for another key " + << current_application_); return; } @@ -133,7 +130,7 @@ VideoStreamToFileAdapter::Streamer::~Streamer() { } void VideoStreamToFileAdapter::Streamer::threadMain() { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); open(); @@ -141,7 +138,7 @@ void VideoStreamToFileAdapter::Streamer::threadMain() { while (!server_->messages_.empty()) { ::protocol_handler::RawMessagePtr msg = server_->messages_.pop(); if (!msg) { - LOG4CXX_ERROR(logger, "Null pointer message"); + SDL_LOG_ERROR("Null pointer message"); continue; } @@ -157,7 +154,7 @@ void VideoStreamToFileAdapter::Streamer::threadMain() { messsages_for_session); } } else { - LOG4CXX_WARN(logger, "Can't open File stream! " << server_->file_name_); + SDL_LOG_WARN("Can't open File stream! " << server_->file_name_); } } server_->messages_.wait(); @@ -167,22 +164,22 @@ void VideoStreamToFileAdapter::Streamer::threadMain() { } void VideoStreamToFileAdapter::Streamer::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger); + SDL_LOG_AUTO_TRACE(); stop_flag_ = true; server_->messages_.Shutdown(); } void VideoStreamToFileAdapter::Streamer::open() { - LOG4CXX_INFO(logger, "Streamer::open()" << server_->file_name_.c_str()); + SDL_LOG_INFO("Streamer::open()" << server_->file_name_.c_str()); DCHECK(file_system::CreateDirectoryRecursively( profile::Profile::instance()->app_storage_folder())); file_stream_ = file_system::Open(server_->file_name_); if (!file_stream_) { - LOG4CXX_WARN(logger, "Can't open file stream! " << server_->file_name_); + SDL_LOG_WARN("Can't open file stream! " << server_->file_name_); } else { - LOG4CXX_INFO(logger, "file_stream_ opened :" << file_stream_); + SDL_LOG_INFO("file_stream_ opened :" << file_stream_); } } diff --git a/src/components/policy/policy_external/src/access_remote_impl.cc b/src/components/policy/policy_external/src/access_remote_impl.cc index 26c8c5e38e..037f4551f1 100644 --- a/src/components/policy/policy_external/src/access_remote_impl.cc +++ b/src/components/policy/policy_external/src/access_remote_impl.cc @@ -36,7 +36,7 @@ #include "policy/cache_manager.h" #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl") +SDL_CREATE_LOG_VARIABLE("PolicyManagerImpl") using policy_table::DeviceData; using policy_table::FunctionalGroupings; @@ -48,11 +48,10 @@ struct ToHMIType { policy_table::AppHMITypes::value_type operator()(int item) const { policy_table::AppHMIType type = static_cast<policy_table::AppHMIType>(item); if (!IsValidEnum(type)) { - LOG4CXX_WARN(logger_, "HMI type isn't known " << item); + SDL_LOG_WARN("HMI type isn't known " << item); type = policy_table::AHT_DEFAULT; } - LOG4CXX_DEBUG(logger_, - "HMI type: " << item << " - " << EnumToJsonString(type)); + SDL_LOG_DEBUG("HMI type: " << item << " - " << EnumToJsonString(type)); return policy_table::AppHMITypes::value_type(type); } }; @@ -94,7 +93,7 @@ AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache) bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, policy_table::ModuleType module) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!cache_->IsApplicationRepresented(app_id)) { return false; } @@ -117,10 +116,10 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules, const std::string& module_name, const std::string& rpc_name, RemoteControlParams* input) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::AccessModules::const_iterator i = modules.find(module_name); if (i == modules.end()) { - LOG4CXX_DEBUG(logger_, "Module " << module_name << " wasn't found"); + SDL_LOG_DEBUG("Module " << module_name << " wasn't found"); return false; } @@ -133,19 +132,19 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules, const policy_table::Strings& parameters = j->second; return CompareParameters(parameters, input); } - LOG4CXX_DEBUG(logger_, "RPC " << rpc_name << " wasn't found"); + SDL_LOG_DEBUG("RPC " << rpc_name << " wasn't found"); return false; } bool AccessRemoteImpl::CompareParameters( const policy_table::Strings& parameters, RemoteControlParams* input) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (parameters.empty()) { return true; } if (input->empty()) { - LOG4CXX_DEBUG(logger_, "Input is empty"); + SDL_LOG_DEBUG("Input is empty"); return false; } @@ -157,7 +156,7 @@ bool AccessRemoteImpl::CompareParameters( void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, const std::vector<int>& hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); HMIList::mapped_type types; std::transform(hmi_types.begin(), hmi_types.end(), @@ -168,7 +167,7 @@ void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( const ApplicationOnDevice& who) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cache_->IsDefaultPolicy(who.app_id)) { return hmi_types_[who]; } else { @@ -179,7 +178,7 @@ const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( const policy_table::Strings& AccessRemoteImpl::GetGroups( const ApplicationOnDevice& who) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetGroups(who.app_id); } @@ -193,7 +192,7 @@ bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) { bool AccessRemoteImpl::GetPermissionsForApp(const std::string& device_id, const std::string& app_id, FunctionalIdType& group_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GetGroupsIds(device_id, app_id, group_types[kTypeGeneral]); GetGroupsIds(device_id, kDefaultId, group_types[kTypeDefault]); GetGroupsIds( @@ -229,13 +228,13 @@ void AccessRemoteImpl::GetGroupsIds(const std::string& device_id, FunctionalGroupIDs& groups_ids) { ApplicationOnDevice who = {device_id, app_id}; const policy_table::Strings& groups = GetGroups(who); - LOG4CXX_DEBUG(logger_, "Groups Names: " << groups); + SDL_LOG_DEBUG("Groups Names: " << groups); groups_ids.resize(groups.size()); std::transform(groups.begin(), groups.end(), groups_ids.begin(), &CacheManager::GenerateHash); - LOG4CXX_DEBUG(logger_, "Groups Ids: " << groups_ids); + SDL_LOG_DEBUG("Groups Ids: " << groups_ids); } bool AccessRemoteImpl::GetModuleTypes(const std::string& application_id, diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 164aa6bdf7..67d8bdb2d1 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -226,22 +226,22 @@ struct DefaultPolicyUpdater { namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") -#define CACHE_MANAGER_CHECK(return_value) \ - { \ - if (!pt_) { \ - LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \ - return return_value; \ - } \ +#define CACHE_MANAGER_CHECK(return_value) \ + { \ + if (!pt_) { \ + SDL_LOG_WARN("The cache manager is not initialized"); \ + return return_value; \ + } \ } -#define CACHE_MANAGER_CHECK_VOID() \ - { \ - if (!pt_) { \ - LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \ - return; \ - } \ +#define CACHE_MANAGER_CHECK_VOID() \ + { \ + if (!pt_) { \ + SDL_LOG_WARN("The cache manager is not initialized"); \ + return; \ + } \ } struct LanguageFinder { @@ -282,7 +282,7 @@ CacheManager::CacheManager(bool in_memory) } CacheManager::~CacheManager() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(backuper_locker_); backup_thread_->Stop(threads::Thread::kThreadSoftStop); delete backup_thread_->GetDelegate(); @@ -291,7 +291,7 @@ CacheManager::~CacheManager() { ConsentPriorityType CacheManager::GetConsentsPriority( const std::string& device_id, const std::string& application_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ConsentPriorityType prio_type = ConsentPriorityType::kExternalConsentPrio; CACHE_MANAGER_CHECK(prio_type); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -299,7 +299,7 @@ ConsentPriorityType CacheManager::GetConsentsPriority( pt_->policy_table.device_data->find(device_id); if (pt_->policy_table.device_data->end() == dev_params_iter) { - LOG4CXX_DEBUG(logger_, "Device id " << device_id << " not found."); + SDL_LOG_DEBUG("Device id " << device_id << " not found."); return prio_type; } @@ -309,8 +309,7 @@ ConsentPriorityType CacheManager::GetConsentsPriority( dev_par.user_consent_records->find(application_id); if (dev_par.user_consent_records->end() == app_consent_record) { - LOG4CXX_DEBUG(logger_, - "Application id " << application_id << " not found."); + SDL_LOG_DEBUG("Application id " << application_id << " not found."); return prio_type; } @@ -327,7 +326,7 @@ const policy_table::Strings& CacheManager::GetGroups(const PTString& app_id) { } const policy_table::Strings CacheManager::GetPolicyAppIDs() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto apps = pt_->policy_table.app_policies_section.apps; @@ -448,13 +447,12 @@ bool CacheManager::GetUserPermissionsForDevice( const std::string& device_id, StringArray& consented_groups, StringArray& disallowed_groups) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::DeviceData& device_data = *pt_->policy_table.device_data; if (device_data.end() == device_data.find(device_id)) { - LOG4CXX_ERROR(logger_, - "Device with " << device_id << "was not found in PT"); + SDL_LOG_ERROR("Device with " << device_id << "was not found in PT"); return false; } const policy_table::DeviceParams& params = device_data[device_id]; @@ -481,7 +479,7 @@ bool CacheManager::GetUserPermissionsForDevice( void CacheManager::GetAllAppGroups(const std::string& app_id, FunctionalGroupIDs& all_group_ids) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -520,7 +518,7 @@ void CacheManager::GetAllAppGroups(const std::string& app_id, void CacheManager::GetPreConsentedGroups( const std::string& app_id, FunctionalGroupIDs& preconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); if (kDeviceId == app_id) { @@ -560,7 +558,7 @@ void CacheManager::GetConsentedGroups(const std::string& device_id, const std::string& app_id, FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::DeviceData::iterator dev_params_iter = @@ -596,12 +594,11 @@ void CacheManager::GetUnconsentedGroups( const std::string& device_id, const std::string& policy_app_id, FunctionalGroupIDs& unconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); if (!IsApplicationRepresented(policy_app_id)) { - LOG4CXX_WARN(logger_, - "The application with app_id: " << policy_app_id + SDL_LOG_WARN("The application with app_id: " << policy_app_id << " is not represented"); return; } @@ -680,21 +677,18 @@ void CacheManager::ProcessUpdate( if (app_id == kDefaultId || app_id == kPreDataConsentId) { if (new_request_types.is_omitted()) { - LOG4CXX_INFO(logger_, - "Application " << app_id + SDL_LOG_INFO("Application " << app_id << " has omitted RequestTypes." " Previous values will be kept."); update_request_types = false; } else if (new_request_types.empty()) { if (new_request_types.is_cleaned_up()) { - LOG4CXX_INFO(logger_, - "Application " << app_id + SDL_LOG_INFO("Application " << app_id << " has cleaned up all values." " Previous values will be kept."); update_request_types = false; } else { - LOG4CXX_INFO(logger_, - "Application " << app_id + SDL_LOG_INFO("Application " << app_id << " has empty RequestTypes." " Any parameter will be allowed."); } @@ -721,7 +715,7 @@ void CacheManager::ProcessUpdate( } bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); pt_->policy_table.functional_groupings = @@ -812,7 +806,7 @@ policy_table::VehicleDataItems CacheManager::CollectCustomVDItems( void CacheManager::GetHMIAppTypeAfterUpdate( std::map<std::string, StringArray>& app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator policy_iter_begin = @@ -876,7 +870,7 @@ std::string CacheManager::currentDateTime() { bool CacheManager::GetPermissionsForApp(const std::string& device_id, const std::string& app_id, FunctionalIdType& group_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GetAllAppGroups(app_id, group_types[kTypeGeneral]); GetAllAppGroups(kDefaultId, group_types[kTypeDefault]); GetAllAppGroups(kPreDataConsentId, group_types[kTypePreDataConsented]); @@ -896,7 +890,7 @@ bool CacheManager::GetPermissionsForApp(const std::string& device_id, bool CacheManager::GetDeviceGroupsFromPolicies( policy_table::Strings& groups, policy_table::Strings& preconsented_groups) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); groups = pt_->policy_table.app_policies_section.device.groups; @@ -906,7 +900,7 @@ bool CacheManager::GetDeviceGroupsFromPolicies( } bool CacheManager::IsDeviceConsentCached(const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock lock(cached_device_permissions_lock_); CachedDevicePermissions::const_iterator cached_dev_consent_iter; @@ -916,7 +910,7 @@ bool CacheManager::IsDeviceConsentCached(const std::string& device_id) const { DeviceConsent CacheManager::GetCachedDeviceConsent( const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(cached_device_permissions_lock_); DeviceConsent result = kDeviceHasNoConsent; CACHE_MANAGER_CHECK(result); @@ -930,7 +924,7 @@ DeviceConsent CacheManager::GetCachedDeviceConsent( void CacheManager::SaveDeviceConsentToCache(const std::string& device_id, const bool is_allowed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock lock(cached_device_permissions_lock_); DeviceConsent result = is_allowed ? kDeviceAllowed : kDeviceDisallowed; @@ -943,7 +937,7 @@ bool CacheManager::GetPermissionsList(StringArray& perm_list) const { policy_table::Strings groups; policy_table::Strings preconsented_groups; if (!GetDeviceGroupsFromPolicies(groups, preconsented_groups)) { - LOG4CXX_WARN(logger_, "Can't get device groups from policies."); + SDL_LOG_WARN("Can't get device groups from policies."); return false; } @@ -955,8 +949,8 @@ bool CacheManager::GetPermissionsList(StringArray& perm_list) const { bool CacheManager::HasDeviceSpecifiedConsent(const std::string& device_id, const bool is_allowed) const { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device :" << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device :" << device_id); const DeviceConsent current_consent = GetDeviceConsent(device_id); const bool is_current_device_allowed = DeviceConsent::kDeviceAllowed == current_consent ? true : false; @@ -966,15 +960,14 @@ bool CacheManager::HasDeviceSpecifiedConsent(const std::string& device_id, return false; } const std::string consent = is_allowed ? "allowed" : "disallowed"; - LOG4CXX_INFO( - logger_, - "DeviceGetDeviceGroupsFromPolicies is already " << consent << "."); + SDL_LOG_INFO("DeviceGetDeviceGroupsFromPolicies is already " << consent + << "."); return true; } void CacheManager::SetDeviceConsent(const std::string& device_id, const bool is_allowed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); if (HasDeviceSpecifiedConsent(device_id, is_allowed)) { return; @@ -987,7 +980,7 @@ void CacheManager::SetDeviceConsent(const std::string& device_id, StringArray list_of_permissions; if (!GetPermissionsList(list_of_permissions) || list_of_permissions.empty()) { - LOG4CXX_WARN(logger_, "List of permissions can't be received or empty"); + SDL_LOG_WARN("List of permissions can't be received or empty"); return; } @@ -1003,7 +996,7 @@ void CacheManager::SetDeviceConsent(const std::string& device_id, if (!SetUserPermissionsForDevice( device_id, consented_groups, disallowed_groups)) { - LOG4CXX_WARN(logger_, "Can't set user consent for device"); + SDL_LOG_WARN("Can't set user consent for device"); return; } SaveDeviceConsentToCache(device_id, is_allowed); @@ -1011,7 +1004,7 @@ void CacheManager::SetDeviceConsent(const std::string& device_id, DeviceConsent CacheManager::GetDeviceConsent( const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(kDeviceHasNoConsent); if (IsDeviceConsentCached(device_id)) { return GetCachedDeviceConsent(device_id); @@ -1054,7 +1047,7 @@ DeviceConsent CacheManager::GetDeviceConsent( bool CacheManager::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); @@ -1078,14 +1071,14 @@ bool CacheManager::SetDeviceData(const std::string& device_id, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); if (pt_->policy_table.device_data->end() == pt_->policy_table.device_data->find(device_id)) { - LOG4CXX_ERROR(logger_, "Unable to find mobile device: " << device_id); + SDL_LOG_ERROR("Unable to find mobile device: " << device_id); return false; } @@ -1107,7 +1100,7 @@ bool CacheManager::SetUserPermissionsForDevice( const std::string& device_id, const StringArray& consented_groups, const StringArray& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); policy_table::DeviceParams& params = @@ -1140,7 +1133,7 @@ bool CacheManager::SetUserPermissionsForDevice( bool CacheManager::ReactOnUserDevConsentForApp(const std::string& app_id, bool is_device_allowed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); bool result = true; if (is_device_allowed) { @@ -1174,7 +1167,7 @@ void CacheManager::GetGroupNameByHashID(const int32_t group_id, bool CacheManager::SetUserPermissionsForApp( const PermissionConsent& permissions, bool* out_app_permissions_changed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); std::vector<FunctionalGroupPermission>::const_iterator iter = @@ -1204,7 +1197,7 @@ bool CacheManager::SetUserPermissionsForApp( const date_time::TimeDuration tm = date_time::getCurrentTime(); int64_t current_time_msec = date_time::getmSecs(tm); ucr.consent_last_updated = current_time_msec; - LOG4CXX_DEBUG(logger_, "Updating consents time " << current_time_msec); + SDL_LOG_DEBUG("Updating consents time " << current_time_msec); } (*ucr.consent_groups)[group_name] = is_allowed; @@ -1240,13 +1233,13 @@ void CacheManager::CheckPermissions(const PTString& app_id, const PTString& hmi_level, const PTString& rpc, CheckPermissionResult& result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); if (!IsApplicationRepresented(app_id)) { - LOG4CXX_ERROR( - logger_, "Application id " << app_id << " was not found in policy DB."); + SDL_LOG_ERROR("Application id " << app_id + << " was not found in policy DB."); return; } @@ -1301,16 +1294,15 @@ int CacheManager::IgnitionCyclesBeforeExchange() { static_cast<int>( pt_->policy_table.module_config.exchange_after_x_ignition_cycles), 0); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "IgnitionCyclesBeforeExchange limit:" << static_cast<int>(limit)); uint8_t current = 0; const int last_exch = static_cast<int>( *pt_->policy_table.module_meta->ignition_cycles_since_last_exchange); current = std::max(last_exch, 0); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "IgnitionCyclesBeforeExchange current:" << static_cast<int>(current)); return std::max(limit - current, 0); @@ -1323,16 +1315,16 @@ int CacheManager::KilometersBeforeExchange(int current) { std::max(static_cast<int>( pt_->policy_table.module_config.exchange_after_x_kilometers), 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange limit:" << limit); + SDL_LOG_DEBUG("KilometersBeforeExchange limit:" << limit); int last = 0; const int odo_val = static_cast<int>( *pt_->policy_table.module_meta->pt_exchanged_at_odometer_x); last = std::max(odo_val, 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange last:" << last); + SDL_LOG_DEBUG("KilometersBeforeExchange last:" << last); const int actual = std::max((current - last), 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange actual:" << actual); + SDL_LOG_DEBUG("KilometersBeforeExchange actual:" << actual); return std::max(limit - actual, 0); } @@ -1343,18 +1335,16 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate( switch (counter) { case KILOMETERS: *pt_->policy_table.module_meta->pt_exchanged_at_odometer_x = value; - LOG4CXX_DEBUG(logger_, - "SetCountersPassedForSuccessfulUpdate km:" << value); + SDL_LOG_DEBUG("SetCountersPassedForSuccessfulUpdate km:" << value); break; case DAYS_AFTER_EPOCH: *pt_->policy_table.module_meta->pt_exchanged_x_days_after_epoch = value; - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "SetCountersPassedForSuccessfulUpdate days after epoch:" << value); break; default: - LOG4CXX_ERROR(logger_, - "Unknown counter was requested to set: " << counter); + SDL_LOG_ERROR("Unknown counter was requested to set: " << counter); return false; } @@ -1363,7 +1353,7 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate( } int CacheManager::DaysBeforeExchange(uint16_t current) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(0); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -1375,14 +1365,13 @@ int CacheManager::DaysBeforeExchange(uint16_t current) { } const uint8_t limit = pt_->policy_table.module_config.exchange_after_x_days; - LOG4CXX_DEBUG(logger_, - "Exchange after: " << static_cast<int>(limit) << " days"); + SDL_LOG_DEBUG("Exchange after: " << static_cast<int>(limit) << " days"); - LOG4CXX_DEBUG(logger_, "Epoch since last update: " << *days_after_epoch); + SDL_LOG_DEBUG("Epoch since last update: " << *days_after_epoch); const uint16_t actual = std::max(static_cast<uint16_t>(current - *days_after_epoch), uint16_t(0)); - LOG4CXX_DEBUG(logger_, "The days since last update: " << actual); + SDL_LOG_DEBUG("The days since last update: " << actual); return std::max(limit - actual, 0); } @@ -1394,7 +1383,7 @@ void CacheManager::IncrementIgnitionCycles() { *pt_->policy_table.module_meta->ignition_cycles_since_last_exchange); (*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange) = ign_val + 1; - LOG4CXX_DEBUG(logger_, "IncrementIgnitionCycles ignitions:" << ign_val); + SDL_LOG_DEBUG("IncrementIgnitionCycles ignitions:" << ign_val); Backup(); } @@ -1616,7 +1605,7 @@ void CacheManager::SetHybridAppPreference( void CacheManager::GetAppServiceParameters( const std::string& policy_app_id, policy_table::AppServiceParameters* app_service_parameters) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -1659,7 +1648,7 @@ const boost::optional<bool> CacheManager::LockScreenDismissalEnabledState() const boost::optional<std::string> CacheManager::LockScreenDismissalWarningMessage( const std::string& language) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); boost::optional<std::string> empty; CACHE_MANAGER_CHECK(empty); @@ -1682,7 +1671,7 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( const std::vector<std::string>& msg_codes, const std::string& language, const std::string& active_hmi_language) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<UserFriendlyMessage> result; CACHE_MANAGER_CHECK(result); @@ -1699,23 +1688,20 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( FindLanguage(msg_languages, language); if (!message_string.is_valid()) { - LOG4CXX_WARN(logger_, - "Language " - << language - << " haven't been found for message code: " << *it); + SDL_LOG_WARN("Language " + << language + << " haven't been found for message code: " << *it); policy_table::MessageString active_hmi_language_message_string = FindLanguage(msg_languages, active_hmi_language); if (!active_hmi_language_message_string.is_valid()) { - LOG4CXX_WARN(logger_, - "Active hmi language " - << active_hmi_language - << " haven't been found for message code: " << *it); + SDL_LOG_WARN("Active hmi language " + << active_hmi_language + << " haven't been found for message code: " << *it); policy_table::MessageString fallback_message_string = FindLanguage(msg_languages, "en-us"); if (!fallback_message_string.is_valid()) { - LOG4CXX_ERROR(logger_, - "No fallback language found for message code: " << *it); + SDL_LOG_ERROR("No fallback language found for message code: " << *it); continue; } message_string = fallback_message_string; @@ -1755,10 +1741,10 @@ void CacheManager::GetUpdateUrls(const uint32_t service_type, void CacheManager::GetUpdateUrls(const std::string& service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); - LOG4CXX_DEBUG(logger_, "Search service value is: " << service_type); + SDL_LOG_DEBUG("Search service value is: " << service_type); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ServiceEndpoints::const_iterator iter = @@ -1842,7 +1828,7 @@ bool CacheManager::GetPriority(const std::string& policy_app_id, void CacheManager::CheckSnapshotInitialization() { CACHE_MANAGER_CHECK_VOID(); if (!snapshot_) { - LOG4CXX_ERROR(logger_, "Snapshot pointer is not initialized"); + SDL_LOG_ERROR("Snapshot pointer is not initialized"); return; } @@ -1960,15 +1946,14 @@ void CacheManager::CheckSnapshotInitialization() { policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff( const policy_table::VehicleDataItems& items_before, const policy_table::VehicleDataItems& items_after) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (items_before.empty()) { - LOG4CXX_DEBUG(logger_, "No custom VD items found in policy"); + SDL_LOG_DEBUG("No custom VD items found in policy"); return policy_table::VehicleDataItems(); } if (items_after.empty()) { - LOG4CXX_DEBUG(logger_, - "All custom VD items were removed after policy update"); + SDL_LOG_DEBUG("All custom VD items were removed after policy update"); return items_before; } @@ -1986,19 +1971,18 @@ policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff( } } - LOG4CXX_DEBUG(logger_, - "Found " << removed_items.size() << " removed VD items"); + SDL_LOG_DEBUG("Found " << removed_items.size() << " removed VD items"); return removed_items; } void CacheManager::SetRemovedCustomVdItems( const policy_table::VehicleDataItems& removed_items) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); removed_custom_vd_items_ = removed_items; } void CacheManager::PersistData() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (backup_.use_count() != 0) { if (pt_.use_count() != 0) { // Comma expression is used to hold the lock only during the constructor @@ -2058,7 +2042,7 @@ void CacheManager::PersistData() { #ifdef ENABLE_LOG policy_table::DeviceData& device_data = *copy_pt.policy_table.device_data; - LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size()); + SDL_LOG_DEBUG("Device_data size is: " << device_data.size()); #endif // ENABLE_LOG for (; it_device != it_end_device; ++it_device) { if (is_unpaired_.end() != is_unpaired_.find(it_device->first)) { @@ -2067,7 +2051,7 @@ void CacheManager::PersistData() { ex_backup_->SetUnpairedDevice(it_device->first, false); } } - LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size()); + SDL_LOG_DEBUG("Device_data size is: " << device_data.size()); } backup_->WriteDb(); } @@ -2075,14 +2059,14 @@ void CacheManager::PersistData() { } void CacheManager::ResetCalculatedPermissions() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_.clear(); } void CacheManager::ResetCalculatedPermissionsForDevice( const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_.erase(device_id); } @@ -2090,9 +2074,8 @@ void CacheManager::ResetCalculatedPermissionsForDevice( void CacheManager::AddCalculatedPermissions(const std::string& device_id, const std::string& policy_app_id, const Permissions& permissions) { - LOG4CXX_DEBUG(logger_, - "AddCalculatedPermissions for device: " - << device_id << " and app: " << policy_app_id); + SDL_LOG_DEBUG("AddCalculatedPermissions for device: " + << device_id << " and app: " << policy_app_id); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_[device_id][policy_app_id] = permissions; } @@ -2100,9 +2083,8 @@ void CacheManager::AddCalculatedPermissions(const std::string& device_id, bool CacheManager::IsPermissionsCalculated(const std::string& device_id, const std::string& policy_app_id, Permissions& permission) { - LOG4CXX_DEBUG(logger_, - "IsPermissionsCalculated for device: " - << device_id << " and app: " << policy_app_id); + SDL_LOG_DEBUG("IsPermissionsCalculated for device: " + << device_id << " and app: " << policy_app_id); sync_primitives::AutoLock lock(calculated_permissions_lock_); CalculatedPermissions::const_iterator it = calculated_permissions_.find(device_id); @@ -2145,7 +2127,7 @@ std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { bool CacheManager::GetInitialAppData(const std::string& app_id, StringArray& nicknames, StringArray& app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -2168,7 +2150,7 @@ bool CacheManager::GetInitialAppData(const std::string& app_id, bool CacheManager::GetFunctionalGroupings( policy_table::FunctionalGroupings& groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); const policy_table::FunctionalGroupings& f_groupings = @@ -2180,9 +2162,9 @@ bool CacheManager::GetFunctionalGroupings( int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); - LOG4CXX_DEBUG(logger_, "Application id: " << policy_app_id); + SDL_LOG_DEBUG("Application id: " << policy_app_id); int result = 0; if (kDeviceId != policy_app_id && !IsApplicationRepresented(policy_app_id)) { return 0; @@ -2280,7 +2262,7 @@ int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id, } void CacheManager::SetPreloadedPtFlag(const bool is_preloaded) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); *pt_->policy_table.module_config.preloaded_pt = is_preloaded; Backup(); } @@ -2304,7 +2286,7 @@ bool CacheManager::SetMetaInfo(const std::string& ccpu_version, } std::string CacheManager::GetCCPUVersionFromPT() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc::Optional<policy_table::ModuleMeta>& module_meta = pt_->policy_table.module_meta; return *(module_meta->ccpu_version); @@ -2329,7 +2311,7 @@ bool CacheManager::SetSystemLanguage(const std::string& language) { } bool CacheManager::GetFunctionalGroupNames(FunctionalGroupNames& names) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); rpc::policy_table_interface_base::FunctionalGroupings::iterator iter = @@ -2354,28 +2336,27 @@ bool CacheManager::CleanupUnpairedDevices() { sync_primitives::AutoLock lock_unpaired(unpaired_lock_); UnpairedDevices::iterator iter = is_unpaired_.begin(); UnpairedDevices::const_iterator iter_end = is_unpaired_.end(); - LOG4CXX_DEBUG(logger_, "Is_unpaired size is: " << is_unpaired_.size()); + SDL_LOG_DEBUG("Is_unpaired size is: " << is_unpaired_.size()); for (; iter != iter_end; ++iter) { // Delete device if (!pt_->policy_table.device_data.is_initialized()) { - LOG4CXX_ERROR(logger_, "Device_data section is not initialized."); + SDL_LOG_ERROR("Device_data section is not initialized."); return false; } policy_table::DeviceData& device_data = *pt_->policy_table.device_data; policy_table::DeviceData::iterator it_device = device_data.find(*iter); if (device_data.end() == it_device) { - LOG4CXX_INFO(logger_, - "No device id " - << *iter << " had been found in device_data section."); + SDL_LOG_INFO("No device id " + << *iter << " had been found in device_data section."); return false; } - LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size()); + SDL_LOG_DEBUG("Device_data size is: " << device_data.size()); device_data.erase(it_device); - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "Device id " << *iter << " had been deleted from device_data section."); - LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size()); + SDL_LOG_DEBUG("Device_data size is: " << device_data.size()); } is_unpaired_.clear(); Backup(); @@ -2396,7 +2377,7 @@ void CacheManager::Increment(usage_statistics::GlobalCounterId type) { ++(*pt_->policy_table.usage_and_error_counts->count_of_sync_reboots); break; default: - LOG4CXX_WARN(logger_, "Type global counter is unknown"); + SDL_LOG_WARN("Type global counter is unknown"); return; } Backup(); @@ -2444,7 +2425,7 @@ void CacheManager::Increment(const std::string& app_id, .count_of_tls_errors; break; default: - LOG4CXX_WARN(logger_, "Type app counter is unknown"); + SDL_LOG_WARN("Type app counter is unknown"); return; } Backup(); @@ -2465,7 +2446,7 @@ void CacheManager::Set(const std::string& app_id, .app_registration_language_vui = value; break; default: - LOG4CXX_WARN(logger_, "Type app info is unknown"); + SDL_LOG_WARN("Type app info is unknown"); return; } Backup(); @@ -2495,7 +2476,7 @@ void CacheManager::Add(const std::string& app_id, .minutes_in_hmi_none += minutes; break; default: - LOG4CXX_WARN(logger_, "Type app stopwatch is unknown"); + SDL_LOG_WARN("Type app stopwatch is unknown"); return; } Backup(); @@ -2558,8 +2539,7 @@ bool CacheManager::SetPredataPolicy(const std::string& app_id) { pt_->policy_table.app_policies_section.apps.find(kPreDataConsentId); if (pt_->policy_table.app_policies_section.apps.end() == iter) { - LOG4CXX_ERROR(logger_, - "Could not set " << kPreDataConsentId + SDL_LOG_ERROR("Could not set " << kPreDataConsentId << " permissions for app " << app_id); return false; } @@ -2589,20 +2569,18 @@ bool CacheManager::SetUnpairedDevice(const std::string& device_id, const bool result = pt_->policy_table.device_data->end() != pt_->policy_table.device_data->find(device_id); if (!result) { - LOG4CXX_DEBUG(logger_, - "Couldn't set unpaired flag for device id " - << device_id << " , since it wasn't found."); + SDL_LOG_DEBUG("Couldn't set unpaired flag for device id " + << device_id << " , since it wasn't found."); return false; } sync_primitives::AutoLock lock(unpaired_lock_); if (unpaired) { is_unpaired_.insert(device_id); - LOG4CXX_DEBUG(logger_, "Unpaired flag was set for device id " << device_id); + SDL_LOG_DEBUG("Unpaired flag was set for device id " << device_id); } else { is_unpaired_.erase(device_id); - LOG4CXX_DEBUG(logger_, - "Unpaired flag was removed for device id " << device_id); + SDL_LOG_DEBUG("Unpaired flag was removed for device id " << device_id); } return result; } @@ -2627,7 +2605,7 @@ bool CacheManager::IsApplicationRepresented(const std::string& app_id) const { bool CacheManager::Init(const std::string& file_name, const PolicySettings* settings) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); settings_ = settings; InitResult init_result = backup_->Init(settings); ex_backup_ = std::dynamic_pointer_cast<PTExtRepresentation>(backup_); @@ -2635,7 +2613,7 @@ bool CacheManager::Init(const std::string& file_name, bool result = true; switch (init_result) { case InitResult::EXISTS: { - LOG4CXX_INFO(logger_, "Policy Table exists, was loaded correctly."); + SDL_LOG_INFO("Policy Table exists, was loaded correctly."); result = LoadFromBackup(); if (result) { if (!backup_->IsDBVersionActual()) { @@ -2651,16 +2629,15 @@ bool CacheManager::Init(const std::string& file_name, } } break; case InitResult::SUCCESS: { - LOG4CXX_INFO(logger_, "Policy Table was inited successfully"); + SDL_LOG_INFO("Policy Table was inited successfully"); result = LoadFromFile(file_name, *pt_); std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); - LOG4CXX_DEBUG(logger_, - "Check if snapshot valid: " << std::boolalpha << result); + SDL_LOG_DEBUG("Check if snapshot valid: " << std::boolalpha << result); if (!UnwrapAppPolicies(pt_->policy_table.app_policies_section.apps)) { - LOG4CXX_ERROR(logger_, "Cannot unwrap application policies"); + SDL_LOG_ERROR("Cannot unwrap application policies"); } if (result) { @@ -2670,14 +2647,13 @@ bool CacheManager::Init(const std::string& file_name, } else { rpc::ValidationReport report("policy_table"); snapshot->ReportErrors(&report); - LOG4CXX_DEBUG(logger_, - "Validation report: " << rpc::PrettyFormat(report)); + SDL_LOG_DEBUG("Validation report: " << rpc::PrettyFormat(report)); ex_backup_->RemoveDB(); } } break; default: { result = false; - LOG4CXX_ERROR(logger_, "Failed to init policy table."); + SDL_LOG_ERROR("Failed to init policy table."); } break; } @@ -2729,11 +2705,11 @@ bool CacheManager::LoadFromBackup() { bool CacheManager::LoadFromFile(const std::string& file_name, policy_table::Table& table) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Loading policy table from file " << file_name); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Loading policy table from file " << file_name); BinaryMessage json_string; if (!file_system::ReadBinaryFile(file_name, json_string)) { - LOG4CXX_FATAL(logger_, "Failed to read policy table source file."); + SDL_LOG_FATAL("Failed to read policy table source file."); return false; } @@ -2742,20 +2718,18 @@ bool CacheManager::LoadFromFile(const std::string& file_name, std::string json(json_string.begin(), json_string.end()); if (!reader.parse(json, &value)) { - LOG4CXX_FATAL(logger_, "Preloaded PT is corrupted."); + SDL_LOG_FATAL("Preloaded PT is corrupted."); return false; } - LOG4CXX_DEBUG(logger_, - "Start verification of policy table loaded from file."); + SDL_LOG_DEBUG("Start verification of policy table loaded from file."); sync_primitives::AutoLock locker(cache_lock_); table = policy_table::Table(&value); #ifdef ENABLE_LOG Json::StreamWriterBuilder writer_builder; - LOG4CXX_DEBUG(logger_, - "Policy table content loaded:" << Json::writeString( + SDL_LOG_DEBUG("Policy table content loaded:" << Json::writeString( writer_builder, table.ToJsonValue())); #endif // ENABLE_LOG @@ -2764,21 +2738,20 @@ bool CacheManager::LoadFromFile(const std::string& file_name, if (!table.is_valid()) { rpc::ValidationReport report("policy_table"); table.ReportErrors(&report); - LOG4CXX_FATAL(logger_, - "Parsed table is not valid " << rpc::PrettyFormat(report)); + SDL_LOG_FATAL("Parsed table is not valid " << rpc::PrettyFormat(report)); return false; } return true; } bool CacheManager::ResetPT(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_unpaired_.clear(); backuper_->WaitForBackupIsDone(); if (!backup_->RefreshDB()) { - LOG4CXX_ERROR(logger_, "Can't re-create policy database. Reset failed."); + SDL_LOG_ERROR("Can't re-create policy database. Reset failed."); return false; } @@ -2794,25 +2767,22 @@ bool CacheManager::ResetPT(const std::string& file_name) { policy::RequestType::State CacheManager::GetAppRequestTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator app_policies_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request types for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id); return policy::RequestType::State::UNAVAILABLE; } const policy_table::RequestTypes& request_types = *app_policies_iter->second.RequestType; if (!request_types.is_initialized()) { - LOG4CXX_TRACE(logger_, - "Request types for " << policy_app_id << " are OMITTED"); + SDL_LOG_TRACE("Request types for " << policy_app_id << " are OMITTED"); return RequestType::State::OMITTED; } if (request_types.empty()) { - LOG4CXX_TRACE(logger_, - "Request types for " << policy_app_id << " are EMPTY"); + SDL_LOG_TRACE("Request types for " << policy_app_id << " are EMPTY"); return policy::RequestType::State::EMPTY; } return policy::RequestType::State::AVAILABLE; @@ -2821,19 +2791,17 @@ policy::RequestType::State CacheManager::GetAppRequestTypesState( void CacheManager::GetAppRequestTypes( const std::string& policy_app_id, std::vector<std::string>& request_types) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); if (kDeviceId == policy_app_id) { - LOG4CXX_DEBUG(logger_, - "Request types not applicable for app_id " << kDeviceId); + SDL_LOG_DEBUG("Request types not applicable for app_id " << kDeviceId); return; } policy_table::ApplicationPolicies::iterator policy_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request types for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id); return; } if (policy_iter->second.RequestType.is_initialized()) { @@ -2846,25 +2814,22 @@ void CacheManager::GetAppRequestTypes( RequestSubType::State CacheManager::GetAppRequestSubTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator app_policies_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request subtypes for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id); return RequestSubType::State::UNAVAILABLE; } const policy_table::RequestSubTypes& request_subtypes = *app_policies_iter->second.RequestSubType; if (!request_subtypes.is_initialized()) { - LOG4CXX_TRACE(logger_, - "Request subtypes for " << policy_app_id << " are OMITTED"); + SDL_LOG_TRACE("Request subtypes for " << policy_app_id << " are OMITTED"); return RequestSubType::State::OMITTED; } if (request_subtypes.empty()) { - LOG4CXX_TRACE(logger_, - "Request subtypes for " << policy_app_id << " are EMPTY"); + SDL_LOG_TRACE("Request subtypes for " << policy_app_id << " are EMPTY"); return RequestSubType::State::EMPTY; } return RequestSubType::State::AVAILABLE; @@ -2873,19 +2838,17 @@ RequestSubType::State CacheManager::GetAppRequestSubTypesState( void CacheManager::GetAppRequestSubTypes( const std::string& policy_app_id, std::vector<std::string>& request_subtypes) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); if (kDeviceId == policy_app_id) { - LOG4CXX_DEBUG(logger_, - "Request subtypes not applicable for app_id " << kDeviceId); + SDL_LOG_DEBUG("Request subtypes not applicable for app_id " << kDeviceId); return; } sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::iterator policy_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request subtypes for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id); return; } @@ -2896,7 +2859,7 @@ void CacheManager::GetAppRequestSubTypes( } const MetaInfo CacheManager::GetMetaInfo() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); MetaInfo meta_info; meta_info.ccpu_version = *pt_->policy_table.module_meta->ccpu_version; @@ -2916,7 +2879,7 @@ std::string CacheManager::GetCertificate() const { } void CacheManager::SetDecryptedCertificate(const std::string& certificate) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); *pt_->policy_table.module_config.certificate = certificate; @@ -2925,10 +2888,10 @@ void CacheManager::SetDecryptedCertificate(const std::string& certificate) { bool CacheManager::SetExternalConsentStatus( const ExternalConsentStatus& status) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); if (status.empty()) { - LOG4CXX_INFO(logger_, "No ExternalConsent status update."); + SDL_LOG_INFO("No ExternalConsent status update."); return false; } @@ -2936,13 +2899,13 @@ bool CacheManager::SetExternalConsentStatus( } ExternalConsentStatus CacheManager::GetExternalConsentStatus() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); return ex_backup_->GetExternalConsentStatus(); } ExternalConsentStatus CacheManager::GetExternalConsentEntities() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); ExternalConsentStatus items; for (policy_table::FunctionalGroupings::const_iterator it = @@ -2971,7 +2934,7 @@ ExternalConsentStatus CacheManager::GetExternalConsentEntities() { GroupsByExternalConsentStatus CacheManager::GetGroupsWithSameEntities( const ExternalConsentStatus& status) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(policy::GroupsByExternalConsentStatus()); sync_primitives::AutoLock auto_lock(cache_lock_); GroupsByExternalConsentStatus groups_by_external_consent; @@ -2985,7 +2948,7 @@ GroupsByExternalConsentStatus CacheManager::GetGroupsWithSameEntities( } std::map<std::string, std::string> CacheManager::GetKnownLinksFromPT() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK((std::map<std::string, std::string>())); std::map<std::string, std::string> links; sync_primitives::AutoLock auto_lock(cache_lock_); @@ -3026,7 +2989,7 @@ bool CacheManager::ConsentsSame( void CacheManager::SetExternalConsentForApp( const PermissionConsent& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ConsentGroups& external_consent_groups = @@ -3035,7 +2998,7 @@ void CacheManager::SetExternalConsentForApp( .external_consent_status_groups; if (ConsentsSame(external_consent_groups, permissions)) { - LOG4CXX_DEBUG(logger_, "External consents already have same values."); + SDL_LOG_DEBUG("External consents already have same values."); return; } @@ -3055,16 +3018,16 @@ void CacheManager::SetExternalConsentForApp( const date_time::TimeDuration tm = date_time::getCurrentTime(); int64_t current_time_msec = date_time::getmSecs(tm); app_consent_records.ext_consent_last_updated = current_time_msec; - LOG4CXX_DEBUG(logger_, "Updating consents time " << current_time_msec); + SDL_LOG_DEBUG("Updating consents time " << current_time_msec); Backup(); } bool CacheManager::MergePreloadPT(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::Table table; if (!LoadFromFile(file_name, table)) { - LOG4CXX_DEBUG(logger_, "Unable to load preloaded PT."); + SDL_LOG_DEBUG("Unable to load preloaded PT."); return false; } @@ -3086,7 +3049,7 @@ bool CacheManager::MergePreloadPT(const std::string& file_name) { void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::ModuleConfig copy(pt.module_config); pt.module_config = new_pt.module_config; @@ -3097,19 +3060,19 @@ void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt, void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::FunctionalGroupings::const_iterator it = new_pt.functional_groupings.begin(); for (; it != new_pt.functional_groupings.end(); ++it) { - LOG4CXX_DEBUG(logger_, "Merge functional group: " << it->first); + SDL_LOG_DEBUG("Merge functional group: " << it->first); pt.functional_groupings[it->first] = it->second; } } void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); pt.app_policies_section.device = const_cast<policy_table::PolicyTable&>(new_pt) .app_policies_section.device; @@ -3125,7 +3088,7 @@ void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (new_pt.consumer_friendly_messages.is_initialized()) { if (!pt.consumer_friendly_messages.is_initialized()) { pt.consumer_friendly_messages = new_pt.consumer_friendly_messages; @@ -3136,9 +3099,9 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, pt.consumer_friendly_messages->version = new_pt.consumer_friendly_messages->version; for (; it != new_pt.consumer_friendly_messages->messages->end(); ++it) { - LOG4CXX_DEBUG(logger_, "Merge CFM: " << it->first); + SDL_LOG_DEBUG("Merge CFM: " << it->first); if (!(pt.consumer_friendly_messages->messages.is_initialized())) { - LOG4CXX_DEBUG(logger_, "CFM not initialized."); + SDL_LOG_DEBUG("CFM not initialized."); } (*pt.consumer_friendly_messages->messages)[it->first] = it->second; } @@ -3148,12 +3111,12 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, void CacheManager::MergeVD(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); pt.vehicle_data.assign_if_valid(new_pt.vehicle_data); } void CacheManager::InitBackupThread() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); backuper_ = new BackgroundBackuper(this); backup_thread_ = threads::CreateThread("Backup thread", backuper_); backup_thread_->Start(); @@ -3167,7 +3130,7 @@ const PolicySettings& CacheManager::get_settings() const { void CacheManager::OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); auto device_data = *(pt_->policy_table.device_data); @@ -3180,12 +3143,11 @@ void CacheManager::OnDeviceSwitching(const std::string& device_id_from, auto& consents_from = *(from->second.user_consent_records); auto& consents_to = *(to->second.user_consent_records); - LOG4CXX_DEBUG(logger_, - "Merging user consents from device: " - << device_id_from << " to device: " << device_id_to); + SDL_LOG_DEBUG("Merging user consents from device: " + << device_id_from << " to device: " << device_id_to); for (auto f = consents_from.begin(); f != consents_from.end(); ++f) { const auto app_id = f->first; - LOG4CXX_DEBUG(logger_, "Updating permissions for key: " << app_id); + SDL_LOG_DEBUG("Updating permissions for key: " << app_id); consents_to[app_id] = f->second; } } @@ -3196,26 +3158,26 @@ CacheManager::BackgroundBackuper::BackgroundBackuper( , backup_is_in_progress_(false) , stop_flag_(false) , new_data_available_(false) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } CacheManager::BackgroundBackuper::~BackgroundBackuper() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void CacheManager::BackgroundBackuper::InternalBackup() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(cache_manager_); while (new_data_available_) { new_data_available_ = false; - LOG4CXX_DEBUG(logger_, "DoBackup"); + SDL_LOG_DEBUG("DoBackup"); cache_manager_->PersistData(); } } void CacheManager::BackgroundBackuper::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(need_backup_lock_); while (!stop_flag_) { backup_is_in_progress_.exchange(true); @@ -3225,7 +3187,7 @@ void CacheManager::BackgroundBackuper::threadMain() { } { - LOG4CXX_DEBUG(logger_, "Backup is done"); + SDL_LOG_DEBUG("Backup is done"); sync_primitives::AutoLock auto_lock(backup_done_lock_); backup_is_in_progress_.exchange(false); backup_done_.Broadcast(); @@ -3235,27 +3197,27 @@ void CacheManager::BackgroundBackuper::threadMain() { continue; } - LOG4CXX_DEBUG(logger_, "Wait for a next backup"); + SDL_LOG_DEBUG("Wait for a next backup"); backup_notifier_.Wait(need_backup_lock_); } } void CacheManager::BackgroundBackuper::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(need_backup_lock_); stop_flag_ = true; backup_notifier_.NotifyOne(); } void CacheManager::BackgroundBackuper::DoBackup() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(need_backup_lock_); new_data_available_ = true; backup_notifier_.NotifyOne(); } void CacheManager::BackgroundBackuper::WaitForBackupIsDone() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(backup_done_lock_); if (backup_is_in_progress_) { backup_done_.Wait(auto_lock); @@ -3264,7 +3226,7 @@ void CacheManager::BackgroundBackuper::WaitForBackupIsDone() { EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag( const std::string& application) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); return pt_->policy_table.app_policies_section.apps[application] @@ -3273,14 +3235,14 @@ EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag( EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag( const std::string& functional_group) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto& functional_groupings = pt_->policy_table.functional_groupings; const auto& grouping_itr = functional_groupings.find(functional_group); if (grouping_itr == functional_groupings.end()) { - LOG4CXX_WARN(logger_, "Group " << functional_group << " not found"); + SDL_LOG_WARN("Group " << functional_group << " not found"); return rpc::Optional<rpc::Boolean>(rpc::Boolean(false)); } @@ -3290,14 +3252,13 @@ EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag( void CacheManager::GetApplicationParams( const std::string& application_name, policy_table::ApplicationParams& application_params) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto apps = pt_->policy_table.app_policies_section.apps; const auto it = apps.find(application_name); if (apps.end() == it) { - LOG4CXX_WARN(logger_, - "Application " << application_name << " was not found"); + SDL_LOG_WARN("Application " << application_name << " was not found"); return; } diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc index b8bbb1682c..4607c3ca5f 100644 --- a/src/components/policy/policy_external/src/policy_helper.cc +++ b/src/components/policy/policy_external/src/policy_helper.cc @@ -44,7 +44,7 @@ namespace custom_str = utils::custom_string; namespace { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") bool CompareStrings(const StringsValueType& first, const StringsValueType& second) { @@ -356,7 +356,7 @@ std::vector<FunctionalGroupPermission> policy::CheckAppPolicy::GetRevokedGroups( FunctionalGroupNames groups_attributes; if (!pm_->cache_->GetFunctionalGroupNames(groups_attributes)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return std::vector<FunctionalGroupPermission>(); } @@ -390,7 +390,7 @@ bool CheckAppPolicy::IsKnownAppication( bool CheckAppPolicy::IsAppRevoked( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Application params are not initialized = application revoked // i.e. "123":null return app_policy.second.is_null(); @@ -427,7 +427,7 @@ void CheckAppPolicy::InsertPermission(const std::string& app_id, auto result = pm_->app_permissions_diff_.insert( std::make_pair(app_id, permissions_diff)); if (!result.second) { - LOG4CXX_ERROR(logger_, "App ID: " << app_id << " already exists in map."); + SDL_LOG_ERROR("App ID: " << app_id << " already exists in map."); } pm_->app_permissions_diff_lock_.Release(); } @@ -443,8 +443,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { AppPermissions permissions_diff(app_id); if (!IsKnownAppication(app_id)) { - LOG4CXX_WARN(logger_, - "Application:" << app_id << " is not present in snapshot."); + SDL_LOG_WARN("Application:" << app_id << " is not present in snapshot."); return true; } @@ -469,8 +468,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { const bool is_request_type_changed = IsRequestTypeChanged(app_policy); const bool is_request_subtype_changed = IsRequestSubTypeChanged(app_policy); if (is_request_type_changed) { - LOG4CXX_TRACE(logger_, - "Request types were changed for application: " << app_id); + SDL_LOG_TRACE("Request types were changed for application: " << app_id); SetPendingPermissions( app_policy, RESULT_REQUEST_TYPE_CHANGED, permissions_diff); AddResult(app_id, RESULT_REQUEST_TYPE_CHANGED); @@ -478,8 +476,8 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { (RESULT_NO_CHANGES == result) ? RESULT_REQUEST_TYPE_CHANGED : result; } if (is_request_subtype_changed) { - LOG4CXX_TRACE( - logger_, "Request subtypes were changed for application: " << app_id); + SDL_LOG_TRACE( + "Request subtypes were changed for application: " << app_id); SetPendingPermissions( app_policy, RESULT_REQUEST_SUBTYPE_CHANGED, permissions_diff); AddResult(app_id, RESULT_REQUEST_SUBTYPE_CHANGED); @@ -489,16 +487,14 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { } if (RESULT_NO_CHANGES == result) { - LOG4CXX_INFO( - logger_, - "Permissions for application:" << app_id << " wasn't changed."); + SDL_LOG_INFO("Permissions for application:" << app_id + << " wasn't changed."); AddResult(app_id, result); return true; } - LOG4CXX_INFO( - logger_, - "Permissions for application:" << app_id << " have been changed."); + SDL_LOG_INFO("Permissions for application:" << app_id + << " have been changed."); if (!IsPredefinedApp(app_policy)) { SetPendingPermissions(app_policy, result, permissions_diff); @@ -677,7 +673,7 @@ bool CheckAppPolicy::IsRequestSubTypeChanged( bool CheckAppPolicy::IsAppPropertiesProvided( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app_policy.second.hybrid_app_preference.is_initialized() || app_policy.second.endpoint.is_initialized() || app_policy.second.enabled.is_initialized() || @@ -691,15 +687,15 @@ bool CheckAppPolicy::IsAppPropertiesProvided( bool CheckAppPolicy::IsAppPropertiesChanged( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!IsAppPropertiesProvided(app_policy)) { return false; } if (!IsKnownAppication(app_policy.first)) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "AppProperties provided for new application: " << app_policy.first); return true; } @@ -710,33 +706,33 @@ bool CheckAppPolicy::IsAppPropertiesChanged( if (app_policy.second.enabled.is_initialized() && app_policy.second.enabled != snapshot_properties.second.enabled) { - LOG4CXX_DEBUG(logger_, "\"enabled\" was changed"); + SDL_LOG_DEBUG("\"enabled\" was changed"); return true; } if (app_policy.second.endpoint.is_initialized() && app_policy.second.endpoint != snapshot_properties.second.endpoint) { - LOG4CXX_DEBUG(logger_, "\"endpoint\" was changed"); + SDL_LOG_DEBUG("\"endpoint\" was changed"); return true; } if (app_policy.second.hybrid_app_preference.is_initialized() && app_policy.second.hybrid_app_preference != snapshot_properties.second.hybrid_app_preference) { - LOG4CXX_DEBUG(logger_, "\"hybrid_app_preference\" was changed"); + SDL_LOG_DEBUG("\"hybrid_app_preference\" was changed"); return true; } if (app_policy.second.auth_token.is_initialized() && app_policy.second.auth_token != snapshot_properties.second.auth_token) { - LOG4CXX_DEBUG(logger_, "\"auth_token\" was changed"); + SDL_LOG_DEBUG("\"auth_token\" was changed"); return true; } if (app_policy.second.cloud_transport_type.is_initialized() && app_policy.second.cloud_transport_type != snapshot_properties.second.cloud_transport_type) { - LOG4CXX_DEBUG(logger_, "\"cloud_transport_type\" was changed"); + SDL_LOG_DEBUG("\"cloud_transport_type\" was changed"); return true; } @@ -745,14 +741,14 @@ bool CheckAppPolicy::IsAppPropertiesChanged( bool CheckAppPolicy::IsEncryptionRequiredFlagChanged( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto get_app_encryption_needed = [](const std::string& policy_app_id, policy_table::ApplicationPolicies& policies) -> rpc::Optional<rpc::Boolean> { auto it = policies.find(policy_app_id); if (policies.end() == it) { - LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id); + SDL_LOG_WARN("App is not present in policies" << policy_app_id); return rpc::Optional<rpc::Boolean>(false); } return it->second.encryption_required; @@ -764,7 +760,7 @@ bool CheckAppPolicy::IsEncryptionRequiredFlagChanged( policy_table::Strings result; auto it = policies.find(policy_app_id); if (policies.end() == it) { - LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id); + SDL_LOG_WARN("App is not present in policies" << policy_app_id); return result; } auto& groups = it->second.groups; @@ -1193,7 +1189,7 @@ void FillFunctionalGroupPermissions( FunctionalGroupNames& names, GroupConsent state, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs::const_iterator it = ids.begin(); FunctionalGroupIDs::const_iterator it_end = ids.end(); for (; it != it_end; ++it) { @@ -1213,7 +1209,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) { FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, const FunctionalGroupIDs& what) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs from_copy(from); FunctionalGroupIDs what_copy(what); @@ -1235,7 +1231,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); @@ -1257,7 +1253,7 @@ FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOG4CXX_INFO(logger_, "Find same groups"); + SDL_LOG_INFO("Find same groups"); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); @@ -1281,7 +1277,7 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) { policy_table::ApplicationPolicies::iterator it_default = app_policies.find(kDefaultId); if (app_policies.end() == it_default) { - LOG4CXX_ERROR(logger_, "No default application policy found in PTU."); + SDL_LOG_ERROR("No default application policy found in PTU."); return false; } diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index 7314fc040d..773c689409 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -202,7 +202,7 @@ struct GroupSorter namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") PolicyManagerImpl::PolicyManagerImpl() : PolicyManager() @@ -253,15 +253,14 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse( } void PolicyManagerImpl::CheckTriggers() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool exceed_ignition_cycles = ExceededIgnitionCycles(); const bool exceed_days = ExceededDays(); - LOG4CXX_DEBUG( - logger_, - "\nDays exceeded: " << std::boolalpha << exceed_days - << "\nIgnition cycles exceeded: " << std::boolalpha - << exceed_ignition_cycles); + SDL_LOG_DEBUG("\nDays exceeded: " << std::boolalpha << exceed_days + << "\nIgnition cycles exceeded: " + << std::boolalpha + << exceed_ignition_cycles); if (exceed_ignition_cycles || exceed_days) { update_status_manager_.ScheduleUpdate(); @@ -464,15 +463,15 @@ void FilterPolicyTable( PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( const std::string& file, const BinaryMessage& pt_content) { - LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size()); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_INFO("LoadPT of size " << pt_content.size()); + SDL_LOG_DEBUG( + "PTU content is: " << std::string(pt_content.begin(), pt_content.end())); // Parse message into table struct std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content); if (!pt_update) { - LOG4CXX_WARN(logger_, "Parsed table pointer is NULL."); + SDL_LOG_WARN("Parsed table pointer is NULL."); return PtProcessingResult::kWrongPtReceived; } @@ -481,7 +480,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( FilterPolicyTable(pt_update->policy_table, current_vd_items); if (!IsPTValid(pt_update, policy_table::PT_UPDATE)) { - LOG4CXX_WARN(logger_, "Received policy table update is not valid"); + SDL_LOG_WARN("Received policy table update is not valid"); return PtProcessingResult::kWrongPtReceived; } @@ -491,8 +490,8 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( // Get current DB data, since it could be updated during awaiting of PTU auto policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed to create snapshot of policy table, trying another exchange"); return PtProcessingResult::kNewPtRequired; } @@ -507,8 +506,8 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( // Replace current data with updated if (!cache_->ApplyUpdate(*pt_update)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Unsuccessful save of updated policy table, trying another exchange"); return PtProcessingResult::kNewPtRequired; } @@ -531,10 +530,10 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( std::map<std::string, StringArray> app_hmi_types; cache_->GetHMIAppTypeAfterUpdate(app_hmi_types); if (!app_hmi_types.empty()) { - LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType"); + SDL_LOG_INFO("app_hmi_types is full calling OnUpdateHMIAppType"); listener_->OnUpdateHMIAppType(app_hmi_types); } else { - LOG4CXX_INFO(logger_, "app_hmi_types empty"); + SDL_LOG_INFO("app_hmi_types empty"); } std::vector<std::string> enabled_apps; @@ -547,11 +546,11 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( } void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ptu_requested_ = false; if (PtProcessingResult::kWrongPtReceived == ptu_result) { - LOG4CXX_DEBUG(logger_, "Wrong PT was received"); + SDL_LOG_DEBUG("Wrong PT was received"); update_status_manager_.OnWrongUpdateReceived(); return; } @@ -561,7 +560,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { if (HasApplicationForPTU()) { update_status_manager_.OnExistedApplicationAdded(true); } else if (PtProcessingResult::kNewPtRequired == ptu_result) { - LOG4CXX_DEBUG(logger_, "New PTU interation is required"); + SDL_LOG_DEBUG("New PTU interation is required"); ForcePTExchange(); return; } @@ -571,8 +570,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { // If there was a user request for policy table update, it should be started // right after current update is finished if (update_status_manager_.IsUpdateRequired()) { - LOG4CXX_DEBUG(logger_, - "PTU was successful and new PTU iteration was scheduled"); + SDL_LOG_DEBUG("PTU was successful and new PTU iteration was scheduled"); StartPTExchange(); return; } @@ -583,7 +581,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges( const std::shared_ptr<policy_table::Table> pt_update, const std::shared_ptr<policy_table::Table> snapshot) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Replace predefined policies with its actual setting, e.g. "123":"default" // to actual values of default section @@ -668,13 +666,13 @@ void PolicyManagerImpl::PrepareNotificationData( const policy_table::Strings& group_names, const std::vector<FunctionalGroupPermission>& group_permission, Permissions& notification_data) { - LOG4CXX_INFO(logger_, "Preparing data for notification."); + SDL_LOG_INFO("Preparing data for notification."); ProcessFunctionalGroup processor(groups, group_permission, notification_data); std::for_each(group_names.begin(), group_names.end(), processor); } std::string PolicyManagerImpl::GetUpdateUrl(int service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); EndpointUrls urls; GetUpdateUrls(service_type, urls); @@ -689,28 +687,28 @@ std::string PolicyManagerImpl::GetUpdateUrl(int service_type) { ++index; } else { - LOG4CXX_ERROR(logger_, "The endpoint entry is empty"); + SDL_LOG_ERROR("The endpoint entry is empty"); } return url; } void PolicyManagerImpl::GetUpdateUrls(const std::string& service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->GetUpdateUrls(service_type, out_end_points); } void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->GetUpdateUrls(service_type, out_end_points); } void PolicyManagerImpl::RequestPTUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { - LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); + SDL_LOG_ERROR("Failed to create snapshot of policy table"); return; } @@ -720,19 +718,19 @@ void PolicyManagerImpl::RequestPTUpdate() { writer_builder["indentation"] = ""; std::string message_string = Json::writeString(writer_builder, value); - LOG4CXX_DEBUG(logger_, "Snapshot contents is : " << message_string); + SDL_LOG_DEBUG("Snapshot contents is : " << message_string); BinaryMessage update(message_string.begin(), message_string.end()); ptu_requested_ = true; listener_->OnSnapshotCreated( update, RetrySequenceDelaysSeconds(), TimeoutExchangeMSec()); } else { - LOG4CXX_ERROR(logger_, "Invalid Policy table snapshot - PTUpdate failed"); + SDL_LOG_ERROR("Invalid Policy table snapshot - PTUpdate failed"); } } void PolicyManagerImpl::StartPTExchange() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (ignition_check) { CheckTriggers(); @@ -741,9 +739,9 @@ void PolicyManagerImpl::StartPTExchange() { if (update_status_manager_.IsAppsSearchInProgress() && update_status_manager_.IsUpdateRequired()) { - LOG4CXX_INFO(logger_, - "Starting exchange skipped, since applications " - "search is in progress."); + SDL_LOG_INFO( + "Starting exchange skipped, since applications " + "search is in progress."); return; } @@ -751,29 +749,29 @@ void PolicyManagerImpl::StartPTExchange() { if (trigger_ptu_) { update_status_manager_.ScheduleUpdate(); } - LOG4CXX_INFO(logger_, - "Starting exchange skipped, since another exchange " - "is in progress."); + SDL_LOG_INFO( + "Starting exchange skipped, since another exchange " + "is in progress."); return; } - LOG4CXX_INFO(logger_, "Policy want to call RequestPTUpdate"); + SDL_LOG_INFO("Policy want to call RequestPTUpdate"); if (listener_) { - LOG4CXX_INFO(logger_, "Listener CanUpdate"); + SDL_LOG_INFO("Listener CanUpdate"); if (update_status_manager_.IsUpdateRequired()) { update_status_manager_.PendingUpdate(); - LOG4CXX_INFO(logger_, "IsUpdateRequired"); + SDL_LOG_INFO("IsUpdateRequired"); RequestPTUpdate(); } } } void PolicyManagerImpl::OnAppsSearchStarted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.OnAppsSearchStarted(); } void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.OnAppsSearchCompleted(); trigger_ptu_ = trigger_ptu; @@ -802,13 +800,13 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes( RequestType::State PolicyManagerImpl::GetAppRequestTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetAppRequestTypesState(policy_app_id); } RequestSubType::State PolicyManagerImpl::GetAppRequestSubTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetAppRequestSubTypesState(policy_app_id); } @@ -890,7 +888,7 @@ void PolicyManagerImpl::GetAppServiceParameters( bool PolicyManagerImpl::UnknownRPCPassthroughAllowed( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->UnknownRPCPassthroughAllowed(policy_app_id); } @@ -900,18 +898,15 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, const PTString& rpc, const RPCParams& rpc_params, CheckPermissionResult& result) { - LOG4CXX_INFO(logger_, - "CheckPermissions for " << app_id << " and rpc " << rpc + SDL_LOG_INFO("CheckPermissions for " << app_id << " and rpc " << rpc << " for " << hmi_level << " level."); Permissions rpc_permissions; // Check, if there are calculated permission present in cache if (!cache_->IsPermissionsCalculated(device_id, app_id, rpc_permissions)) { - LOG4CXX_DEBUG(logger_, - "IsPermissionsCalculated for device: " - << device_id << " and app: " << app_id - << " returns false"); + SDL_LOG_DEBUG("IsPermissionsCalculated for device: " + << device_id << " and app: " << app_id << " returns false"); // Get actual application group permission according to user consents std::vector<FunctionalGroupPermission> app_group_permissions; GetPermissionsForApp(device_id, app_id, app_group_permissions); @@ -934,10 +929,8 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, cache_->AddCalculatedPermissions(device_id, app_id, rpc_permissions); } else { - LOG4CXX_DEBUG(logger_, - "IsPermissionsCalculated for device: " - << device_id << " and app: " << app_id - << " returns true"); + SDL_LOG_DEBUG("IsPermissionsCalculated for device: " + << device_id << " and app: " << app_id << " returns true"); } if (cache_->IsApplicationRevoked(app_id)) { @@ -952,7 +945,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, } const bool known_rpc = rpc_permissions.end() != rpc_permissions.find(rpc); - LOG4CXX_DEBUG(logger_, "Is known rpc " << (known_rpc ? "true" : "false")); + SDL_LOG_DEBUG("Is known rpc " << (known_rpc ? "true" : "false")); if (!known_rpc) { // RPC not found in list == disallowed by backend result.hmi_level_permitted = kRpcDisallowed; @@ -974,20 +967,19 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, rpc_permissions[rpc].hmi_permissions[kUserDisallowedKey].find( hmi_level)) { // RPC found in allowed == allowed by backend, but disallowed by user - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "RPC found in allowed == allowed by backend, but disallowed by user"); result.hmi_level_permitted = kRpcUserDisallowed; } else { - LOG4CXX_DEBUG(logger_, - "HMI level " << hmi_level << " wasn't found " + SDL_LOG_DEBUG("HMI level " << hmi_level << " wasn't found " << " for rpc " << rpc << " and appID " << app_id); return; } if (kRpcAllowed != result.hmi_level_permitted) { - LOG4CXX_DEBUG(logger_, "RPC is not allowed. Stop parameters processing."); + SDL_LOG_DEBUG("RPC is not allowed. Stop parameters processing."); result.list_of_allowed_params = rpc_permissions[rpc].parameter_permissions[kAllowedKey]; @@ -1003,7 +995,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, // permissions, so that flag is processed first if (rpc_permissions[rpc] .parameter_permissions.any_parameter_disallowed_by_user) { - LOG4CXX_DEBUG(logger_, "All parameters are disallowed by user."); + SDL_LOG_DEBUG("All parameters are disallowed by user."); result.list_of_disallowed_params = rpc_params; result.hmi_level_permitted = kRpcUserDisallowed; return; @@ -1011,14 +1003,14 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, if (rpc_permissions[rpc] .parameter_permissions.any_parameter_disallowed_by_policy) { - LOG4CXX_DEBUG(logger_, "All parameters are disallowed by policy."); + SDL_LOG_DEBUG("All parameters are disallowed by policy."); result.list_of_undefined_params = rpc_params; result.hmi_level_permitted = kRpcDisallowed; return; } if (rpc_permissions[rpc].parameter_permissions.any_parameter_allowed) { - LOG4CXX_DEBUG(logger_, "All parameters are allowed."); + SDL_LOG_DEBUG("All parameters are allowed."); result.list_of_allowed_params = rpc_params; return; } @@ -1041,8 +1033,7 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, RPCParams::const_iterator end = rpc_params.end(); for (; end != parameter; ++parameter) { if (!result.HasParameter(*parameter)) { - LOG4CXX_DEBUG(logger_, - "Parameter " << *parameter + SDL_LOG_DEBUG("Parameter " << *parameter << " is unknown." " Adding to undefined list."); result.list_of_undefined_params.insert(*parameter); @@ -1050,10 +1041,10 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, } if (result.DisallowedInclude(rpc_params)) { - LOG4CXX_DEBUG(logger_, "All parameters are disallowed."); + SDL_LOG_DEBUG("All parameters are disallowed."); result.hmi_level_permitted = kRpcUserDisallowed; } else if (!result.IsAnyAllowed(rpc_params)) { - LOG4CXX_DEBUG(logger_, "There are no parameters allowed."); + SDL_LOG_DEBUG("There are no parameters allowed."); if (!result.list_of_undefined_params.empty()) { result.hmi_level_permitted = kRpcAllowed; @@ -1079,12 +1070,12 @@ policy_table::Strings PolicyManagerImpl::GetGroupsNames( void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( const std::string& device_id, const std::string& application_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (device_id.empty()) { - LOG4CXX_WARN(logger_, - "Couldn't find device info for application id " - "'" << application_id - << "'"); + SDL_LOG_WARN( + "Couldn't find device info for application id " + "'" + << application_id << "'"); return; } @@ -1102,8 +1093,7 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( app_group_permissions, notification_data); - LOG4CXX_INFO(logger_, - "Send notification for application_id:" << application_id); + SDL_LOG_INFO("Send notification for application_id:" << application_id); const ApplicationOnDevice who = {device_id, application_id}; if (access_remote_->IsAppRemoteControl(who)) { @@ -1120,27 +1110,27 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( } bool PolicyManagerImpl::CleanupUnpairedDevices() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->CleanupUnpairedDevices(); } DeviceConsent PolicyManagerImpl::GetUserConsentForDevice( const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetDeviceConsent(device_id); } void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id, const bool is_allowed) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device :" << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device :" << device_id); cache_->SetDeviceConsent(device_id, is_allowed); if (listener_) { listener_->OnDeviceConsentChanged(device_id, is_allowed); } else { - LOG4CXX_WARN(logger_, - "Event listener is not initialized. " - "Can't call OnDeviceConsentChanged"); + SDL_LOG_WARN( + "Event listener is not initialized. " + "Can't call OnDeviceConsentChanged"); } if (is_allowed && listener_->CanUpdate()) { update_status_manager_.OnDeviceConsented(); @@ -1194,7 +1184,7 @@ bool PolicyManagerImpl::ReactOnUserDevConsentForApp( bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, StringArray* nicknames, StringArray* app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool result = nicknames && app_hmi_types; if (result) { cache_->GetInitialAppData(application_id, *nicknames, *app_hmi_types); @@ -1204,23 +1194,23 @@ bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, void PolicyManagerImpl::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device: " << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device: " << device_id); if (!cache_->AddDevice(device_id, connection_type)) { - LOG4CXX_WARN(logger_, "Can't add device."); + SDL_LOG_WARN("Can't add device."); } } void PolicyManagerImpl::OnLocalAppAdded() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.ScheduleUpdate(); StartPTExchange(); } void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id, const DeviceInfo& device_info) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device :" << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device :" << device_id); if (!cache_->SetDeviceData(device_id, device_info.hardware, device_info.firmware_rev, @@ -1229,7 +1219,7 @@ void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id, device_info.carrier, device_info.max_number_rfcom_ports, device_info.connection_type)) { - LOG4CXX_WARN(logger_, "Can't set device data."); + SDL_LOG_WARN("Can't set device data."); } } @@ -1270,19 +1260,18 @@ PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent( void PolicyManagerImpl::CheckPendingPermissionsChanges( const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& current_permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(app_permissions_diff_lock_); PendingPermissions::iterator it_pending = app_permissions_diff_.find(policy_app_id); if (app_permissions_diff_.end() == it_pending) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "No pending permissions had been found for appID: " << policy_app_id); return; } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Pending permissions had been found for appID: " << policy_app_id); // Change appPermissionsConsentNeeded depending on unconsented groups @@ -1294,16 +1283,16 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges( for (; it_groups != it_end_groups; ++it_groups) { if (policy::kGroupUndefined == it_groups->state) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Unconsented groups still present for appID: " << policy_app_id); it_pending->second.appPermissionsConsentNeeded = true; return; } } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Unconsented groups not present anymore for appID: " << policy_app_id); it_pending->second.appPermissionsConsentNeeded = false; return; @@ -1313,7 +1302,7 @@ void PolicyManagerImpl::NotifyPermissionsChanges( const std::string& device_id, const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& app_group_permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Get current functional groups from DB with RPC permissions policy_table::FunctionalGroupings functional_groups; cache_->GetFunctionalGroupings(functional_groups); @@ -1331,7 +1320,7 @@ void PolicyManagerImpl::NotifyPermissionsChanges( void PolicyManagerImpl::SetUserConsentForApp( const PermissionConsent& permissions, const NotificationMode mode) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->ResetCalculatedPermissions(); PermissionConsent verified_permissions = @@ -1340,20 +1329,19 @@ void PolicyManagerImpl::SetUserConsentForApp( bool app_permissions_changed = false; if (!cache_->SetUserPermissionsForApp(verified_permissions, &app_permissions_changed)) { - LOG4CXX_WARN(logger_, "Can't set user permissions for application."); + SDL_LOG_WARN("Can't set user permissions for application."); return; } if (kSilentMode == mode) { - LOG4CXX_WARN(logger_, - "Silent mode is enabled. Application won't be informed."); + SDL_LOG_WARN("Silent mode is enabled. Application won't be informed."); return; } if (!app_permissions_changed) { - LOG4CXX_WARN(logger_, - "Application already has same consents. " - "Notificaton won't be sent."); + SDL_LOG_WARN( + "Application already has same consents. " + "Notificaton won't be sent."); return; } @@ -1371,30 +1359,28 @@ void PolicyManagerImpl::SetUserConsentForApp( } bool PolicyManagerImpl::IsAllowedRetryCountExceeded() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); return retry_sequence_index_ >= retry_sequence_seconds_.size(); } void PolicyManagerImpl::IncrementRetryIndex() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); if (!is_ptu_in_progress_) { - LOG4CXX_TRACE(logger_, - "First PTU iteration, skipping incrementing retry index"); + SDL_LOG_TRACE("First PTU iteration, skipping incrementing retry index"); is_ptu_in_progress_ = true; return; } ++retry_sequence_index_; - LOG4CXX_DEBUG(logger_, - "current retry_sequence_index_ is: " << retry_sequence_index_); + SDL_LOG_DEBUG("current retry_sequence_index_ is: " << retry_sequence_index_); } void PolicyManagerImpl::RetrySequenceFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); listener_->OnPTUFinished(false); ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate); @@ -1407,7 +1393,7 @@ void PolicyManagerImpl::RetrySequenceFailed() { } void PolicyManagerImpl::ResetTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (update_status_manager_.IsUpdatePending()) { uint32_t update_timeout = TimeoutExchangeMSec(); update_status_manager_.ResetTimeout(update_timeout); @@ -1415,14 +1401,14 @@ void PolicyManagerImpl::ResetTimeout() { } void PolicyManagerImpl::OnSystemRequestReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); IncrementRetryIndex(); } bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id, const std::string& policy_app_id, std::string* default_hmi) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeviceConsent device_consent = GetUserConsentForDevice(device_id); const std::string app_id = policy::kDeviceAllowed != device_consent ? kPreDataConsentId @@ -1432,9 +1418,9 @@ bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id, bool PolicyManagerImpl::GetPriority(const std::string& policy_app_id, std::string* priority) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!priority) { - LOG4CXX_WARN(logger_, "Input priority parameter is null."); + SDL_LOG_WARN("Input priority parameter is null."); return false; } @@ -1453,12 +1439,11 @@ void PolicyManagerImpl::GetUserConsentForApp( const std::string& device_id, const std::string& policy_app_id, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalIdType group_types; if (!cache_->GetPermissionsForApp(device_id, policy_app_id, group_types)) { - LOG4CXX_WARN(logger_, - "Can't get user permissions for app " << policy_app_id); + SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id); return; } @@ -1466,7 +1451,7 @@ void PolicyManagerImpl::GetUserConsentForApp( // automatically allowed and it could not be changed by user FunctionalGroupNames group_names; if (!cache_->GetFunctionalGroupNames(group_names)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return; } @@ -1516,12 +1501,11 @@ void PolicyManagerImpl::GetPermissionsForApp( const std::string& device_id, const std::string& policy_app_id, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string app_id_to_check = policy_app_id; if (!cache_->IsApplicationRepresented(policy_app_id)) { - LOG4CXX_WARN(logger_, - "Application with id " << policy_app_id + SDL_LOG_WARN("Application with id " << policy_app_id << " is not found within known apps."); return; } @@ -1544,8 +1528,7 @@ void PolicyManagerImpl::GetPermissionsForApp( cache_->GetPermissionsForApp(device_id, app_id_to_check, group_types); if (!ret) { - LOG4CXX_WARN(logger_, - "Can't get user permissions for app " << policy_app_id); + SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id); return; } @@ -1553,14 +1536,14 @@ void PolicyManagerImpl::GetPermissionsForApp( // automatically allowed and it could not be changed by user FunctionalGroupNames group_names; if (!cache_->GetFunctionalGroupNames(group_names)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return; } // The "default" and "pre_DataConsent" are auto-allowed groups // So, check if application in the one of these mode. if (allowed_by_default) { - LOG4CXX_INFO(logger_, "Get auto allowed groups"); + SDL_LOG_INFO("Get auto allowed groups"); GroupType type = (kDefaultId == app_id_to_check ? kTypeDefault : kTypePreDataConsented); @@ -1619,7 +1602,7 @@ void PolicyManagerImpl::GetPermissionsForApp( std::string& PolicyManagerImpl::GetCurrentDeviceId( const transport_manager::DeviceHandle& device_handle, const std::string& policy_app_id) const { - LOG4CXX_INFO(logger_, "GetDeviceInfo"); + SDL_LOG_INFO("GetDeviceInfo"); last_device_id_ = listener()->OnCurrentDeviceIdUpdateRequired(device_handle, policy_app_id); return last_device_id_; @@ -1630,25 +1613,25 @@ void PolicyManagerImpl::SetSystemLanguage(const std::string& language) { } void PolicyManagerImpl::SetPreloadedPtFlag(const bool is_preloaded) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetPreloadedPtFlag(is_preloaded); } void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetMetaInfo(ccpu_version, wers_country_code, language); } std::string PolicyManagerImpl::GetCCPUVersionFromPT() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetCCPUVersionFromPT(); } uint32_t PolicyManagerImpl::GetNotificationsNumber(const std::string& priority, const bool is_subtle) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetNotificationsNumber(priority, is_subtle); } @@ -1661,10 +1644,10 @@ bool PolicyManagerImpl::IsPTValid( policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { - LOG4CXX_ERROR(logger_, "Policy table is not valid."); + SDL_LOG_ERROR("Policy table is not valid."); rpc::ValidationReport report("policy_table"); policy_table->ReportErrors(&report); - LOG4CXX_DEBUG(logger_, "Errors: " << rpc::PrettyFormat(report)); + SDL_LOG_DEBUG("Errors: " << rpc::PrettyFormat(report)); return false; } return true; @@ -1685,12 +1668,12 @@ void PolicyManagerImpl::UpdateAppConsentWithExternalConsent( const GroupsNames& allowed_groups, const GroupsNames& disallowed_groups, const ConsentProcessingPolicy processing_policy) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (allowed_groups.empty() && disallowed_groups.empty()) { - LOG4CXX_DEBUG(logger_, - "Allowed and disallowed groups are empty, skipping update by " - "external user consent."); + SDL_LOG_DEBUG( + "Allowed and disallowed groups are empty, skipping update by " + "external user consent."); return; } @@ -1733,12 +1716,12 @@ void PolicyManagerImpl::UpdateAppConsentWithExternalConsent( void PolicyManagerImpl::SendOnAppPropertiesChangeNotification( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); listener_->SendOnAppPropertiesChangeNotification(policy_app_id); } void PolicyManagerImpl::ResumePendingAppPolicyActions() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (auto& notify_system_params : notify_system_list_) { NotifySystem(notify_system_params.first, notify_system_params.second); @@ -1768,8 +1751,7 @@ void PolicyManagerImpl::SendPermissionsToApp( const std::string app_id = app_policy.first; if (device_id.empty()) { - LOG4CXX_WARN(logger_, - "Couldn't find device info for application id: " << app_id); + SDL_LOG_WARN("Couldn't find device info for application id: " << app_id); return; } std::vector<FunctionalGroupPermission> group_permissons; @@ -1787,7 +1769,7 @@ void PolicyManagerImpl::SendPermissionsToApp( group_permissons, notification_data); - LOG4CXX_INFO(logger_, "Send notification for application_id: " << app_id); + SDL_LOG_INFO("Send notification for application_id: " << app_id); listener()->OnPermissionsUpdated( device_id, app_id, @@ -1834,7 +1816,7 @@ bool ConsentStatusComparatorFunc(const ExternalConsentStatusItem& i1, bool PolicyManagerImpl::IsNeedToUpdateExternalConsentStatus( const ExternalConsentStatus& new_status) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); typedef std::vector<ExternalConsentStatusItem> ItemV; const ExternalConsentStatus existing_status = cache_->GetExternalConsentEntities(); @@ -1859,15 +1841,15 @@ bool PolicyManagerImpl::IsNeedToUpdateExternalConsentStatus( bool PolicyManagerImpl::SetExternalConsentStatus( const ExternalConsentStatus& status) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (status.empty()) { - LOG4CXX_INFO(logger_, "External consent status is empty, skipping update."); + SDL_LOG_INFO("External consent status is empty, skipping update."); return false; } if (!cache_->SetExternalConsentStatus(status)) { - LOG4CXX_WARN(logger_, "Can't set external user consent status."); + SDL_LOG_WARN("Can't set external user consent status."); return false; } @@ -1880,7 +1862,7 @@ bool PolicyManagerImpl::SetExternalConsentStatus( } ExternalConsentStatus PolicyManagerImpl::GetExternalConsentStatus() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetExternalConsentStatus(); } @@ -1888,7 +1870,7 @@ void PolicyManagerImpl::CalculateGroupsConsentFromExternalConsent( const GroupsByExternalConsentStatus& groups_by_external_consent, GroupsNames& out_allowed_groups, GroupsNames& out_disallowed_groups) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GroupSorter sorter(out_allowed_groups, out_disallowed_groups); std::for_each(groups_by_external_consent.begin(), groups_by_external_consent.end(), @@ -1906,7 +1888,7 @@ void PolicyManagerImpl::CalculateGroupsConsentFromExternalConsent( } bool PolicyManagerImpl::ExceededDays() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); date_time::TimeDuration current_time = date_time::getCurrentTime(); const int kSecondsInDay = 60 * 60 * 24; @@ -1915,16 +1897,16 @@ bool PolicyManagerImpl::ExceededDays() { DCHECK(std::numeric_limits<uint16_t>::max() >= days); if (std::numeric_limits<uint16_t>::max() <= days) { - LOG4CXX_WARN(logger_, "The days since epoch exceeds maximum value."); + SDL_LOG_WARN("The days since epoch exceeds maximum value."); return false; } return 0 == cache_->DaysBeforeExchange(static_cast<uint16_t>(days)); } void PolicyManagerImpl::KmsChanged(int kilometers) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (0 == cache_->KilometersBeforeExchange(kilometers)) { - LOG4CXX_INFO(logger_, "Enough kilometers passed to send for PT update."); + SDL_LOG_INFO("Enough kilometers passed to send for PT update."); update_status_manager_.ScheduleUpdate(); StartPTExchange(); PTUpdatedAt(KILOMETERS, kilometers); @@ -1933,14 +1915,14 @@ void PolicyManagerImpl::KmsChanged(int kilometers) { const boost::optional<bool> PolicyManagerImpl::LockScreenDismissalEnabledState() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->LockScreenDismissalEnabledState(); } const boost::optional<std::string> PolicyManagerImpl::LockScreenDismissalWarningMessage( const std::string& language) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->LockScreenDismissalWarningMessage(language); } @@ -1955,7 +1937,7 @@ std::string PolicyManagerImpl::ForcePTExchange() { } void policy::PolicyManagerImpl::StopRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cache_->UpdateRequired()) { ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate); @@ -1963,7 +1945,7 @@ void policy::PolicyManagerImpl::StopRetrySequence() { } std::string PolicyManagerImpl::ForcePTExchangeAtUserRequest() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.ScheduleManualUpdate(); StartPTExchange(); return update_status_manager_.StringifiedUpdateStatus(); @@ -1975,7 +1957,7 @@ std::string PolicyManagerImpl::GetPolicyTableStatus() const { int PolicyManagerImpl::NextRetryTimeout() { sync_primitives::AutoLock auto_lock(retry_sequence_lock_); - LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_); + SDL_LOG_DEBUG("Index: " << retry_sequence_index_); int next = 0; if (!retry_sequence_seconds_.empty() && @@ -1995,7 +1977,7 @@ void PolicyManagerImpl::RefreshRetrySequence() { void PolicyManagerImpl::ResetRetrySequence( const ResetRetryCountType reset_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); retry_sequence_index_ = 0; is_ptu_in_progress_ = false; @@ -2014,15 +1996,14 @@ const std::vector<int> PolicyManagerImpl::RetrySequenceDelaysSeconds() { } void PolicyManagerImpl::OnExceededTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.OnUpdateTimeoutOccurs(); } void PolicyManagerImpl::OnUpdateStarted() { uint32_t update_timeout = TimeoutExchangeMSec(); - LOG4CXX_DEBUG(logger_, - "Update timeout will be set to (milisec): " << update_timeout); + SDL_LOG_DEBUG("Update timeout will be set to (milisec): " << update_timeout); send_on_update_sent_out_ = policy::kUpdating != update_status_manager_.StringifiedUpdateStatus(); @@ -2033,33 +2014,33 @@ void PolicyManagerImpl::OnUpdateStarted() { } void PolicyManagerImpl::PTUpdatedAt(Counters counter, int value) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetCountersPassedForSuccessfulUpdate(counter, value); cache_->ResetIgnitionCycles(); } void PolicyManagerImpl::Increment(usage_statistics::GlobalCounterId type) { - LOG4CXX_INFO(logger_, "Increment without app id"); + SDL_LOG_INFO("Increment without app id"); cache_->Increment(type); } void PolicyManagerImpl::Increment(const std::string& app_id, usage_statistics::AppCounterId type) { - LOG4CXX_DEBUG(logger_, "Increment " << app_id << " AppCounter: " << type); + SDL_LOG_DEBUG("Increment " << app_id << " AppCounter: " << type); cache_->Increment(app_id, type); } void PolicyManagerImpl::Set(const std::string& app_id, usage_statistics::AppInfoId type, const std::string& value) { - LOG4CXX_INFO(logger_, "Set " << app_id); + SDL_LOG_INFO("Set " << app_id); cache_->Set(app_id, type, value); } void PolicyManagerImpl::Add(const std::string& app_id, usage_statistics::AppStopwatchId type, int32_t timespan_seconds) { - LOG4CXX_INFO(logger_, "Add " << app_id); + SDL_LOG_INFO("Add " << app_id); cache_->Add(app_id, type, timespan_seconds); } @@ -2069,9 +2050,9 @@ bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const { bool PolicyManagerImpl::IsConsentNeeded(const std::string& device_id, const std::string& app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const int count = cache_->CountUnconsentedGroups(app_id, device_id); - LOG4CXX_DEBUG(logger_, "There are: " << count << " unconsented groups."); + SDL_LOG_DEBUG("There are: " << count << " unconsented groups."); return count != 0; } @@ -2113,7 +2094,7 @@ bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) const { void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) { if (!cache_->SetUnpairedDevice(device_id)) { - LOG4CXX_DEBUG(logger_, "Could not set unpaired flag for " << device_id); + SDL_LOG_DEBUG("Could not set unpaired flag for " << device_id); return; } SetUserConsentForDevice(device_id, false); @@ -2129,17 +2110,17 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile( void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->OnDeviceSwitching(device_id_from, device_id_to); } const MetaInfo PolicyManagerImpl::GetMetaInfo() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetMetaInfo(); } std::string PolicyManagerImpl::RetrieveCertificate() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetCertificate(); } @@ -2149,12 +2130,12 @@ bool PolicyManagerImpl::HasCertificate() const { void PolicyManagerImpl::SetDecryptedCertificate( const std::string& certificate) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetDecryptedCertificate(certificate); } AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const AppIdURL next_app_url = RetrySequenceUrl(retry_sequence_url_, urls); @@ -2216,19 +2197,18 @@ StatusNotifier PolicyManagerImpl::AddApplication( const std::string& device_id, const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto device_consent = GetUserConsentForDevice(device_id); - LOG4CXX_DEBUG(logger_, - "check_device_id: " << device_id << " check_device_consent: " + SDL_LOG_DEBUG("check_device_id: " << device_id << " check_device_consent: " << device_consent); sync_primitives::AutoLock lock(apps_registration_lock_); if (IsNewApplication(application_id)) { - LOG4CXX_DEBUG(logger_, "Adding new application"); + SDL_LOG_DEBUG("Adding new application"); AddNewApplication(device_id, application_id, device_consent); return std::make_shared<CallStatusChange>(update_status_manager_, device_consent); } - LOG4CXX_DEBUG(logger_, "Promote existed application"); + SDL_LOG_DEBUG("Promote existed application"); PromoteExistedApplication(device_id, application_id, device_consent); if (!ptu_requested_) { update_status_manager_.OnExistedApplicationAdded(cache_->UpdateRequired()); @@ -2243,7 +2223,7 @@ void PolicyManagerImpl::RemoveAppConsentForGroup( bool PolicyManagerImpl::IsPredataPolicy( const std::string& policy_app_id) const { - LOG4CXX_INFO(logger_, "IsPredataApp"); + SDL_LOG_INFO("IsPredataApp"); return cache_->IsPredataPolicy(policy_app_id); } @@ -2260,7 +2240,7 @@ void PolicyManagerImpl::ProcessExternalConsentStatusForApp( CalculateGroupsConsentFromExternalConsent( groups_by_status, allowed_groups, disallowed_groups); - LOG4CXX_DEBUG(logger_, "check device_id: " << device_id); + SDL_LOG_DEBUG("check device_id: " << device_id); UpdateAppConsentWithExternalConsent(device_id, application_id, allowed_groups, @@ -2271,20 +2251,20 @@ void PolicyManagerImpl::ProcessExternalConsentStatusForApp( void PolicyManagerImpl::AddNewApplication(const std::string& device_id, const std::string& application_id, DeviceConsent device_consent) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (kDeviceHasNoConsent == device_consent || kDeviceDisallowed == device_consent) { - LOG4CXX_INFO(logger_, - "Setting " - << policy::kPreDataConsentId - << " permissions for application id: " << application_id); + SDL_LOG_INFO( + + "Setting " << policy::kPreDataConsentId + << " permissions for application id: " << application_id); cache_->SetPredataPolicy(application_id); } else { - LOG4CXX_INFO(logger_, - "Setting " - << policy::kDefaultId - << " permissions for application id: " << application_id); + SDL_LOG_INFO( + + "Setting " << policy::kDefaultId + << " permissions for application id: " << application_id); cache_->SetDefaultPolicy(application_id); } @@ -2300,16 +2280,15 @@ void PolicyManagerImpl::PromoteExistedApplication( DeviceConsent device_consent) { // If device consent changed to allowed during application being // disconnected, app permissions should be changed also - LOG4CXX_DEBUG(logger_, - "kDeviceAllowed == device_consent: " - << (kDeviceAllowed == device_consent) - << " device_consent: " << device_consent); + SDL_LOG_DEBUG("kDeviceAllowed == device_consent: " + << (kDeviceAllowed == device_consent) + << " device_consent: " << device_consent); if (kDeviceAllowed == device_consent && cache_->IsPredataPolicy(application_id)) { - LOG4CXX_INFO(logger_, - "Setting " - << policy::kDefaultId - << " permissions for application id: " << application_id); + SDL_LOG_INFO( + + "Setting " << policy::kDefaultId + << " permissions for application id: " << application_id); cache_->SetDefaultPolicy(application_id); } ProcessExternalConsentStatusForApp( @@ -2322,7 +2301,7 @@ bool PolicyManagerImpl::IsNewApplication( } bool PolicyManagerImpl::ResetPT(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->ResetCalculatedPermissions(); const bool result = cache_->ResetPT(file_name); if (result) { @@ -2332,19 +2311,17 @@ bool PolicyManagerImpl::ResetPT(const std::string& file_name) { } bool PolicyManagerImpl::CheckAppStorageFolder() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string app_storage_folder = get_settings().app_storage_folder(); - LOG4CXX_DEBUG(logger_, "AppStorageFolder " << app_storage_folder); + SDL_LOG_DEBUG("AppStorageFolder " << app_storage_folder); if (!file_system::DirectoryExists(app_storage_folder)) { - LOG4CXX_WARN(logger_, - "Storage directory doesn't exist " << app_storage_folder); + SDL_LOG_WARN("Storage directory doesn't exist " << app_storage_folder); return false; } if (!(file_system::IsWritingAllowed(app_storage_folder) && file_system::IsReadingAllowed(app_storage_folder))) { - LOG4CXX_WARN(logger_, - "Storage directory doesn't have read/write permissions " - << app_storage_folder); + SDL_LOG_WARN("Storage directory doesn't have read/write permissions " + << app_storage_folder); return false; } return true; @@ -2352,10 +2329,10 @@ bool PolicyManagerImpl::CheckAppStorageFolder() const { bool PolicyManagerImpl::InitPT(const std::string& file_name, const PolicySettings* settings) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); settings_ = settings; if (!CheckAppStorageFolder()) { - LOG4CXX_ERROR(logger_, "Can not read/write into AppStorageFolder"); + SDL_LOG_ERROR("Can not read/write into AppStorageFolder"); return false; } const bool ret = cache_->Init(file_name, settings); @@ -2375,7 +2352,7 @@ uint32_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const { } void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!is_update_needed) { ResetRetrySequence(ResetRetryCountType::kResetInternally); @@ -2402,7 +2379,7 @@ void PolicyManagerImpl::SetDefaultHmiTypes( const transport_manager::DeviceHandle& device_handle, const std::string& application_id, const std::vector<int>& hmi_types) { - LOG4CXX_INFO(logger_, "SetDefaultHmiTypes"); + SDL_LOG_INFO("SetDefaultHmiTypes"); const auto device_id = GetCurrentDeviceId(device_handle, application_id); ApplicationOnDevice who = {device_id, application_id}; access_remote_->SetDefaultHmiTypes(who, hmi_types); @@ -2416,7 +2393,7 @@ struct HMITypeToInt { bool PolicyManagerImpl::GetHMITypes(const std::string& application_id, std::vector<int>* app_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cache_->IsDefaultPolicy(application_id)) { return false; } @@ -2433,7 +2410,7 @@ bool PolicyManagerImpl::GetHMITypes(const std::string& application_id, bool PolicyManagerImpl::CheckModule(const PTString& app_id, const PTString& module) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::ModuleType module_type; return EnumFromJsonString(module, &module_type) && access_remote_->CheckModuleType(app_id, module_type); @@ -2444,16 +2421,15 @@ void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) { if (GetDefaultHmi(who.dev_id, who.app_id, &default_hmi)) { listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi); } else { - LOG4CXX_WARN( - logger_, - "Couldn't get default HMI level for application " << who.app_id); + SDL_LOG_WARN("Couldn't get default HMI level for application " + << who.app_id); } } void PolicyManagerImpl::GetPermissions(const std::string device_id, const std::string application_id, Permissions* data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(data); std::vector<FunctionalGroupPermission> app_group_permissions; GetPermissionsForApp(device_id, application_id, app_group_permissions); @@ -2528,7 +2504,7 @@ const rpc::Optional<rpc::Boolean> PolicyManagerImpl::GetAppEncryptionRequired( const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace rpc::policy_table_interface_base; DCHECK(kDeviceId != policy_app_id); @@ -2548,7 +2524,7 @@ const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp( const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<std::string> policy_app_ids; const auto apps = cache_->GetPolicyAppIDs(); @@ -2562,14 +2538,14 @@ const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs() bool PolicyManagerImpl::FunctionGroupNeedEncryption( const std::string& policy_group) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupings functional_groupings; cache_->GetFunctionalGroupings(functional_groupings); const auto& grouping_itr = functional_groupings.find(policy_group); if (grouping_itr == functional_groupings.end()) { - LOG4CXX_WARN(logger_, "Group " << policy_group << " not found"); + SDL_LOG_WARN("Group " << policy_group << " not found"); return false; } @@ -2582,7 +2558,7 @@ bool PolicyManagerImpl::FunctionGroupNeedEncryption( const std::string PolicyManagerImpl::GetPolicyFunctionName( const uint32_t function_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return policy_table::EnumToJsonString( static_cast<policy_table::FunctionID>(function_id)); } @@ -2605,12 +2581,13 @@ const std::vector<std::string> PolicyManagerImpl::GetRPCsForFunctionGroup( } // namespace policy -__attribute__((visibility("default"))) policy::PolicyManager* CreateManager() { +__attribute__((visibility("default"))) policy::PolicyManager* CreateManager( + logger::Logger* logger_instance) { + logger::Logger::instance(logger_instance); return new policy::PolicyManagerImpl(); } __attribute__((visibility("default"))) void DeleteManager( policy::PolicyManager* pm) { delete pm; - DELETE_THREAD_LOGGER(policy::logger_); } diff --git a/src/components/policy/policy_external/src/policy_table.cc b/src/components/policy/policy_external/src/policy_table.cc index 8ca6b698d1..7d82e8b635 100644 --- a/src/components/policy/policy_external/src/policy_table.cc +++ b/src/components/policy/policy_external/src/policy_table.cc @@ -38,7 +38,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") PolicyTable::PolicyTable() : pt_data_(new SQLPTExtRepresentation()) {} @@ -46,7 +46,7 @@ PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { - LOG4CXX_INFO(logger_, "Destroying policy table."); + SDL_LOG_INFO("Destroying policy table."); } } // namespace policy diff --git a/src/components/policy/policy_external/src/policy_table/validation.cc b/src/components/policy/policy_external/src/policy_table/validation.cc index 12a79748d7..89c5992fab 100644 --- a/src/components/policy/policy_external/src/policy_table/validation.cc +++ b/src/components/policy/policy_external/src/policy_table/validation.cc @@ -14,7 +14,7 @@ bool IsPredefinedApplication(const std::string& app_id) { namespace rpc { namespace policy_table_interface_base { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") bool VerifyPredefinedApp(ApplicationPolicies::value_type& app_policies) { const std::string& app_id = app_policies.first; @@ -25,18 +25,17 @@ bool VerifyPredefinedApp(ApplicationPolicies::value_type& app_policies) { RequestTypes& predefined_request_types = *app_policies.second.RequestType; if (!predefined_request_types.is_valid()) { - LOG4CXX_WARN(logger_, - app_id << " policy invalid RequestTypes will be cleaned."); + SDL_LOG_WARN(app_id << " policy invalid RequestTypes will be cleaned."); predefined_request_types.CleanUp(); if (PT_PRELOADED == app_policies.second.GetPolicyTableType() && predefined_request_types.is_cleaned_up()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + app_id << " policy RequestTypes is empty after clean-up. Exiting."); return false; } - LOG4CXX_WARN(logger_, app_id << " request types have cleaned up."); + SDL_LOG_WARN(app_id << " request types have cleaned up."); } return true; } @@ -56,13 +55,13 @@ bool ApplicationPoliciesSection::Validate() const { // Default and PreData policies are mandatory if (apps.end() == it_default_policy || apps.end() == it_pre_data_policy) { - LOG4CXX_ERROR(logger_, "Default or preData policy is not present."); + SDL_LOG_ERROR("Default or preData policy is not present."); return false; } // Device policy is mandatory if (!device.is_initialized()) { - LOG4CXX_ERROR(logger_, "Device policy is not present."); + SDL_LOG_ERROR("Device policy is not present."); return false; } @@ -89,52 +88,48 @@ bool ApplicationPoliciesSection::Validate() const { continue; } - LOG4CXX_TRACE(logger_, "Checking app Request Types..."); + SDL_LOG_TRACE("Checking app Request Types..."); RequestTypes& app_request_types = *iter->second.RequestType; if (app_request_types.is_omitted()) { - LOG4CXX_WARN(logger_, - "RequestTypes omitted for " - << app_id << " Will be replaced with default."); + SDL_LOG_WARN("RequestTypes omitted for " + << app_id << " Will be replaced with default."); app_request_types = *apps[kDefaultApp].RequestType; ++iter; continue; } if (!app_request_types.is_valid()) { - LOG4CXX_WARN( - logger_, - "Invalid RequestTypes for " << app_id << " Will be cleaned up."); + SDL_LOG_WARN("Invalid RequestTypes for " << app_id + << " Will be cleaned up."); app_request_types.CleanUp(); if (app_request_types.is_cleaned_up()) { if (PT_PRELOADED == pt_type) { - LOG4CXX_ERROR(logger_, - "RequestTypes empty after clean-up for " - << app_id << " Exiting."); + SDL_LOG_ERROR("RequestTypes empty after clean-up for " + << app_id << " Exiting."); return false; } - LOG4CXX_WARN(logger_, - "RequestTypes empty after clean-up for " - << app_id << " Will be replaced with default."); + SDL_LOG_WARN("RequestTypes empty after clean-up for " + << app_id << " Will be replaced with default."); app_request_types = *apps[kDefaultApp].RequestType; } - LOG4CXX_DEBUG(logger_, "Clean up for " << app_id << " is done."); + SDL_LOG_DEBUG("Clean up for " << app_id << " is done."); ++iter; continue; } if (app_request_types.is_empty()) { - LOG4CXX_WARN(logger_, "RequestTypes is empty for " << app_id); + SDL_LOG_WARN("RequestTypes is empty for " << app_id); } ++iter; } - LOG4CXX_TRACE(logger_, "Checking app Request SubTypes..."); + SDL_LOG_TRACE("Checking app Request SubTypes..."); iter = apps.begin(); while (iter != end_iter) { if (it_default_policy == iter || it_pre_data_policy == iter) { @@ -146,9 +141,9 @@ bool ApplicationPoliciesSection::Validate() const { !app_params.RequestSubType.is_initialized(); if (is_request_subtype_omitted) { - LOG4CXX_WARN(logger_, - "App policy RequestSubTypes omitted." - " Will be replaced with default."); + SDL_LOG_WARN( + "App policy RequestSubTypes omitted." + " Will be replaced with default."); app_params.RequestSubType = apps[kDefaultApp].RequestSubType; ++iter; continue; @@ -156,7 +151,7 @@ bool ApplicationPoliciesSection::Validate() const { const bool is_request_subtype_empty = app_params.RequestSubType->empty(); if (is_request_subtype_empty) { - LOG4CXX_WARN(logger_, "App policy RequestSubTypes empty."); + SDL_LOG_WARN("App policy RequestSubTypes empty."); } ++iter; } @@ -260,8 +255,7 @@ bool ModuleConfig::Validate() const { ++it_endpoints) { const URLList& endpoint_list = it_endpoints->second; if (endpoint_list.end() == endpoint_list.find(kDefaultApp)) { - LOG4CXX_ERROR(logger_, - "Endpoint " << it_endpoints->first + SDL_LOG_ERROR("Endpoint " << it_endpoints->first << "does not contain default group"); return false; } @@ -332,8 +326,8 @@ bool VehicleDataItem::Validate() const { }; if (!ValidateTypes()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Unknown type: " << std::string(type) << " of " << std::string(key)); return false; } diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc index c8a1b5d7ea..05b45e5f1c 100644 --- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc @@ -41,7 +41,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") SQLPTExtRepresentation::SQLPTExtRepresentation() {} SQLPTExtRepresentation::SQLPTExtRepresentation(bool in_memory) @@ -76,7 +76,7 @@ bool SQLPTExtRepresentation::ResetUserConsent() { bool SQLPTExtRepresentation::ResetDeviceConsents() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kResetDeviceConsents)) { - LOG4CXX_WARN(logger_, "Incorrect delete statement from device_consents."); + SDL_LOG_WARN("Incorrect delete statement from device_consents."); return false; } return query.Exec(); @@ -90,10 +90,10 @@ bool SQLPTExtRepresentation::GetUserPermissionsForDevice( const std::string& device_id, StringArray* consented_groups, StringArray* disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) { - LOG4CXX_WARN(logger_, "Incorrect select from device consented groups"); + SDL_LOG_WARN("Incorrect select from device consented groups"); return false; } query.Bind(0, device_id); @@ -118,9 +118,9 @@ bool SQLPTExtRepresentation::GetPermissionsForApp( const std::string& device_id, const std::string& policy_app_id, FunctionalIdType* group_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!group_types) { - LOG4CXX_WARN(logger_, "Input parameter for group types is null."); + SDL_LOG_WARN("Input parameter for group types is null."); return false; } // Get all app groups for specified device and application @@ -171,7 +171,7 @@ bool SQLPTExtRepresentation::GetPermissionsForApp( bool SQLPTExtRepresentation::GetDeviceGroupsFromPolicies( policy_table::Strings* groups, policy_table::Strings* preconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (groups) { GatherAppGroup(kDeviceId, groups); } @@ -189,17 +189,17 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery count_query(db()); if (!count_query.Prepare(sql_pt_ext::kCountDevice)) { - LOG4CXX_WARN(logger_, "Incorrect statement for count of device."); + SDL_LOG_WARN("Incorrect statement for count of device."); return false; } count_query.Bind(0, device_id); if (!count_query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect count of device."); + SDL_LOG_WARN("Incorrect count of device."); return false; } @@ -209,7 +209,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, if (update) { utils::dbms::SQLQuery update_query(db()); if (!update_query.Prepare(sql_pt_ext::kUpdateDevice)) { - LOG4CXX_WARN(logger_, "Incorrect statement for udpate device."); + SDL_LOG_WARN("Incorrect statement for udpate device."); return false; } @@ -223,7 +223,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, update_query.Bind(7, connection_type); if (!update_query.Exec() || !update_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect update for device."); + SDL_LOG_WARN("Incorrect update for device."); return false; } @@ -233,7 +233,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, // Insert new data utils::dbms::SQLQuery insert_query(db()); if (!insert_query.Prepare(sql_pt_ext::kInsertDevice)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for device."); + SDL_LOG_WARN("Incorrect insert statement for device."); return false; } @@ -247,7 +247,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, insert_query.Bind(7, connection_type); if (!insert_query.Exec() || !insert_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert to device."); + SDL_LOG_WARN("Incorrect insert to device."); return false; } @@ -260,17 +260,17 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( const std::string& device_id, const StringArray& consented_groups, const StringArray& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery count_query(db()); if (!count_query.Prepare(sql_pt_ext::kCountDeviceConsentGroup)) { - LOG4CXX_WARN(logger_, "Incorrect count of device consented groups"); + SDL_LOG_WARN("Incorrect count of device consented groups"); return false; } count_query.Bind(0, device_id); if (!count_query.Exec()) { - LOG4CXX_WARN(logger_, "Failed count of device consented groups"); + SDL_LOG_WARN("Failed count of device consented groups"); return false; } @@ -281,8 +281,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( // Update old values if (update) { if (!query.Prepare(sql_pt_ext::kUpdateDeviceConsentedGroup)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Incorrect statement for updating consented groups on device"); return false; } @@ -298,8 +297,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( query.Bind(3, *it_consented_groups); // TODO(AOleynik): Get this info from external data if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Failed update of device allowed consented groups."); + SDL_LOG_WARN("Failed update of device allowed consented groups."); return false; } } @@ -315,8 +313,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( query.Bind(2, device_id); query.Bind(3, *it_disallowed_groups); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Failed update of device disallowed consented groups."); + SDL_LOG_WARN("Failed update of device disallowed consented groups."); return false; } } @@ -326,8 +323,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( // Insert new values if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) { - LOG4CXX_WARN(logger_, - "Incorrect statement of inserting to device consented groups"); + SDL_LOG_WARN("Incorrect statement of inserting to device consented groups"); return false; } @@ -341,8 +337,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( // TODO(AOleynik): Get this info from external data query.Bind(3, std::string("GUI")); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Failed insert to device allowed consented groups."); + SDL_LOG_WARN("Failed insert to device allowed consented groups."); return false; } } @@ -357,8 +352,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice( query.Bind(2, false); query.Bind(3); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Failed insert to device disallowed consented groups."); + SDL_LOG_WARN("Failed insert to device disallowed consented groups."); return false; } } @@ -376,15 +370,13 @@ bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp( if (IsPredataPolicy(app_id)) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kHasAppPreloadedGroups)) { - LOG4CXX_WARN(logger_, - "Incorrect statement for has app preloaded groups"); + SDL_LOG_WARN("Incorrect statement for has app preloaded groups"); return false; } query.Bind(0, app_id); query.Bind(1, kPreDataConsentId); if (!query.Exec()) { - LOG4CXX_WARN(logger_, - "Incorrect select for app has predataconsted groups"); + SDL_LOG_WARN("Incorrect select for app has predataconsted groups"); return false; } if (query.GetInteger(0) > 0) { @@ -408,7 +400,7 @@ bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp( bool SQLPTExtRepresentation::SetUserPermissionsForApp( const PermissionConsent& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO(AOleynik): Handle situation, when no application was specified, i.e. // general permissions were set std::vector<FunctionalGroupPermission>::const_iterator it = @@ -420,7 +412,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( for (; it != it_end; ++it) { utils::dbms::SQLQuery counter(db()); if (!counter.Prepare(sql_pt_ext::kCountAppConsents)) { - LOG4CXX_WARN(logger_, "Incorrect statement for consent group count."); + SDL_LOG_WARN("Incorrect statement for consent group count."); return false; } @@ -428,7 +420,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( counter.Bind(1, permissions.policy_app_id); counter.Bind(2, static_cast<int>((*it).group_id)); if (!counter.Exec()) { - LOG4CXX_WARN(logger_, "Incorrent count on consent groups."); + SDL_LOG_WARN("Incorrent count on consent groups."); return false; } @@ -437,7 +429,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( // Update already present consent record if (update_required) { if (!query.Prepare(sql_pt_ext::kUpdateGroupPermissions)) { - LOG4CXX_WARN(logger_, "Incorrect statement for update consent groups."); + SDL_LOG_WARN("Incorrect statement for update consent groups."); return false; } @@ -452,9 +444,9 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( query.Bind(4, permissions.device_id); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Incorrect update on user defined permissions " - "for app groups."); + SDL_LOG_WARN( + "Incorrect update on user defined permissions " + "for app groups."); return false; } continue; @@ -462,8 +454,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( // Insert new consent record if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) { - LOG4CXX_WARN(logger_, - "Incorrect statement for update app group permissions."); + SDL_LOG_WARN("Incorrect statement for update app group permissions."); return false; } @@ -478,9 +469,9 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp( query.Bind(4, permissions.consent_source); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, - "Incorrect insert to user defined permissions " - "for app groups."); + SDL_LOG_WARN( + "Incorrect insert to user defined permissions " + "for app groups."); return false; } continue; @@ -493,7 +484,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( utils::dbms::SQLQuery query(db()); std::vector<UserFriendlyMessage> result; if (!query.Prepare(sql_pt_ext::kSelectFriendlyMsg)) { - LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages."); + SDL_LOG_WARN("Incorrect statement for select friendly messages."); return result; } @@ -511,7 +502,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( query.Bind(1, msg_language); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect select from friendly messages."); + SDL_LOG_WARN("Incorrect select from friendly messages."); return result; } @@ -527,9 +518,9 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( result.push_back(msg); if (!query.Reset()) { - LOG4CXX_WARN(logger_, - "Failed reset statement for selecting friendly " - "messages."); + SDL_LOG_WARN( + "Failed reset statement for selecting friendly " + "messages."); return result; } } @@ -540,7 +531,7 @@ std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages( policy_table::ConsumerFriendlyMessages* messages) const { if (NULL == messages) { - LOG4CXX_ERROR(logger_, "NULL pointer has been passed to fill"); + SDL_LOG_ERROR("NULL pointer has been passed to fill"); return false; } @@ -583,7 +574,7 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages( } } } else { - LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages."); + SDL_LOG_WARN("Incorrect statement for select friendly messages."); } return result; } @@ -591,10 +582,10 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages( bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateMetaParams)) { - LOG4CXX_WARN(logger_, "Incorrect statement for insert to module meta."); + SDL_LOG_WARN("Incorrect statement for insert to module meta."); return false; } @@ -603,22 +594,22 @@ bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version, query.Bind(2, language); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert to module meta."); + SDL_LOG_WARN("Incorrect insert to module meta."); return false; } return true; } bool SQLPTExtRepresentation::IsMetaInfoPresent() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectMetaParams)) { - LOG4CXX_WARN(logger_, "Incorrect statement for selecting meta info."); + SDL_LOG_WARN("Incorrect statement for selecting meta info."); return false; } if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect select from module meta."); + SDL_LOG_WARN("Incorrect select from module meta."); return false; } @@ -626,17 +617,17 @@ bool SQLPTExtRepresentation::IsMetaInfoPresent() { } bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateMetaLanguage)) { - LOG4CXX_WARN(logger_, "Incorrect statement for update meta language."); + SDL_LOG_WARN("Incorrect statement for update meta language."); return false; } query.Bind(0, language); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update for meta language."); + SDL_LOG_WARN("Incorrect update for meta language."); return false; } @@ -645,46 +636,46 @@ bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) { bool SQLPTExtRepresentation::SaveApplicationPoliciesSection( const policy_table::ApplicationPoliciesSection& policies) { - LOG4CXX_INFO(logger_, "SaveApplicationPolicies ext"); + SDL_LOG_INFO("SaveApplicationPolicies ext"); utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); + SDL_LOG_WARN("Incorrect delete from app_group."); return false; } utils::dbms::SQLQuery query_delete_preconsented(db()); if (!query_delete_preconsented.Exec(sql_pt_ext::kDeletePreconsentedGroups)) { - LOG4CXX_WARN(logger_, "Incorrect delete from preconsented_group."); + SDL_LOG_WARN("Incorrect delete from preconsented_group."); return false; } if (!query_delete.Exec(sql_pt::kDeleteApplication)) { - LOG4CXX_WARN(logger_, "Incorrect delete from application."); + SDL_LOG_WARN("Incorrect delete from application."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestType)) { - LOG4CXX_WARN(logger_, "Incorrect delete from request type."); + SDL_LOG_WARN("Incorrect delete from request type."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestSubType)) { - LOG4CXX_WARN(logger_, "Incorrect delete from request subtype."); + SDL_LOG_WARN("Incorrect delete from request subtype."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs."); + SDL_LOG_WARN("Incorrect delete from handled rpcs."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect delete from service names."); + SDL_LOG_WARN("Incorrect delete from service names."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled service types."); + SDL_LOG_WARN("Incorrect delete from handled service types."); return false; } @@ -755,7 +746,7 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy( utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + SDL_LOG_WARN("Incorrect insert statement into application."); return false; } @@ -799,7 +790,7 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy( : app_query.Bind(16); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -843,8 +834,7 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy( const policy_table::DevicePolicy& device) { utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement into application (device)."); + SDL_LOG_WARN("Incorrect insert statement into application (device)."); return false; } app_query.Bind(0, kDeviceId); @@ -859,7 +849,7 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy( app_query.Bind(7, 0); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -875,10 +865,10 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy( bool SQLPTExtRepresentation::GatherApplicationPoliciesSection( policy_table::ApplicationPoliciesSection* policies) const { - LOG4CXX_INFO(logger_, "Gather applications policies"); + SDL_LOG_INFO("Gather applications policies"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectAppPolicies)) { - LOG4CXX_WARN(logger_, "Incorrect select from app_policies"); + SDL_LOG_WARN("Incorrect select from app_policies"); return false; } @@ -990,7 +980,7 @@ void SQLPTExtRepresentation::GatherPreconsentedGroup( const std::string& app_id, policy_table::Strings* groups) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select from preconsented group"); + SDL_LOG_WARN("Incorrect select from preconsented group"); return; } @@ -1002,10 +992,10 @@ void SQLPTExtRepresentation::GatherPreconsentedGroup( bool SQLPTExtRepresentation::GatherUsageAndErrorCounts( policy_table::UsageAndErrorCounts* counts) const { - LOG4CXX_INFO(logger_, "Gather Usage and Error Counts."); + SDL_LOG_INFO("Gather Usage and Error Counts."); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectUsageAndErrorCount) || !query.Exec()) { - LOG4CXX_INFO(logger_, "Failed select from user_and_error_count"); + SDL_LOG_INFO("Failed select from user_and_error_count"); return false; } @@ -1020,9 +1010,8 @@ bool SQLPTExtRepresentation::GatherAppLevels( policy_table::AppLevels* apps) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectAppLevels)) { - LOG4CXX_INFO(logger_, - "Failed select from app_level. SQLError = " - << query.LastError().text()); + SDL_LOG_INFO("Failed select from app_level. SQLError = " + << query.LastError().text()); return false; } while (query.Next()) { @@ -1051,10 +1040,10 @@ bool SQLPTExtRepresentation::GatherAppLevels( void SQLPTExtRepresentation::GatherDeviceData( policy_table::DeviceData* data) const { - LOG4CXX_INFO(logger_, "Gather device data."); + SDL_LOG_INFO("Gather device data."); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectDeviceData)) { - LOG4CXX_WARN(logger_, "Incorrect select statement for device data."); + SDL_LOG_WARN("Incorrect select statement for device data."); return; } data->mark_initialized(); @@ -1076,12 +1065,11 @@ void SQLPTExtRepresentation::GatherDeviceData( void SQLPTExtRepresentation::GatherConsentGroup( const std::string& device_id, policy_table::UserConsentRecords* records) const { - LOG4CXX_INFO(logger_, "Gather consent records."); + SDL_LOG_INFO("Gather consent records."); utils::dbms::SQLQuery query(db()); // Fill data for device if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for device consented groups."); + SDL_LOG_WARN("Incorrect select statement for device consented groups."); return; } @@ -1107,8 +1095,7 @@ void SQLPTExtRepresentation::GatherConsentGroup( // Fill data for applications if (!query.Prepare(sql_pt_ext::kSelectConsentGroup)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for app consented groups."); + SDL_LOG_WARN("Incorrect select statement for app consented groups."); return; } @@ -1135,8 +1122,8 @@ void SQLPTExtRepresentation::GatherConsentGroup( // Fill data for ExternalConsent consents if (!query.Prepare(sql_pt_ext::kSelectExternalConsentStatusGroup)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Incorrect select statement for ExternalConsent consented groups."); return; } @@ -1159,31 +1146,31 @@ void SQLPTExtRepresentation::GatherConsentGroup( bool SQLPTExtRepresentation::SaveDeviceData( const policy_table::DeviceData& devices) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery drop_device_query(db()); const std::string drop_device = "DELETE FROM `device`"; if (!drop_device_query.Exec(drop_device)) { - LOG4CXX_WARN(logger_, "Could not clear device table."); + SDL_LOG_WARN("Could not clear device table."); return false; } utils::dbms::SQLQuery drop_device_consents_query(db()); const std::string drop_device_consents = "DELETE FROM `device_consent_group`"; if (!drop_device_consents_query.Exec(drop_device_consents)) { - LOG4CXX_WARN(logger_, "Could not clear device consents."); + SDL_LOG_WARN("Could not clear device consents."); return false; } utils::dbms::SQLQuery drop_user_consents_query(db()); const std::string drop_user_consents = "DELETE FROM `consent_group`"; if (!drop_user_consents_query.Exec(drop_user_consents)) { - LOG4CXX_WARN(logger_, "Could not clear user consents."); + SDL_LOG_WARN("Could not clear user consents."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kInsertDeviceData)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for device data."); + SDL_LOG_WARN("Incorrect insert statement for device data."); return false; } @@ -1200,7 +1187,7 @@ bool SQLPTExtRepresentation::SaveDeviceData( query.Bind(7, *(it->second.connection_type)); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into device data."); + SDL_LOG_WARN("Incorrect insert into device data."); return false; } @@ -1216,7 +1203,7 @@ bool SQLPTExtRepresentation::SaveDeviceData( bool SQLPTExtRepresentation::SaveConsentGroup( const std::string& device_id, const policy_table::UserConsentRecords& records) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); policy_table::UserConsentRecords::const_iterator it = records.begin(); @@ -1230,8 +1217,7 @@ bool SQLPTExtRepresentation::SaveConsentGroup( for (; it_groups != it_groups_end; ++it_groups) { if (kDeviceId == it->first) { if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for device consent group."); + SDL_LOG_WARN("Incorrect insert statement for device consent group."); return false; } query.Bind(0, device_id); @@ -1241,16 +1227,13 @@ bool SQLPTExtRepresentation::SaveConsentGroup( 3, std::string(policy_table::EnumToJsonString(*(it->second.input)))); query.Bind(4, std::string(*(it->second.time_stamp))); - LOG4CXX_INFO(logger_, - "Device:" - << "time stamp " - << std::string(*(it->second.time_stamp)) << " group " - << it_groups->first << " consent " - << it_groups->second); + SDL_LOG_INFO("Device:" + << "time stamp " << std::string(*(it->second.time_stamp)) + << " group " << it_groups->first << " consent " + << it_groups->second); } else { if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for consent group."); + SDL_LOG_WARN("Incorrect insert statement for consent group."); return false; } query.Bind(0, device_id); @@ -1262,16 +1245,14 @@ bool SQLPTExtRepresentation::SaveConsentGroup( std::string(policy_table::EnumToJsonString(*(it->second.input)))); query.Bind(5, std::string(*(it->second.time_stamp))); query.Bind(6, (it->second.consent_last_updated)); - LOG4CXX_INFO(logger_, - "Device:" - << "time stamp " - << std::string(*(it->second.time_stamp)) << " group " - << it_groups->first << " consent " - << it_groups->second); + SDL_LOG_INFO("Device:" + << "time stamp " << std::string(*(it->second.time_stamp)) + << " group " << it_groups->first << " consent " + << it_groups->second); } if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into consent group."); + SDL_LOG_WARN("Incorrect insert into consent group."); return false; } } @@ -1284,8 +1265,7 @@ bool SQLPTExtRepresentation::SaveConsentGroup( for (; end_external_consent_consent != it_external_consent_consent; ++it_external_consent_consent) { if (!query.Prepare(sql_pt_ext::kInsertExternalConsentStatusGroups)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for external consent group."); + SDL_LOG_WARN("Incorrect insert statement for external consent group."); return false; } query.Bind(0, device_id); @@ -1296,14 +1276,13 @@ bool SQLPTExtRepresentation::SaveConsentGroup( 4, std::string(policy_table::EnumToJsonString(*(it->second.input)))); query.Bind(5, std::string(*(it->second.time_stamp))); query.Bind(6, (it->second.ext_consent_last_updated)); - LOG4CXX_INFO(logger_, - "Device:" - << "time stamp " << std::string(*(it->second.time_stamp)) - << " group " << it_external_consent_consent->first - << " consent " << it_external_consent_consent->second); + SDL_LOG_INFO("Device:" + << "time stamp " << std::string(*(it->second.time_stamp)) + << " group " << it_external_consent_consent->first + << " consent " << it_external_consent_consent->second); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into external consent group."); + SDL_LOG_WARN("Incorrect insert into external consent group."); return false; } } // external_consent_consent_group @@ -1314,10 +1293,10 @@ bool SQLPTExtRepresentation::SaveConsentGroup( bool SQLPTExtRepresentation::SavePreconsentedGroup( const std::string& app_id, const policy_table::Strings& groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kInsertPreconsentedGroups)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for preconsented groups"); + SDL_LOG_WARN("Incorrect insert statement for preconsented groups"); return false; } @@ -1326,7 +1305,7 @@ bool SQLPTExtRepresentation::SavePreconsentedGroup( query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into preconsented groups."); + SDL_LOG_WARN("Incorrect insert into preconsented groups."); return false; } } @@ -1336,7 +1315,7 @@ bool SQLPTExtRepresentation::SavePreconsentedGroup( void SQLPTExtRepresentation::GatherModuleMeta( policy_table::ModuleMeta* meta) const { - LOG4CXX_INFO(logger_, "Gather Module Meta Info"); + SDL_LOG_INFO("Gather Module Meta Info"); utils::dbms::SQLQuery query(db()); if (query.Prepare(sql_pt_ext::kSelectModuleMeta) && query.Next()) { *meta->ccpu_version = query.GetString(0); @@ -1354,19 +1333,19 @@ void SQLPTExtRepresentation::Increment(const std::string& type) const { std::string update_counter = "UPDATE `usage_and_error_count` SET `" + type + "` = `" + type + "` + 1"; if (!query.Exec(update_counter)) { - LOG4CXX_INFO(logger_, "Failed updating global counter"); + SDL_LOG_INFO("Failed updating global counter"); } } bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kCountAppLevel)) { - LOG4CXX_INFO(logger_, "Incorrect statement of count app_level"); + SDL_LOG_INFO("Incorrect statement of count app_level"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Failed count app_level"); + SDL_LOG_INFO("Failed count app_level"); return false; } return query.GetInteger(0) > 0; @@ -1374,10 +1353,10 @@ bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const { bool SQLPTExtRepresentation::GetAllAppGroups(const std::string& policy_app_id, FunctionalGroupIDs& all_groups) { - LOG4CXX_INFO(logger_, "GetAllAppGroups for '" << policy_app_id << "'"); + SDL_LOG_INFO("GetAllAppGroups for '" << policy_app_id << "'"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectAppGroupsId)) { - LOG4CXX_WARN(logger_, "Incorrect statement for select app groups id."); + SDL_LOG_WARN("Incorrect statement for select app groups id."); return false; } @@ -1395,10 +1374,10 @@ bool SQLPTExtRepresentation::GetConsentedGroups( const std::string& device_id, FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectConsentedGroupsId)) { - LOG4CXX_WARN(logger_, "Incorrect statement for select consent groups id."); + SDL_LOG_WARN("Incorrect statement for select consent groups id."); return false; } @@ -1418,11 +1397,10 @@ bool SQLPTExtRepresentation::GetConsentedGroups( bool SQLPTExtRepresentation::GetPreconsentedGroups( const std::string& policy_app_id, FunctionalGroupIDs& preconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroupsId)) { - LOG4CXX_WARN(logger_, - "Incorrect statement for select preconsented groups id."); + SDL_LOG_WARN("Incorrect statement for select preconsented groups id."); return false; } @@ -1437,11 +1415,10 @@ bool SQLPTExtRepresentation::GetPreconsentedGroups( bool SQLPTExtRepresentation::GetFunctionalGroupNames( FunctionalGroupNames& names) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectFunctionalGroupNames)) { - LOG4CXX_WARN(logger_, - "Incorrect statement for select functional groups names."); + SDL_LOG_WARN("Incorrect statement for select functional groups names."); return false; } @@ -1491,12 +1468,12 @@ void SQLPTExtRepresentation::Increment(const std::string& app_id, "VALUES (?, 1)"; } if (!query.Prepare(sql_counter)) { - LOG4CXX_INFO(logger_, "Incorrect statement of update app counter"); + SDL_LOG_INFO("Incorrect statement of update app counter"); return; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Failed updating app counter"); + SDL_LOG_INFO("Failed updating app counter"); } } @@ -1517,13 +1494,13 @@ void SQLPTExtRepresentation::Set(const std::string& app_id, "VALUES (?, ?)"; } if (!query.Prepare(sql_info)) { - LOG4CXX_INFO(logger_, "Incorrect statement of update app info"); + SDL_LOG_INFO("Incorrect statement of update app info"); return; } query.Bind(0, value); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Failed updating app info"); + SDL_LOG_INFO("Failed updating app info"); } } @@ -1543,29 +1520,29 @@ void SQLPTExtRepresentation::Add(const std::string& app_id, "VALUES (?, ?)"; } if (!query.Prepare(sql_stopwatch)) { - LOG4CXX_INFO(logger_, "Incorrect statement of update app stopwatch"); + SDL_LOG_INFO("Incorrect statement of update app stopwatch"); return; } query.Bind(0, seconds); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Failed updating app stopwatch"); + SDL_LOG_INFO("Failed updating app stopwatch"); } } bool SQLPTExtRepresentation::GetDefaultHMI(const std::string& policy_app_id, std::string* default_hmi) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectDefaultHmi)) { - LOG4CXX_INFO(logger_, "Incorrect statement for default hmi."); + SDL_LOG_INFO("Incorrect statement for default hmi."); return false; } query.Bind(0, policy_app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Error during default hmi getting."); + SDL_LOG_INFO("Error during default hmi getting."); return false; } @@ -1583,10 +1560,10 @@ bool SQLPTExtRepresentation::CountUnconsentedGroups( const std::string& policy_app_id, const std::string& device_id, int* result) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kCountUnconsentedGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select for unconsented groups."); + SDL_LOG_WARN("Incorrect select for unconsented groups."); return false; } @@ -1596,7 +1573,7 @@ bool SQLPTExtRepresentation::CountUnconsentedGroups( query.Bind(3, kPreDataConsentId); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Error during executing unconsented groups."); + SDL_LOG_INFO("Error during executing unconsented groups."); return false; } *result = query.GetInteger(0); @@ -1607,7 +1584,7 @@ bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string& message, const std::string& language) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kHasMsgLanguageCode)) { - LOG4CXX_WARN(logger_, "Incorrect statement for message language check."); + SDL_LOG_WARN("Incorrect statement for message language check."); return false; } @@ -1615,7 +1592,7 @@ bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string& message, query.Bind(1, language); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to check message language code."); + SDL_LOG_WARN("Failed to check message language code."); return false; } @@ -1628,7 +1605,7 @@ bool SQLPTExtRepresentation::SaveMessageString( const policy_table::MessageString& strings) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertMessageString)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for message."); + SDL_LOG_WARN("Incorrect insert statement for message."); return false; } @@ -1651,7 +1628,7 @@ bool SQLPTExtRepresentation::SaveMessageString( } if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into message."); + SDL_LOG_WARN("Incorrect insert into message."); return false; } @@ -1668,7 +1645,7 @@ bool SQLPTExtRepresentation::SaveModuleMeta( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSaveModuleMeta)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for module_meta."); + SDL_LOG_WARN("Incorrect insert statement for module_meta."); return false; } const int64_t odometer = *(meta.pt_exchanged_at_odometer_x); @@ -1682,7 +1659,7 @@ bool SQLPTExtRepresentation::SaveModuleMeta( query.Bind(6, *(meta.vin)); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update for module_meta."); + SDL_LOG_WARN("Incorrect update for module_meta."); return false; } @@ -1693,11 +1670,11 @@ bool SQLPTExtRepresentation::SaveAppCounters( const rpc::policy_table_interface_base::AppLevels& app_levels) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app level."); + SDL_LOG_WARN("Incorrect delete from app level."); return false; } if (!query.Prepare(sql_pt::kInsertAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app level."); + SDL_LOG_WARN("Incorrect insert statement for app level."); return false; } @@ -1721,7 +1698,7 @@ bool SQLPTExtRepresentation::SaveAppCounters( query.Bind(15, it->second.count_of_tls_errors); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app level."); + SDL_LOG_WARN("Incorrect insert into app level."); return false; } } @@ -1732,7 +1709,7 @@ bool SQLPTExtRepresentation::SaveGlobalCounters( const rpc::policy_table_interface_base::UsageAndErrorCounts& counts) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateGlobalCounters)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for global counters."); + SDL_LOG_WARN("Incorrect insert statement for global counters."); return false; } @@ -1741,7 +1718,7 @@ bool SQLPTExtRepresentation::SaveGlobalCounters( query.Bind(2, *counts.count_of_sync_reboots); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into global counters."); + SDL_LOG_WARN("Incorrect insert into global counters."); return false; } @@ -1750,22 +1727,22 @@ bool SQLPTExtRepresentation::SaveGlobalCounters( bool SQLPTExtRepresentation::CleanupUnpairedDevices( const DeviceIds& device_ids) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery delete_device_query(db()); if (!delete_device_query.Prepare(sql_pt::kDeleteDevice)) { - LOG4CXX_WARN(logger_, "Incorrect statement for device delete."); + SDL_LOG_WARN("Incorrect statement for device delete."); return true; } utils::dbms::SQLQuery delete_device_consent_query(db()); if (!delete_device_consent_query.Prepare(sql_pt_ext::kDeleteDeviceConsent)) { - LOG4CXX_WARN(logger_, "Incorrect statement for delete device consent."); + SDL_LOG_WARN("Incorrect statement for delete device consent."); return false; } utils::dbms::SQLQuery delete_app_consent_query(db()); if (!delete_app_consent_query.Prepare(sql_pt_ext::kDeleteAppConsent)) { - LOG4CXX_WARN(logger_, "Incorrect statement for delete app consent."); + SDL_LOG_WARN("Incorrect statement for delete app consent."); return false; } @@ -1774,20 +1751,20 @@ bool SQLPTExtRepresentation::CleanupUnpairedDevices( for (; it != it_end; ++it) { delete_device_query.Bind(0, (*it)); if (!delete_device_query.Exec() || !delete_device_query.Reset()) { - LOG4CXX_WARN(logger_, "Failed to delete from device"); + SDL_LOG_WARN("Failed to delete from device"); return false; } delete_device_consent_query.Bind(0, (*it)); if (!delete_device_consent_query.Exec() || !delete_device_consent_query.Reset()) { - LOG4CXX_WARN(logger_, "Failed to delete from device consent."); + SDL_LOG_WARN("Failed to delete from device consent."); return false; } delete_app_consent_query.Bind(0, (*it)); if (!delete_app_consent_query.Exec() || !delete_app_consent_query.Reset()) { - LOG4CXX_WARN(logger_, "Failed to delete from app consent."); + SDL_LOG_WARN("Failed to delete from app consent."); return false; } } @@ -1797,22 +1774,22 @@ bool SQLPTExtRepresentation::CleanupUnpairedDevices( bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } @@ -1835,26 +1812,25 @@ bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) { } bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) { - LOG4CXX_INFO(logger_, - "SQLPTExtRepresentation::SetPredataPolicy for " << app_id); + SDL_LOG_INFO("SQLPTExtRepresentation::SetPredataPolicy for " << app_id); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } @@ -1878,13 +1854,13 @@ bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) { bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectApplicationIsPreData)) { - LOG4CXX_WARN(logger_, "Incorrect select application is pre_dataConsented"); + SDL_LOG_WARN("Incorrect select application is pre_dataConsented"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select application is pre_dataConsented"); + SDL_LOG_WARN("Failed select application is pre_dataConsented"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -1892,17 +1868,17 @@ bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const { bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id, bool is_pre_data) { - LOG4CXX_TRACE(logger_, "Set flag is_predata of application"); + SDL_LOG_TRACE("Set flag is_predata of application"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateIsPredata)) { - LOG4CXX_WARN(logger_, "Incorect statement for updating is_predata"); + SDL_LOG_WARN("Incorect statement for updating is_predata"); return false; } query.Bind(0, is_pre_data); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update is_predata"); + SDL_LOG_WARN("Failed update is_predata"); return false; } return true; @@ -1910,27 +1886,27 @@ bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id, bool SQLPTExtRepresentation::SetUnpairedDevice(const std::string& device_id, bool unpaired) const { - LOG4CXX_TRACE(logger_, "Set unpaired device: " << device_id); + SDL_LOG_TRACE("Set unpaired device: " << device_id); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateUnpairedDevice)) { - LOG4CXX_WARN(logger_, "Incorect statement for updating unpaired device"); + SDL_LOG_WARN("Incorect statement for updating unpaired device"); return false; } query.Bind(0, unpaired); query.Bind(1, device_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update unpaired device"); + SDL_LOG_WARN("Failed update unpaired device"); return false; } return true; } bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const { - LOG4CXX_TRACE(logger_, "Get list of unpaired devices"); + SDL_LOG_TRACE("Get list of unpaired devices"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectUnpairedDevices)) { - LOG4CXX_WARN(logger_, "Incorect statement for selecting unpaired devices"); + SDL_LOG_WARN("Incorect statement for selecting unpaired devices"); return false; } @@ -1943,7 +1919,7 @@ bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const { bool SQLPTExtRepresentation::SetVINValue(const std::string& value) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kUpdateModuleMetaVinParam)) { - LOG4CXX_WARN(logger_, "Incorect statement for updating module_meta params"); + SDL_LOG_WARN("Incorect statement for updating module_meta params"); return false; } @@ -1951,18 +1927,17 @@ bool SQLPTExtRepresentation::SetVINValue(const std::string& value) { const bool result = query.Exec(); if (!result) { - LOG4CXX_WARN(logger_, "Failed update module_meta"); + SDL_LOG_WARN("Failed update module_meta"); } return result; } bool SQLPTExtRepresentation::SaveExternalConsentStatus( const ExternalConsentStatus& status) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kInsertExternalConsentStatus)) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for saving external consent status."); + SDL_LOG_ERROR("Incorrect statement for saving external consent status."); return false; } @@ -1978,7 +1953,7 @@ bool SQLPTExtRepresentation::SaveExternalConsentStatus( policy::kStatusOn == it->status_ ? std::string("ON") : std::string("OFF")); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR(logger_, "Error during ExternalConsent status saving."); + SDL_LOG_ERROR("Error during ExternalConsent status saving."); return false; } } @@ -1987,11 +1962,10 @@ bool SQLPTExtRepresentation::SaveExternalConsentStatus( } ExternalConsentStatus SQLPTExtRepresentation::GetExternalConsentStatus() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kSelectExternalConsentStatus)) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for selecting external consent status."); + SDL_LOG_ERROR("Incorrect statement for selecting external consent status."); return ExternalConsentStatus(); } @@ -2013,14 +1987,14 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup( const std::string& functional_group_name) const { utils::dbms::SQLQuery query_group_id(db()); if (!query_group_id.Prepare(sql_pt_ext::kSelectGroupId)) { - LOG4CXX_WARN(logger_, "Incorect statement for select group name."); + SDL_LOG_WARN("Incorect statement for select group name."); return false; } query_group_id.Bind(0, functional_group_name); if (!query_group_id.Exec()) { - LOG4CXX_WARN(logger_, "Failed to select group id."); + SDL_LOG_WARN("Failed to select group id."); return false; } @@ -2028,7 +2002,7 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kDeleteAppGroupConsent)) { - LOG4CXX_WARN(logger_, "Incorect statement for remove app consent."); + SDL_LOG_WARN("Incorect statement for remove app consent."); return false; } @@ -2036,7 +2010,7 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup( query.Bind(1, id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to remove app consent."); + SDL_LOG_WARN("Failed to remove app consent."); return false; } diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index a7658740c4..36e363d922 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -51,7 +51,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") namespace dbms = utils::dbms; @@ -108,8 +108,8 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id, utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRpc)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Incorrect select statement from rpcs" << query.LastError().text()); return; } @@ -119,8 +119,7 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id, bool ret = query.Next(); result.hmi_level_permitted = ret ? kRpcAllowed : kRpcDisallowed; - LOG4CXX_INFO(logger_, - "Level is " << (result.hmi_level_permitted == kRpcAllowed + SDL_LOG_INFO("Level is " << (result.hmi_level_permitted == kRpcAllowed ? "permitted" : "not permitted")); std::string parameter; @@ -141,7 +140,7 @@ bool SQLPTRepresentation::IsPTPreloaded() { int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectIgnitionCycles) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select ignition cycles"); + SDL_LOG_WARN("Can not select ignition cycles"); return 0; } int limit = query.GetInteger(0); @@ -157,7 +156,7 @@ int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { int SQLPTRepresentation::KilometersBeforeExchange(int current) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectKilometers) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select kilometers"); + SDL_LOG_WARN("Can not select kilometers"); return 0; } int limit = query.GetInteger(0); @@ -173,17 +172,16 @@ int SQLPTRepresentation::KilometersBeforeExchange(int current) { bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( int kilometers, int days_after_epoch) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateCountersSuccessfulUpdate)) { - LOG4CXX_WARN(logger_, - "Wrong update query for counters on successful update."); + SDL_LOG_WARN("Wrong update query for counters on successful update."); return false; } query.Bind(0, kilometers); query.Bind(1, days_after_epoch); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to update counters on successful update."); + SDL_LOG_WARN("Failed to update counters on successful update."); return false; } return true; @@ -192,7 +190,7 @@ bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( int SQLPTRepresentation::DaysBeforeExchange(uint16_t current) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectDays) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select days"); + SDL_LOG_WARN("Can not select days"); return 0; } int limit = query.GetInteger(0); @@ -212,7 +210,7 @@ int SQLPTRepresentation::DaysBeforeExchange(uint16_t current) { int SQLPTRepresentation::TimeoutResponse() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) { - LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence"); + SDL_LOG_INFO("Can not select timeout response for retry sequence"); const int defaultTimeout = 30 * date_time::MILLISECONDS_IN_SECOND; return defaultTimeout; } @@ -222,8 +220,7 @@ int SQLPTRepresentation::TimeoutResponse() { bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { - LOG4CXX_INFO(logger_, - "Incorrect select statement from seconds between retries"); + SDL_LOG_INFO("Incorrect select statement from seconds between retries"); return false; } while (query.Next()) { @@ -246,8 +243,7 @@ std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg( } EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { - LOG4CXX_INFO(logger_, - "SQLPTRepresentation::GetUpdateUrls for " << service_type); + SDL_LOG_INFO("SQLPTRepresentation::GetUpdateUrls for " << service_type); utils::dbms::SQLQuery query(db()); EndpointUrls ret; if (query.Prepare(sql_pt::kSelectEndpoint)) { @@ -262,23 +258,23 @@ EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { ret.push_back(data); } } else { - LOG4CXX_WARN(logger_, "Invalid select endpoints statement."); + SDL_LOG_WARN("Invalid select endpoints statement."); } return ret; } int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectNotificationsPerPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for priority " - "notification number."); + SDL_LOG_WARN( + "Incorrect select statement for priority " + "notification number."); return 0; } query.Bind(0, priority); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority."); + SDL_LOG_WARN("Incorrect select from notifications by priority."); return 0; } @@ -291,21 +287,21 @@ int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, std::string* priority) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (NULL == priority) { - LOG4CXX_WARN(logger_, "Input priority parameter is null."); + SDL_LOG_WARN("Input priority parameter is null."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectPriority)) { - LOG4CXX_INFO(logger_, "Incorrect statement for priority."); + SDL_LOG_INFO("Incorrect statement for priority."); return false; } query.Bind(0, policy_app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Error during select priority."); + SDL_LOG_INFO("Error during select priority."); return false; } @@ -321,7 +317,7 @@ bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { settings_ = settings; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef BUILD_TESTS open_counter_ = 0; #endif // BUILD_TESTS @@ -334,60 +330,57 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { } #endif // __QNX__ if (!db_->Open()) { - LOG4CXX_ERROR(logger_, "Failed opening database."); - LOG4CXX_INFO(logger_, "Starting opening retries."); + SDL_LOG_ERROR("Failed opening database."); + SDL_LOG_INFO("Starting opening retries."); const uint16_t attempts = get_settings().attempts_to_open_policy_db(); - LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts); + SDL_LOG_DEBUG("Total attempts number is: " << attempts); bool is_opened = false; const uint16_t open_attempt_timeout_ms = get_settings().open_attempt_timeout_ms(); const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000; - LOG4CXX_DEBUG(logger_, - "Open attempt timeout(ms) is: " << open_attempt_timeout_ms); + SDL_LOG_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms); for (int i = 0; i < attempts; ++i) { usleep(sleep_interval_mcsec); - LOG4CXX_INFO(logger_, "Attempt: " << i + 1); + SDL_LOG_INFO("Attempt: " << i + 1); #ifdef BUILD_TESTS ++open_counter_; #endif // BUILD_TESTS if (db_->Open()) { - LOG4CXX_INFO(logger_, "Database opened."); + SDL_LOG_INFO("Database opened."); is_opened = true; break; } } if (!is_opened) { - LOG4CXX_ERROR(logger_, - "Open retry sequence failed. Tried " - << attempts << " attempts with " - << open_attempt_timeout_ms - << " open timeout(ms) for each."); + SDL_LOG_ERROR("Open retry sequence failed. Tried " + << attempts << " attempts with " << open_attempt_timeout_ms + << " open timeout(ms) for each."); return InitResult::FAIL; } } #ifndef __QNX__ if (!db_->IsReadWrite()) { - LOG4CXX_ERROR(logger_, "There are no read/write permissions for database"); + SDL_LOG_ERROR("There are no read/write permissions for database"); return InitResult::FAIL; } #endif // __QNX__ utils::dbms::SQLQuery check_pages(db()); if (!check_pages.Prepare(sql_pt::kCheckPgNumber) || !check_pages.Next()) { - LOG4CXX_WARN(logger_, "Incorrect pragma for page counting."); + SDL_LOG_WARN("Incorrect pragma for page counting."); } else { if (0 < check_pages.GetInteger(0)) { utils::dbms::SQLQuery db_check(db()); if (!db_check.Prepare(sql_pt::kCheckDBIntegrity)) { - LOG4CXX_WARN(logger_, "Incorrect pragma for integrity check."); + SDL_LOG_WARN("Incorrect pragma for integrity check."); } else { while (db_check.Next()) { if (db_check.GetString(0).compare("ok") == 0) { utils::dbms::SQLQuery check_first_run(db()); if (check_first_run.Prepare(sql_pt::kIsFirstRun) && check_first_run.Next()) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "Selecting is first run " << check_first_run.GetBoolean(0)); if (check_first_run.GetBoolean(0)) { utils::dbms::SQLQuery set_not_first_run(db()); @@ -395,12 +388,11 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { return InitResult::SUCCESS; } } else { - LOG4CXX_WARN(logger_, "Incorrect select is first run"); + SDL_LOG_WARN("Incorrect select is first run"); } return InitResult::EXISTS; } else { - LOG4CXX_ERROR(logger_, - "Existing policy table representation is invlaid."); + SDL_LOG_ERROR("Existing policy table representation is invlaid."); // TODO(PV): add handle return InitResult::FAIL; } @@ -410,14 +402,14 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { } utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed creating schema of database: " << query.LastError().text()); return InitResult::FAIL; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return InitResult::FAIL; } @@ -432,8 +424,7 @@ bool SQLPTRepresentation::Close() { bool SQLPTRepresentation::Drop() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDropSchema)) { - LOG4CXX_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_LOG_WARN("Failed dropping database: " << query.LastError().text()); return false; } return true; @@ -446,13 +437,12 @@ void SQLPTRepresentation::WriteDb() { bool SQLPTRepresentation::Clear() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteData)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -462,19 +452,18 @@ bool SQLPTRepresentation::Clear() { bool SQLPTRepresentation::RefreshDB() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDropSchema)) { - LOG4CXX_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_LOG_WARN("Failed dropping database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed creating schema of database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -483,7 +472,7 @@ bool SQLPTRepresentation::RefreshDB() { std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto table = std::make_shared<policy_table::Table>(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); @@ -503,17 +492,17 @@ std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() void SQLPTRepresentation::GatherModuleMeta( policy_table::ModuleMeta* meta) const { - LOG4CXX_INFO(logger_, "Gather Module Meta Info"); + SDL_LOG_INFO("Gather Module Meta Info"); meta->mark_initialized(); // Section Module Meta is empty for SDL specific } void SQLPTRepresentation::GatherModuleConfig( policy_table::ModuleConfig* config) const { - LOG4CXX_INFO(logger_, "Gather Configuration Info"); + SDL_LOG_INFO("Gather Configuration Info"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectModuleConfig) || !query.Next()) { - LOG4CXX_WARN(logger_, "Incorrect select statement for module config"); + SDL_LOG_WARN("Incorrect select statement for module config"); } else { *config->preloaded_pt = query.GetBoolean(0); config->exchange_after_x_ignition_cycles = query.GetInteger(1); @@ -532,7 +521,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery endpoints(db()); if (!endpoints.Prepare(sql_pt::kSelectEndpoints)) { - LOG4CXX_WARN(logger_, "Incorrect select statement for endpoints"); + SDL_LOG_WARN("Incorrect select statement for endpoints"); } else { while (endpoints.Next()) { const std::string& url = endpoints.GetString(0); @@ -544,7 +533,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery endpoint_properties(db()); if (!endpoint_properties.Prepare(sql_pt::kSelectEndpointProperties)) { - LOG4CXX_ERROR(logger_, "Incorrect statement for Endpoint properties"); + SDL_LOG_ERROR("Incorrect statement for Endpoint properties"); } else { while (endpoint_properties.Next()) { const std::string& service = endpoint_properties.GetString(0); @@ -556,7 +545,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery notifications(db()); if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) { - LOG4CXX_WARN(logger_, "Incorrect select statement for notifications"); + SDL_LOG_WARN("Incorrect select statement for notifications"); } else { while (notifications.Next()) { config->notifications_per_minute_by_priority[notifications.GetString(0)] = @@ -565,8 +554,7 @@ void SQLPTRepresentation::GatherModuleConfig( } utils::dbms::SQLQuery subtle_notifications(db()); if (!subtle_notifications.Prepare(sql_pt::kSelectSubtleNotificationsPerMin)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for subtle notifications"); + SDL_LOG_WARN("Incorrect select statement for subtle notifications"); } else { while (subtle_notifications.Next()) { (*config->subtle_notifications_per_minute_by_priority) @@ -576,8 +564,7 @@ void SQLPTRepresentation::GatherModuleConfig( } utils::dbms::SQLQuery seconds(db()); if (!seconds.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { - LOG4CXX_INFO(logger_, - "Incorrect select statement from seconds between retries"); + SDL_LOG_INFO("Incorrect select statement from seconds between retries"); } else { while (seconds.Next()) { config->seconds_between_retries.push_back(seconds.GetInteger(0)); @@ -587,7 +574,7 @@ void SQLPTRepresentation::GatherModuleConfig( bool SQLPTRepresentation::GatherUsageAndErrorCounts( policy_table::UsageAndErrorCounts* counts) const { - LOG4CXX_INFO(logger_, "Gather Usage and Error Counts."); + SDL_LOG_INFO("Gather Usage and Error Counts."); utils::dbms::SQLQuery query(db()); if (query.Prepare(sql_pt::kSelectAppLevels)) { policy_table::AppLevel app_level_empty; @@ -601,7 +588,7 @@ bool SQLPTRepresentation::GatherUsageAndErrorCounts( void SQLPTRepresentation::GatherDeviceData( policy_table::DeviceData* data) const { - LOG4CXX_INFO(logger_, "Gather device data."); + SDL_LOG_INFO("Gather device data."); data->mark_initialized(); utils::dbms::SQLQuery query(db()); @@ -616,24 +603,23 @@ void SQLPTRepresentation::GatherDeviceData( bool SQLPTRepresentation::GatherFunctionalGroupings( policy_table::FunctionalGroupings* groups) const { - LOG4CXX_INFO(logger_, "Gather Functional Groupings info"); + SDL_LOG_INFO("Gather Functional Groupings info"); utils::dbms::SQLQuery func_group(db()); if (!func_group.Prepare(sql_pt::kSelectFunctionalGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select from functional_groupings"); + SDL_LOG_WARN("Incorrect select from functional_groupings"); return false; } utils::dbms::SQLQuery rpcs(db()); if (!rpcs.Prepare(sql_pt::kSelectAllRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select all from rpc"); + SDL_LOG_WARN("Incorrect select all from rpc"); return false; } utils::dbms::SQLQuery external_consent_entities(db()); if (!external_consent_entities.Prepare( sql_pt::kSelectExternalConsentEntities)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for 'external_consent_entities'."); + SDL_LOG_WARN("Incorrect select statement for 'external_consent_entities'."); return false; } @@ -702,10 +688,10 @@ bool SQLPTRepresentation::GatherFunctionalGroupings( bool SQLPTRepresentation::GatherConsumerFriendlyMessages( policy_table::ConsumerFriendlyMessages* messages) const { - LOG4CXX_INFO(logger_, "Gather Consumer Friendly Messages"); + SDL_LOG_INFO("Gather Consumer Friendly Messages"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectUserMsgsVersion) || !query.Next()) { - LOG4CXX_WARN(logger_, "Incorrect select from consumer_friendly_messages"); + SDL_LOG_WARN("Incorrect select from consumer_friendly_messages"); return false; } @@ -743,7 +729,7 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages( } } } else { - LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages."); + SDL_LOG_WARN("Incorrect statement for select friendly messages."); } return true; @@ -751,10 +737,10 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages( bool SQLPTRepresentation::GatherApplicationPoliciesSection( policy_table::ApplicationPoliciesSection* policies) const { - LOG4CXX_INFO(logger_, "Gather applications policies"); + SDL_LOG_INFO("Gather applications policies"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppPolicies)) { - LOG4CXX_WARN(logger_, "Incorrect select from app_policies"); + SDL_LOG_WARN("Incorrect select from app_policies"); return false; } @@ -855,8 +841,7 @@ bool SQLPTRepresentation::GatherVehicleData( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataSchemaVersion) || !query.Next()) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for vehicle data schema version"); + SDL_LOG_ERROR("Incorrect statement for vehicle data schema version"); return false; } *vehicle_data->schema_version = query.GetString(0); @@ -888,7 +873,7 @@ bool SQLPTRepresentation::GatherVehicleDataItems( } bool SQLPTRepresentation::Save(const policy_table::Table& table) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); db_->BeginTransaction(); if (!SaveFunctionalGroupings(table.policy_table.functional_groupings)) { db_->RollbackTransaction(); @@ -933,23 +918,23 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( const policy_table::FunctionalGroupings& groups) { utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteRpc)) { - LOG4CXX_WARN(logger_, "Incorrect delete from rpc."); + SDL_LOG_WARN("Incorrect delete from rpc."); return false; } if (!query_delete.Exec(sql_pt::kDeleteExternalConsentEntities)) { - LOG4CXX_WARN(logger_, "Incorrect delete from external consent entities."); + SDL_LOG_WARN("Incorrect delete from external consent entities."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteFunctionalGroup)) { - LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries."); + SDL_LOG_WARN("Incorrect delete from seconds between retries."); return false; } if (!query.Prepare(sql_pt::kInsertFunctionalGroup)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for functional groups"); + SDL_LOG_WARN("Incorrect insert statement for functional groups"); return false; } @@ -974,7 +959,7 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( ? query.Bind(3, *(groups_it->second.encryption_required)) : query.Bind(3); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into functional groups"); + SDL_LOG_WARN("Incorrect insert into functional groups"); return false; } @@ -1008,7 +993,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, utils::dbms::SQLQuery query_parameter(db()); if (!query.Prepare(sql_pt::kInsertRpc) || !query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for rpc"); + SDL_LOG_WARN("Incorrect insert statement for rpc"); return false; } @@ -1028,7 +1013,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, query_parameter.Bind(2, std::string(*ps_it)); query_parameter.Bind(3, group_id); if (!query_parameter.Exec() || !query_parameter.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter"); + SDL_LOG_WARN("Incorrect insert into rpc with parameter"); return false; } } @@ -1041,7 +1026,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, std::string(policy_table::EnumToJsonString(policy_table::P_EMPTY))); query_parameter.Bind(3, group_id); if (!query_parameter.Exec() || !query_parameter.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter"); + SDL_LOG_WARN("Incorrect insert into rpc with parameter"); return false; } } else { @@ -1049,7 +1034,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, query.Bind(1, std::string(policy_table::EnumToJsonString(*hmi_it))); query.Bind(2, group_id); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc"); + SDL_LOG_WARN("Incorrect insert into rpc"); return false; } } @@ -1063,32 +1048,32 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection( const policy_table::ApplicationPoliciesSection& policies) { utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); + SDL_LOG_WARN("Incorrect delete from app_group."); return false; } if (!query_delete.Exec(sql_pt::kDeleteApplication)) { - LOG4CXX_WARN(logger_, "Incorrect delete from application."); + SDL_LOG_WARN("Incorrect delete from application."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestType)) { - LOG4CXX_WARN(logger_, "Incorrect delete from request type."); + SDL_LOG_WARN("Incorrect delete from request type."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs."); + SDL_LOG_WARN("Incorrect delete from handled rpcs."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect delete from service names."); + SDL_LOG_WARN("Incorrect delete from service names."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled service types."); + SDL_LOG_WARN("Incorrect delete from handled service types."); return false; } @@ -1132,8 +1117,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( const policy_table::ApplicationPolicies::value_type& app) { utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt::kInsertApplication)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement into application (device)."); + SDL_LOG_WARN("Incorrect insert statement into application (device)."); return false; } @@ -1173,7 +1157,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( : app_query.Bind(13); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -1219,7 +1203,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( const policy_table::DevicePolicy& device) { utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt::kInsertApplication)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + SDL_LOG_WARN("Incorrect insert statement into application."); return false; } @@ -1232,7 +1216,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( app_query.Bind(5); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -1245,7 +1229,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( bool SQLPTRepresentation::SaveVehicleDataItems( const policy_table::VehicleDataItems& vehicle_data_items) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeleteVehicleDataItems(); for (const auto& item : vehicle_data_items) { if (!InsertVehicleDataItem(item)) { @@ -1257,18 +1241,17 @@ bool SQLPTRepresentation::SaveVehicleDataItems( bool SQLPTRepresentation::SaveVehicleData( const policy_table::VehicleData& vehicle_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (vehicle_data.is_initialized() && vehicle_data.schema_version.is_initialized()) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertVehicleDataSchemaVersion)) { - LOG4CXX_WARN(logger_, - "Incorrect insert of schema_version to vehicle_data."); + SDL_LOG_WARN("Incorrect insert of schema_version to vehicle_data."); return false; } query.Bind(0, *vehicle_data.schema_version); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Failed to insert schema_version to vehicle_data."); + SDL_LOG_WARN("Failed to insert schema_version to vehicle_data."); return false; } } @@ -1285,20 +1268,19 @@ bool SQLPTRepresentation::SaveAppGroup( const std::string& app_id, const policy_table::Strings& app_groups) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppGroup)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app group"); + SDL_LOG_WARN("Incorrect insert statement for app group"); return false; } - LOG4CXX_INFO(logger_, "SaveAppGroup"); + SDL_LOG_INFO("SaveAppGroup"); policy_table::Strings::const_iterator it; for (it = app_groups.begin(); it != app_groups.end(); ++it) { std::string ssss = *it; - LOG4CXX_INFO(logger_, "Group: " << ssss); + SDL_LOG_INFO("Group: " << ssss); query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN( - logger_, - "Incorrect insert into app group." << query.LastError().text()); + SDL_LOG_WARN("Incorrect insert into app group." + << query.LastError().text()); return false; } } @@ -1310,7 +1292,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id, const policy_table::Strings& nicknames) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertNickname)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for nickname"); + SDL_LOG_WARN("Incorrect insert statement for nickname"); return false; } @@ -1319,7 +1301,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id, query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into nickname."); + SDL_LOG_WARN("Incorrect insert into nickname."); return false; } } @@ -1331,7 +1313,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id, const policy_table::AppHMITypes& types) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app type"); + SDL_LOG_WARN("Incorrect insert statement for app type"); return false; } @@ -1340,7 +1322,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id, query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app type."); + SDL_LOG_WARN("Incorrect insert into app type."); return false; } } @@ -1352,29 +1334,29 @@ bool SQLPTRepresentation::SaveRequestType( const std::string& app_id, const policy_table::RequestTypes& types) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRequestType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for request types."); + SDL_LOG_WARN("Incorrect insert statement for request types."); return false; } policy_table::RequestTypes::const_iterator it; if (!types.empty()) { - LOG4CXX_WARN(logger_, "Request types not empty."); + SDL_LOG_WARN("Request types not empty."); for (it = types.begin(); it != types.end(); ++it) { query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + SDL_LOG_WARN("Incorrect insert into request types."); return false; } } } else if (types.is_initialized()) { - LOG4CXX_WARN(logger_, "Request types empty."); + SDL_LOG_WARN("Request types empty."); query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString( policy_table::RequestType::RT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + SDL_LOG_WARN("Incorrect insert into request types."); return false; } } @@ -1386,29 +1368,29 @@ bool SQLPTRepresentation::SaveRequestSubType( const policy_table::RequestSubTypes& request_subtypes) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRequestSubType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes."); + SDL_LOG_WARN("Incorrect insert statement for request subtypes."); return false; } policy_table::Strings::const_iterator it; if (!request_subtypes.empty()) { - LOG4CXX_TRACE(logger_, "Request subtypes are not empty."); + SDL_LOG_TRACE("Request subtypes are not empty."); for (it = request_subtypes.begin(); it != request_subtypes.end(); ++it) { query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + SDL_LOG_WARN("Incorrect insert into request subtypes."); return false; } } } else if (request_subtypes.is_initialized()) { - LOG4CXX_WARN(logger_, "Request subtypes empty."); + SDL_LOG_WARN("Request subtypes empty."); query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString( policy_table::RequestType::RT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + SDL_LOG_WARN("Incorrect insert into request subtypes."); return false; } } @@ -1418,11 +1400,11 @@ bool SQLPTRepresentation::SaveRequestSubType( bool SQLPTRepresentation::SaveAppServiceParameters( const std::string& app_id, const policy_table::AppServiceParameters& app_service_parameters) { - LOG4CXX_INFO(logger_, "Save app service parameters"); + SDL_LOG_INFO("Save app service parameters"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app service types"); + SDL_LOG_WARN("Incorrect insert statement for app service types"); return false; } policy_table::AppServiceParameters::const_iterator it; @@ -1435,14 +1417,14 @@ bool SQLPTRepresentation::SaveAppServiceParameters( query.Bind(1, it->first); query.Bind(2, app_id); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Insert execute failed for into app service types"); + SDL_LOG_WARN("Insert execute failed for into app service types"); return false; } // Insert app names array into db utils::dbms::SQLQuery service_name_query(db()); if (!service_name_query.Prepare(sql_pt::kInsertAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app service names"); + SDL_LOG_WARN("Incorrect insert statement for app service names"); return false; } @@ -1450,11 +1432,11 @@ bool SQLPTRepresentation::SaveAppServiceParameters( if (app_service_names.is_initialized() && app_service_names->empty()) { // App service names is an empty array - LOG4CXX_DEBUG(logger_, "App Service Names is Empty Array"); + SDL_LOG_DEBUG("App Service Names is Empty Array"); service_name_query.Bind(0, static_cast<int64_t>(id)); service_name_query.Bind(1); if (!service_name_query.Exec() || !service_name_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into empty app service names"); + SDL_LOG_WARN("Incorrect insert into empty app service names"); return false; } } else { @@ -1465,7 +1447,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( service_name_query.Bind(0, static_cast<int64_t>(id)); service_name_query.Bind(1, *names_it); if (!service_name_query.Exec() || !service_name_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app service names"); + SDL_LOG_WARN("Incorrect insert into app service names"); return false; } } @@ -1474,8 +1456,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( // Insert handled rpcs array into db utils::dbms::SQLQuery handled_rpcs_query(db()); if (!handled_rpcs_query.Prepare(sql_pt::kInsertAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for app service handled rpcs"); + SDL_LOG_WARN("Incorrect insert statement for app service handled rpcs"); return false; } @@ -1486,7 +1467,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( handled_rpcs_query.Bind(0, static_cast<int64_t>(id)); handled_rpcs_query.Bind(1, static_cast<int32_t>(rpc_it->function_id)); if (!handled_rpcs_query.Exec() || !handled_rpcs_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app service handled rpcs"); + SDL_LOG_WARN("Incorrect insert into app service handled rpcs"); return false; } } @@ -1503,7 +1484,7 @@ bool SQLPTRepresentation::SaveModuleConfig( const policy_table::ModuleConfig& config) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateModuleConfig)) { - LOG4CXX_WARN(logger_, "Incorrect update statement for module config"); + SDL_LOG_WARN("Incorrect update statement for module config"); return false; } @@ -1532,7 +1513,7 @@ bool SQLPTRepresentation::SaveModuleConfig( : query.Bind(10); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update module config"); + SDL_LOG_WARN("Incorrect update module config"); return false; } @@ -1565,12 +1546,12 @@ bool SQLPTRepresentation::SaveServiceEndpoints( const policy_table::ServiceEndpoints& endpoints) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteEndpoint)) { - LOG4CXX_WARN(logger_, "Incorrect delete from endpoint."); + SDL_LOG_WARN("Incorrect delete from endpoint."); return false; } if (!query.Prepare(sql_pt::kInsertEndpoint)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for endpoint"); + SDL_LOG_WARN("Incorrect insert statement for endpoint"); return false; } @@ -1586,7 +1567,7 @@ bool SQLPTRepresentation::SaveServiceEndpoints( query.Bind(1, *url_it); query.Bind(2, app_it->first); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into endpoint"); + SDL_LOG_WARN("Incorrect insert into endpoint"); return false; } } @@ -1600,8 +1581,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( const policy_table::ServiceEndpointProperties& endpoint_properties) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertEndpointVersion)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Incorrect insert of endpoint property to endpoint_properties."); return false; } @@ -1611,8 +1591,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( query.Bind(1, endpoint_property.second.version); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Failed to insert endpoint property into endpoint_properties."); return false; } @@ -1623,13 +1602,13 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( bool SQLPTRepresentation::SaveConsumerFriendlyMessages( const policy_table::ConsumerFriendlyMessages& messages) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // According CRS-2419 If there is no “consumer_friendly_messages” key, // the current local consumer_friendly_messages section shall be maintained in // the policy table. So it won't be changed/updated if (!messages.messages.is_initialized()) { - LOG4CXX_INFO(logger_, "ConsumerFriendlyMessages messages list is empty"); + SDL_LOG_INFO("ConsumerFriendlyMessages messages list is empty"); return true; } @@ -1640,18 +1619,18 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( } if (!delete_query_exec_result) { - LOG4CXX_WARN(logger_, "Failed to delete messages from DB."); + SDL_LOG_WARN("Failed to delete messages from DB."); return false; } if (!query.Prepare(sql_pt::kUpdateVersion)) { - LOG4CXX_WARN(logger_, "Invalid update messages version statement."); + SDL_LOG_WARN("Invalid update messages version statement."); return false; } query.Bind(0, messages.version); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to update messages version number in DB."); + SDL_LOG_WARN("Failed to update messages version number in DB."); return false; } @@ -1678,13 +1657,13 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( bool SQLPTRepresentation::SaveMessageType(const std::string& type) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertMessageType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for message type."); + SDL_LOG_WARN("Incorrect insert statement for message type."); return false; } query.Bind(0, type); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into message type."); + SDL_LOG_WARN("Incorrect insert into message type."); return false; } @@ -1694,13 +1673,13 @@ bool SQLPTRepresentation::SaveMessageType(const std::string& type) { bool SQLPTRepresentation::SaveLanguage(const std::string& code) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertLanguage)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for language."); + SDL_LOG_WARN("Incorrect insert statement for language."); return false; } query.Bind(0, code); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into language."); + SDL_LOG_WARN("Incorrect insert into language."); return false; } @@ -1759,8 +1738,7 @@ policy_table::VehicleDataItems SQLPTRepresentation::SelectCompositeVehicleDataItems() const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectCompositeVehicleDataItemsKey)) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for parameterized vehicle data items"); + SDL_LOG_ERROR("Incorrect statement for parameterized vehicle data items"); return policy_table::VehicleDataItems(); } @@ -1784,8 +1762,7 @@ policy_table::VehicleDataItems SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectPrimitiveVehicleDataItems)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Incorrect statement for non parameterized vehicle data items"); return policy_table::VehicleDataItems(); } @@ -1805,17 +1782,15 @@ SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const { bool SQLPTRepresentation::DeleteVehicleDataItems() const { utils::dbms::SQLQuery query(db()); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!query.Exec(sql_pt::kDeleteVehicleDataItems)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kDeleteVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } return true; @@ -1833,12 +1808,11 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries( const policy_table::SecondsBetweenRetries& seconds) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteSecondsBetweenRetries)) { - LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries."); + SDL_LOG_WARN("Incorrect delete from seconds between retries."); return false; } if (!query.Prepare(sql_pt::kInsertSecondsBetweenRetry)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for seconds between retries."); + SDL_LOG_WARN("Incorrect insert statement for seconds between retries."); return false; } @@ -1846,7 +1820,7 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries( query.Bind(0, static_cast<int>(i)); query.Bind(1, seconds[i]); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into seconds between retries."); + SDL_LOG_WARN("Incorrect insert into seconds between retries."); return false; } } @@ -1858,8 +1832,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( const policy_table::NumberOfNotificationsPerMinute& notifications) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertNotificationsByPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for notifications by priority."); + SDL_LOG_WARN("Incorrect insert statement for notifications by priority."); return false; } @@ -1868,7 +1841,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( query.Bind(0, it->first); query.Bind(1, it->second); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority."); + SDL_LOG_WARN("Incorrect insert into notifications by priority."); return false; } } @@ -1880,8 +1853,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute( const policy_table::NumberOfNotificationsPerMinute& notifications) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertSubtleNotificationsByPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for notifications by priority."); + SDL_LOG_WARN("Incorrect insert statement for notifications by priority."); return false; } @@ -1890,7 +1862,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute( query.Bind(0, it->first); query.Bind(1, it->second); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority."); + SDL_LOG_WARN("Incorrect insert into notifications by priority."); return false; } } @@ -1902,7 +1874,7 @@ bool SQLPTRepresentation::SaveDeviceData( const policy_table::DeviceData& devices) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertDeviceData)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for device data."); + SDL_LOG_WARN("Incorrect insert statement for device data."); return false; } @@ -1910,7 +1882,7 @@ bool SQLPTRepresentation::SaveDeviceData( for (it = devices.begin(); it != devices.end(); ++it) { query.Bind(0, it->first); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into device data."); + SDL_LOG_WARN("Incorrect insert into device data."); return false; } } @@ -1923,11 +1895,11 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( const_cast<policy_table::UsageAndErrorCounts&>(counts).mark_initialized(); utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app level."); + SDL_LOG_WARN("Incorrect delete from app level."); return false; } if (!query.Prepare(sql_pt::kInsertAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app level."); + SDL_LOG_WARN("Incorrect insert statement for app level."); return false; } @@ -1937,7 +1909,7 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( for (it = app_levels.begin(); it != app_levels.end(); ++it) { query.Bind(0, it->first); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app level."); + SDL_LOG_WARN("Incorrect insert into app level."); return false; } } @@ -1947,23 +1919,22 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( void SQLPTRepresentation::IncrementIgnitionCycles() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kIncrementIgnitionCycles)) { - LOG4CXX_WARN(logger_, "Failed incrementing ignition cycles"); + SDL_LOG_WARN("Failed incrementing ignition cycles"); } } void SQLPTRepresentation::ResetIgnitionCycles() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kResetIgnitionCycles)) { - LOG4CXX_WARN(logger_, "Failed to reset ignition cycles number."); + SDL_LOG_WARN("Failed to reset ignition cycles number."); } } bool SQLPTRepresentation::UpdateRequired() const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectFlagUpdateRequired) || !query.Exec()) { - LOG4CXX_WARN(logger_, - "Failed select update required flag from module meta"); + SDL_LOG_WARN("Failed select update required flag from module meta"); return false; } return query.GetBoolean(0); @@ -1974,34 +1945,33 @@ void SQLPTRepresentation::SaveUpdateRequired(bool value) { // TODO(AOleynik): Quick fix, will be reworked if (!query.Prepare(/*sql_pt::kUpdateFlagUpdateRequired*/ "UPDATE `module_meta` SET `flag_update_required` = ?")) { - LOG4CXX_WARN(logger_, - "Incorrect update into module meta (update_required): " - << strerror(errno)); + SDL_LOG_WARN("Incorrect update into module meta (update_required): " + << strerror(errno)); return; } query.Bind(0, value); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update module meta (update_required)"); + SDL_LOG_WARN("Failed update module meta (update_required)"); } } bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, StringArray* nicknames, StringArray* app_types) { - LOG4CXX_INFO(logger_, "Getting initial application data."); + SDL_LOG_INFO("Getting initial application data."); utils::dbms::SQLQuery app_names(db()); if (!app_names.Prepare(sql_pt::kSelectNicknames)) { - LOG4CXX_WARN(logger_, "Incorrect select from app nicknames"); + SDL_LOG_WARN("Incorrect select from app nicknames"); return false; } utils::dbms::SQLQuery app_hmi_types(db()); if (!app_hmi_types.Prepare(sql_pt::kSelectAppTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } dbms::SQLQuery module_types(db()); if (!module_types.Prepare(sql_pt::kSelectModuleTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from module types"); + SDL_LOG_WARN("Incorrect select from module types"); return false; } @@ -2026,7 +1996,7 @@ bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, bool SQLPTRepresentation::GetFunctionalGroupings( policy_table::FunctionalGroupings& groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return GatherFunctionalGroupings(&groups); } @@ -2034,7 +2004,7 @@ bool SQLPTRepresentation::GatherAppType( const std::string& app_id, policy_table::AppHMITypes* app_types) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } @@ -2054,7 +2024,7 @@ bool SQLPTRepresentation::GatherRequestType( policy_table::RequestTypes* request_types) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRequestTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from request types."); + SDL_LOG_WARN("Incorrect select from request types."); return false; } @@ -2078,7 +2048,7 @@ bool SQLPTRepresentation::GatherRequestSubType( policy_table::RequestSubTypes* request_subtypes) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRequestSubTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from request subtypes."); + SDL_LOG_WARN("Incorrect select from request subtypes."); return false; } @@ -2098,22 +2068,22 @@ bool SQLPTRepresentation::GatherRequestSubType( bool SQLPTRepresentation::GatherAppServiceParameters( const std::string& app_id, policy_table::AppServiceParameters* app_service_parameters) const { - LOG4CXX_INFO(logger_, "Gather app service info"); + SDL_LOG_INFO("Gather app service info"); utils::dbms::SQLQuery service_type_query(db()); if (!service_type_query.Prepare(sql_pt::kSelectAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from service_types"); + SDL_LOG_WARN("Incorrect select from service_types"); return false; } utils::dbms::SQLQuery service_name_query(db()); if (!service_name_query.Prepare(sql_pt::kSelectAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect select all from app_service_names"); + SDL_LOG_WARN("Incorrect select all from app_service_names"); return false; } utils::dbms::SQLQuery handled_rpcs_query(db()); if (!handled_rpcs_query.Prepare(sql_pt::kSelectAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select all from app_service_handled_rpcs"); + SDL_LOG_WARN("Incorrect select all from app_service_handled_rpcs"); return false; } @@ -2125,7 +2095,7 @@ bool SQLPTRepresentation::GatherAppServiceParameters( service_name_query.Bind(0, service_type_id); while (service_name_query.Next()) { - LOG4CXX_DEBUG(logger_, "Loading service name"); + SDL_LOG_DEBUG("Loading service name"); (*app_service_parameters)[service_type].service_names->push_back( service_name_query.GetString(0)); (*app_service_parameters)[service_type].service_names->mark_initialized(); @@ -2140,11 +2110,11 @@ bool SQLPTRepresentation::GatherAppServiceParameters( } if (!service_name_query.Reset()) { - LOG4CXX_ERROR(logger_, "Could not reset service_name query"); + SDL_LOG_ERROR("Could not reset service_name query"); return false; } if (!handled_rpcs_query.Reset()) { - LOG4CXX_ERROR(logger_, "Could not reset handled_rpcs query"); + SDL_LOG_ERROR("Could not reset handled_rpcs query"); return false; } } @@ -2156,7 +2126,7 @@ bool SQLPTRepresentation::GatherNickName( const std::string& app_id, policy_table::Strings* nicknames) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectNicknames)) { - LOG4CXX_WARN(logger_, "Incorrect select from app nicknames"); + SDL_LOG_WARN("Incorrect select from app nicknames"); return false; } @@ -2171,7 +2141,7 @@ bool SQLPTRepresentation::GatherAppGroup( const std::string& app_id, policy_table::Strings* app_groups) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select from app groups"); + SDL_LOG_WARN("Incorrect select from app groups"); return false; } @@ -2184,10 +2154,10 @@ bool SQLPTRepresentation::GatherAppGroup( bool SQLPTRepresentation::GatherRemoteControlDenied(const std::string& app_id, bool* denied) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRemoteControlDenied)) { - LOG4CXX_WARN(logger_, "Incorrect select remote control flag"); + SDL_LOG_WARN("Incorrect select remote control flag"); return false; } query.Bind(0, app_id); @@ -2203,7 +2173,7 @@ bool SQLPTRepresentation::GatherModuleType( const std::string& app_id, policy_table::ModuleTypes* app_types) const { dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectModuleTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } @@ -2224,17 +2194,17 @@ bool SQLPTRepresentation::GatherModuleType( bool SQLPTRepresentation::SaveRemoteControlDenied(const std::string& app_id, bool deny) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateRemoteControlDenied)) { - LOG4CXX_WARN(logger_, "Incorrect update statement for remote control flag"); + SDL_LOG_WARN("Incorrect update statement for remote control flag"); return false; } - LOG4CXX_DEBUG(logger_, "App: " << app_id << std::boolalpha << " - " << deny); + SDL_LOG_DEBUG("App: " << app_id << std::boolalpha << " - " << deny); query.Bind(0, deny); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update remote control flag."); + SDL_LOG_WARN("Incorrect update remote control flag."); return false; } return true; @@ -2244,7 +2214,7 @@ bool SQLPTRepresentation::SaveModuleType( const std::string& app_id, const policy_table::ModuleTypes& types) { dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertModuleType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for module type"); + SDL_LOG_WARN("Incorrect insert statement for module type"); return false; } @@ -2254,10 +2224,9 @@ bool SQLPTRepresentation::SaveModuleType( query.Bind(0, app_id); std::string module(policy_table::EnumToJsonString(*it)); query.Bind(1, module); - LOG4CXX_DEBUG(logger_, - "Module(app: " << app_id << ", type: " << module << ")"); + SDL_LOG_DEBUG("Module(app: " << app_id << ", type: " << module << ")"); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into module type."); + SDL_LOG_WARN("Incorrect insert into module type."); return false; } } @@ -2267,21 +2236,21 @@ bool SQLPTRepresentation::SaveModuleType( std::string(policy_table::EnumToJsonString( policy_table::ModuleType::MT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into module types."); + SDL_LOG_WARN("Incorrect insert into module types."); return false; } } else { - LOG4CXX_WARN(logger_, "Module Type omitted."); + SDL_LOG_WARN("Module Type omitted."); } return true; } bool SQLPTRepresentation::SaveAccessModule( TypeAccess access, const policy_table::AccessModules& modules) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAccessModule)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for access module"); + SDL_LOG_WARN("Incorrect insert statement for access module"); return false; } @@ -2292,12 +2261,12 @@ bool SQLPTRepresentation::SaveAccessModule( query.Bind(0, name); query.Bind(1, access); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into access module."); + SDL_LOG_WARN("Incorrect insert into access module."); return false; } int id = query.LastInsertId(); if (!query.Reset()) { - LOG4CXX_WARN(logger_, "Couldn't reset query access module."); + SDL_LOG_WARN("Couldn't reset query access module."); return false; } if (!SaveRemoteRpc(id, rpcs)) { @@ -2309,10 +2278,10 @@ bool SQLPTRepresentation::SaveAccessModule( bool SQLPTRepresentation::GatherAccessModule( TypeAccess access, policy_table::AccessModules* modules) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAccessModules)) { - LOG4CXX_WARN(logger_, "Incorrect select from access module"); + SDL_LOG_WARN("Incorrect select from access module"); return false; } @@ -2331,10 +2300,10 @@ bool SQLPTRepresentation::GatherAccessModule( bool SQLPTRepresentation::SaveRemoteRpc(int module_id, const policy_table::RemoteRpcs& rpcs) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRemoteRpc)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for remote rpc"); + SDL_LOG_WARN("Incorrect insert statement for remote rpc"); return false; } policy_table::RemoteRpcs::const_iterator i; @@ -2347,7 +2316,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, query.Bind(1, name); query.Bind(2); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + SDL_LOG_WARN("Incorrect insert into remote rpc."); return false; } } else { @@ -2357,7 +2326,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, query.Bind(1, name); query.Bind(2, param); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + SDL_LOG_WARN("Incorrect insert into remote rpc."); return false; } } @@ -2368,10 +2337,10 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, bool SQLPTRepresentation::GatherRemoteRpc( int module_id, policy_table::RemoteRpcs* rpcs) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRemoteRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select from remote rpc"); + SDL_LOG_WARN("Incorrect select from remote rpc"); return false; } @@ -2394,7 +2363,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, bool is_predata) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateApplicationCustomData)) { - LOG4CXX_WARN(logger_, "Incorrect update in application"); + SDL_LOG_WARN("Incorrect update in application"); return false; } @@ -2404,7 +2373,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, query.Bind(3, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update in application"); + SDL_LOG_WARN("Failed update in application"); return false; } @@ -2415,13 +2384,13 @@ bool SQLPTRepresentation::IsApplicationRevoked( const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationRevoked)) { - LOG4CXX_WARN(logger_, "Incorrect select from is_revoked of application"); + SDL_LOG_WARN("Incorrect select from is_revoked of application"); } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select is_revoked of application"); + SDL_LOG_WARN("Failed select is_revoked of application"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -2430,13 +2399,13 @@ bool SQLPTRepresentation::IsApplicationRepresented( const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationRepresented)) { - LOG4CXX_WARN(logger_, "Incorrect select application by id"); + SDL_LOG_WARN("Incorrect select application by id"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select application by id"); + SDL_LOG_WARN("Failed select application by id"); return false; } return query.GetInteger(0) != 0; @@ -2445,13 +2414,13 @@ bool SQLPTRepresentation::IsApplicationRepresented( bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationIsDefault)) { - LOG4CXX_WARN(logger_, "Incorrect select application by id"); + SDL_LOG_WARN("Incorrect select application by id"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select application by id"); + SDL_LOG_WARN("Failed select application by id"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -2464,12 +2433,12 @@ bool SQLPTRepresentation::IsPredataPolicy(const std::string& app_id) const { bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } @@ -2514,17 +2483,17 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { bool SQLPTRepresentation::SetIsDefault(const std::string& app_id, bool is_default) const { - LOG4CXX_TRACE(logger_, "Set flag is_default of application"); + SDL_LOG_TRACE("Set flag is_default of application"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateIsDefault)) { - LOG4CXX_WARN(logger_, "Incorect statement for updating is_default"); + SDL_LOG_WARN("Incorect statement for updating is_default"); return false; } query.Bind(0, is_default); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update is_default"); + SDL_LOG_WARN("Failed update is_default"); return false; } return true; @@ -2535,18 +2504,16 @@ void SQLPTRepresentation::RemoveDB() const { } bool SQLPTRepresentation::IsDBVersionActual() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectDBVersion) || !query.Exec()) { - LOG4CXX_ERROR(logger_, - "Failed to get DB version: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to get DB version: " << query.LastError().text()); return false; } const int32_t saved_db_version = query.GetInteger(0); const int32_t current_db_version = GetDBVersion(); - LOG4CXX_DEBUG(logger_, - "Saved DB version is: " << saved_db_version + SDL_LOG_DEBUG("Saved DB version is: " << saved_db_version << ". Current DB vesion is: " << current_db_version); @@ -2554,21 +2521,19 @@ bool SQLPTRepresentation::IsDBVersionActual() const { } bool SQLPTRepresentation::UpdateDBVersion() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateDBVersion)) { - LOG4CXX_ERROR(logger_, - "Incorrect DB version query: " << query.LastError().text()); + SDL_LOG_ERROR("Incorrect DB version query: " << query.LastError().text()); return false; } const int32_t db_version = GetDBVersion(); - LOG4CXX_DEBUG(logger_, "DB version will be updated to: " << db_version); + SDL_LOG_DEBUG("DB version will be updated to: " << db_version); query.Bind(0, db_version); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, - "DB version getting failed: " << query.LastError().text()); + SDL_LOG_ERROR("DB version getting failed: " << query.LastError().text()); return false; } @@ -2581,9 +2546,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataItem)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return result; } @@ -2600,9 +2564,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem( if (policy_table::VehicleDataItem::kStruct == static_cast<std::string>(vdi.type)) { if (!param_query.Prepare(sql_pt::kSelectVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << param_query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << param_query.LastError().text()); return policy_table::VehicleDataItems(); } @@ -2634,21 +2597,19 @@ bool SQLPTRepresentation::InsertVehicleDataItem( utils::dbms::SQLQuery query(db()); if (!vehicle_data_item.is_initialized() || !vehicle_data_item.is_valid()) { - LOG4CXX_ERROR(logger_, "Vehicle data item is not initialized."); + SDL_LOG_ERROR("Vehicle data item is not initialized."); return false; } if (VehicleDataItemExists(vehicle_data_item)) { - LOG4CXX_INFO(logger_, - static_cast<std::string>(vehicle_data_item.key) - << " is already stored."); + SDL_LOG_INFO(static_cast<std::string>(vehicle_data_item.key) + << " is already stored."); return true; } if (!query.Prepare(sql_pt::kInsertVehicleDataItem)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return false; } @@ -2691,10 +2652,9 @@ bool SQLPTRepresentation::InsertVehicleDataItem( : query.Bind(14); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR(logger_, - "Failed to insert vehicle data item: " - << static_cast<std::string>(vehicle_data_item.key) - << ". Error: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to insert vehicle data item: " + << static_cast<std::string>(vehicle_data_item.key) + << ". Error: " << query.LastError().text()); return false; } @@ -2707,14 +2667,13 @@ bool SQLPTRepresentation::InsertVehicleDataItem( if (stored_vehicle_data_item_params.end() != stored_vehicle_data_item_params.find(param.name)) { - LOG4CXX_DEBUG(logger_, "Parameter already stored."); + SDL_LOG_DEBUG("Parameter already stored."); continue; } if (!query.Prepare(sql_pt::kInsertVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return false; } @@ -2724,11 +2683,11 @@ bool SQLPTRepresentation::InsertVehicleDataItem( query.Bind(3, param.key); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed to insert to vehicle data item relations helper table: " - << static_cast<std::string>(param.key) - << ". Error: " << query.LastError().text()); + << static_cast<std::string>(param.key) + << ". Error: " << query.LastError().text()); return false; } stored_vehicle_data_item_params[param.name] = param.key; @@ -2742,9 +2701,8 @@ bool SQLPTRepresentation::VehicleDataItemExists( const policy_table::VehicleDataItem& vehicle_data_item) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataItemWithVersion)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement for vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement for vehicle data item. " + << query.LastError().text()); return false; } @@ -2758,10 +2716,9 @@ bool SQLPTRepresentation::VehicleDataItemExists( : query.Bind(3); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, - "Failed to retrieve vehicle data item: " - << std::string(vehicle_data_item.key) - << ". Error: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to retrieve vehicle data item: " + << std::string(vehicle_data_item.key) + << ". Error: " << query.LastError().text()); return false; } return !query.IsNull(0); @@ -2785,18 +2742,18 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, const std::string& destination) { utils::dbms::SQLQuery source_app(db()); if (!source_app.Prepare(sql_pt::kSelectApplicationFull)) { - LOG4CXX_WARN(logger_, "Incorrect select statement from application."); + SDL_LOG_WARN("Incorrect select statement from application."); return false; } source_app.Bind(0, source); if (!source_app.Exec()) { - LOG4CXX_WARN(logger_, "Failed selecting from application."); + SDL_LOG_WARN("Failed selecting from application."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertApplicationFull)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement into application full."); + SDL_LOG_WARN("Incorrect insert statement into application full."); return false; } query.Bind(0, destination); @@ -2834,7 +2791,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, : query.Bind(18, source_app.GetBoolean(17)); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed inserting into application."); + SDL_LOG_WARN("Failed inserting into application."); return false; } return true; @@ -2843,13 +2800,13 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, void SQLPTRepresentation::SetPreloaded(bool value) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdatePreloaded)) { - LOG4CXX_WARN(logger_, "Incorrect statement of updating preloaded."); + SDL_LOG_WARN("Incorrect statement of updating preloaded."); return; } query.Bind(0, value); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed updating preloaded."); + SDL_LOG_WARN("Failed updating preloaded."); return; } } @@ -2864,8 +2821,7 @@ bool SQLPTRepresentation::SaveExternalConsentEntities( ExternalConsentEntitiesType type) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt_ext::kInsertExternalConsentEntity)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for external consent entities."); + SDL_LOG_WARN("Incorrect insert statement for external consent entities."); return false; } @@ -2882,8 +2838,7 @@ bool SQLPTRepresentation::SaveExternalConsentEntities( query.Bind(2, it_entity->entity_id); query.Bind(3, external_consent_entity_type); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR(logger_, - "Can't insert '" << external_consent_entity_type + SDL_LOG_ERROR("Can't insert '" << external_consent_entity_type << "' external consent entity."); return false; } diff --git a/src/components/policy/policy_external/src/update_status_manager.cc b/src/components/policy/policy_external/src/update_status_manager.cc index c50aefd0eb..59b95a405c 100644 --- a/src/components/policy/policy_external/src/update_status_manager.cc +++ b/src/components/policy/policy_external/src/update_status_manager.cc @@ -37,7 +37,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) @@ -52,7 +52,7 @@ UpdateStatusManager::UpdateStatusManager() } UpdateStatusManager::~UpdateStatusManager() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(update_status_thread_delegate_); DCHECK(thread_); thread_->Stop(threads::Thread::kThreadSoftStop); @@ -61,7 +61,7 @@ UpdateStatusManager::~UpdateStatusManager() { } void UpdateStatusManager::ProcessEvent(UpdateEvent event) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(status_lock_); current_status_->ProcessEvent(this, event); last_processed_event_ = event; @@ -81,14 +81,14 @@ void UpdateStatusManager::set_listener(PolicyListener* listener) { } void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(update_status_thread_delegate_); update_status_thread_delegate_->updateTimeOut(update_timeout); ProcessEvent(kOnUpdateSentOut); } void UpdateStatusManager::OnUpdateTimeoutOccurs() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto& ptu_retry_handler = listener_->ptu_retry_handler(); @@ -103,25 +103,25 @@ void UpdateStatusManager::OnUpdateTimeoutOccurs() { } void UpdateStatusManager::OnValidUpdateReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_thread_delegate_->updateTimeOut(0); // Stop Timer ProcessEvent(kOnValidUpdateReceived); } void UpdateStatusManager::ResetTimeout(uint32_t update_timeout) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_thread_delegate_->updateTimeOut( update_timeout); // Restart Timer } void UpdateStatusManager::OnWrongUpdateReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_thread_delegate_->updateTimeOut(0); // Stop Timer ProcessEvent(kOnWrongUpdateReceived); } void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_update_required) { ProcessEvent(kOnResetPolicyTableRequireUpdate); return; @@ -130,13 +130,13 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { } void UpdateStatusManager::OnResetRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnResetRetrySequence); } void UpdateStatusManager::OnExistedApplicationAdded( const bool is_update_required) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_update_required) { current_status_.reset(new UpToDateStatus()); ProcessEvent(kScheduleUpdate); @@ -144,13 +144,13 @@ void UpdateStatusManager::OnExistedApplicationAdded( } void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (kDeviceAllowed != consent) { - LOG4CXX_DEBUG(logger_, "Application registered from non-consented device"); + SDL_LOG_DEBUG("Application registered from non-consented device"); app_registered_from_non_consented_device_ = true; return; } - LOG4CXX_DEBUG(logger_, "Application registered from consented device"); + SDL_LOG_DEBUG("Application registered from consented device"); app_registered_from_non_consented_device_ = false; if (kOnResetRetrySequence == last_processed_event_) { current_status_.reset(new UpToDateStatus()); @@ -161,7 +161,7 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { } void UpdateStatusManager::OnDeviceConsented() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app_registered_from_non_consented_device_) { ProcessEvent(kOnNewAppRegistered); } @@ -176,17 +176,17 @@ bool UpdateStatusManager::IsUpdatePending() const { } void UpdateStatusManager::ScheduleUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kScheduleUpdate); } void UpdateStatusManager::PendingUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kPendingUpdate); } void UpdateStatusManager::ScheduleManualUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kScheduleManualUpdate); } @@ -195,19 +195,19 @@ std::string UpdateStatusManager::StringifiedUpdateStatus() const { } void policy::UpdateStatusManager::OnAppsSearchStarted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); apps_search_in_progress_ = true; } void policy::UpdateStatusManager::OnAppsSearchCompleted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); apps_search_in_progress_ = false; } bool policy::UpdateStatusManager::IsAppsSearchInProgress() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); return apps_search_in_progress_; } @@ -244,22 +244,22 @@ UpdateStatusManager::UpdateThreadDelegate::UpdateThreadDelegate( : timeout_(0) , stop_flag_(false) , update_status_manager_(update_status_manager) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Create UpdateThreadDelegate"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Create UpdateThreadDelegate"); } UpdateStatusManager::UpdateThreadDelegate::~UpdateThreadDelegate() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Delete UpdateThreadDelegate"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Delete UpdateThreadDelegate"); } void UpdateStatusManager::UpdateThreadDelegate::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "UpdateStatusManager thread started (started normal)"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("UpdateStatusManager thread started (started normal)"); sync_primitives::AutoLock auto_lock(state_lock_); while (false == stop_flag_) { if (timeout_ > 0) { - LOG4CXX_DEBUG(logger_, "Timeout is greater then 0"); + SDL_LOG_DEBUG("Timeout is greater then 0"); sync_primitives::ConditionalVariable::WaitStatus wait_status = termination_condition_.WaitFor(auto_lock, timeout_); if (sync_primitives::ConditionalVariable::kTimeout == wait_status) { @@ -276,16 +276,16 @@ void UpdateStatusManager::UpdateThreadDelegate::threadMain() { } void UpdateStatusManager::UpdateThreadDelegate::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); stop_flag_ = true; - LOG4CXX_DEBUG(logger_, "before notify"); + SDL_LOG_DEBUG("before notify"); termination_condition_.NotifyOne(); } void UpdateStatusManager::UpdateThreadDelegate::updateTimeOut( const uint32_t timeout_ms) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); timeout_ = timeout_ms; termination_condition_.NotifyOne(); diff --git a/src/components/policy/policy_regular/src/access_remote_impl.cc b/src/components/policy/policy_regular/src/access_remote_impl.cc index f743a4d56e..439fbcc8d2 100644 --- a/src/components/policy/policy_regular/src/access_remote_impl.cc +++ b/src/components/policy/policy_regular/src/access_remote_impl.cc @@ -36,7 +36,7 @@ #include "policy/cache_manager.h" #include "utils/logger.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl") +SDL_CREATE_LOG_VARIABLE("PolicyManagerImpl") using policy_table::DeviceData; using policy_table::FunctionalGroupings; @@ -48,11 +48,10 @@ struct ToHMIType { policy_table::AppHMITypes::value_type operator()(int item) const { policy_table::AppHMIType type = static_cast<policy_table::AppHMIType>(item); if (!IsValidEnum(type)) { - LOG4CXX_WARN(logger_, "HMI type isn't known " << item); + SDL_LOG_WARN("HMI type isn't known " << item); type = policy_table::AHT_DEFAULT; } - LOG4CXX_DEBUG(logger_, - "HMI type: " << item << " - " << EnumToJsonString(type)); + SDL_LOG_DEBUG("HMI type: " << item << " - " << EnumToJsonString(type)); return policy_table::AppHMITypes::value_type(type); } }; @@ -94,7 +93,7 @@ AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache) bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, policy_table::ModuleType module) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!cache_->IsApplicationRepresented(app_id)) { return false; } @@ -117,10 +116,10 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules, const std::string& module_name, const std::string& rpc_name, RemoteControlParams* input) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::AccessModules::const_iterator i = modules.find(module_name); if (i == modules.end()) { - LOG4CXX_DEBUG(logger_, "Module " << module_name << " wasn't found"); + SDL_LOG_DEBUG("Module " << module_name << " wasn't found"); return false; } @@ -133,19 +132,19 @@ bool AccessRemoteImpl::IsAllowed(const policy_table::AccessModules& modules, const policy_table::Strings& parameters = j->second; return CompareParameters(parameters, input); } - LOG4CXX_DEBUG(logger_, "RPC " << rpc_name << " wasn't found"); + SDL_LOG_DEBUG("RPC " << rpc_name << " wasn't found"); return false; } bool AccessRemoteImpl::CompareParameters( const policy_table::Strings& parameters, RemoteControlParams* input) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (parameters.empty()) { return true; } if (input->empty()) { - LOG4CXX_DEBUG(logger_, "Input is empty"); + SDL_LOG_DEBUG("Input is empty"); return false; } @@ -157,7 +156,7 @@ bool AccessRemoteImpl::CompareParameters( void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, const std::vector<int>& hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); HMIList::mapped_type types; std::transform(hmi_types.begin(), hmi_types.end(), @@ -168,7 +167,7 @@ void AccessRemoteImpl::SetDefaultHmiTypes(const ApplicationOnDevice& who, const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( const ApplicationOnDevice& who) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cache_->IsDefaultPolicy(who.app_id)) { return hmi_types_[who]; } else { @@ -180,12 +179,12 @@ const policy_table::AppHMITypes& AccessRemoteImpl::HmiTypes( const policy_table::Strings& AccessRemoteImpl::GetGroups( const ApplicationOnDevice& who) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetGroups(who.app_id); } bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const policy_table::AppHMITypes& hmi_types = HmiTypes(who); return std::find(hmi_types.begin(), hmi_types.end(), @@ -195,7 +194,7 @@ bool AccessRemoteImpl::IsAppRemoteControl(const ApplicationOnDevice& who) { bool AccessRemoteImpl::GetPermissionsForApp(const std::string& device_id, const std::string& app_id, FunctionalIdType& group_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GetGroupsIds(device_id, app_id, group_types[kTypeGeneral]); GetGroupsIds(device_id, kDefaultId, group_types[kTypeDefault]); GetGroupsIds( @@ -221,7 +220,7 @@ void AccessRemoteImpl::GetGroupsIds(const std::string& device_id, groups.end(), groups_ids.begin(), &CacheManager::GenerateHash); - LOG4CXX_DEBUG(logger_, "Groups Ids: " << groups_ids); + SDL_LOG_DEBUG("Groups Ids: " << groups_ids); } bool AccessRemoteImpl::GetModuleTypes(const std::string& application_id, diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index 7c491a28a5..5a75c47725 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -60,22 +60,22 @@ namespace policy_table = rpc::policy_table_interface_base; namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") -#define CACHE_MANAGER_CHECK(return_value) \ - { \ - if (!pt_) { \ - LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \ - return return_value; \ - } \ +#define CACHE_MANAGER_CHECK(return_value) \ + { \ + if (!pt_) { \ + SDL_LOG_WARN("The cache manager is not initialized"); \ + return return_value; \ + } \ } -#define CACHE_MANAGER_CHECK_VOID() \ - { \ - if (!pt_) { \ - LOG4CXX_WARN(logger_, "The cache manager is not initialized"); \ - return; \ - } \ +#define CACHE_MANAGER_CHECK_VOID() \ + { \ + if (!pt_) { \ + SDL_LOG_WARN("The cache manager is not initialized"); \ + return; \ + } \ } struct LanguageFinder { @@ -110,14 +110,14 @@ CacheManager::CacheManager() , update_required(false) , removed_custom_vd_items_() , settings_(nullptr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); backuper_ = new BackgroundBackuper(this); backup_thread_ = threads::CreateThread("Backup thread", backuper_); backup_thread_->Start(); } CacheManager::~CacheManager() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(backuper_locker_); backup_thread_->Stop(threads::Thread::kThreadSoftStop); delete backup_thread_->GetDelegate(); @@ -130,7 +130,7 @@ const policy_table::Strings& CacheManager::GetGroups(const PTString& app_id) { } const policy_table::Strings CacheManager::GetPolicyAppIDs() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto apps = pt_->policy_table.app_policies_section.apps; @@ -204,18 +204,18 @@ bool CacheManager::GetUserPermissionsForDevice( const std::string& device_id, StringArray& consented_groups, StringArray& disallowed_groups) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); return true; } void CacheManager::GetAllAppGroups(const std::string& app_id, FunctionalGroupIDs& all_group_ids) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); if (kDeviceId == app_id) { - LOG4CXX_INFO(logger_, "Devices doesn't have groups"); + SDL_LOG_INFO("Devices doesn't have groups"); return; } @@ -238,7 +238,7 @@ void CacheManager::GetAllAppGroups(const std::string& app_id, void CacheManager::GetPreConsentedGroups( const std::string& app_id, FunctionalGroupIDs& preconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); } @@ -246,7 +246,7 @@ void CacheManager::GetConsentedGroups(const std::string& device_id, const std::string& app_id, FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); } @@ -254,7 +254,7 @@ void CacheManager::GetUnconsentedGroups( const std::string& device_id, const std::string& policy_app_id, FunctionalGroupIDs& unconsented_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); } @@ -264,7 +264,7 @@ void CacheManager::RemoveAppConsentForGroup(const std::string& app_id, } bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); pt_->policy_table.functional_groupings = @@ -355,7 +355,7 @@ policy_table::VehicleDataItems CacheManager::CollectCustomVDItems( void CacheManager::GetHMIAppTypeAfterUpdate( std::map<std::string, StringArray>& app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator policy_iter_begin = @@ -419,7 +419,7 @@ std::string CacheManager::currentDateTime() { bool CacheManager::GetPermissionsForApp(const std::string& device_id, const std::string& app_id, FunctionalIdType& group_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); GetAllAppGroups(app_id, group_types[kTypeGeneral]); GetAllAppGroups(kDefaultId, group_types[kTypeDefault]); GetAllAppGroups(kPreDataConsentId, group_types[kTypePreDataConsented]); @@ -429,14 +429,14 @@ bool CacheManager::GetPermissionsForApp(const std::string& device_id, bool CacheManager::GetDeviceGroupsFromPolicies( policy_table::Strings& groups, policy_table::Strings& preconsented_groups) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); return true; } bool CacheManager::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); @@ -462,7 +462,7 @@ bool CacheManager::SetDeviceData(const std::string& device_id, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); @@ -474,7 +474,7 @@ bool CacheManager::SetUserPermissionsForDevice( const std::string& device_id, const StringArray& consented_groups, const StringArray& disallowed_groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); Backup(); @@ -483,7 +483,7 @@ bool CacheManager::SetUserPermissionsForDevice( bool CacheManager::ReactOnUserDevConsentForApp(const std::string& app_id, bool is_device_allowed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); bool result = true; Backup(); @@ -509,7 +509,7 @@ void CacheManager::GetGroupNameByHashID(const int32_t group_id, bool CacheManager::SetUserPermissionsForApp( const PermissionConsent& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); CACHE_MANAGER_CHECK(false); Backup(); @@ -541,7 +541,7 @@ void CacheManager::CheckPermissions(const policy_table::Strings& groups, const PTString& hmi_level, const PTString& rpc, CheckPermissionResult& result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -600,14 +600,14 @@ int CacheManager::IgnitionCyclesBeforeExchange() { static_cast<int>( pt_->policy_table.module_config.exchange_after_x_ignition_cycles), 0); - LOG4CXX_DEBUG(logger_, "IgnitionCyclesBeforeExchange limit:" << limit); + SDL_LOG_DEBUG("IgnitionCyclesBeforeExchange limit:" << limit); uint8_t current = 0; const int last_exch = static_cast<int>( *pt_->policy_table.module_meta->ignition_cycles_since_last_exchange); current = std::max(last_exch, 0); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "IgnitionCyclesBeforeExchange current:" << static_cast<int>(current)); return std::max(limit - current, 0); @@ -620,16 +620,16 @@ int CacheManager::KilometersBeforeExchange(int current) { std::max(static_cast<int>( pt_->policy_table.module_config.exchange_after_x_kilometers), 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange limit:" << limit); + SDL_LOG_DEBUG("KilometersBeforeExchange limit:" << limit); int last = 0; const int odo_val = static_cast<int>( *pt_->policy_table.module_meta->pt_exchanged_at_odometer_x); last = std::max(odo_val, 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange last:" << last); + SDL_LOG_DEBUG("KilometersBeforeExchange last:" << last); const int actual = std::max((current - last), 0); - LOG4CXX_DEBUG(logger_, "KilometersBeforeExchange actual:" << actual); + SDL_LOG_DEBUG("KilometersBeforeExchange actual:" << actual); return std::max(limit - actual, 0); } @@ -640,18 +640,16 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate( switch (counter) { case KILOMETERS: *pt_->policy_table.module_meta->pt_exchanged_at_odometer_x = value; - LOG4CXX_DEBUG(logger_, - "SetCountersPassedForSuccessfulUpdate km:" << value); + SDL_LOG_DEBUG("SetCountersPassedForSuccessfulUpdate km:" << value); break; case DAYS_AFTER_EPOCH: *pt_->policy_table.module_meta->pt_exchanged_x_days_after_epoch = value; - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "SetCountersPassedForSuccessfulUpdate days after epoch:" << value); break; default: - LOG4CXX_ERROR(logger_, - "Unknown counter was requested to set: " << counter); + SDL_LOG_ERROR("Unknown counter was requested to set: " << counter); return false; } @@ -660,7 +658,7 @@ bool CacheManager::SetCountersPassedForSuccessfulUpdate( } int CacheManager::DaysBeforeExchange(int current) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(0); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -672,14 +670,13 @@ int CacheManager::DaysBeforeExchange(int current) { } const uint8_t limit = pt_->policy_table.module_config.exchange_after_x_days; - LOG4CXX_DEBUG(logger_, - "Exchange after: " << static_cast<int>(limit) << " days"); + SDL_LOG_DEBUG("Exchange after: " << static_cast<int>(limit) << " days"); - LOG4CXX_DEBUG(logger_, "Epoch since last update: " << *days_after_epoch); + SDL_LOG_DEBUG("Epoch since last update: " << *days_after_epoch); const uint16_t actual = std::max(static_cast<uint16_t>(current - *days_after_epoch), uint16_t(0)); - LOG4CXX_DEBUG(logger_, "The days since last update: " << actual); + SDL_LOG_DEBUG("The days since last update: " << actual); return std::max(limit - actual, 0); } @@ -691,7 +688,7 @@ void CacheManager::IncrementIgnitionCycles() { *pt_->policy_table.module_meta->ignition_cycles_since_last_exchange); (*pt_->policy_table.module_meta->ignition_cycles_since_last_exchange) = ign_val + 1; - LOG4CXX_DEBUG(logger_, "IncrementIgnitionCycles ignitions:" << ign_val); + SDL_LOG_DEBUG("IncrementIgnitionCycles ignitions:" << ign_val); Backup(); } @@ -914,7 +911,7 @@ void CacheManager::SetHybridAppPreference( void CacheManager::GetAppServiceParameters( const std::string& policy_app_id, policy_table::AppServiceParameters* app_service_parameters) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const policy_table::ApplicationPolicies& policies = pt_->policy_table.app_policies_section.apps; policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -944,24 +941,23 @@ bool CacheManager::UnknownRPCPassthroughAllowed( const boost::optional<bool> CacheManager::LockScreenDismissalEnabledState() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); boost::optional<bool> empty; CACHE_MANAGER_CHECK(empty); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ModuleConfig& module_config = pt_->policy_table.module_config; if (module_config.lock_screen_dismissal_enabled.is_initialized()) { - LOG4CXX_TRACE(logger_, - "state = " << *module_config.lock_screen_dismissal_enabled); + SDL_LOG_TRACE("state = " << *module_config.lock_screen_dismissal_enabled); return boost::optional<bool>(*module_config.lock_screen_dismissal_enabled); } - LOG4CXX_TRACE(logger_, "state = empty"); + SDL_LOG_TRACE("state = empty"); return empty; } const boost::optional<std::string> CacheManager::LockScreenDismissalWarningMessage( const std::string& language) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); boost::optional<std::string> empty; CACHE_MANAGER_CHECK(empty); @@ -983,7 +979,7 @@ CacheManager::LockScreenDismissalWarningMessage( std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( const std::vector<std::string>& msg_codes, const std::string& language) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<UserFriendlyMessage> result; CACHE_MANAGER_CHECK(result); @@ -1003,10 +999,9 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( msg_languages.languages.begin(), msg_languages.languages.end(), finder); if (msg_languages.languages.end() == it_language) { - LOG4CXX_WARN(logger_, - "Language " - << language - << " haven't been found for message code: " << *it); + SDL_LOG_WARN("Language " + << language + << " haven't been found for message code: " << *it); LanguageFinder fallback_language_finder("en-us"); @@ -1016,8 +1011,7 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( fallback_language_finder); if (msg_languages.languages.end() == it_fallback_language) { - LOG4CXX_ERROR(logger_, - "No fallback language found for message code: " << *it); + SDL_LOG_ERROR("No fallback language found for message code: " << *it); continue; } @@ -1058,10 +1052,10 @@ void CacheManager::GetUpdateUrls(const uint32_t service_type, void CacheManager::GetUpdateUrls(const std::string& service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); - LOG4CXX_DEBUG(logger_, "Search service value is: " << service_type); + SDL_LOG_DEBUG("Search service value is: " << service_type); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ServiceEndpoints::const_iterator iter = @@ -1145,7 +1139,7 @@ bool CacheManager::GetPriority(const std::string& policy_app_id, void CacheManager::CheckSnapshotInitialization() { CACHE_MANAGER_CHECK_VOID(); if (!snapshot_) { - LOG4CXX_ERROR(logger_, "Snapshot pointer is not initialized"); + SDL_LOG_ERROR("Snapshot pointer is not initialized"); return; } @@ -1177,8 +1171,7 @@ void CacheManager::CheckSnapshotInitialization() { snapshot_->policy_table.consumer_friendly_messages->messages = rpc::Optional<policy_table::Messages>(); } else { - LOG4CXX_WARN(logger_, - "policy_table.consumer_friendly_messages is not initialized"); + SDL_LOG_WARN("policy_table.consumer_friendly_messages is not initialized"); } /* policy_table.usage_and_error_counts are required for PTS and @@ -1256,22 +1249,21 @@ void CacheManager::CheckSnapshotInitialization() { } } } else { - LOG4CXX_WARN(logger_, "app_level is not initialized"); + SDL_LOG_WARN("app_level is not initialized"); } } policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff( const policy_table::VehicleDataItems& items_before, const policy_table::VehicleDataItems& items_after) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (items_before.empty()) { - LOG4CXX_DEBUG(logger_, "No custom VD items found in policy"); + SDL_LOG_DEBUG("No custom VD items found in policy"); return policy_table::VehicleDataItems(); } if (items_after.empty()) { - LOG4CXX_DEBUG(logger_, - "All custom VD items were removed after policy update"); + SDL_LOG_DEBUG("All custom VD items were removed after policy update"); return items_before; } @@ -1289,19 +1281,18 @@ policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff( } } - LOG4CXX_DEBUG(logger_, - "Found " << removed_items.size() << " removed VD items"); + SDL_LOG_DEBUG("Found " << removed_items.size() << " removed VD items"); return removed_items; } void CacheManager::SetRemovedCustomVdItems( const policy_table::VehicleDataItems& removed_items) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); removed_custom_vd_items_ = removed_items; } void CacheManager::PersistData() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (backup_.use_count() != 0) { if (pt_.use_count() != 0) { // Comma expression is used to hold the lock only during the constructor @@ -1359,7 +1350,7 @@ void CacheManager::PersistData() { } void CacheManager::ResetCalculatedPermissions() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_.clear(); } @@ -1367,9 +1358,8 @@ void CacheManager::ResetCalculatedPermissions() { void CacheManager::AddCalculatedPermissions(const std::string& device_id, const std::string& policy_app_id, const Permissions& permissions) { - LOG4CXX_DEBUG(logger_, - "AddCalculatedPermissions for device: " - << device_id << " and app: " << policy_app_id); + SDL_LOG_DEBUG("AddCalculatedPermissions for device: " + << device_id << " and app: " << policy_app_id); sync_primitives::AutoLock lock(calculated_permissions_lock_); calculated_permissions_[device_id][policy_app_id] = permissions; } @@ -1377,9 +1367,8 @@ void CacheManager::AddCalculatedPermissions(const std::string& device_id, bool CacheManager::IsPermissionsCalculated(const std::string& device_id, const std::string& policy_app_id, Permissions& permission) { - LOG4CXX_DEBUG(logger_, - "IsPermissionsCalculated for device: " - << device_id << " and app: " << policy_app_id); + SDL_LOG_DEBUG("IsPermissionsCalculated for device: " + << device_id << " and app: " << policy_app_id); sync_primitives::AutoLock lock(calculated_permissions_lock_); CalculatedPermissions::const_iterator it = calculated_permissions_.find(device_id); @@ -1443,7 +1432,7 @@ std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { bool CacheManager::GetInitialAppData(const std::string& app_id, StringArray& nicknames, StringArray& app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::const_iterator policy_iter = @@ -1466,7 +1455,7 @@ bool CacheManager::GetInitialAppData(const std::string& app_id, bool CacheManager::GetFunctionalGroupings( policy_table::FunctionalGroupings& groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); const policy_table::FunctionalGroupings& f_groupings = @@ -1478,15 +1467,15 @@ bool CacheManager::GetFunctionalGroupings( int CacheManager::CountUnconsentedGroups(const std::string& policy_app_id, const std::string& device_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); - LOG4CXX_DEBUG(logger_, "Application id: " << policy_app_id); + SDL_LOG_DEBUG("Application id: " << policy_app_id); int result = 0; return result; } void CacheManager::SetPreloadedPtFlag(const bool is_preloaded) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); *(pt_->policy_table.module_config.preloaded_pt) = is_preloaded; Backup(); } @@ -1507,7 +1496,7 @@ bool CacheManager::SetMetaInfo(const std::string& ccpu_version, } std::string CacheManager::GetCCPUVersionFromPT() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); rpc::Optional<policy_table::ModuleMeta>& module_meta = pt_->policy_table.module_meta; return *(module_meta->ccpu_version); @@ -1526,7 +1515,7 @@ bool CacheManager::SetSystemLanguage(const std::string& language) { } bool CacheManager::GetFunctionalGroupNames(FunctionalGroupNames& names) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK(false); sync_primitives::AutoLock auto_lock(cache_lock_); rpc::policy_table_interface_base::FunctionalGroupings::iterator iter = @@ -1598,7 +1587,7 @@ void CacheManager::Increment(const std::string& app_id, .count_of_tls_errors; break; default: - LOG4CXX_WARN(logger_, "Type app counter is unknown"); + SDL_LOG_WARN("Type app counter is unknown"); return; } Backup(); @@ -1619,7 +1608,7 @@ void CacheManager::Set(const std::string& app_id, .app_registration_language_vui = value; break; default: - LOG4CXX_WARN(logger_, "Type app info is unknown"); + SDL_LOG_WARN("Type app info is unknown"); return; } Backup(); @@ -1649,7 +1638,7 @@ void CacheManager::Add(const std::string& app_id, .minutes_in_hmi_none += minutes; break; default: - LOG4CXX_WARN(logger_, "Type app stopwatch is unknown"); + SDL_LOG_WARN("Type app stopwatch is unknown"); return; } Backup(); @@ -1706,8 +1695,7 @@ bool CacheManager::SetPredataPolicy(const std::string& app_id) { pt_->policy_table.app_policies_section.apps.find(kPreDataConsentId); if (pt_->policy_table.app_policies_section.apps.end() == iter) { - LOG4CXX_ERROR(logger_, - "Could not set " << kPreDataConsentId + SDL_LOG_ERROR("Could not set " << kPreDataConsentId << " permissions for app " << app_id); return false; } @@ -1756,20 +1744,18 @@ bool CacheManager::SetUnpairedDevice(const std::string& device_id, const bool result = pt_->policy_table.device_data->end() != pt_->policy_table.device_data->find(device_id); if (!result) { - LOG4CXX_DEBUG(logger_, - "Couldn't set unpaired flag for device id " - << device_id << " , since it wasn't found."); + SDL_LOG_DEBUG("Couldn't set unpaired flag for device id " + << device_id << " , since it wasn't found."); return false; } sync_primitives::AutoLock lock(unpaired_lock_); if (unpaired) { is_unpaired_.insert(device_id); - LOG4CXX_DEBUG(logger_, "Unpaired flag was set for device id " << device_id); + SDL_LOG_DEBUG("Unpaired flag was set for device id " << device_id); } else { is_unpaired_.erase(device_id); - LOG4CXX_DEBUG(logger_, - "Unpaired flag was removed for device id " << device_id); + SDL_LOG_DEBUG("Unpaired flag was removed for device id " << device_id); } return result; } @@ -1793,20 +1779,20 @@ bool CacheManager::IsApplicationRepresented(const std::string& app_id) const { bool CacheManager::Init(const std::string& file_name, const PolicySettings* settings) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); settings_ = settings; InitResult init_result = backup_->Init(settings); bool result = true; switch (init_result) { case InitResult::EXISTS: { - LOG4CXX_INFO(logger_, "Policy Table exists, was loaded correctly."); + SDL_LOG_INFO("Policy Table exists, was loaded correctly."); result = LoadFromBackup(); if (result) { if (!backup_->IsDBVersionActual()) { - LOG4CXX_INFO(logger_, "DB version is NOT actual"); + SDL_LOG_INFO("DB version is NOT actual"); if (!backup_->RefreshDB()) { - LOG4CXX_ERROR(logger_, "RefreshDB() failed"); + SDL_LOG_ERROR("RefreshDB() failed"); return false; } backup_->UpdateDBVersion(); @@ -1818,24 +1804,22 @@ bool CacheManager::Init(const std::string& file_name, } } break; case InitResult::SUCCESS: { - LOG4CXX_INFO(logger_, "Policy Table was inited successfully"); + SDL_LOG_INFO("Policy Table was inited successfully"); result = LoadFromFile(file_name, *pt_); std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); - LOG4CXX_DEBUG(logger_, - "Check if snapshot is valid: " << std::boolalpha << result); + SDL_LOG_DEBUG("Check if snapshot is valid: " << std::boolalpha << result); if (!result) { rpc::ValidationReport report("policy_table"); snapshot->ReportErrors(&report); - LOG4CXX_DEBUG(logger_, - "Validation report: " << rpc::PrettyFormat(report)); + SDL_LOG_DEBUG("Validation report: " << rpc::PrettyFormat(report)); return result; } if (!UnwrapAppPolicies(pt_->policy_table.app_policies_section.apps)) { - LOG4CXX_ERROR(logger_, "Cannot unwrap application policies"); + SDL_LOG_ERROR("Cannot unwrap application policies"); } backup_->UpdateDBVersion(); @@ -1843,7 +1827,7 @@ bool CacheManager::Init(const std::string& file_name, } break; default: { result = false; - LOG4CXX_ERROR(logger_, "Failed to init policy table."); + SDL_LOG_ERROR("Failed to init policy table."); } break; } @@ -1853,12 +1837,11 @@ bool CacheManager::Init(const std::string& file_name, void CacheManager::FillDeviceSpecificData() {} bool CacheManager::LoadFromBackup() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(cache_lock_); pt_ = backup_->GenerateSnapshot(); update_required = backup_->UpdateRequired(); - LOG4CXX_DEBUG(logger_, - "Update required flag from backup: " << std::boolalpha + SDL_LOG_DEBUG("Update required flag from backup: " << std::boolalpha << update_required); FillDeviceSpecificData(); @@ -1888,10 +1871,10 @@ void CacheManager::MakeLowerCaseAppNames(policy_table::Table& pt) const { bool CacheManager::LoadFromFile(const std::string& file_name, policy_table::Table& table) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); BinaryMessage json_string; if (!file_system::ReadBinaryFile(file_name, json_string)) { - LOG4CXX_FATAL(logger_, "Failed to read pt file."); + SDL_LOG_FATAL("Failed to read pt file."); return false; } @@ -1904,27 +1887,25 @@ bool CacheManager::LoadFromFile(const std::string& file_name, std::string json(json_string.begin(), json_string.end()); const size_t json_len = json.length(); if (!reader->parse(json.c_str(), json.c_str() + json_len, &value, &err)) { - LOG4CXX_FATAL(logger_, "Preloaded PT is corrupted: " << err); + SDL_LOG_FATAL("Preloaded PT is corrupted: " << err); return false; } - LOG4CXX_TRACE(logger_, "Start create PT"); + SDL_LOG_TRACE("Start create PT"); sync_primitives::AutoLock locker(cache_lock_); table = policy_table::Table(&value); Json::StreamWriterBuilder writer_builder; - LOG4CXX_DEBUG(logger_, "PT out:"); - LOG4CXX_DEBUG(logger_, - Json::writeString(writer_builder, table.ToJsonValue())); + SDL_LOG_DEBUG("PT out:"); + SDL_LOG_DEBUG(Json::writeString(writer_builder, table.ToJsonValue())); MakeLowerCaseAppNames(table); if (!table.is_valid()) { rpc::ValidationReport report("policy_table"); table.ReportErrors(&report); - LOG4CXX_FATAL(logger_, - "Parsed table is not valid " << rpc::PrettyFormat(report)); + SDL_LOG_FATAL("Parsed table is not valid " << rpc::PrettyFormat(report)); return false; } @@ -1962,25 +1943,22 @@ int32_t CacheManager::GenerateHash(const std::string& str_to_hash) { RequestType::State CacheManager::GetAppRequestTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::iterator app_policies_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request types for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id); return RequestType::State::UNAVAILABLE; } const policy_table::RequestTypes& request_types = *app_policies_iter->second.RequestType; if (!request_types.is_initialized()) { - LOG4CXX_DEBUG(logger_, - "Request types for " << policy_app_id << " are OMITTED"); + SDL_LOG_DEBUG("Request types for " << policy_app_id << " are OMITTED"); return RequestType::State::OMITTED; } if (request_types.empty()) { - LOG4CXX_DEBUG(logger_, - "Request types for " << policy_app_id << " are EMPTY"); + SDL_LOG_DEBUG("Request types for " << policy_app_id << " are EMPTY"); return RequestType::State::EMPTY; } return RequestType::State::AVAILABLE; @@ -1989,19 +1967,17 @@ RequestType::State CacheManager::GetAppRequestTypesState( void CacheManager::GetAppRequestTypes( const std::string& policy_app_id, std::vector<std::string>& request_types) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); if (kDeviceId == policy_app_id) { - LOG4CXX_DEBUG(logger_, - "Request types not applicable for app_id " << kDeviceId); + SDL_LOG_DEBUG("Request types not applicable for app_id " << kDeviceId); return; } policy_table::ApplicationPolicies::iterator policy_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request types for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request types for app_id " << policy_app_id); return; } @@ -2013,25 +1989,22 @@ void CacheManager::GetAppRequestTypes( RequestSubType::State CacheManager::GetAppRequestSubTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); policy_table::ApplicationPolicies::iterator app_policies_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == app_policies_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request subtypes for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id); return RequestSubType::State::UNAVAILABLE; } const policy_table::RequestSubTypes& request_subtypes = *app_policies_iter->second.RequestSubType; if (!request_subtypes.is_initialized()) { - LOG4CXX_DEBUG(logger_, - "Request subtypes for " << policy_app_id << " are OMITTED"); + SDL_LOG_DEBUG("Request subtypes for " << policy_app_id << " are OMITTED"); return RequestSubType::State::OMITTED; } if (request_subtypes.empty()) { - LOG4CXX_DEBUG(logger_, - "Request subtypes for " << policy_app_id << " are EMPTY"); + SDL_LOG_DEBUG("Request subtypes for " << policy_app_id << " are EMPTY"); return RequestSubType::State::EMPTY; } return RequestSubType::State::AVAILABLE; @@ -2040,19 +2013,17 @@ RequestSubType::State CacheManager::GetAppRequestSubTypesState( void CacheManager::GetAppRequestSubTypes( const std::string& policy_app_id, std::vector<std::string>& request_types) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); CACHE_MANAGER_CHECK_VOID(); sync_primitives::AutoLock auto_lock(cache_lock_); if (kDeviceId == policy_app_id) { - LOG4CXX_DEBUG(logger_, - "Request subtypes not applicable for app_id " << kDeviceId); + SDL_LOG_DEBUG("Request subtypes not applicable for app_id " << kDeviceId); return; } policy_table::ApplicationPolicies::iterator policy_iter = pt_->policy_table.app_policies_section.apps.find(policy_app_id); if (pt_->policy_table.app_policies_section.apps.end() == policy_iter) { - LOG4CXX_DEBUG(logger_, - "Can't find request subtypes for app_id " << policy_app_id); + SDL_LOG_DEBUG("Can't find request subtypes for app_id " << policy_app_id); return; } @@ -2072,10 +2043,10 @@ std::string CacheManager::GetCertificate() const { } bool CacheManager::MergePreloadPT(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::Table table; if (!LoadFromFile(file_name, table)) { - LOG4CXX_DEBUG(logger_, "Unable to load preloaded PT."); + SDL_LOG_DEBUG("Unable to load preloaded PT."); return false; } @@ -2097,7 +2068,7 @@ bool CacheManager::MergePreloadPT(const std::string& file_name) { void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::ModuleConfig copy(pt.module_config); pt.module_config = new_pt.module_config; @@ -2108,19 +2079,19 @@ void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt, void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::FunctionalGroupings::const_iterator it = new_pt.functional_groupings.begin(); for (; it != new_pt.functional_groupings.end(); ++it) { - LOG4CXX_DEBUG(logger_, "Merge functional group: " << it->first); + SDL_LOG_DEBUG("Merge functional group: " << it->first); pt.functional_groupings[it->first] = it->second; } } void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); pt.app_policies_section.device = const_cast<policy_table::PolicyTable&>(new_pt) .app_policies_section.device; @@ -2136,7 +2107,7 @@ void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt, void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (new_pt.consumer_friendly_messages.is_initialized()) { if (!pt.consumer_friendly_messages.is_initialized()) { pt.consumer_friendly_messages = new_pt.consumer_friendly_messages; @@ -2147,9 +2118,9 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, pt.consumer_friendly_messages->version = new_pt.consumer_friendly_messages->version; for (; it != new_pt.consumer_friendly_messages->messages->end(); ++it) { - LOG4CXX_DEBUG(logger_, "Merge CFM: " << it->first); + SDL_LOG_DEBUG("Merge CFM: " << it->first); if (!(pt.consumer_friendly_messages->messages.is_initialized())) { - LOG4CXX_DEBUG(logger_, "CFM not initialized."); + SDL_LOG_DEBUG("CFM not initialized."); } (*pt.consumer_friendly_messages->messages)[it->first] = it->second; } @@ -2159,7 +2130,7 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt, void CacheManager::MergeVD(const policy_table::PolicyTable& new_pt, policy_table::PolicyTable& pt) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); pt.vehicle_data.assign_if_valid(new_pt.vehicle_data); } @@ -2171,8 +2142,8 @@ const PolicySettings& CacheManager::get_settings() const { void CacheManager::OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_INFO(logger_, "Implementation does not support user consents."); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_INFO("Implementation does not support user consents."); } CacheManager::BackgroundBackuper::BackgroundBackuper( @@ -2180,26 +2151,26 @@ CacheManager::BackgroundBackuper::BackgroundBackuper( : cache_manager_(cache_manager) , stop_flag_(false) , new_data_available_(false) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } CacheManager::BackgroundBackuper::~BackgroundBackuper() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void CacheManager::BackgroundBackuper::InternalBackup() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(cache_manager_); while (new_data_available_) { new_data_available_ = false; - LOG4CXX_DEBUG(logger_, "DoBackup"); + SDL_LOG_DEBUG("DoBackup"); cache_manager_->PersistData(); } } void CacheManager::BackgroundBackuper::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(need_backup_lock_); while (!stop_flag_) { { @@ -2209,20 +2180,20 @@ void CacheManager::BackgroundBackuper::threadMain() { if (new_data_available_ || stop_flag_) { continue; } - LOG4CXX_DEBUG(logger_, "Wait for a next backup"); + SDL_LOG_DEBUG("Wait for a next backup"); backup_notifier_.Wait(need_backup_lock_); } } void CacheManager::BackgroundBackuper::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(need_backup_lock_); stop_flag_ = true; backup_notifier_.NotifyOne(); } void CacheManager::BackgroundBackuper::DoBackup() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(need_backup_lock_); new_data_available_ = true; backup_notifier_.NotifyOne(); @@ -2230,7 +2201,7 @@ void CacheManager::BackgroundBackuper::DoBackup() { EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag( const std::string& application) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); return pt_->policy_table.app_policies_section.apps[application] @@ -2239,14 +2210,14 @@ EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag( EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag( const std::string& functional_group) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto& functional_groupings = pt_->policy_table.functional_groupings; const auto& grouping_itr = functional_groupings.find(functional_group); if (grouping_itr == functional_groupings.end()) { - LOG4CXX_WARN(logger_, "Group " << functional_group << " not found"); + SDL_LOG_WARN("Group " << functional_group << " not found"); return EncryptionRequired(rpc::Boolean(false)); } @@ -2256,14 +2227,13 @@ EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag( void CacheManager::GetApplicationParams( const std::string& application_name, policy_table::ApplicationParams& application_params) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(cache_lock_); const auto apps = pt_->policy_table.app_policies_section.apps; const auto it = apps.find(application_name); if (apps.end() == it) { - LOG4CXX_WARN(logger_, - "Application " << application_name << " was not found"); + SDL_LOG_WARN("Application " << application_name << " was not found"); return; } diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc index 08f1fbb177..7d99ff51c0 100644 --- a/src/components/policy/policy_regular/src/policy_helper.cc +++ b/src/components/policy/policy_regular/src/policy_helper.cc @@ -44,7 +44,7 @@ namespace custom_str = utils::custom_string; namespace { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") bool CompareStrings(const StringsValueType& first, const StringsValueType& second) { @@ -302,7 +302,7 @@ std::vector<FunctionalGroupPermission> policy::CheckAppPolicy::GetRevokedGroups( FunctionalGroupNames groups_attributes; if (!pm_->cache_->GetFunctionalGroupNames(groups_attributes)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return std::vector<FunctionalGroupPermission>(); } @@ -339,8 +339,8 @@ void policy::CheckAppPolicy::NotifySystem( auto& listener = *pm_->listener(); const auto devices_ids = listener.GetDevicesIds(app_policy.first); if (devices_ids.empty()) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Couldn't find device info for application id: " << app_policy.first); return; } @@ -352,7 +352,7 @@ void policy::CheckAppPolicy::NotifySystem( bool CheckAppPolicy::IsAppRevoked( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Application params are not initialized = application revoked // i.e. "123":null return app_policy.second.is_null(); @@ -380,7 +380,7 @@ bool CheckAppPolicy::NicknamesMatch( void CheckAppPolicy::AddResult(const std::string& app_id, PermissionsCheckResult result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto item = std::make_pair(app_id, result); out_results_.insert(item); } @@ -395,8 +395,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { } if (!IsKnownAppication(app_id)) { - LOG4CXX_WARN(logger_, - "Application:" << app_id << " is not present in snapshot."); + SDL_LOG_WARN("Application:" << app_id << " is not present in snapshot."); return true; } @@ -427,16 +426,14 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { } } if (RESULT_NO_CHANGES == result) { - LOG4CXX_INFO( - logger_, - "Permissions for application:" << app_id << " wasn't changed."); + SDL_LOG_INFO("Permissions for application:" << app_id + << " wasn't changed."); AddResult(app_id, RESULT_NO_CHANGES); return true; } - LOG4CXX_INFO( - logger_, - "Permissions for application:" << app_id << " have been changed."); + SDL_LOG_INFO("Permissions for application:" << app_id + << " have been changed."); if (IsPredefinedApp(app_policy)) { const auto& snapshot_app_policy_begin = @@ -616,7 +613,7 @@ bool CheckAppPolicy::IsRequestSubTypeChanged( bool CheckAppPolicy::IsAppPropertiesProvided( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app_policy.second.hybrid_app_preference.is_initialized() || app_policy.second.endpoint.is_initialized() || app_policy.second.enabled.is_initialized() || @@ -630,15 +627,15 @@ bool CheckAppPolicy::IsAppPropertiesProvided( bool CheckAppPolicy::IsAppPropertiesChanged( const AppPoliciesValueType& app_policy) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!IsAppPropertiesProvided(app_policy)) { return false; } if (!IsKnownAppication(app_policy.first)) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "AppProperties provided for new application: " << app_policy.first); return true; } @@ -649,33 +646,33 @@ bool CheckAppPolicy::IsAppPropertiesChanged( if (app_policy.second.enabled.is_initialized() && app_policy.second.enabled != snapshot_properties.second.enabled) { - LOG4CXX_DEBUG(logger_, "\"enabled\" was changed"); + SDL_LOG_DEBUG("\"enabled\" was changed"); return true; } if (app_policy.second.endpoint.is_initialized() && app_policy.second.endpoint != snapshot_properties.second.endpoint) { - LOG4CXX_DEBUG(logger_, "\"endpoint\" was changed"); + SDL_LOG_DEBUG("\"endpoint\" was changed"); return true; } if (app_policy.second.hybrid_app_preference.is_initialized() && app_policy.second.hybrid_app_preference != snapshot_properties.second.hybrid_app_preference) { - LOG4CXX_DEBUG(logger_, "\"hybrid_app_preference\" was changed"); + SDL_LOG_DEBUG("\"hybrid_app_preference\" was changed"); return true; } if (app_policy.second.auth_token.is_initialized() && app_policy.second.auth_token != snapshot_properties.second.auth_token) { - LOG4CXX_DEBUG(logger_, "\"auth_token\" was changed"); + SDL_LOG_DEBUG("\"auth_token\" was changed"); return true; } if (app_policy.second.cloud_transport_type.is_initialized() && app_policy.second.cloud_transport_type != snapshot_properties.second.cloud_transport_type) { - LOG4CXX_DEBUG(logger_, "\"cloud_transport_type\" was changed"); + SDL_LOG_DEBUG("\"cloud_transport_type\" was changed"); return true; } @@ -690,7 +687,7 @@ bool CheckAppPolicy::IsEncryptionRequiredFlagChanged( -> rpc::Optional<rpc::Boolean> { auto it = policies.find(policy_app_id); if (policies.end() == it) { - LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id); + SDL_LOG_WARN("App is not present in policies " << policy_app_id); return rpc::Optional<rpc::Boolean>(false); } return it->second.encryption_required; @@ -702,7 +699,7 @@ bool CheckAppPolicy::IsEncryptionRequiredFlagChanged( policy_table::Strings result; auto it = policies.find(policy_app_id); if (policies.end() == it) { - LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id); + SDL_LOG_WARN("App is not present in policies " << policy_app_id); return result; } auto& groups = it->second.groups; @@ -1047,7 +1044,7 @@ void FillFunctionalGroupPermissions( FunctionalGroupNames& names, GroupConsent state, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs::const_iterator it = ids.begin(); FunctionalGroupIDs::const_iterator it_end = ids.end(); for (; it != it_end; ++it) { @@ -1067,7 +1064,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) { FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, const FunctionalGroupIDs& what) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs from_copy(from); FunctionalGroupIDs what_copy(what); @@ -1089,7 +1086,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); @@ -1111,7 +1108,7 @@ FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first, const FunctionalGroupIDs& second) { - LOG4CXX_INFO(logger_, "Find same groups"); + SDL_LOG_INFO("Find same groups"); FunctionalGroupIDs first_copy(first); FunctionalGroupIDs second_copy(second); @@ -1142,9 +1139,9 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) { (*it).second = (*it_default).second; it->second.set_to_string(kDefaultId); } else { - LOG4CXX_ERROR(logger_, - "There is no default application policy was " - "found in PTU."); + SDL_LOG_ERROR( + "There is no default application policy was " + "found in PTU."); return false; } } diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index 174d0d5d12..36beeeb07f 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -60,7 +60,7 @@ const uint32_t kDefaultRetryTimeoutInMSec = namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") PolicyManagerImpl::PolicyManagerImpl() : PolicyManager() @@ -126,15 +126,14 @@ std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray( #endif void PolicyManagerImpl::CheckTriggers() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool exceed_ignition_cycles = ExceededIgnitionCycles(); const bool exceed_days = ExceededDays(); - LOG4CXX_DEBUG( - logger_, - "\nDays exceeded: " << std::boolalpha << exceed_days - << "\nIgnition cycles exceeded: " << std::boolalpha - << exceed_ignition_cycles); + SDL_LOG_DEBUG("\nDays exceeded: " << std::boolalpha << exceed_days + << "\nIgnition cycles exceeded: " + << std::boolalpha + << exceed_ignition_cycles); if (exceed_ignition_cycles || exceed_days) { update_status_manager_.ScheduleUpdate(); @@ -327,9 +326,9 @@ void FilterPolicyTable( PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( const std::string& file, const BinaryMessage& pt_content) { - LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size()); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_INFO("LoadPT of size " << pt_content.size()); + SDL_LOG_DEBUG( + "PTU content is: " << std::string(pt_content.begin(), pt_content.end())); #ifdef USE_HMI_PTU_DECRYPTION @@ -343,7 +342,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( std::shared_ptr<policy_table::Table> pt_update = ParseArray(pt_content); #endif if (!pt_update) { - LOG4CXX_WARN(logger_, "Parsed table pointer is NULL."); + SDL_LOG_WARN("Parsed table pointer is NULL."); ; return PtProcessingResult::kWrongPtReceived; } @@ -354,13 +353,13 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( FilterPolicyTable(pt_update->policy_table, current_vd_items); if (!IsPTValid(pt_update, policy_table::PT_UPDATE)) { - LOG4CXX_WARN(logger_, "Received policy table update is not valid"); + SDL_LOG_WARN("Received policy table update is not valid"); return PtProcessingResult::kWrongPtReceived; } // Update finished, no need retry if (timer_retry_sequence_.is_running()) { - LOG4CXX_INFO(logger_, "Stop retry sequence"); + SDL_LOG_INFO("Stop retry sequence"); timer_retry_sequence_.Stop(); } @@ -371,8 +370,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( // Get current DB data, since it could be updated during awaiting of PTU auto policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Failed to create snapshot of policy table, trying another exchange"); return PtProcessingResult::kNewPtRequired; } @@ -387,8 +385,8 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( // Replace current data with updated if (!cache_->ApplyUpdate(*pt_update)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Unsuccessful save of updated policy table, trying another exchange"); return PtProcessingResult::kNewPtRequired; } @@ -403,10 +401,10 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( std::map<std::string, StringArray> app_hmi_types; cache_->GetHMIAppTypeAfterUpdate(app_hmi_types); if (!app_hmi_types.empty()) { - LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType"); + SDL_LOG_INFO("app_hmi_types is full calling OnUpdateHMIAppType"); listener_->OnUpdateHMIAppType(app_hmi_types); } else { - LOG4CXX_INFO(logger_, "app_hmi_types empty" << pt_content.size()); + SDL_LOG_INFO("app_hmi_types empty" << pt_content.size()); } std::vector<std::string> enabled_apps; @@ -419,10 +417,10 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( } void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ptu_requested_ = false; if (PtProcessingResult::kWrongPtReceived == ptu_result) { - LOG4CXX_DEBUG(logger_, "Wrong PT was received"); + SDL_LOG_DEBUG("Wrong PT was received"); update_status_manager_.OnWrongUpdateReceived(); return; } @@ -430,7 +428,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { update_status_manager_.OnValidUpdateReceived(); if (PtProcessingResult::kNewPtRequired == ptu_result) { - LOG4CXX_DEBUG(logger_, "New PTU interation is required"); + SDL_LOG_DEBUG("New PTU interation is required"); ForcePTExchange(); return; } @@ -440,8 +438,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { // If there was a user request for policy table update, it should be started // right after current update is finished if (update_status_manager_.IsUpdateRequired() && HasApplicationForPTU()) { - LOG4CXX_DEBUG(logger_, - "PTU was successful and new PTU iteration was scheduled"); + SDL_LOG_DEBUG("PTU was successful and new PTU iteration was scheduled"); StartPTExchange(); return; } @@ -452,7 +449,7 @@ void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) { void PolicyManagerImpl::ProcessAppPolicyCheckResults( const CheckAppPolicyResults& results, const rpc::policy_table_interface_base::ApplicationPolicies& app_policies) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ApplicationsPoliciesActions actions_for_apps_policies; FillActionsForAppPolicies filler(actions_for_apps_policies, app_policies); @@ -508,12 +505,12 @@ void PolicyManagerImpl::ProcessActionsForAppPolicies( void PolicyManagerImpl::SendOnAppPropertiesChangeNotification( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); listener_->SendOnAppPropertiesChangeNotification(policy_app_id); } void PolicyManagerImpl::ResumePendingAppPolicyActions() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (auto& notify_system_params : notify_system_list_) { NotifySystem(notify_system_params.first, notify_system_params.second); @@ -566,7 +563,7 @@ void PolicyManagerImpl::SendPermissionsToApp( CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges( const std::shared_ptr<policy_table::Table> pt_update, const std::shared_ptr<policy_table::Table> snapshot) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Replace predefined policies with its actual setting, e.g. "123":"default" // to actual values of default section @@ -597,31 +594,31 @@ void PolicyManagerImpl::PrepareNotificationData( const policy_table::Strings& group_names, const std::vector<FunctionalGroupPermission>& group_permission, Permissions& notification_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessFunctionalGroup processor(groups, group_permission, notification_data); std::for_each(group_names.begin(), group_names.end(), processor); } void PolicyManagerImpl::GetUpdateUrls(const std::string& service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->GetUpdateUrls(service_type, out_end_points); } void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, EndpointUrls& out_end_points) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->GetUpdateUrls(service_type, out_end_points); } bool PolicyManagerImpl::RequestPTUpdate(const PTUIterationType iteration_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); BinaryMessage update; if (PTUIterationType::DefaultIteration == iteration_type) { std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { - LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); + SDL_LOG_ERROR("Failed to create snapshot of policy table"); return false; } @@ -632,7 +629,7 @@ bool PolicyManagerImpl::RequestPTUpdate(const PTUIterationType iteration_type) { writer_builder["indentation"] = ""; std::string message_string = Json::writeString(writer_builder, value); - LOG4CXX_DEBUG(logger_, "Snapshot contents is : " << message_string); + SDL_LOG_DEBUG("Snapshot contents is : " << message_string); update = BinaryMessage(message_string.begin(), message_string.end()); } @@ -647,24 +644,24 @@ std::string PolicyManagerImpl::GetIconUrl( } void PolicyManagerImpl::StartPTExchange() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool update_required = update_status_manager_.IsUpdateRequired(); if (update_status_manager_.IsAppsSearchInProgress() && update_required) { update_status_manager_.ScheduleUpdate(); - LOG4CXX_INFO(logger_, - "Starting exchange skipped, since applications " - "search is in progress."); + SDL_LOG_INFO( + "Starting exchange skipped, since applications " + "search is in progress."); return; } if (update_status_manager_.IsUpdatePending() && update_required) { if (trigger_ptu_) update_status_manager_.ScheduleUpdate(); - LOG4CXX_INFO(logger_, - "Starting exchange skipped, since another exchange " - "is in progress."); + SDL_LOG_INFO( + "Starting exchange skipped, since another exchange " + "is in progress."); return; } @@ -682,8 +679,7 @@ void PolicyManagerImpl::StartPTExchange() { const uint32_t timeout_msec = NextRetryTimeout(); if (timeout_msec) { - LOG4CXX_DEBUG(logger_, - "Start retry sequence timeout = " << timeout_msec); + SDL_LOG_DEBUG("Start retry sequence timeout = " << timeout_msec); timer_retry_sequence_.Start(timeout_msec, timer::kPeriodic); } } @@ -692,12 +688,12 @@ void PolicyManagerImpl::StartPTExchange() { } void PolicyManagerImpl::OnAppsSearchStarted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.OnAppsSearchStarted(); } void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.OnAppsSearchCompleted(); trigger_ptu_ = trigger_ptu; @@ -709,13 +705,13 @@ void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) { } void PolicyManagerImpl::OnLocalAppAdded() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); update_status_manager_.ScheduleUpdate(); StartPTExchange(); } void PolicyManagerImpl::UpdatePTUReadyAppsCount(const uint32_t new_app_count) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); applications_pending_ptu_count_ = new_app_count; } @@ -723,7 +719,7 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile( const std::string& device_id, const std::string& application_id) { if (application_id != last_registered_policy_app_id_) { if (last_registered_policy_app_id_.empty()) { - LOG4CXX_DEBUG(logger_, "Stopping update after first app is registered"); + SDL_LOG_DEBUG("Stopping update after first app is registered"); // ResetRetrySequence(ResetRetryCountType::kResetInternally); StopRetrySequence(); } @@ -736,7 +732,7 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile( void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from, const std::string& device_id_to) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->OnDeviceSwitching(device_id_from, device_id_to); } @@ -749,13 +745,13 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes( RequestType::State PolicyManagerImpl::GetAppRequestTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetAppRequestTypesState(policy_app_id); } RequestSubType::State PolicyManagerImpl::GetAppRequestSubTypesState( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetAppRequestSubTypesState(policy_app_id); } @@ -836,7 +832,7 @@ void PolicyManagerImpl::GetAppServiceParameters( bool PolicyManagerImpl::UnknownRPCPassthroughAllowed( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->UnknownRPCPassthroughAllowed(policy_app_id); } @@ -846,23 +842,21 @@ void PolicyManagerImpl::CheckPermissions(const PTString& device_id, const PTString& rpc, const RPCParams& rpc_params, CheckPermissionResult& result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!cache_->IsApplicationRepresented(app_id)) { - LOG4CXX_WARN(logger_, "Application " << app_id << " isn't exist"); + SDL_LOG_WARN("Application " << app_id << " isn't exist"); return; } - LOG4CXX_INFO(logger_, - "CheckPermissions for " << app_id << " and rpc " << rpc + SDL_LOG_INFO("CheckPermissions for " << app_id << " and rpc " << rpc << " for " << hmi_level << " level."); ApplicationOnDevice who = {device_id, app_id}; policy_table::Strings groups; if (access_remote_->IsAppRemoteControl(who)) { groups = access_remote_->GetGroups(who); - LOG4CXX_INFO(logger_, - "CheckPermissions for " << app_id << " and rpc " << rpc + SDL_LOG_INFO("CheckPermissions for " << app_id << " and rpc " << rpc << " for " << hmi_level << " level."); } else { groups = cache_->GetGroups(app_id); @@ -886,7 +880,7 @@ bool PolicyManagerImpl::ResetUserConsent() { void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( const std::string& device_id, const std::string& application_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<FunctionalGroupPermission> app_group_permissions; GetPermissionsForApp(device_id, application_id, app_group_permissions); @@ -905,8 +899,7 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( app_group_permissions, notification_data); - LOG4CXX_INFO(logger_, - "Send notification for application_id: " << application_id); + SDL_LOG_INFO("Send notification for application_id: " << application_id); std::string default_hmi = "NONE"; @@ -922,21 +915,21 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( } bool PolicyManagerImpl::CleanupUnpairedDevices() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // For SDL-specific it doesn't matter return true; } DeviceConsent PolicyManagerImpl::GetUserConsentForDevice( const std::string& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return kDeviceAllowed; } void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id, bool is_allowed) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device :" << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device :" << device_id); DeviceConsent current_consent = GetUserConsentForDevice(device_id); bool is_current_device_allowed = DeviceConsent::kDeviceAllowed == current_consent ? true : false; @@ -946,7 +939,7 @@ void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id, if (DeviceConsent::kDeviceHasNoConsent != current_consent && is_current_device_allowed == is_allowed) { const std::string consent = is_allowed ? "allowed" : "disallowed"; - LOG4CXX_INFO(logger_, "Device is already " << consent << "."); + SDL_LOG_INFO("Device is already " << consent << "."); return; } } @@ -964,7 +957,7 @@ bool PolicyManagerImpl::ReactOnUserDevConsentForApp( bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, StringArray* nicknames, StringArray* app_hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool result = nicknames && app_hmi_types; if (result) { cache_->GetInitialAppData(application_id, *nicknames, *app_hmi_types); @@ -974,17 +967,17 @@ bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, void PolicyManagerImpl::AddDevice(const std::string& device_id, const std::string& connection_type) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device: " << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device: " << device_id); if (!cache_->AddDevice(device_id, connection_type)) { - LOG4CXX_WARN(logger_, "Can't add device."); + SDL_LOG_WARN("Can't add device."); } } void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id, const DeviceInfo& device_info) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device :" << device_id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device :" << device_id); } PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent( @@ -1024,19 +1017,18 @@ PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent( void PolicyManagerImpl::CheckPendingPermissionsChanges( const std::string& policy_app_id, const std::vector<FunctionalGroupPermission>& current_permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(app_permissions_diff_lock_); std::map<std::string, AppPermissions>::iterator it_pending = app_permissions_diff_.find(policy_app_id); if (app_permissions_diff_.end() == it_pending) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "No pending permissions had been found for appID: " << policy_app_id); return; } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Pending permissions had been found for appID: " << policy_app_id); // Change appPermissionsConsentNeeded depending on unconsented groups @@ -1048,16 +1040,16 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges( for (; it_groups != it_end_groups; ++it_groups) { if (policy::kGroupUndefined == it_groups->state) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Unconsented groups still present for appID: " << policy_app_id); it_pending->second.appPermissionsConsentNeeded = true; return; } } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Unconsented groups not present anymore for appID: " << policy_app_id); it_pending->second.appPermissionsConsentNeeded = false; return; @@ -1065,13 +1057,13 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges( void PolicyManagerImpl::SetUserConsentForApp( const PermissionConsent& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id, const std::string& policy_app_id, std::string* default_hmi) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const DeviceConsent device_consent = GetUserConsentForDevice(device_id); const std::string app_id = policy::kDeviceAllowed != device_consent ? kPreDataConsentId @@ -1081,9 +1073,9 @@ bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id, bool PolicyManagerImpl::GetPriority(const std::string& policy_app_id, std::string* priority) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!priority) { - LOG4CXX_WARN(logger_, "Input priority parameter is null."); + SDL_LOG_WARN("Input priority parameter is null."); return false; } @@ -1099,12 +1091,11 @@ void PolicyManagerImpl::GetUserConsentForApp( const std::string& device_id, const std::string& policy_app_id, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalIdType group_types; if (!cache_->GetPermissionsForApp(device_id, policy_app_id, group_types)) { - LOG4CXX_WARN(logger_, - "Can't get user permissions for app " << policy_app_id); + SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id); return; } @@ -1112,7 +1103,7 @@ void PolicyManagerImpl::GetUserConsentForApp( // automatically allowed and it could not be changed by user FunctionalGroupNames group_names; if (!cache_->GetFunctionalGroupNames(group_names)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return; } @@ -1147,7 +1138,7 @@ void PolicyManagerImpl::GetPermissionsForApp( const std::string& device_id, const std::string& policy_app_id, std::vector<FunctionalGroupPermission>& permissions) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string app_id_to_check = policy_app_id; bool allowed_by_default = false; @@ -1172,8 +1163,7 @@ void PolicyManagerImpl::GetPermissionsForApp( } if (!ret) { - LOG4CXX_WARN(logger_, - "Can't get user permissions for app " << policy_app_id); + SDL_LOG_WARN("Can't get user permissions for app " << policy_app_id); return; } @@ -1181,14 +1171,14 @@ void PolicyManagerImpl::GetPermissionsForApp( // automatically allowed and it could not be changed by user FunctionalGroupNames group_names; if (!cache_->GetFunctionalGroupNames(group_names)) { - LOG4CXX_WARN(logger_, "Can't get functional group names"); + SDL_LOG_WARN("Can't get functional group names"); return; } // The "default" and "pre_DataConsent" are auto-allowed groups // So, check if application in the one of these mode. if (allowed_by_default) { - LOG4CXX_INFO(logger_, "Get auto allowed groups"); + SDL_LOG_INFO("Get auto allowed groups"); GroupType type = (kDefaultId == app_id_to_check ? kTypeDefault : kTypePreDataConsented); @@ -1212,7 +1202,7 @@ void PolicyManagerImpl::GetPermissionsForApp( std::string& PolicyManagerImpl::GetCurrentDeviceId( const transport_manager::DeviceHandle& device_handle, const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); last_device_id_ = listener()->OnCurrentDeviceIdUpdateRequired(device_handle, policy_app_id); return last_device_id_; @@ -1221,25 +1211,25 @@ std::string& PolicyManagerImpl::GetCurrentDeviceId( void PolicyManagerImpl::SetSystemLanguage(const std::string& language) {} void PolicyManagerImpl::SetPreloadedPtFlag(const bool is_preloaded) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetPreloadedPtFlag(is_preloaded); } void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetMetaInfo(ccpu_version, wers_country_code, language); } std::string PolicyManagerImpl::GetCCPUVersionFromPT() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetCCPUVersionFromPT(); } uint32_t PolicyManagerImpl::GetNotificationsNumber(const std::string& priority, const bool is_subtle) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetNotificationsNumber(priority, is_subtle); } @@ -1252,10 +1242,10 @@ bool PolicyManagerImpl::IsPTValid( policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { - LOG4CXX_ERROR(logger_, "Policy table is not valid."); + SDL_LOG_ERROR("Policy table is not valid."); rpc::ValidationReport report("policy_table"); policy_table->ReportErrors(&report); - LOG4CXX_DEBUG(logger_, "Errors: " << rpc::PrettyFormat(report)); + SDL_LOG_DEBUG("Errors: " << rpc::PrettyFormat(report)); return false; } return true; @@ -1267,7 +1257,7 @@ const PolicySettings& PolicyManagerImpl::get_settings() const { } bool PolicyManagerImpl::ExceededDays() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); date_time::TimeDuration current_time = date_time::getCurrentTime(); const int kSecondsInDay = 60 * 60 * 24; @@ -1277,9 +1267,9 @@ bool PolicyManagerImpl::ExceededDays() { } void PolicyManagerImpl::KmsChanged(int kilometers) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (0 == cache_->KilometersBeforeExchange(kilometers)) { - LOG4CXX_INFO(logger_, "Enough kilometers passed to send for PT update."); + SDL_LOG_INFO("Enough kilometers passed to send for PT update."); update_status_manager_.ScheduleUpdate(); StartPTExchange(); PTUpdatedAt(KILOMETERS, kilometers); @@ -1310,7 +1300,7 @@ std::string PolicyManagerImpl::ForcePTExchange() { } void PolicyManagerImpl::StopRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (timer_retry_sequence_.is_running()) { timer_retry_sequence_.Stop(); @@ -1332,9 +1322,9 @@ std::string PolicyManagerImpl::GetPolicyTableStatus() const { } uint32_t PolicyManagerImpl::NextRetryTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); - LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_); + SDL_LOG_DEBUG("Index: " << retry_sequence_index_); uint32_t next = 0u; if (retry_sequence_seconds_.empty() || retry_sequence_index_ > retry_sequence_seconds_.size()) { @@ -1358,7 +1348,7 @@ uint32_t PolicyManagerImpl::NextRetryTimeout() { } void PolicyManagerImpl::RefreshRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); retry_sequence_timeout_ = cache_->TimeoutResponse(); retry_sequence_seconds_.clear(); @@ -1367,7 +1357,7 @@ void PolicyManagerImpl::RefreshRetrySequence() { void PolicyManagerImpl::ResetRetrySequence( const ResetRetryCountType reset_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(retry_sequence_lock_); retry_sequence_index_ = 0; retry_sequence_url_ = RetrySequenceURL(); @@ -1396,33 +1386,33 @@ void PolicyManagerImpl::OnUpdateStarted() { } void PolicyManagerImpl::PTUpdatedAt(Counters counter, int value) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetCountersPassedForSuccessfulUpdate(counter, value); cache_->ResetIgnitionCycles(); } void PolicyManagerImpl::Increment(usage_statistics::GlobalCounterId type) { - LOG4CXX_INFO(logger_, "Increment without app id"); + SDL_LOG_INFO("Increment without app id"); cache_->Increment(type); } void PolicyManagerImpl::Increment(const std::string& app_id, usage_statistics::AppCounterId type) { - LOG4CXX_DEBUG(logger_, "Increment " << app_id << " AppCounter: " << type); + SDL_LOG_DEBUG("Increment " << app_id << " AppCounter: " << type); cache_->Increment(app_id, type); } void PolicyManagerImpl::Set(const std::string& app_id, usage_statistics::AppInfoId type, const std::string& value) { - LOG4CXX_INFO(logger_, "Set " << app_id); + SDL_LOG_INFO("Set " << app_id); cache_->Set(app_id, type, value); } void PolicyManagerImpl::Add(const std::string& app_id, usage_statistics::AppStopwatchId type, int32_t timespan_seconds) { - LOG4CXX_INFO(logger_, "Add " << app_id); + SDL_LOG_INFO("Add " << app_id); cache_->Add(app_id, type, timespan_seconds); } @@ -1432,7 +1422,7 @@ bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const { bool PolicyManagerImpl::IsConsentNeeded(const std::string& device_id, const std::string& app_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return false; } @@ -1471,12 +1461,12 @@ bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) const { void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) {} std::string PolicyManagerImpl::RetrieveCertificate() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetCertificate(); } AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const AppIdURL next_app_url = RetrySequenceUrl(retry_sequence_url_, urls); @@ -1539,7 +1529,7 @@ StatusNotifier PolicyManagerImpl::AddApplication( const std::string& device_id, const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto device_consent = GetUserConsentForDevice(device_id); sync_primitives::AutoLock lock(apps_registration_lock_); if (IsNewApplication(application_id)) { @@ -1561,20 +1551,20 @@ void PolicyManagerImpl::RemoveAppConsentForGroup( bool PolicyManagerImpl::IsPredataPolicy( const std::string& policy_app_id) const { - LOG4CXX_INFO(logger_, "IsPredataApp"); + SDL_LOG_INFO("IsPredataApp"); return cache_->IsPredataPolicy(policy_app_id); } void PolicyManagerImpl::AddNewApplication(const std::string& application_id, DeviceConsent device_consent) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->SetDefaultPolicy(application_id); } void PolicyManagerImpl::PromoteExistedApplication( const std::string& application_id, DeviceConsent device_consent) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // If device consent changed to allowed during application being // disconnected, app permissions should be changed also if (kDeviceAllowed == device_consent && @@ -1589,7 +1579,7 @@ bool PolicyManagerImpl::IsNewApplication( } bool PolicyManagerImpl::ResetPT(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); cache_->ResetCalculatedPermissions(); const bool result = cache_->ResetPT(file_name); if (result) { @@ -1599,19 +1589,17 @@ bool PolicyManagerImpl::ResetPT(const std::string& file_name) { } bool PolicyManagerImpl::CheckAppStorageFolder() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string app_storage_folder = get_settings().app_storage_folder(); - LOG4CXX_DEBUG(logger_, "AppStorageFolder " << app_storage_folder); + SDL_LOG_DEBUG("AppStorageFolder " << app_storage_folder); if (!file_system::DirectoryExists(app_storage_folder)) { - LOG4CXX_WARN(logger_, - "Storage directory doesn't exist " << app_storage_folder); + SDL_LOG_WARN("Storage directory doesn't exist " << app_storage_folder); return false; } if (!(file_system::IsWritingAllowed(app_storage_folder) && file_system::IsReadingAllowed(app_storage_folder))) { - LOG4CXX_WARN(logger_, - "Storage directory doesn't have read/write permissions " - << app_storage_folder); + SDL_LOG_WARN("Storage directory doesn't have read/write permissions " + << app_storage_folder); return false; } return true; @@ -1619,10 +1607,10 @@ bool PolicyManagerImpl::CheckAppStorageFolder() const { bool PolicyManagerImpl::InitPT(const std::string& file_name, const PolicySettings* settings) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); settings_ = settings; if (!CheckAppStorageFolder()) { - LOG4CXX_ERROR(logger_, "Can not read/write into AppStorageFolder"); + SDL_LOG_ERROR("Can not read/write into AppStorageFolder"); return false; } const bool ret = cache_->Init(file_name, settings); @@ -1646,7 +1634,7 @@ uint32_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const { } void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!is_update_needed) { ResetRetrySequence(ResetRetryCountType::kResetInternally); @@ -1660,7 +1648,7 @@ void PolicyManagerImpl::set_cache_manager( } void PolicyManagerImpl::ResetTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (update_status_manager_.IsUpdatePending()) { if (timer_retry_sequence_.is_running()) { timer_retry_sequence_.Stop(); @@ -1670,13 +1658,13 @@ void PolicyManagerImpl::ResetTimeout() { } void PolicyManagerImpl::OnPTUIterationTimeout() { - LOG4CXX_DEBUG(logger_, "Start new retry sequence"); + SDL_LOG_DEBUG("Start new retry sequence"); const bool is_exceeded_retries_count = (retry_sequence_seconds_.size() < retry_sequence_index_); if (is_exceeded_retries_count) { - LOG4CXX_WARN(logger_, "Exceeded allowed PTU retry count"); + SDL_LOG_WARN("Exceeded allowed PTU retry count"); listener_->OnPTUTimeOut(); ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate); if (timer_retry_sequence_.is_running()) { @@ -1692,7 +1680,7 @@ void PolicyManagerImpl::OnPTUIterationTimeout() { update_status_manager_.OnUpdateTimeoutOccurs(); const uint32_t timeout_msec = NextRetryTimeout(); - LOG4CXX_DEBUG(logger_, "New retry sequence timeout = " << timeout_msec); + SDL_LOG_DEBUG("New retry sequence timeout = " << timeout_msec); if (!timeout_msec) { if (timer_retry_sequence_.is_running()) { timer_retry_sequence_.Stop(); @@ -1712,7 +1700,7 @@ void PolicyManagerImpl::SetDefaultHmiTypes( const transport_manager::DeviceHandle& device_handle, const std::string& application_id, const std::vector<int>& hmi_types) { - LOG4CXX_INFO(logger_, "SetDefaultHmiTypes"); + SDL_LOG_INFO("SetDefaultHmiTypes"); const std::string device_id = GetCurrentDeviceId(device_handle, application_id); ApplicationOnDevice who = {device_id, application_id}; @@ -1727,7 +1715,7 @@ struct HMITypeToInt { bool PolicyManagerImpl::GetHMITypes(const std::string& application_id, std::vector<int>* app_types) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cache_->IsDefaultPolicy(application_id)) { return false; } @@ -1744,7 +1732,7 @@ bool PolicyManagerImpl::GetHMITypes(const std::string& application_id, bool PolicyManagerImpl::CheckModule(const PTString& app_id, const PTString& module) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); policy_table::ModuleType module_type; return EnumFromJsonString(module, &module_type) && access_remote_->CheckModuleType(app_id, module_type); @@ -1755,16 +1743,15 @@ void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) { if (GetDefaultHmi(who.dev_id, who.app_id, &default_hmi)) { listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi); } else { - LOG4CXX_WARN( - logger_, - "Couldn't get default HMI level for application " << who.app_id); + SDL_LOG_WARN("Couldn't get default HMI level for application " + << who.app_id); } } void PolicyManagerImpl::GetPermissions(const std::string device_id, const std::string application_id, Permissions* data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(data); std::vector<FunctionalGroupPermission> app_group_permissions; GetPermissionsForApp(device_id, application_id, app_group_permissions); @@ -1826,7 +1813,7 @@ void PolicyManagerImpl::set_access_remote( bool PolicyManagerImpl::AppNeedEncryption( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto encryption_required = cache_->GetAppEncryptionRequiredFlag(policy_app_id); @@ -1835,13 +1822,13 @@ bool PolicyManagerImpl::AppNeedEncryption( const rpc::Optional<rpc::Boolean> PolicyManagerImpl::GetAppEncryptionRequired( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return cache_->GetAppEncryptionRequiredFlag(policy_app_id); } const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp( const std::string& policy_app_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); using namespace rpc::policy_table_interface_base; DCHECK(kDeviceId != policy_app_id); @@ -1861,7 +1848,7 @@ const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp( const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<std::string> policy_app_ids; const auto apps = cache_->GetPolicyAppIDs(); @@ -1875,13 +1862,13 @@ const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs() bool PolicyManagerImpl::FunctionGroupNeedEncryption( const std::string& policy_group) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FunctionalGroupings functional_groupings; cache_->GetFunctionalGroupings(functional_groupings); const auto& grouping_itr = functional_groupings.find(policy_group); if (grouping_itr == functional_groupings.end()) { - LOG4CXX_WARN(logger_, "Group " << policy_group << " not found"); + SDL_LOG_WARN("Group " << policy_group << " not found"); return false; } @@ -1893,7 +1880,7 @@ bool PolicyManagerImpl::FunctionGroupNeedEncryption( } void PolicyManagerImpl::TriggerPTUOnStartupIfRequired() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (ignition_check) { StartPTExchange(); } @@ -1923,12 +1910,13 @@ const std::vector<std::string> PolicyManagerImpl::GetRPCsForFunctionGroup( } // namespace policy -__attribute__((visibility("default"))) policy::PolicyManager* CreateManager() { +__attribute__((visibility("default"))) policy::PolicyManager* CreateManager( + logger::Logger* logger_instance) { + logger::Logger::instance(logger_instance); return new policy::PolicyManagerImpl(); } __attribute__((visibility("default"))) void DeleteManager( policy::PolicyManager* pm) { delete pm; - DELETE_THREAD_LOGGER(policy::logger_); } diff --git a/src/components/policy/policy_regular/src/policy_table.cc b/src/components/policy/policy_regular/src/policy_table.cc index b0fa5739da..dd6eef0c45 100644 --- a/src/components/policy/policy_regular/src/policy_table.cc +++ b/src/components/policy/policy_regular/src/policy_table.cc @@ -38,7 +38,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") PolicyTable::PolicyTable() : pt_data_(new SQLPTRepresentation()) {} @@ -46,7 +46,7 @@ PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { - LOG4CXX_INFO(logger_, "Destroying policy table."); + SDL_LOG_INFO("Destroying policy table."); } } // namespace policy diff --git a/src/components/policy/policy_regular/src/policy_table/validation.cc b/src/components/policy/policy_regular/src/policy_table/validation.cc index 14b6d657c2..c98a0ed5f0 100644 --- a/src/components/policy/policy_regular/src/policy_table/validation.cc +++ b/src/components/policy/policy_regular/src/policy_table/validation.cc @@ -12,7 +12,7 @@ bool IsTypeInvalid( namespace rpc { namespace policy_table_interface_base { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") void RemoveInvalidTypes(RequestTypes& types) { types.erase(std::remove_if(types.begin(), types.end(), &IsTypeInvalid), @@ -30,13 +30,13 @@ bool ApplicationPoliciesSection::Validate() const { // Default and PreData policies are mandatory if (apps.end() == it_default_policy || apps.end() == it_pre_data_policy) { - LOG4CXX_ERROR(logger_, "Default or preData policy is not present."); + SDL_LOG_ERROR("Default or preData policy is not present."); return false; } // Device policy is mandatory if (!device.is_initialized()) { - LOG4CXX_ERROR(logger_, "Device policy is not present."); + SDL_LOG_ERROR("Device policy is not present."); return false; } @@ -45,17 +45,15 @@ bool ApplicationPoliciesSection::Validate() const { return true; } - LOG4CXX_TRACE(logger_, "Checking app Request Types..."); + SDL_LOG_TRACE("Checking app Request Types..."); if (!it_default_policy->second.RequestType.is_valid()) { - LOG4CXX_WARN(logger_, - "Default policy RequestTypes are not valid. Will be cleaned."); + SDL_LOG_WARN("Default policy RequestTypes are not valid. Will be cleaned."); RemoveInvalidTypes(*it_default_policy->second.RequestType); // If preloaded does not have valid default types - validation fails // Otherwise default will be empty, i.e. all types allowed if (PT_PRELOADED == pt_type) { if (it_default_policy->second.RequestType->empty()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Default policy RequestTypes empty after clean-up. Exiting."); return false; } @@ -78,46 +76,43 @@ bool ApplicationPoliciesSection::Validate() const { if (PT_PRELOADED == pt_type) { if (!is_request_type_valid) { - LOG4CXX_WARN(logger_, - "App policy RequestTypes are not valid. Will be cleaned."); + SDL_LOG_WARN("App policy RequestTypes are not valid. Will be cleaned."); RemoveInvalidTypes(*app_params.RequestType); if (app_params.RequestType->empty()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "App policy RequestTypes empty after clean-up. Exiting."); return false; } } } else { if (is_request_type_omitted) { - LOG4CXX_WARN(logger_, - "App policy RequestTypes omitted." - " Will be replaced with default."); + SDL_LOG_WARN( + "App policy RequestTypes omitted." + " Will be replaced with default."); app_params.RequestType = apps[kDefaultApp].RequestType; ++iter; continue; } if (!is_request_type_valid) { - LOG4CXX_WARN(logger_, - "App policy RequestTypes are invalid. Will be cleaned."); + SDL_LOG_WARN("App policy RequestTypes are invalid. Will be cleaned."); RemoveInvalidTypes(*app_params.RequestType); if (app_params.RequestType->empty()) { - LOG4CXX_WARN(logger_, - "App policy RequestTypes empty after clean-up." - " Will be replaced with default."); + SDL_LOG_WARN( + "App policy RequestTypes empty after clean-up." + " Will be replaced with default."); app_params.RequestType = apps[kDefaultApp].RequestType; ++iter; continue; } } if (is_request_type_empty) { - LOG4CXX_WARN(logger_, "App policy RequestTypes empty."); + SDL_LOG_WARN("App policy RequestTypes empty."); } } ++iter; } - LOG4CXX_TRACE(logger_, "Checking app Request SubTypes..."); + SDL_LOG_TRACE("Checking app Request SubTypes..."); iter = apps.begin(); while (iter != end_iter) { if (it_default_policy == iter || it_pre_data_policy == iter) { @@ -129,9 +124,9 @@ bool ApplicationPoliciesSection::Validate() const { !app_params.RequestSubType.is_initialized(); if (is_request_subtype_omitted) { - LOG4CXX_WARN(logger_, - "App policy RequestSubTypes omitted." - " Will be replaced with default."); + SDL_LOG_WARN( + "App policy RequestSubTypes omitted." + " Will be replaced with default."); app_params.RequestSubType = apps[kDefaultApp].RequestSubType; ++iter; continue; @@ -139,7 +134,7 @@ bool ApplicationPoliciesSection::Validate() const { const bool is_request_subtype_empty = app_params.RequestSubType->empty(); if (is_request_subtype_empty) { - LOG4CXX_WARN(logger_, "App policy RequestSubTypes empty."); + SDL_LOG_WARN("App policy RequestSubTypes empty."); } ++iter; } @@ -222,8 +217,7 @@ bool ModuleConfig::Validate() const { ++it_endpoints) { const URLList& endpoint_list = it_endpoints->second; if (endpoint_list.end() == endpoint_list.find(kDefaultApp)) { - LOG4CXX_ERROR(logger_, - "Endpoint " << it_endpoints->first + SDL_LOG_ERROR("Endpoint " << it_endpoints->first << "does not contain default group"); return false; } @@ -294,8 +288,8 @@ bool VehicleDataItem::Validate() const { }; if (!ValidateTypes()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Unknown type: " << std::string(type) << " of " << std::string(key)); return false; } diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc index 043b413c13..49b7f2e7be 100644 --- a/src/components/policy/policy_regular/src/sql_pt_representation.cc +++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc @@ -49,7 +49,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") namespace { template <typename T, typename K> @@ -92,8 +92,8 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id, utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRpc)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Incorrect select statement from rpcs" << query.LastError().text()); return; } @@ -103,8 +103,7 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id, bool ret = query.Next(); result.hmi_level_permitted = ret ? kRpcAllowed : kRpcDisallowed; - LOG4CXX_INFO(logger_, - "Level is " << (result.hmi_level_permitted == kRpcAllowed + SDL_LOG_INFO("Level is " << (result.hmi_level_permitted == kRpcAllowed ? "permitted" : "not permitted")); std::string parameter; @@ -125,7 +124,7 @@ bool SQLPTRepresentation::IsPTPreloaded() { int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectIgnitionCycles) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select ignition cycles"); + SDL_LOG_WARN("Can not select ignition cycles"); return 0; } int limit = query.GetInteger(0); @@ -141,7 +140,7 @@ int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { int SQLPTRepresentation::KilometersBeforeExchange(int current) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectKilometers) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select kilometers"); + SDL_LOG_WARN("Can not select kilometers"); return 0; } int limit = query.GetInteger(0); @@ -157,17 +156,16 @@ int SQLPTRepresentation::KilometersBeforeExchange(int current) { bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( int kilometers, int days_after_epoch) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateCountersSuccessfulUpdate)) { - LOG4CXX_WARN(logger_, - "Wrong update query for counters on successful update."); + SDL_LOG_WARN("Wrong update query for counters on successful update."); return false; } query.Bind(0, kilometers); query.Bind(1, days_after_epoch); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to update counters on successful update."); + SDL_LOG_WARN("Failed to update counters on successful update."); return false; } return true; @@ -176,7 +174,7 @@ bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( int SQLPTRepresentation::DaysBeforeExchange(int current) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectDays) || !query.Exec()) { - LOG4CXX_WARN(logger_, "Can not select days"); + SDL_LOG_WARN("Can not select days"); return 0; } int limit = query.GetInteger(0); @@ -197,7 +195,7 @@ int SQLPTRepresentation::DaysBeforeExchange(int current) { int SQLPTRepresentation::TimeoutResponse() { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) { - LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence"); + SDL_LOG_INFO("Can not select timeout response for retry sequence"); const int defaultTimeout = 30 * date_time::MILLISECONDS_IN_SECOND; return defaultTimeout; } @@ -207,8 +205,7 @@ int SQLPTRepresentation::TimeoutResponse() { bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { - LOG4CXX_INFO(logger_, - "Incorrect select statement from seconds between retries"); + SDL_LOG_INFO("Incorrect select statement from seconds between retries"); return false; } while (query.Next()) { @@ -231,8 +228,7 @@ std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg( } EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { - LOG4CXX_INFO(logger_, - "SQLPTRepresentation::GetUpdateUrls for " << service_type); + SDL_LOG_INFO("SQLPTRepresentation::GetUpdateUrls for " << service_type); utils::dbms::SQLQuery query(db()); EndpointUrls ret; if (query.Prepare(sql_pt::kSelectEndpoint)) { @@ -247,23 +243,23 @@ EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { ret.push_back(data); } } else { - LOG4CXX_WARN(logger_, "Invalid select endpoints statement."); + SDL_LOG_WARN("Invalid select endpoints statement."); } return ret; } int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectNotificationsPerPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for priority " - "notification number."); + SDL_LOG_WARN( + "Incorrect select statement for priority " + "notification number."); return 0; } query.Bind(0, priority); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority."); + SDL_LOG_WARN("Incorrect select from notifications by priority."); return 0; } @@ -276,21 +272,21 @@ int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, std::string* priority) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (NULL == priority) { - LOG4CXX_WARN(logger_, "Input priority parameter is null."); + SDL_LOG_WARN("Input priority parameter is null."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectPriority)) { - LOG4CXX_INFO(logger_, "Incorrect statement for priority."); + SDL_LOG_INFO("Incorrect statement for priority."); return false; } query.Bind(0, policy_app_id); if (!query.Exec()) { - LOG4CXX_INFO(logger_, "Error during select priority."); + SDL_LOG_INFO("Error during select priority."); return false; } @@ -306,7 +302,7 @@ bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { settings_ = settings; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef BUILD_TESTS open_counter_ = 0; #endif // BUILD_TESTS @@ -319,59 +315,56 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { } if (!db_->Open()) { - LOG4CXX_ERROR(logger_, "Failed opening database."); - LOG4CXX_INFO(logger_, "Starting opening retries."); + SDL_LOG_ERROR("Failed opening database."); + SDL_LOG_INFO("Starting opening retries."); const uint16_t attempts = get_settings().attempts_to_open_policy_db(); - LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts); + SDL_LOG_DEBUG("Total attempts number is: " << attempts); bool is_opened = false; const uint16_t open_attempt_timeout_ms = get_settings().open_attempt_timeout_ms(); const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000; - LOG4CXX_DEBUG(logger_, - "Open attempt timeout(ms) is: " << open_attempt_timeout_ms); + SDL_LOG_DEBUG("Open attempt timeout(ms) is: " << open_attempt_timeout_ms); for (int i = 0; i < attempts; ++i) { usleep(sleep_interval_mcsec); - LOG4CXX_INFO(logger_, "Attempt: " << i + 1); + SDL_LOG_INFO("Attempt: " << i + 1); #ifdef BUILD_TESTS ++open_counter_; #endif // BUILD_TESTS if (db_->Open()) { - LOG4CXX_INFO(logger_, "Database opened."); + SDL_LOG_INFO("Database opened."); is_opened = true; break; } } if (!is_opened) { - LOG4CXX_ERROR(logger_, - "Open retry sequence failed. Tried " - << attempts << " attempts with " - << open_attempt_timeout_ms - << " open timeout(ms) for each."); + SDL_LOG_ERROR("Open retry sequence failed. Tried " + << attempts << " attempts with " << open_attempt_timeout_ms + << " open timeout(ms) for each."); return InitResult::FAIL; } } if (!db_->IsReadWrite()) { - LOG4CXX_ERROR(logger_, "There are no read/write permissions for database"); + SDL_LOG_ERROR("There are no read/write permissions for database"); return InitResult::FAIL; } utils::dbms::SQLQuery check_pages(db()); if (!check_pages.Prepare(sql_pt::kCheckPgNumber) || !check_pages.Next()) { - LOG4CXX_WARN(logger_, "Incorrect pragma for page counting."); + SDL_LOG_WARN("Incorrect pragma for page counting."); } else { if (0 < check_pages.GetInteger(0)) { utils::dbms::SQLQuery db_check(db()); if (!db_check.Prepare(sql_pt::kCheckDBIntegrity)) { - LOG4CXX_WARN(logger_, "Incorrect pragma for integrity check."); + SDL_LOG_WARN("Incorrect pragma for integrity check."); } else { while (db_check.Next()) { if (db_check.GetString(0).compare("ok") == 0) { utils::dbms::SQLQuery check_first_run(db()); if (check_first_run.Prepare(sql_pt::kIsFirstRun) && check_first_run.Next()) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "Selecting is first run " << check_first_run.GetBoolean(0)); if (check_first_run.GetBoolean(0)) { utils::dbms::SQLQuery set_not_first_run(db()); @@ -379,12 +372,11 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { return InitResult::SUCCESS; } } else { - LOG4CXX_WARN(logger_, "Incorrect select is first run"); + SDL_LOG_WARN("Incorrect select is first run"); } return InitResult::EXISTS; } else { - LOG4CXX_ERROR(logger_, - "Existing policy table representation is invlaid."); + SDL_LOG_ERROR("Existing policy table representation is invlaid."); // TODO(PV): add handle return InitResult::FAIL; } @@ -394,14 +386,14 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) { } utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed creating schema of database: " << query.LastError().text()); return InitResult::FAIL; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return InitResult::FAIL; } @@ -416,8 +408,7 @@ bool SQLPTRepresentation::Close() { bool SQLPTRepresentation::Drop() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDropSchema)) { - LOG4CXX_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_LOG_WARN("Failed dropping database: " << query.LastError().text()); return false; } return true; @@ -430,13 +421,12 @@ void SQLPTRepresentation::WriteDb() { bool SQLPTRepresentation::Clear() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteData)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -446,19 +436,18 @@ bool SQLPTRepresentation::Clear() { bool SQLPTRepresentation::RefreshDB() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDropSchema)) { - LOG4CXX_WARN(logger_, - "Failed dropping database: " << query.LastError().text()); + SDL_LOG_WARN("Failed dropping database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kCreateSchema)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed creating schema of database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kInsertInitData)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed insert init data to database: " << query.LastError().text()); return false; } @@ -467,7 +456,7 @@ bool SQLPTRepresentation::RefreshDB() { std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto table = std::make_shared<policy_table::Table>(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); @@ -487,7 +476,7 @@ std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() void SQLPTRepresentation::GatherModuleMeta( policy_table::ModuleMeta* meta) const { - LOG4CXX_INFO(logger_, "Gather Module Meta Info"); + SDL_LOG_INFO("Gather Module Meta Info"); utils::dbms::SQLQuery query(db()); if (query.Prepare(sql_pt::kSelectModuleMeta) && query.Next()) { *meta->pt_exchanged_at_odometer_x = query.GetInteger(0); @@ -499,10 +488,10 @@ void SQLPTRepresentation::GatherModuleMeta( void SQLPTRepresentation::GatherModuleConfig( policy_table::ModuleConfig* config) const { - LOG4CXX_INFO(logger_, "Gather Configuration Info"); + SDL_LOG_INFO("Gather Configuration Info"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectModuleConfig) || !query.Next()) { - LOG4CXX_WARN(logger_, "Incorrect select statement for module config"); + SDL_LOG_WARN("Incorrect select statement for module config"); } else { *config->preloaded_pt = query.GetBoolean(0); config->exchange_after_x_ignition_cycles = query.GetInteger(1); @@ -520,7 +509,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery endpoints(db()); if (!endpoints.Prepare(sql_pt::kSelectEndpoints)) { - LOG4CXX_WARN(logger_, "Incorrect select statement for endpoints"); + SDL_LOG_WARN("Incorrect select statement for endpoints"); } else { while (endpoints.Next()) { const std::string& url = endpoints.GetString(0); @@ -532,7 +521,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery endpoint_properties(db()); if (!endpoint_properties.Prepare(sql_pt::kSelectEndpointProperties)) { - LOG4CXX_ERROR(logger_, "Incorrect statement for Endpoint properties"); + SDL_LOG_ERROR("Incorrect statement for Endpoint properties"); } else { while (endpoint_properties.Next()) { const std::string& service = endpoint_properties.GetString(0); @@ -544,7 +533,7 @@ void SQLPTRepresentation::GatherModuleConfig( utils::dbms::SQLQuery notifications(db()); if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) { - LOG4CXX_WARN(logger_, "Incorrect select statement for notifications"); + SDL_LOG_WARN("Incorrect select statement for notifications"); } else { while (notifications.Next()) { config->notifications_per_minute_by_priority[notifications.GetString(0)] = @@ -553,8 +542,7 @@ void SQLPTRepresentation::GatherModuleConfig( } utils::dbms::SQLQuery subtle_notifications(db()); if (!subtle_notifications.Prepare(sql_pt::kSelectSubtleNotificationsPerMin)) { - LOG4CXX_WARN(logger_, - "Incorrect select statement for subtle notifications"); + SDL_LOG_WARN("Incorrect select statement for subtle notifications"); } else { while (subtle_notifications.Next()) { (*config->subtle_notifications_per_minute_by_priority) @@ -564,8 +552,7 @@ void SQLPTRepresentation::GatherModuleConfig( } utils::dbms::SQLQuery seconds(db()); if (!seconds.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { - LOG4CXX_INFO(logger_, - "Incorrect select statement from seconds between retries"); + SDL_LOG_INFO("Incorrect select statement from seconds between retries"); } else { while (seconds.Next()) { config->seconds_between_retries.push_back(seconds.GetInteger(0)); @@ -575,7 +562,7 @@ void SQLPTRepresentation::GatherModuleConfig( bool SQLPTRepresentation::GatherUsageAndErrorCounts( policy_table::UsageAndErrorCounts* counts) const { - LOG4CXX_INFO(logger_, "Gather Usage and Error Counts."); + SDL_LOG_INFO("Gather Usage and Error Counts."); utils::dbms::SQLQuery query(db()); if (query.Prepare(sql_pt::kSelectAppLevels)) { policy_table::AppLevel app_level; @@ -592,7 +579,7 @@ bool SQLPTRepresentation::GatherUsageAndErrorCounts( void SQLPTRepresentation::GatherDeviceData( policy_table::DeviceData* data) const { - LOG4CXX_INFO(logger_, "Gather device data."); + SDL_LOG_INFO("Gather device data."); data->mark_initialized(); utils::dbms::SQLQuery query(db()); @@ -608,15 +595,15 @@ void SQLPTRepresentation::GatherDeviceData( bool SQLPTRepresentation::GatherFunctionalGroupings( policy_table::FunctionalGroupings* groups) const { - LOG4CXX_INFO(logger_, "Gather Functional Groupings info"); + SDL_LOG_INFO("Gather Functional Groupings info"); utils::dbms::SQLQuery functional_group(db()); if (!functional_group.Prepare(sql_pt::kSelectFunctionalGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select from functional_groupings"); + SDL_LOG_WARN("Incorrect select from functional_groupings"); return false; } utils::dbms::SQLQuery rpcs(db()); if (!rpcs.Prepare(sql_pt::kSelectAllRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select all from rpc"); + SDL_LOG_WARN("Incorrect select all from rpc"); return false; } @@ -672,10 +659,10 @@ bool SQLPTRepresentation::GatherFunctionalGroupings( bool SQLPTRepresentation::GatherConsumerFriendlyMessages( policy_table::ConsumerFriendlyMessages* messages) const { - LOG4CXX_INFO(logger_, "Gather Consumer Friendly Messages"); + SDL_LOG_INFO("Gather Consumer Friendly Messages"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectUserMsgsVersion) || !query.Next()) { - LOG4CXX_WARN(logger_, "Incorrect select from consumer_friendly_messages"); + SDL_LOG_WARN("Incorrect select from consumer_friendly_messages"); return false; } @@ -713,24 +700,24 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages( } } } else { - LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages."); + SDL_LOG_WARN("Incorrect statement for select friendly messages."); } return true; } bool SQLPTRepresentation::SetMetaInfo(const std::string& ccpu_version) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateMetaParams)) { - LOG4CXX_WARN(logger_, "Incorrect statement for insert to module meta."); + SDL_LOG_WARN("Incorrect statement for insert to module meta."); return false; } query.Bind(0, ccpu_version); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert to module meta."); + SDL_LOG_WARN("Incorrect insert to module meta."); return false; } return true; @@ -738,10 +725,10 @@ bool SQLPTRepresentation::SetMetaInfo(const std::string& ccpu_version) { bool SQLPTRepresentation::GatherApplicationPoliciesSection( policy_table::ApplicationPoliciesSection* policies) const { - LOG4CXX_INFO(logger_, "Gather applications policies"); + SDL_LOG_INFO("Gather applications policies"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppPolicies)) { - LOG4CXX_WARN(logger_, "Incorrect select from app_policies"); + SDL_LOG_WARN("Incorrect select from app_policies"); return false; } @@ -844,8 +831,7 @@ bool SQLPTRepresentation::GatherVehicleData( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataSchemaVersion) || !query.Next()) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for vehicle data schema version"); + SDL_LOG_ERROR("Incorrect statement for vehicle data schema version"); return false; } *vehicle_data->schema_version = query.GetString(0); @@ -856,7 +842,7 @@ bool SQLPTRepresentation::GatherVehicleData( bool SQLPTRepresentation::GatherVehicleDataItems( policy_table::VehicleDataItems* vehicle_data_items) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto parameterized_vdi = SelectCompositeVehicleDataItems(); if (!parameterized_vdi.is_initialized()) { return false; @@ -878,7 +864,7 @@ bool SQLPTRepresentation::GatherVehicleDataItems( } bool SQLPTRepresentation::Save(const policy_table::Table& table) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); db_->BeginTransaction(); if (!SaveFunctionalGroupings(table.policy_table.functional_groupings)) { db_->RollbackTransaction(); @@ -923,17 +909,17 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( const policy_table::FunctionalGroupings& groups) { utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteRpc)) { - LOG4CXX_WARN(logger_, "Incorrect delete from rpc."); + SDL_LOG_WARN("Incorrect delete from rpc."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteFunctionalGroup)) { - LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries."); + SDL_LOG_WARN("Incorrect delete from seconds between retries."); return false; } if (!query.Prepare(sql_pt::kInsertFunctionalGroup)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for functional groups"); + SDL_LOG_WARN("Incorrect insert statement for functional groups"); return false; } @@ -958,7 +944,7 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( ? query.Bind(3, *(it->second.encryption_required)) : query.Bind(3); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into functional groups"); + SDL_LOG_WARN("Incorrect insert into functional groups"); return false; } @@ -971,12 +957,12 @@ bool SQLPTRepresentation::SaveFunctionalGroupings( bool SQLPTRepresentation::SaveRpcs(int64_t group_id, const policy_table::Rpc& rpcs) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); utils::dbms::SQLQuery query_parameter(db()); if (!query.Prepare(sql_pt::kInsertRpc) || !query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for rpc"); + SDL_LOG_WARN("Incorrect insert statement for rpc"); return false; } @@ -996,7 +982,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, query_parameter.Bind(2, std::string(*ps_it)); query_parameter.Bind(3, group_id); if (!query_parameter.Exec() || !query_parameter.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter"); + SDL_LOG_WARN("Incorrect insert into rpc with parameter"); return false; } } @@ -1009,7 +995,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, std::string(policy_table::EnumToJsonString(policy_table::P_EMPTY))); query_parameter.Bind(3, group_id); if (!query_parameter.Exec() || !query_parameter.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter"); + SDL_LOG_WARN("Incorrect insert into rpc with parameter"); return false; } } else { @@ -1017,7 +1003,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id, query.Bind(1, std::string(policy_table::EnumToJsonString(*hmi_it))); query.Bind(2, group_id); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into rpc"); + SDL_LOG_WARN("Incorrect insert into rpc"); return false; } } @@ -1031,40 +1017,40 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection( const policy_table::ApplicationPoliciesSection& policies) { utils::dbms::SQLQuery query_delete(db()); if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); + SDL_LOG_WARN("Incorrect delete from app_group."); return false; } if (!query_delete.Exec(sql_pt::kDeleteModuleTypes)) { - LOG4CXX_WARN(logger_, "Incorrect delete from module_type."); + SDL_LOG_WARN("Incorrect delete from module_type."); return false; } if (!query_delete.Exec(sql_pt::kDeleteApplication)) { - LOG4CXX_WARN(logger_, "Incorrect delete from application."); + SDL_LOG_WARN("Incorrect delete from application."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestType)) { - LOG4CXX_WARN(logger_, "Incorrect delete from request type."); + SDL_LOG_WARN("Incorrect delete from request type."); return false; } if (!query_delete.Exec(sql_pt::kDeleteRequestSubType)) { - LOG4CXX_WARN(logger_, "Incorrect delete from request subtype."); + SDL_LOG_WARN("Incorrect delete from request subtype."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs."); + SDL_LOG_WARN("Incorrect delete from handled rpcs."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect delete from service names."); + SDL_LOG_WARN("Incorrect delete from service names."); return false; } if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect delete from handled service types."); + SDL_LOG_WARN("Incorrect delete from handled service types."); return false; } @@ -1108,8 +1094,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( const policy_table::ApplicationPolicies::value_type& app) { utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt::kInsertApplication)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement into application (device)."); + SDL_LOG_WARN("Incorrect insert statement into application (device)."); return false; } @@ -1149,7 +1134,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy( : app_query.Bind(13); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -1198,7 +1183,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( const policy_table::DevicePolicy& device) { utils::dbms::SQLQuery app_query(db()); if (!app_query.Prepare(sql_pt::kInsertApplication)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + SDL_LOG_WARN("Incorrect insert statement into application."); return false; } @@ -1210,7 +1195,7 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy( app_query.Bind(4, 0); app_query.Bind(5); if (!app_query.Exec() || !app_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into application."); + SDL_LOG_WARN("Incorrect insert into application."); return false; } @@ -1221,20 +1206,19 @@ bool SQLPTRepresentation::SaveAppGroup( const std::string& app_id, const policy_table::Strings& app_groups) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppGroup)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app group"); + SDL_LOG_WARN("Incorrect insert statement for app group"); return false; } - LOG4CXX_INFO(logger_, "SaveAppGroup"); + SDL_LOG_INFO("SaveAppGroup"); policy_table::Strings::const_iterator it; for (it = app_groups.begin(); it != app_groups.end(); ++it) { std::string ssss = *it; - LOG4CXX_INFO(logger_, "Group: " << ssss); + SDL_LOG_INFO("Group: " << ssss); query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN( - logger_, - "Incorrect insert into app group." << query.LastError().text()); + SDL_LOG_WARN("Incorrect insert into app group." + << query.LastError().text()); return false; } } @@ -1246,7 +1230,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id, const policy_table::Strings& nicknames) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertNickname)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for nickname"); + SDL_LOG_WARN("Incorrect insert statement for nickname"); return false; } @@ -1255,7 +1239,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id, query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into nickname."); + SDL_LOG_WARN("Incorrect insert into nickname."); return false; } } @@ -1267,7 +1251,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id, const policy_table::AppHMITypes& types) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app type"); + SDL_LOG_WARN("Incorrect insert statement for app type"); return false; } @@ -1276,7 +1260,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id, query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app type."); + SDL_LOG_WARN("Incorrect insert into app type."); return false; } } @@ -1288,29 +1272,29 @@ bool SQLPTRepresentation::SaveRequestType( const std::string& app_id, const policy_table::RequestTypes& types) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRequestType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for request types."); + SDL_LOG_WARN("Incorrect insert statement for request types."); return false; } policy_table::RequestTypes::const_iterator it; if (!types.empty()) { - LOG4CXX_WARN(logger_, "Request types not empty."); + SDL_LOG_WARN("Request types not empty."); for (it = types.begin(); it != types.end(); ++it) { query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + SDL_LOG_WARN("Incorrect insert into request types."); return false; } } } else if (types.is_initialized()) { - LOG4CXX_WARN(logger_, "Request types empty."); + SDL_LOG_WARN("Request types empty."); query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString( policy_table::RequestType::RT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request types."); + SDL_LOG_WARN("Incorrect insert into request types."); return false; } } @@ -1322,29 +1306,29 @@ bool SQLPTRepresentation::SaveRequestSubType( const policy_table::RequestSubTypes& request_subtypes) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRequestSubType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes."); + SDL_LOG_WARN("Incorrect insert statement for request subtypes."); return false; } policy_table::Strings::const_iterator it; if (!request_subtypes.empty()) { - LOG4CXX_TRACE(logger_, "Request subtypes are not empty."); + SDL_LOG_TRACE("Request subtypes are not empty."); for (it = request_subtypes.begin(); it != request_subtypes.end(); ++it) { query.Bind(0, app_id); query.Bind(1, *it); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + SDL_LOG_WARN("Incorrect insert into request subtypes."); return false; } } } else if (request_subtypes.is_initialized()) { - LOG4CXX_WARN(logger_, "Request subtypes empty."); + SDL_LOG_WARN("Request subtypes empty."); query.Bind(0, app_id); query.Bind(1, std::string(policy_table::EnumToJsonString( policy_table::RequestType::RT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes."); + SDL_LOG_WARN("Incorrect insert into request subtypes."); return false; } } @@ -1354,11 +1338,11 @@ bool SQLPTRepresentation::SaveRequestSubType( bool SQLPTRepresentation::SaveAppServiceParameters( const std::string& app_id, const policy_table::AppServiceParameters& app_service_parameters) { - LOG4CXX_INFO(logger_, "Save app service parameters"); + SDL_LOG_INFO("Save app service parameters"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app service types"); + SDL_LOG_WARN("Incorrect insert statement for app service types"); return false; } policy_table::AppServiceParameters::const_iterator it; @@ -1371,14 +1355,14 @@ bool SQLPTRepresentation::SaveAppServiceParameters( query.Bind(1, it->first); query.Bind(2, app_id); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Insert execute failed for into app service types"); + SDL_LOG_WARN("Insert execute failed for into app service types"); return false; } // Insert app names array into db utils::dbms::SQLQuery service_name_query(db()); if (!service_name_query.Prepare(sql_pt::kInsertAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app service names"); + SDL_LOG_WARN("Incorrect insert statement for app service names"); return false; } @@ -1386,11 +1370,11 @@ bool SQLPTRepresentation::SaveAppServiceParameters( if (app_service_names.is_initialized() && app_service_names->empty()) { // App service names is an empty array - LOG4CXX_DEBUG(logger_, "App Service Names is Empty Array"); + SDL_LOG_DEBUG("App Service Names is Empty Array"); service_name_query.Bind(0, static_cast<int64_t>(id)); service_name_query.Bind(1); if (!service_name_query.Exec() || !service_name_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into empty app service names"); + SDL_LOG_WARN("Incorrect insert into empty app service names"); return false; } } else { @@ -1401,7 +1385,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( service_name_query.Bind(0, static_cast<int64_t>(id)); service_name_query.Bind(1, *names_it); if (!service_name_query.Exec() || !service_name_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app service names"); + SDL_LOG_WARN("Incorrect insert into app service names"); return false; } } @@ -1410,8 +1394,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( // Insert handled rpcs array into db utils::dbms::SQLQuery handled_rpcs_query(db()); if (!handled_rpcs_query.Prepare(sql_pt::kInsertAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for app service handled rpcs"); + SDL_LOG_WARN("Incorrect insert statement for app service handled rpcs"); return false; } @@ -1422,7 +1405,7 @@ bool SQLPTRepresentation::SaveAppServiceParameters( handled_rpcs_query.Bind(0, static_cast<int64_t>(id)); handled_rpcs_query.Bind(1, static_cast<int32_t>(rpc_it->function_id)); if (!handled_rpcs_query.Exec() || !handled_rpcs_query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app service handled rpcs"); + SDL_LOG_WARN("Incorrect insert into app service handled rpcs"); return false; } } @@ -1434,7 +1417,7 @@ bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSaveModuleMeta)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for module_meta."); + SDL_LOG_WARN("Incorrect insert statement for module_meta."); return false; } const int64_t odometer = *(meta.pt_exchanged_at_odometer_x); @@ -1444,7 +1427,7 @@ bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) { query.Bind(2, *(meta.ignition_cycles_since_last_exchange)); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update for module_meta."); + SDL_LOG_WARN("Incorrect update for module_meta."); return false; } @@ -1455,7 +1438,7 @@ bool SQLPTRepresentation::SaveModuleConfig( const policy_table::ModuleConfig& config) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateModuleConfig)) { - LOG4CXX_WARN(logger_, "Incorrect update statement for module config"); + SDL_LOG_WARN("Incorrect update statement for module config"); return false; } @@ -1478,7 +1461,7 @@ bool SQLPTRepresentation::SaveModuleConfig( ? query.Bind(9, *(config.lock_screen_dismissal_enabled)) : query.Bind(9); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update module config"); + SDL_LOG_WARN("Incorrect update module config"); return false; } @@ -1511,12 +1494,12 @@ bool SQLPTRepresentation::SaveServiceEndpoints( const policy_table::ServiceEndpoints& endpoints) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteEndpoint)) { - LOG4CXX_WARN(logger_, "Incorrect delete from endpoint."); + SDL_LOG_WARN("Incorrect delete from endpoint."); return false; } if (!query.Prepare(sql_pt::kInsertEndpoint)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for endpoint"); + SDL_LOG_WARN("Incorrect insert statement for endpoint"); return false; } @@ -1532,7 +1515,7 @@ bool SQLPTRepresentation::SaveServiceEndpoints( query.Bind(1, *url_it); query.Bind(2, app_it->first); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into endpoint"); + SDL_LOG_WARN("Incorrect insert into endpoint"); return false; } } @@ -1546,8 +1529,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( const policy_table::ServiceEndpointProperties& endpoint_properties) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertEndpointVersion)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Incorrect insert of endpoint property to endpoint_properties."); return false; } @@ -1557,8 +1539,7 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( query.Bind(1, endpoint_property.second.version); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Failed to insert endpoint property into endpoint_properties."); return false; } @@ -1569,13 +1550,13 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( bool SQLPTRepresentation::SaveConsumerFriendlyMessages( const policy_table::ConsumerFriendlyMessages& messages) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // According CRS-2419 If there is no “consumer_friendly_messages” key, // the current local consumer_friendly_messages section shall be maintained in // the policy table. So it won't be changed/updated if (!messages.messages.is_initialized()) { - LOG4CXX_INFO(logger_, "ConsumerFriendlyMessages messages list is empty"); + SDL_LOG_INFO("ConsumerFriendlyMessages messages list is empty"); return true; } @@ -1586,18 +1567,18 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( } if (!delete_query_exec_result) { - LOG4CXX_WARN(logger_, "Failed to delete messages from DB."); + SDL_LOG_WARN("Failed to delete messages from DB."); return false; } if (!query.Prepare(sql_pt::kUpdateVersion)) { - LOG4CXX_WARN(logger_, "Invalid update messages version statement."); + SDL_LOG_WARN("Invalid update messages version statement."); return false; } query.Bind(0, messages.version); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed to update messages version number in DB."); + SDL_LOG_WARN("Failed to update messages version number in DB."); return false; } @@ -1624,13 +1605,13 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages( bool SQLPTRepresentation::SaveMessageType(const std::string& type) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertMessageType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for message type."); + SDL_LOG_WARN("Incorrect insert statement for message type."); return false; } query.Bind(0, type); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into message type."); + SDL_LOG_WARN("Incorrect insert into message type."); return false; } @@ -1640,13 +1621,13 @@ bool SQLPTRepresentation::SaveMessageType(const std::string& type) { bool SQLPTRepresentation::SaveLanguage(const std::string& code) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertLanguage)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for language."); + SDL_LOG_WARN("Incorrect insert statement for language."); return false; } query.Bind(0, code); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into language."); + SDL_LOG_WARN("Incorrect insert into language."); return false; } @@ -1659,7 +1640,7 @@ bool SQLPTRepresentation::SaveMessageString( const policy_table::MessageString& strings) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertMessageString)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for message."); + SDL_LOG_WARN("Incorrect insert statement for message."); return false; } @@ -1686,7 +1667,7 @@ bool SQLPTRepresentation::SaveMessageString( } if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into message."); + SDL_LOG_WARN("Incorrect insert into message."); return false; } return true; @@ -1696,12 +1677,11 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries( const policy_table::SecondsBetweenRetries& seconds) { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteSecondsBetweenRetries)) { - LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries."); + SDL_LOG_WARN("Incorrect delete from seconds between retries."); return false; } if (!query.Prepare(sql_pt::kInsertSecondsBetweenRetry)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for seconds between retries."); + SDL_LOG_WARN("Incorrect insert statement for seconds between retries."); return false; } @@ -1709,7 +1689,7 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries( query.Bind(0, static_cast<int>(i)); query.Bind(1, seconds[i]); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into seconds between retries."); + SDL_LOG_WARN("Incorrect insert into seconds between retries."); return false; } } @@ -1721,8 +1701,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( const policy_table::NumberOfNotificationsPerMinute& notifications) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertNotificationsByPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for notifications by priority."); + SDL_LOG_WARN("Incorrect insert statement for notifications by priority."); return false; } @@ -1731,7 +1710,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( query.Bind(0, it->first); query.Bind(1, it->second); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority."); + SDL_LOG_WARN("Incorrect insert into notifications by priority."); return false; } } @@ -1743,8 +1722,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute( const policy_table::NumberOfNotificationsPerMinute& notifications) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertSubtleNotificationsByPriority)) { - LOG4CXX_WARN(logger_, - "Incorrect insert statement for notifications by priority."); + SDL_LOG_WARN("Incorrect insert statement for notifications by priority."); return false; } @@ -1753,7 +1731,7 @@ bool SQLPTRepresentation::SaveNumberOfSubtleNotificationsPerMinute( query.Bind(0, it->first); query.Bind(1, it->second); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority."); + SDL_LOG_WARN("Incorrect insert into notifications by priority."); return false; } } @@ -1765,7 +1743,7 @@ bool SQLPTRepresentation::SaveDeviceData( const policy_table::DeviceData& devices) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertDeviceData)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for device data."); + SDL_LOG_WARN("Incorrect insert statement for device data."); return false; } @@ -1773,7 +1751,7 @@ bool SQLPTRepresentation::SaveDeviceData( for (it = devices.begin(); it != devices.end(); ++it) { query.Bind(0, it->first); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into device data."); + SDL_LOG_WARN("Incorrect insert into device data."); return false; } } @@ -1786,11 +1764,11 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( const_cast<policy_table::UsageAndErrorCounts&>(counts).mark_initialized(); utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kDeleteAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect delete from app level."); + SDL_LOG_WARN("Incorrect delete from app level."); return false; } if (!query.Prepare(sql_pt::kInsertAppLevel)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for app level."); + SDL_LOG_WARN("Incorrect insert statement for app level."); return false; } @@ -1801,7 +1779,7 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( query.Bind(0, it->first); query.Bind(1, it->second.count_of_tls_errors); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into app level."); + SDL_LOG_WARN("Incorrect insert into app level."); return false; } } @@ -1810,18 +1788,17 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts( bool SQLPTRepresentation::SaveVehicleData( const policy_table::VehicleData& vehicle_data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (vehicle_data.is_initialized() && vehicle_data.schema_version.is_initialized()) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertVehicleDataSchemaVersion)) { - LOG4CXX_WARN(logger_, - "Incorrect insert of schema_version to vehicle_data."); + SDL_LOG_WARN("Incorrect insert of schema_version to vehicle_data."); return false; } query.Bind(0, (*vehicle_data.schema_version)); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Failed to insert schema_version to vehicle_data."); + SDL_LOG_WARN("Failed to insert schema_version to vehicle_data."); return false; } } @@ -1836,7 +1813,7 @@ bool SQLPTRepresentation::SaveVehicleData( bool SQLPTRepresentation::SaveVehicleDataItems( const policy_table::VehicleDataItems& vehicle_data_items) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeleteVehicleDataItems(); for (const auto& item : vehicle_data_items) { if (!InsertVehicleDataItem(item)) { @@ -1849,23 +1826,22 @@ bool SQLPTRepresentation::SaveVehicleDataItems( void SQLPTRepresentation::IncrementIgnitionCycles() { utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kIncrementIgnitionCycles)) { - LOG4CXX_WARN(logger_, "Failed incrementing ignition cycles"); + SDL_LOG_WARN("Failed incrementing ignition cycles"); } } void SQLPTRepresentation::ResetIgnitionCycles() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Exec(sql_pt::kResetIgnitionCycles)) { - LOG4CXX_WARN(logger_, "Failed to reset ignition cycles number."); + SDL_LOG_WARN("Failed to reset ignition cycles number."); } } bool SQLPTRepresentation::UpdateRequired() const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectFlagUpdateRequired) || !query.Exec()) { - LOG4CXX_WARN(logger_, - "Failed select update required flag from module meta"); + SDL_LOG_WARN("Failed select update required flag from module meta"); return false; } return query.GetBoolean(0); @@ -1876,29 +1852,28 @@ void SQLPTRepresentation::SaveUpdateRequired(bool value) { // TODO(AOleynik): Quick fix, will be reworked if (!query.Prepare(/*sql_pt::kUpdateFlagUpdateRequired*/ "UPDATE `module_meta` SET `flag_update_required` = ?")) { - LOG4CXX_WARN(logger_, - "Incorrect update into module meta (update_required): " - << strerror(errno)); + SDL_LOG_WARN("Incorrect update into module meta (update_required): " + << strerror(errno)); return; } query.Bind(0, value); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update module meta (update_required)"); + SDL_LOG_WARN("Failed update module meta (update_required)"); } } bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, StringArray* nicknames, StringArray* app_types) { - LOG4CXX_INFO(logger_, "Getting initial application data."); + SDL_LOG_INFO("Getting initial application data."); utils::dbms::SQLQuery app_names(db()); if (!app_names.Prepare(sql_pt::kSelectNicknames)) { - LOG4CXX_WARN(logger_, "Incorrect select from app nicknames"); + SDL_LOG_WARN("Incorrect select from app nicknames"); return false; } utils::dbms::SQLQuery app_hmi_types(db()); if (!app_hmi_types.Prepare(sql_pt::kSelectAppTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } app_names.Bind(0, app_id); @@ -1916,7 +1891,7 @@ bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, bool SQLPTRepresentation::GetFunctionalGroupings( policy_table::FunctionalGroupings& groups) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return GatherFunctionalGroupings(&groups); } @@ -1924,7 +1899,7 @@ bool SQLPTRepresentation::GatherAppType( const std::string& app_id, policy_table::AppHMITypes* app_types) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } @@ -1944,7 +1919,7 @@ bool SQLPTRepresentation::GatherRequestType( policy_table::RequestTypes* request_types) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRequestTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from request types."); + SDL_LOG_WARN("Incorrect select from request types."); return false; } @@ -1968,7 +1943,7 @@ bool SQLPTRepresentation::GatherRequestSubType( policy_table::RequestSubTypes* request_subtypes) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRequestSubTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from request subtypes."); + SDL_LOG_WARN("Incorrect select from request subtypes."); return false; } @@ -1988,22 +1963,22 @@ bool SQLPTRepresentation::GatherRequestSubType( bool SQLPTRepresentation::GatherAppServiceParameters( const std::string& app_id, policy_table::AppServiceParameters* app_service_parameters) const { - LOG4CXX_INFO(logger_, "Gather app service info"); + SDL_LOG_INFO("Gather app service info"); utils::dbms::SQLQuery service_type_query(db()); if (!service_type_query.Prepare(sql_pt::kSelectAppServiceTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from service_types"); + SDL_LOG_WARN("Incorrect select from service_types"); return false; } utils::dbms::SQLQuery service_name_query(db()); if (!service_name_query.Prepare(sql_pt::kSelectAppServiceNames)) { - LOG4CXX_WARN(logger_, "Incorrect select all from app_service_names"); + SDL_LOG_WARN("Incorrect select all from app_service_names"); return false; } utils::dbms::SQLQuery handled_rpcs_query(db()); if (!handled_rpcs_query.Prepare(sql_pt::kSelectAppServiceHandledRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select all from app_service_handled_rpcs"); + SDL_LOG_WARN("Incorrect select all from app_service_handled_rpcs"); return false; } @@ -2011,12 +1986,12 @@ bool SQLPTRepresentation::GatherAppServiceParameters( while (service_type_query.Next()) { const int service_type_id = service_type_query.GetInteger(0); std::string service_type = service_type_query.GetString(1); - LOG4CXX_WARN(logger_, "Load service type from pt: " << service_type); + SDL_LOG_WARN("Load service type from pt: " << service_type); (*app_service_parameters)[service_type] = policy_table::AppServiceInfo(); service_name_query.Bind(0, service_type_id); while (service_name_query.Next()) { - LOG4CXX_DEBUG(logger_, "Loading service name"); + SDL_LOG_DEBUG("Loading service name"); (*app_service_parameters)[service_type].service_names->push_back( service_name_query.GetString(0)); (*app_service_parameters)[service_type].service_names->mark_initialized(); @@ -2031,11 +2006,11 @@ bool SQLPTRepresentation::GatherAppServiceParameters( } if (!service_name_query.Reset()) { - LOG4CXX_ERROR(logger_, "Could not reset service_name query"); + SDL_LOG_ERROR("Could not reset service_name query"); return false; } if (!handled_rpcs_query.Reset()) { - LOG4CXX_ERROR(logger_, "Could not reset handled_rpcs query"); + SDL_LOG_ERROR("Could not reset handled_rpcs query"); return false; } } @@ -2047,7 +2022,7 @@ bool SQLPTRepresentation::GatherNickName( const std::string& app_id, policy_table::Strings* nicknames) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectNicknames)) { - LOG4CXX_WARN(logger_, "Incorrect select from app nicknames"); + SDL_LOG_WARN("Incorrect select from app nicknames"); return false; } @@ -2062,7 +2037,7 @@ bool SQLPTRepresentation::GatherAppGroup( const std::string& app_id, policy_table::Strings* app_groups) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAppGroups)) { - LOG4CXX_WARN(logger_, "Incorrect select from app groups"); + SDL_LOG_WARN("Incorrect select from app groups"); return false; } @@ -2075,10 +2050,10 @@ bool SQLPTRepresentation::GatherAppGroup( bool SQLPTRepresentation::GatherRemoteControlDenied(const std::string& app_id, bool* denied) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRemoteControlDenied)) { - LOG4CXX_WARN(logger_, "Incorrect select remote control flag"); + SDL_LOG_WARN("Incorrect select remote control flag"); return false; } query.Bind(0, app_id); @@ -2094,7 +2069,7 @@ bool SQLPTRepresentation::GatherModuleType( const std::string& app_id, policy_table::ModuleTypes* app_types) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectModuleTypes)) { - LOG4CXX_WARN(logger_, "Incorrect select from app types"); + SDL_LOG_WARN("Incorrect select from app types"); return false; } @@ -2115,17 +2090,17 @@ bool SQLPTRepresentation::GatherModuleType( bool SQLPTRepresentation::SaveRemoteControlDenied(const std::string& app_id, bool deny) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateRemoteControlDenied)) { - LOG4CXX_WARN(logger_, "Incorrect update statement for remote control flag"); + SDL_LOG_WARN("Incorrect update statement for remote control flag"); return false; } - LOG4CXX_DEBUG(logger_, "App: " << app_id << std::boolalpha << " - " << deny); + SDL_LOG_DEBUG("App: " << app_id << std::boolalpha << " - " << deny); query.Bind(0, deny); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect update remote control flag."); + SDL_LOG_WARN("Incorrect update remote control flag."); return false; } return true; @@ -2135,7 +2110,7 @@ bool SQLPTRepresentation::SaveModuleType( const std::string& app_id, const policy_table::ModuleTypes& types) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertModuleType)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for module type"); + SDL_LOG_WARN("Incorrect insert statement for module type"); return false; } @@ -2145,10 +2120,9 @@ bool SQLPTRepresentation::SaveModuleType( query.Bind(0, app_id); std::string module(policy_table::EnumToJsonString(*it)); query.Bind(1, module); - LOG4CXX_DEBUG(logger_, - "Module(app: " << app_id << ", type: " << module << ")"); + SDL_LOG_DEBUG("Module(app: " << app_id << ", type: " << module << ")"); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into module type."); + SDL_LOG_WARN("Incorrect insert into module type."); return false; } } @@ -2158,21 +2132,21 @@ bool SQLPTRepresentation::SaveModuleType( std::string(policy_table::EnumToJsonString( policy_table::ModuleType::MT_EMPTY))); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into module types."); + SDL_LOG_WARN("Incorrect insert into module types."); return false; } } else { - LOG4CXX_WARN(logger_, "Module Type omitted."); + SDL_LOG_WARN("Module Type omitted."); } return true; } bool SQLPTRepresentation::SaveAccessModule( TypeAccess access, const policy_table::AccessModules& modules) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertAccessModule)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for access module"); + SDL_LOG_WARN("Incorrect insert statement for access module"); return false; } @@ -2183,12 +2157,12 @@ bool SQLPTRepresentation::SaveAccessModule( query.Bind(0, name); query.Bind(1, access); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Incorrect insert into access module."); + SDL_LOG_WARN("Incorrect insert into access module."); return false; } int id = query.LastInsertId(); if (!query.Reset()) { - LOG4CXX_WARN(logger_, "Couldn't reset query access module."); + SDL_LOG_WARN("Couldn't reset query access module."); return false; } if (!SaveRemoteRpc(id, rpcs)) { @@ -2200,10 +2174,10 @@ bool SQLPTRepresentation::SaveAccessModule( bool SQLPTRepresentation::GatherAccessModule( TypeAccess access, policy_table::AccessModules* modules) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectAccessModules)) { - LOG4CXX_WARN(logger_, "Incorrect select from access module"); + SDL_LOG_WARN("Incorrect select from access module"); return false; } @@ -2222,10 +2196,10 @@ bool SQLPTRepresentation::GatherAccessModule( bool SQLPTRepresentation::SaveRemoteRpc(int module_id, const policy_table::RemoteRpcs& rpcs) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertRemoteRpc)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement for remote rpc"); + SDL_LOG_WARN("Incorrect insert statement for remote rpc"); return false; } policy_table::RemoteRpcs::const_iterator i; @@ -2238,7 +2212,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, query.Bind(1, name); query.Bind(2); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + SDL_LOG_WARN("Incorrect insert into remote rpc."); return false; } } else { @@ -2248,7 +2222,7 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, query.Bind(1, name); query.Bind(2, param); if (!query.Exec() || !query.Reset()) { - LOG4CXX_WARN(logger_, "Incorrect insert into remote rpc."); + SDL_LOG_WARN("Incorrect insert into remote rpc."); return false; } } @@ -2259,10 +2233,10 @@ bool SQLPTRepresentation::SaveRemoteRpc(int module_id, bool SQLPTRepresentation::GatherRemoteRpc( int module_id, policy_table::RemoteRpcs* rpcs) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectRemoteRpcs)) { - LOG4CXX_WARN(logger_, "Incorrect select from remote rpc"); + SDL_LOG_WARN("Incorrect select from remote rpc"); return false; } @@ -2285,7 +2259,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, bool is_predata) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateApplicationCustomData)) { - LOG4CXX_WARN(logger_, "Incorrect update in application"); + SDL_LOG_WARN("Incorrect update in application"); return false; } @@ -2295,7 +2269,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, query.Bind(3, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update in application"); + SDL_LOG_WARN("Failed update in application"); return false; } @@ -2306,13 +2280,13 @@ bool SQLPTRepresentation::IsApplicationRevoked( const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationRevoked)) { - LOG4CXX_WARN(logger_, "Incorrect select from is_revoked of application"); + SDL_LOG_WARN("Incorrect select from is_revoked of application"); } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select is_revoked of application"); + SDL_LOG_WARN("Failed select is_revoked of application"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -2321,13 +2295,13 @@ bool SQLPTRepresentation::IsApplicationRepresented( const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationRepresented)) { - LOG4CXX_WARN(logger_, "Incorrect select application by id"); + SDL_LOG_WARN("Incorrect select application by id"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select application by id"); + SDL_LOG_WARN("Failed select application by id"); return false; } return query.GetInteger(0) != 0; @@ -2336,13 +2310,13 @@ bool SQLPTRepresentation::IsApplicationRepresented( bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectApplicationIsDefault)) { - LOG4CXX_WARN(logger_, "Incorrect select application by id"); + SDL_LOG_WARN("Incorrect select application by id"); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed select application by id"); + SDL_LOG_WARN("Failed select application by id"); return false; } return query.IsNull(0) ? false : query.GetBoolean(0); @@ -2355,12 +2329,12 @@ bool SQLPTRepresentation::IsPredataPolicy(const std::string& app_id) const { bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { - LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + SDL_LOG_ERROR("Incorrect statement to delete from app_group."); return false; } query.Bind(0, app_id); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + SDL_LOG_ERROR("Failed deleting from app_group."); return false; } @@ -2404,17 +2378,17 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { bool SQLPTRepresentation::SetIsDefault(const std::string& app_id, bool is_default) const { - LOG4CXX_TRACE(logger_, "Set flag is_default of application"); + SDL_LOG_TRACE("Set flag is_default of application"); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateIsDefault)) { - LOG4CXX_WARN(logger_, "Incorect statement for updating is_default"); + SDL_LOG_WARN("Incorect statement for updating is_default"); return false; } query.Bind(0, is_default); query.Bind(1, app_id); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed update is_default"); + SDL_LOG_WARN("Failed update is_default"); return false; } return true; @@ -2425,18 +2399,16 @@ void SQLPTRepresentation::RemoveDB() const { } bool SQLPTRepresentation::IsDBVersionActual() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectDBVersion) || !query.Exec()) { - LOG4CXX_ERROR(logger_, - "Failed to get DB version: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to get DB version: " << query.LastError().text()); return false; } const int32_t saved_db_version = query.GetInteger(0); const int32_t current_db_version = GetDBVersion(); - LOG4CXX_DEBUG(logger_, - "Saved DB version is: " << saved_db_version + SDL_LOG_DEBUG("Saved DB version is: " << saved_db_version << ". Current DB vesion is: " << current_db_version); @@ -2444,21 +2416,19 @@ bool SQLPTRepresentation::IsDBVersionActual() const { } bool SQLPTRepresentation::UpdateDBVersion() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdateDBVersion)) { - LOG4CXX_ERROR(logger_, - "Incorrect DB version query: " << query.LastError().text()); + SDL_LOG_ERROR("Incorrect DB version query: " << query.LastError().text()); return false; } const int32_t db_version = GetDBVersion(); - LOG4CXX_DEBUG(logger_, "DB version will be updated to: " << db_version); + SDL_LOG_DEBUG("DB version will be updated to: " << db_version); query.Bind(0, db_version); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, - "DB version getting failed: " << query.LastError().text()); + SDL_LOG_ERROR("DB version getting failed: " << query.LastError().text()); return false; } @@ -2477,18 +2447,18 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, const std::string& destination) { utils::dbms::SQLQuery source_app(db()); if (!source_app.Prepare(sql_pt::kSelectApplicationFull)) { - LOG4CXX_WARN(logger_, "Incorrect select statement from application."); + SDL_LOG_WARN("Incorrect select statement from application."); return false; } source_app.Bind(0, source); if (!source_app.Exec()) { - LOG4CXX_WARN(logger_, "Failed selecting from application."); + SDL_LOG_WARN("Failed selecting from application."); return false; } utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kInsertApplicationFull)) { - LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + SDL_LOG_WARN("Incorrect insert statement into application."); return false; } query.Bind(0, destination); @@ -2526,7 +2496,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, : query.Bind(18, source_app.GetBoolean(17)); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed inserting into application."); + SDL_LOG_WARN("Failed inserting into application."); return false; } return true; @@ -2535,13 +2505,13 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source, void SQLPTRepresentation::SetPreloaded(bool value) { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kUpdatePreloaded)) { - LOG4CXX_WARN(logger_, "Incorrect statement of updating preloaded."); + SDL_LOG_WARN("Incorrect statement of updating preloaded."); return; } query.Bind(0, value); if (!query.Exec()) { - LOG4CXX_WARN(logger_, "Failed updating preloaded."); + SDL_LOG_WARN("Failed updating preloaded."); return; } } @@ -2554,9 +2524,8 @@ bool SQLPTRepresentation::VehicleDataItemExists( const policy_table::VehicleDataItem& vehicle_data_item) const { utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataItemWithVersion)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement for vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement for vehicle data item. " + << query.LastError().text()); return false; } @@ -2570,10 +2539,9 @@ bool SQLPTRepresentation::VehicleDataItemExists( : query.Bind(3); if (!query.Exec()) { - LOG4CXX_ERROR(logger_, - "Failed to retrieve vehicle data item: " - << std::string(vehicle_data_item.key) - << ". Error: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to retrieve vehicle data item: " + << std::string(vehicle_data_item.key) + << ". Error: " << query.LastError().text()); return false; } return !query.IsNull(0); @@ -2585,9 +2553,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem( utils::dbms::SQLQuery query(db()); if (!query.Prepare(sql_pt::kSelectVehicleDataItem)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return result; } @@ -2604,9 +2571,8 @@ policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem( if (policy_table::VehicleDataItem::kStruct == static_cast<std::string>(vdi.type)) { if (!param_query.Prepare(sql_pt::kSelectVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << param_query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << param_query.LastError().text()); return policy_table::VehicleDataItems(); } @@ -2687,21 +2653,19 @@ bool SQLPTRepresentation::InsertVehicleDataItem( utils::dbms::SQLQuery query(db()); if (!vehicle_data_item.is_initialized() || !vehicle_data_item.is_valid()) { - LOG4CXX_ERROR(logger_, "Vehicle data item is not initialized."); + SDL_LOG_ERROR("Vehicle data item is not initialized."); return false; } if (VehicleDataItemExists(vehicle_data_item)) { - LOG4CXX_INFO(logger_, - static_cast<std::string>(vehicle_data_item.key) - << " is already stored."); + SDL_LOG_INFO(static_cast<std::string>(vehicle_data_item.key) + << " is already stored."); return true; } if (!query.Prepare(sql_pt::kInsertVehicleDataItem)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return false; } @@ -2744,10 +2708,9 @@ bool SQLPTRepresentation::InsertVehicleDataItem( : query.Bind(14); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR(logger_, - "Failed to insert vehicle data item: " - << static_cast<std::string>(vehicle_data_item.key) - << ". Error: " << query.LastError().text()); + SDL_LOG_ERROR("Failed to insert vehicle data item: " + << static_cast<std::string>(vehicle_data_item.key) + << ". Error: " << query.LastError().text()); return false; } @@ -2760,14 +2723,13 @@ bool SQLPTRepresentation::InsertVehicleDataItem( if (stored_vehicle_data_item_params.end() != stored_vehicle_data_item_params.find(param.name)) { - LOG4CXX_DEBUG(logger_, "Parameter already stored."); + SDL_LOG_DEBUG("Parameter already stored."); continue; }; if (!query.Prepare(sql_pt::kInsertVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Incorrent select statement of vehicle data item. " - << query.LastError().text()); + SDL_LOG_ERROR("Incorrent select statement of vehicle data item. " + << query.LastError().text()); return false; } @@ -2777,11 +2739,11 @@ bool SQLPTRepresentation::InsertVehicleDataItem( query.Bind(3, param.key); if (!query.Exec() || !query.Reset()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Failed to insert to vehicle data item relations helper table: " - << static_cast<std::string>(param.key) - << ". Error: " << query.LastError().text()); + << static_cast<std::string>(param.key) + << ". Error: " << query.LastError().text()); return false; } stored_vehicle_data_item_params[param.name] = param.key; @@ -2794,10 +2756,9 @@ bool SQLPTRepresentation::InsertVehicleDataItem( policy_table::VehicleDataItems SQLPTRepresentation::SelectCompositeVehicleDataItems() const { utils::dbms::SQLQuery query(db()); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!query.Prepare(sql_pt::kSelectCompositeVehicleDataItemsKey)) { - LOG4CXX_ERROR(logger_, - "Incorrect statement for parameterized vehicle data items"); + SDL_LOG_ERROR("Incorrect statement for parameterized vehicle data items"); return policy_table::VehicleDataItems(); } @@ -2820,10 +2781,9 @@ SQLPTRepresentation::SelectCompositeVehicleDataItems() const { policy_table::VehicleDataItems SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const { utils::dbms::SQLQuery query(db()); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!query.Prepare(sql_pt::kSelectPrimitiveVehicleDataItems)) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Incorrect statement for non parameterized vehicle data items"); return policy_table::VehicleDataItems(); } @@ -2843,17 +2803,15 @@ SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const { bool SQLPTRepresentation::DeleteVehicleDataItems() const { utils::dbms::SQLQuery query(db()); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!query.Exec(sql_pt::kDeleteVehicleDataItems)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } if (!query.Exec(sql_pt::kDeleteVehicleDataItemParams)) { - LOG4CXX_ERROR(logger_, - "Failed clearing database: " << query.LastError().text()); + SDL_LOG_ERROR("Failed clearing database: " << query.LastError().text()); return false; } diff --git a/src/components/policy/policy_regular/src/update_status_manager.cc b/src/components/policy/policy_regular/src/update_status_manager.cc index 1ba3d0f394..9ac51c3f93 100644 --- a/src/components/policy/policy_regular/src/update_status_manager.cc +++ b/src/components/policy/policy_regular/src/update_status_manager.cc @@ -36,7 +36,7 @@ namespace policy { -CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") +SDL_CREATE_LOG_VARIABLE("Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) @@ -55,7 +55,7 @@ void UpdateStatusManager::ProcessEvent(UpdateEvent event) { } void UpdateStatusManager::PendingUpdate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kPendingUpdate); } @@ -72,27 +72,27 @@ void UpdateStatusManager::set_listener(PolicyListener* listener) { } void UpdateStatusManager::OnUpdateSentOut() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnUpdateSentOut); } void UpdateStatusManager::OnUpdateTimeoutOccurs() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnUpdateTimeout); } void UpdateStatusManager::OnValidUpdateReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnValidUpdateReceived); } void UpdateStatusManager::OnWrongUpdateReceived() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnWrongUpdateReceived); } void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_update_required) { ProcessEvent(kOnResetPolicyTableRequireUpdate); return; @@ -101,13 +101,13 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { } void UpdateStatusManager::OnResetRetrySequence() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProcessEvent(kOnResetRetrySequence); } void UpdateStatusManager::OnExistedApplicationAdded( const bool is_update_required) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (is_update_required) { current_status_.reset(new UpToDateStatus()); ProcessEvent(kScheduleUpdate); @@ -115,7 +115,7 @@ void UpdateStatusManager::OnExistedApplicationAdded( } void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (kDeviceAllowed != consent) { app_registered_from_non_consented_device_ = true; return; @@ -130,7 +130,7 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) { } void UpdateStatusManager::OnDeviceConsented() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (app_registered_from_non_consented_device_) { ProcessEvent(kOnNewAppRegistered); } @@ -157,19 +157,19 @@ std::string UpdateStatusManager::StringifiedUpdateStatus() const { } void policy::UpdateStatusManager::OnAppsSearchStarted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); apps_search_in_progress_ = true; } void policy::UpdateStatusManager::OnAppsSearchCompleted() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); apps_search_in_progress_ = false; } bool policy::UpdateStatusManager::IsAppsSearchInProgress() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(apps_search_in_progress_lock_); return apps_search_in_progress_; } @@ -182,7 +182,7 @@ void UpdateStatusManager::DoTransition() { current_status_ = next_status_; next_status_.reset(); - LOG4CXX_DEBUG(logger_, "last_processed_event_ = " << last_processed_event_); + SDL_LOG_DEBUG("last_processed_event_ = " << last_processed_event_); const bool is_update_pending = policy::StatusProcessingSnapshot == current_status_->get_status(); diff --git a/src/components/protocol/src/rpc_type.cc b/src/components/protocol/src/rpc_type.cc index bc1142ad5c..fb9845d148 100644 --- a/src/components/protocol/src/rpc_type.cc +++ b/src/components/protocol/src/rpc_type.cc @@ -37,7 +37,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOG_VARIABLE("ProtocolHandler") namespace { bool IsSupported(RpcType rpc_type) { @@ -56,7 +56,7 @@ RpcType RpcTypeFromByte(uint8_t byte) { RpcType type = RpcType(byte); bool supported_type = IsSupported(type); if (!supported_type) { - LOG4CXX_INFO(logger_, "Invalid service type: " << int32_t(byte)); + SDL_LOG_INFO("Invalid service type: " << int32_t(byte)); } return supported_type ? type : kRpcTypeReserved; diff --git a/src/components/protocol/src/service_type.cc b/src/components/protocol/src/service_type.cc index 8ca57f338b..e6417b07d0 100644 --- a/src/components/protocol/src/service_type.cc +++ b/src/components/protocol/src/service_type.cc @@ -36,7 +36,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOG_VARIABLE("ProtocolHandler") namespace { // Check if provided service value is one of the specified @@ -58,7 +58,7 @@ ServiceType ServiceTypeFromByte(uint8_t byte) { ServiceType type = ServiceType(byte); const bool valid_type = IsValid(type); if (!valid_type) { - LOG4CXX_INFO(logger_, "Invalid service type: " << int32_t(byte)); + SDL_LOG_INFO("Invalid service type: " << int32_t(byte)); } return valid_type ? type : kInvalidServiceType; } diff --git a/src/components/protocol_handler/src/handshake_handler.cc b/src/components/protocol_handler/src/handshake_handler.cc index 3b4ae6ef1f..e804fdaa08 100644 --- a/src/components/protocol_handler/src/handshake_handler.cc +++ b/src/components/protocol_handler/src/handshake_handler.cc @@ -42,7 +42,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOG_VARIABLE("ProtocolHandler") HandshakeHandler::HandshakeHandler( ProtocolHandlerImpl& protocol_handler, @@ -61,7 +61,7 @@ HandshakeHandler::HandshakeHandler( , service_status_update_handler_(service_status_update_handler) {} HandshakeHandler::~HandshakeHandler() { - LOG4CXX_DEBUG(logger_, "Destroying of HandshakeHandler: " << this); + SDL_LOG_DEBUG("Destroying of HandshakeHandler: " << this); } uint32_t HandshakeHandler::connection_key() const { @@ -79,12 +79,12 @@ bool HandshakeHandler::GetPolicyCertificateData(std::string& data) const { } void HandshakeHandler::OnCertificateUpdateRequired() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } #if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY) bool HandshakeHandler::OnCertDecryptFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (payload_) { ProcessFailedHandshake(*payload_, ServiceStatus::CERT_INVALID); } @@ -94,7 +94,7 @@ bool HandshakeHandler::OnCertDecryptFailed() { #endif bool HandshakeHandler::OnGetSystemTimeFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (payload_) { ProcessFailedHandshake(*payload_, ServiceStatus::INVALID_TIME); @@ -109,7 +109,7 @@ bool HandshakeHandler::OnGetSystemTimeFailed() { } bool HandshakeHandler::OnPTUFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (payload_) { ProcessFailedHandshake(*payload_, ServiceStatus::PTU_FAILED); } @@ -120,14 +120,12 @@ bool HandshakeHandler::OnPTUFailed() { bool HandshakeHandler::OnHandshakeDone( uint32_t connection_key, security_manager::SSLContext::HandshakeResult result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); - LOG4CXX_DEBUG(logger_, - "OnHandshakeDone for service : " << context_.service_type_); + SDL_LOG_DEBUG("OnHandshakeDone for service : " << context_.service_type_); if (connection_key != this->primary_connection_key()) { - LOG4CXX_DEBUG(logger_, - "Listener " << this + SDL_LOG_DEBUG("Listener " << this << " expects notification for connection id: " << this->primary_connection_key() << ". Received notification for connection id " @@ -172,14 +170,13 @@ bool HandshakeHandler::IsAlreadyProtected() const { void HandshakeHandler::ProcessSuccessfulHandshake(const uint32_t connection_key, BsonObject& params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool is_service_already_protected = IsAlreadyProtected(); const bool can_be_protected = CanBeProtected(); - LOG4CXX_DEBUG(logger_, - "Service can be protected: " << can_be_protected + SDL_LOG_DEBUG("Service can be protected: " << can_be_protected << " and service was protected: " << is_service_already_protected); @@ -211,8 +208,8 @@ void HandshakeHandler::ProcessSuccessfulHandshake(const uint32_t connection_key, void HandshakeHandler::ProcessFailedHandshake(BsonObject& params, ServiceStatus service_status) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Handshake failed"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Handshake failed"); const std::vector<int>& force_protected = protocol_handler_.get_settings().force_protected_service(); @@ -221,8 +218,7 @@ void HandshakeHandler::ProcessFailedHandshake(BsonObject& params, force_protected.end(), context_.service_type_) == force_protected.end(); - LOG4CXX_DEBUG(logger_, - "Service can be unprotected: " << can_be_unprotected + SDL_LOG_DEBUG("Service can be unprotected: " << can_be_unprotected << " and this is a new service: " << context_.is_new_service_); diff --git a/src/components/protocol_handler/src/incoming_data_handler.cc b/src/components/protocol_handler/src/incoming_data_handler.cc index 498618d6de..f0692b3304 100644 --- a/src/components/protocol_handler/src/incoming_data_handler.cc +++ b/src/components/protocol_handler/src/incoming_data_handler.cc @@ -35,7 +35,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOG_VARIABLE("ProtocolHandler") IncomingDataHandler::IncomingDataHandler() : header_(), validator_(NULL), last_portion_of_data_was_malformed_(false) {} @@ -52,48 +52,43 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData( const RawMessage& tm_message, RESULT_CODE& out_result, size_t* malformed_occurrence) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(malformed_occurrence); const transport_manager::ConnectionUID connection_id = tm_message.connection_key(); const uint8_t* data = tm_message.data(); const size_t tm_message_size = tm_message.data_size(); if (tm_message_size == 0 || data == NULL) { - LOG4CXX_WARN(logger_, "Wrong raw message " << tm_message_size << " bytes"); + SDL_LOG_WARN("Wrong raw message " << tm_message_size << " bytes"); out_result = RESULT_FAIL; return ProtocolFramePtrList(); } - LOG4CXX_INFO(logger_, - "Processing incoming data of size " - << tm_message_size << " for connection " << connection_id); + SDL_LOG_INFO("Processing incoming data of size " + << tm_message_size << " for connection " << connection_id); ConnectionsDataMap::iterator it = connections_data_.find(connection_id); if (connections_data_.end() == it) { - LOG4CXX_WARN(logger_, "ProcessData requested for unknown connection"); + SDL_LOG_WARN("ProcessData requested for unknown connection"); out_result = RESULT_FAIL; return ProtocolFramePtrList(); } std::vector<uint8_t>& connection_data = it->second; connection_data.insert(connection_data.end(), data, data + tm_message_size); - LOG4CXX_DEBUG(logger_, - "Total data size for connection " << connection_id << " is " + SDL_LOG_DEBUG("Total data size for connection " << connection_id << " is " << connection_data.size()); ProtocolFramePtrList out_frames; *malformed_occurrence = 0; out_result = CreateFrame( connection_data, out_frames, *malformed_occurrence, connection_id); - LOG4CXX_DEBUG(logger_, - "New data size for connection " << connection_id << " is " + SDL_LOG_DEBUG("New data size for connection " << connection_id << " is " << connection_data.size()); if (!out_frames.empty()) { - LOG4CXX_INFO(logger_, - "Created and passed " << out_frames.size() << " packets"); + SDL_LOG_INFO("Created and passed " << out_frames.size() << " packets"); } else { if (RESULT_DEFERRED == out_result) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "No packets have been created. Waiting next portion of data."); } else { - LOG4CXX_WARN(logger_, "No packets have been created."); + SDL_LOG_WARN("No packets have been created."); } } if (*malformed_occurrence > 0u || last_portion_of_data_was_malformed_) { @@ -106,14 +101,14 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData( void IncomingDataHandler::AddConnection( const transport_manager::ConnectionUID connection_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Add empty list of session to new connection connections_data_[connection_id] = ConnectionsDataMap::mapped_type(); } void IncomingDataHandler::RemoveConnection( const transport_manager::ConnectionUID connection_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); connections_data_.erase(connection_id); } @@ -128,8 +123,7 @@ uint32_t IncomingDataHandler::GetPacketSize( case PROTOCOL_VERSION_5: return header.dataSize + PROTOCOL_HEADER_V2_SIZE; default: - LOG4CXX_WARN(logger_, - "Unknown version: " << static_cast<int>(header.version)); + SDL_LOG_WARN("Unknown version: " << static_cast<int>(header.version)); break; } return 0u; @@ -140,7 +134,7 @@ RESULT_CODE IncomingDataHandler::CreateFrame( ProtocolFramePtrList& out_frames, size_t& malformed_occurrence, const transport_manager::ConnectionUID connection_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<uint8_t>::iterator data_it = incoming_data.begin(); size_t data_size = incoming_data.size(); @@ -150,51 +144,47 @@ RESULT_CODE IncomingDataHandler::CreateFrame( validator_ ? validator_->validate(header_) : RESULT_OK; if (validate_result != RESULT_OK) { - LOG4CXX_WARN(logger_, "Packet validation failed"); + SDL_LOG_WARN("Packet validation failed"); if (!last_portion_of_data_was_malformed_) { ++malformed_occurrence; - LOG4CXX_DEBUG(logger_, - "Malformed message found " << malformed_occurrence); + SDL_LOG_DEBUG("Malformed message found " << malformed_occurrence); } last_portion_of_data_was_malformed_ = true; ++data_it; --data_size; - LOG4CXX_DEBUG(logger_, - "Moved to the next byte " - << std::hex << static_cast<const void*>(&*data_it)); + SDL_LOG_DEBUG("Moved to the next byte " + << std::hex << static_cast<const void*>(&*data_it)); continue; } - LOG4CXX_DEBUG(logger_, "Payload size " << header_.dataSize); + SDL_LOG_DEBUG("Payload size " << header_.dataSize); const uint32_t packet_size = GetPacketSize(header_); if (packet_size <= 0) { - LOG4CXX_WARN(logger_, "Null packet size"); + SDL_LOG_WARN("Null packet size"); ++data_it; --data_size; - LOG4CXX_DEBUG(logger_, - "Moved to the next byte " - << std::hex << static_cast<const void*>(&*data_it)); + SDL_LOG_DEBUG("Moved to the next byte " + << std::hex << static_cast<const void*>(&*data_it)); continue; } if (data_size < packet_size) { - LOG4CXX_DEBUG(logger_, "Packet data is not available yet"); + SDL_LOG_DEBUG("Packet data is not available yet"); incoming_data.erase(incoming_data.begin(), data_it); return RESULT_DEFERRED; } ProtocolFramePtr frame(new protocol_handler::ProtocolPacket(connection_id)); const RESULT_CODE deserialize_result = frame->deserializePacket(&*data_it, packet_size); - LOG4CXX_DEBUG(logger_, "Deserialized frame " << frame); + SDL_LOG_DEBUG("Deserialized frame " << frame); if (deserialize_result != RESULT_OK) { - LOG4CXX_WARN(logger_, "Packet deserialization failed"); + SDL_LOG_WARN("Packet deserialization failed"); incoming_data.erase(incoming_data.begin(), data_it); return RESULT_FAIL; } out_frames.push_back(frame); last_portion_of_data_was_malformed_ = false; - LOG4CXX_DEBUG(logger_, - "Frame added. " - << "Connection ID " << connection_id); + SDL_LOG_DEBUG("Frame added. " + << "Connection ID " << connection_id); data_it += packet_size; data_size -= packet_size; diff --git a/src/components/protocol_handler/src/multiframe_builder.cc b/src/components/protocol_handler/src/multiframe_builder.cc index fbfc061490..69e39beaa2 100644 --- a/src/components/protocol_handler/src/multiframe_builder.cc +++ b/src/components/protocol_handler/src/multiframe_builder.cc @@ -41,7 +41,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOG_VARIABLE("ProtocolHandler") MultiFrameBuilder::MultiFrameBuilder() : consecutive_frame_wait_msecs_(0u) {} @@ -50,19 +50,18 @@ void MultiFrameBuilder::set_waiting_timeout( consecutive_frame_wait_msecs_ = static_cast<int64_t>(consecutive_frame_wait_msecs); if (consecutive_frame_wait_msecs == 0) { - LOG4CXX_WARN(logger_, "Waiting timout disabled"); + SDL_LOG_WARN("Waiting timout disabled"); } else { - LOG4CXX_DEBUG(logger_, - "Waiting time in msec: " << consecutive_frame_wait_msecs_); + SDL_LOG_DEBUG("Waiting time in msec: " << consecutive_frame_wait_msecs_); } } bool MultiFrameBuilder::AddConnection(const ConnectionID connection_id) { - LOG4CXX_DEBUG(logger_, "Adding connection_id: " << connection_id); - LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_); + SDL_LOG_DEBUG("Adding connection_id: " << connection_id); + SDL_LOG_DEBUG("Current state is: " << multiframes_map_); const MultiFrameMap::const_iterator it = multiframes_map_.find(connection_id); if (it != multiframes_map_.end()) { - LOG4CXX_ERROR(logger_, "Exists connection_id: " << connection_id); + SDL_LOG_ERROR("Exists connection_id: " << connection_id); return false; } multiframes_map_[connection_id] = SessionToFrameMap(); @@ -70,18 +69,17 @@ bool MultiFrameBuilder::AddConnection(const ConnectionID connection_id) { } bool MultiFrameBuilder::RemoveConnection(const ConnectionID connection_id) { - LOG4CXX_DEBUG(logger_, "Removing connection_id: " << connection_id); - LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_); + SDL_LOG_DEBUG("Removing connection_id: " << connection_id); + SDL_LOG_DEBUG("Current state is: " << multiframes_map_); const MultiFrameMap::iterator it = multiframes_map_.find(connection_id); if (it == multiframes_map_.end()) { - LOG4CXX_ERROR(logger_, "Non-existent connection_id: " << connection_id); + SDL_LOG_ERROR("Non-existent connection_id: " << connection_id); return false; } const SessionToFrameMap& session_to_frame_map = it->second; if (!session_to_frame_map.empty()) { // FIXME(EZamakhov): Ask ReqManager - do we need to send GenericError - LOG4CXX_WARN(logger_, - "For connection_id: " << connection_id + SDL_LOG_WARN("For connection_id: " << connection_id << " waiting: " << multiframes_map_); } multiframes_map_.erase(it); @@ -89,45 +87,43 @@ bool MultiFrameBuilder::RemoveConnection(const ConnectionID connection_id) { } ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_); - LOG4CXX_DEBUG(logger_, - "Current multiframe map size is: " << multiframes_map_.size()); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Current state is: " << multiframes_map_); + SDL_LOG_DEBUG("Current multiframe map size is: " << multiframes_map_.size()); ProtocolFramePtrList outpute_frame_list; for (MultiFrameMap::iterator connection_it = multiframes_map_.begin(); connection_it != multiframes_map_.end(); ++connection_it) { - LOG4CXX_TRACE(logger_, "Step over connection: " << connection_it->first); + SDL_LOG_TRACE("Step over connection: " << connection_it->first); SessionToFrameMap& session_map = connection_it->second; for (SessionToFrameMap::iterator session_it = session_map.begin(); session_it != session_map.end(); ++session_it) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( "Step over session: " << static_cast<int>(session_it->first)); MessageIDToFrameMap& messageId_map = session_it->second; MessageIDToFrameMap::iterator messageId_it = messageId_map.begin(); while (messageId_it != messageId_map.end()) { - LOG4CXX_TRACE(logger_, "Step over messageId: " << messageId_it->first); + SDL_LOG_TRACE("Step over messageId: " << messageId_it->first); ProtocolFrameData& frame_data = messageId_it->second; ProtocolFramePtr frame = frame_data.frame; if (frame && frame->frame_data() == FRAME_DATA_LAST_CONSECUTIVE && frame->payload_size() > 0u) { - LOG4CXX_DEBUG(logger_, "Ready frame: " << frame); + SDL_LOG_DEBUG("Ready frame: " << frame); outpute_frame_list.push_back(frame); messageId_map.erase(messageId_it++); continue; } if (consecutive_frame_wait_msecs_ != 0) { - LOG4CXX_TRACE(logger_, "Expiration verification"); + SDL_LOG_TRACE("Expiration verification"); const int64_t time_left = date_time::calculateTimeSpan(frame_data.append_time); - LOG4CXX_DEBUG(logger_, "mSecs left: " << time_left); + SDL_LOG_DEBUG("mSecs left: " << time_left); if (time_left >= consecutive_frame_wait_msecs_) { - LOG4CXX_WARN(logger_, "Expired frame: " << frame); + SDL_LOG_WARN("Expired frame: " << frame); outpute_frame_list.push_back(frame); messageId_map.erase(messageId_it++); continue; @@ -137,27 +133,27 @@ ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() { } // iteration over messageId_map } // iteration over session_map } // iteration over multiframes_map_ - LOG4CXX_DEBUG(logger_, "Result frames count: " << outpute_frame_list.size()); + SDL_LOG_DEBUG("Result frames count: " << outpute_frame_list.size()); return outpute_frame_list; } RESULT_CODE MultiFrameBuilder::AddFrame(const ProtocolFramePtr packet) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Handling frame: " << packet); - LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Handling frame: " << packet); + SDL_LOG_DEBUG("Current state is: " << multiframes_map_); if (!packet) { - LOG4CXX_ERROR(logger_, "Skip empty frame"); + SDL_LOG_ERROR("Skip empty frame"); return RESULT_FAIL; } switch (packet->frame_type()) { case FRAME_TYPE_FIRST: - LOG4CXX_TRACE(logger_, "FRAME_TYPE_FIRST"); + SDL_LOG_TRACE("FRAME_TYPE_FIRST"); return HandleFirstFrame(packet); case FRAME_TYPE_CONSECUTIVE: - LOG4CXX_TRACE(logger_, "FRAME_TYPE_CONSECUTIVE"); + SDL_LOG_TRACE("FRAME_TYPE_CONSECUTIVE"); return HandleConsecutiveFrame(packet); default: - LOG4CXX_ERROR(logger_, "Frame is not FIRST or CONSECUTIVE :" << packet); + SDL_LOG_ERROR("Frame is not FIRST or CONSECUTIVE :" << packet); break; } return RESULT_FAIL; @@ -165,17 +161,17 @@ RESULT_CODE MultiFrameBuilder::AddFrame(const ProtocolFramePtr packet) { RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) { DCHECK_OR_RETURN(packet->frame_type() == FRAME_TYPE_FIRST, RESULT_FAIL); - LOG4CXX_DEBUG(logger_, "Waiting : " << multiframes_map_); - LOG4CXX_DEBUG(logger_, "Handling FIRST frame: " << packet); + SDL_LOG_DEBUG("Waiting : " << multiframes_map_); + SDL_LOG_DEBUG("Handling FIRST frame: " << packet); if (packet->payload_size() != 0u) { - LOG4CXX_ERROR(logger_, "First frame shall have no data:" << packet); + SDL_LOG_ERROR("First frame shall have no data:" << packet); return RESULT_FAIL; } const ConnectionID connection_id = packet->connection_id(); MultiFrameMap::iterator connection_it = multiframes_map_.find(connection_id); if (connection_it == multiframes_map_.end()) { - LOG4CXX_ERROR(logger_, "Unknown connection_id: " << connection_id); + SDL_LOG_ERROR("Unknown connection_id: " << connection_id); return RESULT_FAIL; } SessionToFrameMap& session_map = connection_it->second; @@ -187,19 +183,17 @@ RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) { const MessageID message_id = packet->message_id(); MessageIDToFrameMap::iterator messageId_it = messageId_map.find(message_id); if (messageId_it != messageId_map.end()) { - LOG4CXX_ERROR(logger_, - "Already waiting message for connection_id: " - << connection_id - << ", session_id: " << static_cast<int>(session_id) - << ", message_id: " << message_id); + SDL_LOG_ERROR("Already waiting message for connection_id: " + << connection_id + << ", session_id: " << static_cast<int>(session_id) + << ", message_id: " << message_id); return RESULT_FAIL; } - LOG4CXX_DEBUG(logger_, - "Start waiting frames for connection_id: " - << connection_id - << ", session_id: " << static_cast<int>(session_id) - << ", message_id: " << message_id); + SDL_LOG_DEBUG("Start waiting frames for connection_id: " + << connection_id + << ", session_id: " << static_cast<int>(session_id) + << ", message_id: " << message_id); messageId_map[message_id] = {packet, date_time::getCurrentTime()}; return RESULT_OK; } @@ -207,12 +201,12 @@ RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) { RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( const ProtocolFramePtr packet) { DCHECK_OR_RETURN(packet->frame_type() == FRAME_TYPE_CONSECUTIVE, RESULT_FAIL); - LOG4CXX_DEBUG(logger_, "Handling CONSECUTIVE frame: " << packet); + SDL_LOG_DEBUG("Handling CONSECUTIVE frame: " << packet); const ConnectionID connection_id = packet->connection_id(); MultiFrameMap::iterator connection_it = multiframes_map_.find(connection_id); if (connection_it == multiframes_map_.end()) { - LOG4CXX_ERROR(logger_, "Unknown connection_id: " << connection_id); + SDL_LOG_ERROR("Unknown connection_id: " << connection_id); return RESULT_FAIL; } SessionToFrameMap& session_map = connection_it->second; @@ -224,11 +218,10 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( const MessageID message_id = packet->message_id(); MessageIDToFrameMap::iterator messageId_it = messageId_map.find(message_id); if (messageId_it == messageId_map.end()) { - LOG4CXX_ERROR(logger_, - "No waiting message for connection_id: " - << connection_id - << ", session_id: " << static_cast<int>(session_id) - << ", message_id: " << message_id); + SDL_LOG_ERROR("No waiting message for connection_id: " + << connection_id + << ", session_id: " << static_cast<int>(session_id) + << ", message_id: " << message_id); return RESULT_FAIL; } @@ -243,7 +236,7 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( if (is_last_consecutive) { // TODO(EZamakhov): implement count of frames and result size verification - LOG4CXX_DEBUG(logger_, "Last CONSECUTIVE frame"); + SDL_LOG_DEBUG("Last CONSECUTIVE frame"); } else { uint8_t previous_frame_data = assembling_frame->frame_data(); if (previous_frame_data == std::numeric_limits<uint8_t>::max()) { @@ -251,12 +244,10 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( } // The next frame data is bigger at 1 if (new_frame_data != (previous_frame_data + 1)) { - LOG4CXX_ERROR(logger_, - "Unexpected CONSECUTIVE frame for connection_id: " - << connection_id - << ", session_id: " << static_cast<int>(session_id) - << ", message_id: " << message_id - << ", frame: " << packet); + SDL_LOG_ERROR("Unexpected CONSECUTIVE frame for connection_id: " + << connection_id + << ", session_id: " << static_cast<int>(session_id) + << ", message_id: " << message_id << ", frame: " << packet); return RESULT_FAIL; } } @@ -268,8 +259,7 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( assembling_frame->set_frame_data(new_frame_data); - LOG4CXX_DEBUG(logger_, - "Appending " << packet->data_size() << " bytes " + SDL_LOG_DEBUG("Appending " << packet->data_size() << " bytes " << "; frame_data " << static_cast<int>(new_frame_data) << "; for connection_id: " << connection_id @@ -278,12 +268,11 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( if (assembling_frame->appendData(packet->data(), packet->data_size()) != RESULT_OK) { - LOG4CXX_ERROR(logger_, "Failed to append frame for multiframe message."); + SDL_LOG_ERROR("Failed to append frame for multiframe message."); return RESULT_FAIL; } - LOG4CXX_INFO(logger_, - "Assembled frame with payload size: " - << assembling_frame->payload_size()); + SDL_LOG_INFO("Assembled frame with payload size: " + << assembling_frame->payload_size()); frame_data.append_time = date_time::getCurrentTime(); return RESULT_OK; } diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 9b7305d48a..1f41ab38a3 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -50,7 +50,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOG_VARIABLE("ProtocolHandler") /** * Function return packet data as std::string. @@ -93,7 +93,7 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( #endif // TELEMETRY_MONITOR { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); protocol_header_validator_.set_max_payload_size( get_settings().maximum_payload_size()); protocol_header_validator_.set_max_control_payload_size( @@ -115,12 +115,11 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( if (message_frequency_time > 0u && message_frequency_count > 0u) { message_meter_.set_time_range(message_frequency_time); - LOG4CXX_DEBUG(logger_, - "Frequency meter is enabled ( " - << message_frequency_count << " per " - << message_frequency_time << " mSecond)"); + SDL_LOG_DEBUG("Frequency meter is enabled ( " + << message_frequency_count << " per " + << message_frequency_time << " mSecond)"); } else { - LOG4CXX_WARN(logger_, "Frequency meter is disabled"); + SDL_LOG_WARN("Frequency meter is disabled"); } const size_t& malformed_frequency_time = @@ -131,18 +130,17 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( if (get_settings().malformed_message_filtering()) { if (malformed_frequency_time > 0u && malformed_frequency_count > 0u) { malformed_message_meter_.set_time_range(malformed_frequency_time); - LOG4CXX_DEBUG(logger_, - "Malformed frequency meter is enabled ( " - << malformed_frequency_count << " per " - << malformed_frequency_time << " mSecond)"); + SDL_LOG_DEBUG("Malformed frequency meter is enabled ( " + << malformed_frequency_count << " per " + << malformed_frequency_time << " mSecond)"); } else { - LOG4CXX_WARN(logger_, "Malformed frequency meter is disabled"); + SDL_LOG_WARN("Malformed frequency meter is disabled"); } } else { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Malformed message filtering is disabled." - << "Connection will be close on first malformed message detection"); + << "Connection will be close on first malformed message detection"); } multiframe_builder_.set_waiting_timeout( get_settings().multiframe_waiting_timeout()); @@ -151,15 +149,15 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( ProtocolHandlerImpl::~ProtocolHandlerImpl() { sync_primitives::AutoLock lock(protocol_observers_lock_); if (!protocol_observers_.empty()) { - LOG4CXX_WARN(logger_, - "Not all observers have unsubscribed" - " from ProtocolHandlerImpl"); + SDL_LOG_WARN( + "Not all observers have unsubscribed" + " from ProtocolHandlerImpl"); } } void ProtocolHandlerImpl::AddProtocolObserver(ProtocolObserver* observer) { if (!observer) { - LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to IProtocolObserver."); + SDL_LOG_ERROR("Invalid (NULL) pointer to IProtocolObserver."); return; } sync_primitives::AutoLock lock(protocol_observers_lock_); @@ -167,9 +165,9 @@ void ProtocolHandlerImpl::AddProtocolObserver(ProtocolObserver* observer) { } void ProtocolHandlerImpl::RemoveProtocolObserver(ProtocolObserver* observer) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!observer) { - LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to IProtocolObserver."); + SDL_LOG_ERROR("Invalid (NULL) pointer to IProtocolObserver."); return; } sync_primitives::AutoLock lock(protocol_observers_lock_); @@ -181,12 +179,10 @@ void set_hash_id(uint32_t hash_id, protocol_handler::ProtocolPacket& packet) { return; } if (packet.protocol_version() < PROTOCOL_VERSION_2) { - LOG4CXX_DEBUG(logger_, - "Packet needs no hash data (protocol version less 2)"); + SDL_LOG_DEBUG("Packet needs no hash data (protocol version less 2)"); return; } - LOG4CXX_DEBUG(logger_, - "Set hash_id 0x" << std::hex << hash_id << " to the packet 0x" + SDL_LOG_DEBUG("Set hash_id 0x" << std::hex << hash_id << " to the packet 0x" << &packet); // Hash id shall be 4 bytes according Ford Protocol v8 DCHECK(sizeof(hash_id) == 4); @@ -201,7 +197,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(ConnectionID connection_id, uint32_t hash_id, uint8_t service_type, bool protection) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); utils::SemanticVersion fullVersion; SendStartSessionAck(connection_id, session_id, @@ -220,7 +216,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( uint8_t service_type, bool protection, utils::SemanticVersion& full_version) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); BsonObject empty_param; bson_object_initialize_default(&empty_param); @@ -246,7 +242,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( bool protection, utils::SemanticVersion& full_version, BsonObject& params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool send_transport_update_event = false; @@ -294,22 +290,20 @@ void ProtocolHandlerImpl::SendStartSessionAck( protocol_header_validator_.max_payload_size_by_service_type( serviceTypeValue))); UNUSED(mtu_written) - LOG4CXX_DEBUG(logger_, - "MTU parameter was written to bson params: " - << mtu_written << "; Value: " - << static_cast<int32_t>( - bson_object_get_int64(¶ms, strings::mtu))); + SDL_LOG_DEBUG( + "MTU parameter was written to bson params: " + << mtu_written << "; Value: " + << static_cast<int32_t>(bson_object_get_int64(¶ms, strings::mtu))); if (serviceTypeValue == kRpc) { // Hash ID is only used in RPC case const bool hash_written = bson_object_put_int32( ¶ms, strings::hash_id, static_cast<int32_t>(hash_id)); UNUSED(hash_written); - LOG4CXX_DEBUG(logger_, - "Hash parameter was written to bson params: " - << hash_written << "; Value: " - << static_cast<int32_t>(bson_object_get_int32( - ¶ms, strings::hash_id))); + SDL_LOG_DEBUG("Hash parameter was written to bson params: " + << hash_written << "; Value: " + << static_cast<int32_t>( + bson_object_get_int32(¶ms, strings::hash_id))); // Minimum protocol version supported by both utils::SemanticVersion* min_version = @@ -323,14 +317,13 @@ void ProtocolHandlerImpl::SendStartSessionAck( const bool protocol_ver_written = bson_object_put_string( ¶ms, strings::protocol_version, protocol_version_string); UNUSED(protocol_ver_written); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Protocol version parameter was written to bson params: " - << protocol_ver_written << "; Value: " - << bson_object_get_string(¶ms, strings::protocol_version)); + << protocol_ver_written << "; Value: " + << bson_object_get_string(¶ms, strings::protocol_version)); - LOG4CXX_INFO(logger_, - "Protocol Version String " << protocol_version_string); + SDL_LOG_INFO("Protocol Version String " << protocol_version_string); std::vector<std::string> secondaryTransports; std::vector<int32_t> audioServiceTransports; @@ -340,7 +333,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( secondaryTransports, audioServiceTransports, videoServiceTransports)) { - LOG4CXX_DEBUG(logger_, "Multiple transports are enabled."); + SDL_LOG_DEBUG("Multiple transports are enabled."); BsonArray secondaryTransportsArr; bson_array_initialize(&secondaryTransportsArr, secondaryTransports.size()); @@ -350,11 +343,11 @@ void ProtocolHandlerImpl::SendStartSessionAck( secondaryTransports[i].c_str(), sizeof(secondaryTransport)); secondaryTransport[sizeof(secondaryTransport) - 1] = '\0'; - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Adding " - << secondaryTransport - << " to secondaryTransports parameter of StartSessionAck"); + << secondaryTransport + << " to secondaryTransports parameter of StartSessionAck"); bson_array_add_string(&secondaryTransportsArr, secondaryTransport); } bson_object_put_array( @@ -364,8 +357,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( bson_array_initialize(&audioServiceTransportsArr, audioServiceTransports.size()); for (unsigned int i = 0; i < audioServiceTransports.size(); i++) { - LOG4CXX_DEBUG(logger_, - "Adding " << audioServiceTransports[i] + SDL_LOG_DEBUG("Adding " << audioServiceTransports[i] << " to audioServiceTransports parameter " "of StartSessionAck"); bson_array_add_int32(&audioServiceTransportsArr, @@ -379,8 +371,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( bson_array_initialize(&videoServiceTransportsArr, videoServiceTransports.size()); for (unsigned int i = 0; i < videoServiceTransports.size(); i++) { - LOG4CXX_DEBUG(logger_, - "Adding " << videoServiceTransports[i] + SDL_LOG_DEBUG("Adding " << videoServiceTransports[i] << " to videoServiceTransports parameter " "of StartSessionAck"); bson_array_add_int32(&videoServiceTransportsArr, @@ -393,8 +384,8 @@ void ProtocolHandlerImpl::SendStartSessionAck( if (settings_.multiple_transports_enabled()) { send_transport_update_event = true; } else { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Multiple transports feature is disabled by configuration"); // In this case, we must remember that this session will never have // a secondary transport. @@ -402,14 +393,14 @@ void ProtocolHandlerImpl::SendStartSessionAck( kDisabledSecondary); } } else { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Failed to set up secondary transport and service type params"); connection_handler_.SetSecondaryTransportID(session_id, kDisabledSecondary); } } else { - LOG4CXX_INFO(logger_, "Older protocol version. No multiple transports"); + SDL_LOG_INFO("Older protocol version. No multiple transports"); connection_handler_.SetSecondaryTransportID(session_id, kDisabledSecondary); } @@ -437,20 +428,19 @@ void ProtocolHandlerImpl::SendStartSessionAck( raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOG4CXX_DEBUG(logger_, - "SendStartSessionAck() for connection " - << connection_id << " for service_type " - << static_cast<int32_t>(service_type) << " session_id " - << static_cast<int32_t>(session_id) << " protection " - << (protection ? "ON" : "OFF")); + SDL_LOG_DEBUG("SendStartSessionAck() for connection " + << connection_id << " for service_type " + << static_cast<int32_t>(service_type) << " session_id " + << static_cast<int32_t>(session_id) << " protection " + << (protection ? "ON" : "OFF")); if (send_transport_update_event) { // Wait until the StartService ACK has been processed for sending. // The TransportUpdateEvent has a higher priority, being that it's // a SERVICE_TYPE_CONTROL message. (The ACK is SERVICE_TYPE_RPC.) - LOG4CXX_DEBUG(logger_, "Waiting for the MessageToMobile queue to be empty"); + SDL_LOG_DEBUG("Waiting for the MessageToMobile queue to be empty"); raw_ford_messages_to_mobile_.WaitDumpQueue(); - LOG4CXX_DEBUG(logger_, "Sending the TransportUpdate event"); + SDL_LOG_DEBUG("Sending the TransportUpdate event"); SendTransportUpdateEvent(connection_id, session_id); } } @@ -473,7 +463,7 @@ void ProtocolHandlerImpl::SendStartSessionNAck( uint8_t protocol_version, uint8_t service_type, std::vector<std::string>& rejectedParams) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProtocolFramePtr ptr( new protocol_handler::ProtocolPacket(connection_id, @@ -511,11 +501,10 @@ void ProtocolHandlerImpl::SendStartSessionNAck( raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOG4CXX_DEBUG(logger_, - "SendStartSessionNAck() for connection " - << connection_id << " for service_type " - << static_cast<int32_t>(service_type) << " session_id " - << static_cast<int32_t>(session_id)); + SDL_LOG_DEBUG("SendStartSessionNAck() for connection " + << connection_id << " for service_type " + << static_cast<int32_t>(service_type) << " session_id " + << static_cast<int32_t>(session_id)); } void ProtocolHandlerImpl::SendEndSessionNAck(ConnectionID connection_id, @@ -536,7 +525,7 @@ void ProtocolHandlerImpl::SendEndSessionNAck( uint8_t protocol_version, uint8_t service_type, std::vector<std::string>& rejectedParams) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProtocolFramePtr ptr( new protocol_handler::ProtocolPacket(connection_id, @@ -574,11 +563,10 @@ void ProtocolHandlerImpl::SendEndSessionNAck( raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOG4CXX_DEBUG(logger_, - "SendEndSessionNAck() for connection " - << connection_id << " for service_type " - << static_cast<int32_t>(service_type) << " session_id " - << static_cast<int32_t>(session_id)); + SDL_LOG_DEBUG("SendEndSessionNAck() for connection " + << connection_id << " for service_type " + << static_cast<int32_t>(service_type) << " session_id " + << static_cast<int32_t>(session_id)); } SessionObserver& ProtocolHandlerImpl::get_session_observer() { @@ -589,7 +577,7 @@ void ProtocolHandlerImpl::SendEndSessionAck(ConnectionID connection_id, uint8_t session_id, uint8_t protocol_version, uint8_t service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProtocolFramePtr ptr( new protocol_handler::ProtocolPacket(connection_id, @@ -605,25 +593,23 @@ void ProtocolHandlerImpl::SendEndSessionAck(ConnectionID connection_id, raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOG4CXX_DEBUG(logger_, - "SendEndSessionAck() for connection " - << connection_id << " for service_type " - << static_cast<int32_t>(service_type) << " session_id " - << static_cast<int32_t>(session_id)); + SDL_LOG_DEBUG("SendEndSessionAck() for connection " + << connection_id << " for service_type " + << static_cast<int32_t>(service_type) << " session_id " + << static_cast<int32_t>(session_id)); } void ProtocolHandlerImpl::SendEndServicePrivate(int32_t primary_connection_id, int32_t connection_id, uint8_t session_id, uint8_t service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint8_t protocol_version; if (session_observer_.ProtocolVersionUsed( primary_connection_id, session_id, protocol_version)) { - LOG4CXX_TRACE(logger_, - "SendEndServicePrivate using protocol version " - << static_cast<int32_t>(protocol_version)); + SDL_LOG_TRACE("SendEndServicePrivate using protocol version " + << static_cast<int32_t>(protocol_version)); ProtocolFramePtr ptr( new protocol_handler::ProtocolPacket(connection_id, protocol_version, @@ -637,22 +623,21 @@ void ProtocolHandlerImpl::SendEndServicePrivate(int32_t primary_connection_id, raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOG4CXX_DEBUG(logger_, - "SendEndServicePrivate() for connection " - << connection_id << " for service_type " - << static_cast<int>(service_type) - << " primary connection " << primary_connection_id - << " session_id " << static_cast<int32_t>(session_id)); + SDL_LOG_DEBUG("SendEndServicePrivate() for connection " + << connection_id << " for service_type " + << static_cast<int>(service_type) << " primary connection " + << primary_connection_id << " session_id " + << static_cast<int32_t>(session_id)); } else { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "SendEndServicePrivate is failed connection or session does not exist"); } } void ProtocolHandlerImpl::SendEndSession(int32_t connection_id, uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // A session is always associated with a primary connection ID SendEndServicePrivate( connection_id, connection_id, session_id, SERVICE_TYPE_RPC); @@ -662,7 +647,7 @@ void ProtocolHandlerImpl::SendEndService(int32_t primary_connection_id, int32_t connection_id, uint8_t session_id, uint8_t service_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SendEndServicePrivate( primary_connection_id, connection_id, session_id, service_type); } @@ -670,7 +655,7 @@ void ProtocolHandlerImpl::SendEndService(int32_t primary_connection_id, RESULT_CODE ProtocolHandlerImpl::SendHeartBeatAck(ConnectionID connection_id, uint8_t session_id, uint32_t message_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint8_t protocol_version; if (session_observer_.ProtocolVersionUsed( @@ -690,15 +675,14 @@ RESULT_CODE ProtocolHandlerImpl::SendHeartBeatAck(ConnectionID connection_id, impl::RawFordMessageToMobile(ptr, false)); return RESULT_OK; } - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "SendHeartBeatAck is failed connection or session does not exist"); return RESULT_FAIL; } void ProtocolHandlerImpl::SendTransportUpdateEvent(ConnectionID connection_id, uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint8_t protocol_version; if (session_observer_.ProtocolVersionUsed( @@ -731,9 +715,8 @@ void ProtocolHandlerImpl::SendTransportUpdateEvent(ConnectionID connection_id, &payload_obj, strings::tcp_ip_address, tcp_ip_address); // omit TCP port number } - LOG4CXX_INFO(logger_, - "SendTransportUpdateEvent IP address: " - << tcp_ip_address << " Port: " << tcp_port); + SDL_LOG_INFO("SendTransportUpdateEvent IP address: " + << tcp_ip_address << " Port: " << tcp_port); uint8_t* payloadBytes = bson_object_to_bytes(&payload_obj); ptr->set_data(payloadBytes, bson_object_size(&payload_obj)); @@ -743,14 +726,13 @@ void ProtocolHandlerImpl::SendTransportUpdateEvent(ConnectionID connection_id, raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOG4CXX_DEBUG(logger_, - "SendTransportUpdateEvent() for connection " - << connection_id << " for session " - << static_cast<int32_t>(session_id)); + SDL_LOG_DEBUG("SendTransportUpdateEvent() for connection " + << connection_id << " for session " + << static_cast<int32_t>(session_id)); } else { - LOG4CXX_WARN(logger_, - "SendTransportUpdateEvent is failed connection or session " - "does not exist"); + SDL_LOG_WARN( + "SendTransportUpdateEvent is failed connection or session " + "does not exist"); } } @@ -758,7 +740,7 @@ RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportAck( ConnectionID connection_id, ConnectionID primary_transport_connection_id, uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // acquire the protocol version from primary transport uint8_t protocol_version; @@ -779,9 +761,9 @@ RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportAck( impl::RawFordMessageToMobile(ptr, false)); return RESULT_OK; } - LOG4CXX_WARN(logger_, - "RegisterSecondaryTransportAck is failed connection or session " - "does not exist"); + SDL_LOG_WARN( + "RegisterSecondaryTransportAck is failed connection or session " + "does not exist"); return RESULT_FAIL; } @@ -790,7 +772,7 @@ RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportNAck( ConnectionID primary_transport_connection_id, uint8_t session_id, BsonObject* reason) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // If mobile sends an invalid session ID and we cannot find out the Connection // ID of primary transport, then we use version 5. (The multiple-transports @@ -800,9 +782,9 @@ RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportNAck( // acquire the protocol version from primary transport if (!session_observer_.ProtocolVersionUsed( primary_transport_connection_id, session_id, protocol_version)) { - LOG4CXX_WARN(logger_, - "Failed to acquire protocol version for " - "RegisterSecondaryTransportNAck"); + SDL_LOG_WARN( + "Failed to acquire protocol version for " + "RegisterSecondaryTransportNAck"); return RESULT_FAIL; } } @@ -831,7 +813,7 @@ RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportNAck( void ProtocolHandlerImpl::SendHeartBeat(int32_t connection_id, uint8_t session_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint8_t protocol_version; if (session_observer_.ProtocolVersionUsed( connection_id, session_id, protocol_version)) { @@ -847,10 +829,9 @@ void ProtocolHandlerImpl::SendHeartBeat(int32_t connection_id, message_counters_[session_id]++)); raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOG4CXX_DEBUG(logger_, "SendHeartBeat finished successfully"); + SDL_LOG_DEBUG("SendHeartBeat finished successfully"); } else { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "SendHeartBeat is failed connection or session does not exist"); } } @@ -861,10 +842,9 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, #ifdef TELEMETRY_MONITOR const date_time::TimeDuration start_time = date_time::getCurrentTime(); #endif // TELEMETRY_MONITOR - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!message) { - LOG4CXX_ERROR(logger_, - "Invalid message for sending to mobile app is received."); + SDL_LOG_ERROR("Invalid message for sending to mobile app is received."); return; } @@ -906,15 +886,13 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, DCHECK(max_block_size > 0); if (max_block_size > 0) { frame_size = max_block_size; - LOG4CXX_DEBUG(logger_, - "Security set new optimal packet size " << frame_size); + SDL_LOG_DEBUG("Security set new optimal packet size " << frame_size); } else { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Security could not return max block size, use the origin one"); } } - LOG4CXX_DEBUG(logger_, "Optimal packet size is " << frame_size); + SDL_LOG_DEBUG("Optimal packet size is " << frame_size); #endif // ENABLE_SECURITY if (message->data_size() <= frame_size) { @@ -927,13 +905,11 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, needs_encryption, final_message); if (result != RESULT_OK) { - LOG4CXX_ERROR(logger_, - "ProtocolHandler failed to send single frame message."); + SDL_LOG_ERROR("ProtocolHandler failed to send single frame message."); } } else { - LOG4CXX_DEBUG(logger_, - "Message will be sent in multiple frames; max frame size is " - << frame_size); + SDL_LOG_DEBUG("Message will be sent in multiple frames; max frame size is " + << frame_size); RESULT_CODE result = SendMultiFrameMessage(connection_handle, sessionID, @@ -945,8 +921,7 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, needs_encryption, final_message); if (result != RESULT_OK) { - LOG4CXX_ERROR(logger_, - "ProtocolHandler failed to send multiframe messages."); + SDL_LOG_ERROR("ProtocolHandler failed to send multiframe messages."); } } #ifdef TELEMETRY_MONITOR @@ -961,34 +936,31 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, } void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!tm_message) { - LOG4CXX_ERROR(logger_, - "Invalid incoming message received in" - << " ProtocolHandler from Transport Manager."); + SDL_LOG_ERROR("Invalid incoming message received in" + << " ProtocolHandler from Transport Manager."); return; } const uint32_t connection_key = tm_message->connection_key(); - LOG4CXX_DEBUG(logger_, - "Received data from TM with connection id " - << connection_key << " msg data_size " - << tm_message->data_size()); + SDL_LOG_DEBUG("Received data from TM with connection id " + << connection_key << " msg data_size " + << tm_message->data_size()); RESULT_CODE result; size_t malformed_occurs = 0u; const ProtocolFramePtrList protocol_frames = incoming_data_handler_.ProcessData( *tm_message, result, &malformed_occurs); - LOG4CXX_DEBUG(logger_, "Processed " << protocol_frames.size() << " frames"); + SDL_LOG_DEBUG("Processed " << protocol_frames.size() << " frames"); if (result != RESULT_OK) { if (result == RESULT_MALFORMED_OCCURS) { - LOG4CXX_WARN( - logger_, - "Malformed message occurs, connection id " << connection_key); + SDL_LOG_WARN("Malformed message occurs, connection id " + << connection_key); if (!get_settings().malformed_message_filtering()) { - LOG4CXX_DEBUG(logger_, "Malformed message filtering disabled"); + SDL_LOG_DEBUG("Malformed message filtering disabled"); session_observer_.OnMalformedMessageCallback(connection_key); // For tracking only malformed occurrence check output } else { @@ -997,7 +969,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) { } } } else { - LOG4CXX_ERROR(logger_, "Incoming data processing failed."); + SDL_LOG_ERROR("Incoming data processing failed."); transport_manager_.DisconnectForce(connection_key); } } @@ -1012,7 +984,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) { #ifdef ENABLE_SECURITY const RESULT_CODE result = DecryptFrame(frame); if (result != RESULT_OK) { - LOG4CXX_WARN(logger_, "Error frame decryption. Frame skipped."); + SDL_LOG_WARN("Error frame decryption. Frame skipped."); continue; } #endif // ENABLE_SECURITY @@ -1030,15 +1002,14 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) { void ProtocolHandlerImpl::OnTMMessageReceiveFailed( const transport_manager::DataReceiveError& error) { // TODO(PV): implement - LOG4CXX_ERROR(logger_, "Received error on attemping to recieve message."); + SDL_LOG_ERROR("Received error on attemping to recieve message."); } void ProtocolHandlerImpl::NotifySubscribers(const RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(protocol_observers_lock_); if (protocol_observers_.empty()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Cannot handle multiframe message: no IProtocolObserver is set."); } for (ProtocolObservers::iterator it = protocol_observers_.begin(); @@ -1050,7 +1021,7 @@ void ProtocolHandlerImpl::NotifySubscribers(const RawMessagePtr message) { } void ProtocolHandlerImpl::OnTMMessageSend(const RawMessagePtr message) { - LOG4CXX_DEBUG(logger_, "Sending message finished successfully."); + SDL_LOG_DEBUG("Sending message finished successfully."); uint32_t connection_handle = 0; uint8_t sessionID = 0; @@ -1073,7 +1044,7 @@ void ProtocolHandlerImpl::OnTMMessageSend(const RawMessagePtr message) { const RESULT_CODE result = sent_message.deserializePacket(message->data(), message->data_size()); if (result != RESULT_OK) { - LOG4CXX_ERROR(logger_, "Error while message deserialization."); + SDL_LOG_ERROR("Error while message deserialization."); return; } std::map<uint8_t, uint32_t>::iterator it = @@ -1103,11 +1074,10 @@ void ProtocolHandlerImpl::OnTMMessageSendFailed( const RawMessagePtr message) { DCHECK_OR_RETURN_VOID(message); // TODO(PV): implement - LOG4CXX_ERROR(logger_, - "Sending message " << message->data_size() - << "bytes failed, connection_key " + SDL_LOG_ERROR("Sending message " << message->data_size() + << " bytes failed, connection_key " << message->connection_key() - << "Error_text: " << error.text()); + << " Error_text: " << error.text()); uint32_t connection_handle = 0; uint8_t session_id = 0; @@ -1154,7 +1124,7 @@ void ProtocolHandlerImpl::OnUnexpectedDisconnect( } void ProtocolHandlerImpl::NotifyOnGetSystemTimeFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef ENABLE_SECURITY security_manager_->ResetPendingSystemTimeRequests(); security_manager_->NotifyListenersOnGetSystemTimeFailed(); @@ -1169,19 +1139,19 @@ void ProtocolHandlerImpl::ProcessFailedPTU() { #ifdef EXTERNAL_PROPRIETARY_MODE void ProtocolHandlerImpl::ProcessFailedCertDecrypt() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); security_manager_->ProcessFailedCertDecrypt(); } #endif void ProtocolHandlerImpl::OnTransportConfigUpdated( const transport_manager::transport_adapter::TransportConfig& configs) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_manager::transport_adapter::TransportConfig::const_iterator it = configs.find(transport_manager::transport_adapter::tc_enabled); if (configs.end() == it) { - LOG4CXX_WARN(logger_, "No enabled field in OnTransportConfigUpdated"); + SDL_LOG_WARN("No enabled field in OnTransportConfigUpdated"); return; } @@ -1191,14 +1161,14 @@ void ProtocolHandlerImpl::OnTransportConfigUpdated( if (tcp_enabled) { it = configs.find(transport_manager::transport_adapter::tc_tcp_port); if (configs.end() == it) { - LOG4CXX_WARN(logger_, "No port field in OnTransportConfigUpdated"); + SDL_LOG_WARN("No port field in OnTransportConfigUpdated"); return; } tcp_port = it->second; it = configs.find(transport_manager::transport_adapter::tc_tcp_ip_address); if (configs.end() == it) { - LOG4CXX_WARN(logger_, "No IP address field in OnTransportConfigUpdated"); + SDL_LOG_WARN("No IP address field in OnTransportConfigUpdated"); return; } tcp_enabled_ = true; @@ -1210,10 +1180,9 @@ void ProtocolHandlerImpl::OnTransportConfigUpdated( tcp_ip_address_.clear(); } - LOG4CXX_INFO(logger_, - "OnTransportConfigUpdated: new config enabled is " - << tcp_enabled_ << ". Port is " << tcp_port_ - << ". IP Address is " << tcp_ip_address_); + SDL_LOG_INFO("OnTransportConfigUpdated: new config enabled is " + << tcp_enabled_ << ". Port is " << tcp_port_ + << ". IP Address is " << tcp_ip_address_); // Walk the SessionConnection map and find all sessions that need a // TransportUpdate Event. Sessions flagged with kDisabledSecondary in their @@ -1228,11 +1197,10 @@ void ProtocolHandlerImpl::OnTransportConfigUpdated( session_connection_map.begin(); while (itr != session_connection_map.end()) { const connection_handler::SessionTransports st = itr->second; - LOG4CXX_INFO(logger_, - "OnTransportConfigUpdated found session " - << itr->first << " with primary connection " - << st.primary_transport << " and secondary connection " - << st.secondary_transport); + SDL_LOG_INFO("OnTransportConfigUpdated found session " + << itr->first << " with primary connection " + << st.primary_transport << " and secondary connection " + << st.secondary_transport); if (st.secondary_transport != kDisabledSecondary) { SendTransportUpdateEvent(st.primary_transport, itr->first); } @@ -1242,7 +1210,7 @@ void ProtocolHandlerImpl::OnTransportConfigUpdated( void ProtocolHandlerImpl::OnAuthTokenUpdated(const std::string& policy_app_id, const std::string& auth_token) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(auth_token_map_lock_); if (auth_token.empty()) { auth_token_map_.erase(policy_app_id); @@ -1253,7 +1221,7 @@ void ProtocolHandlerImpl::OnAuthTokenUpdated(const std::string& policy_app_id, bool ProtocolHandlerImpl::IsRPCServiceSecure( const uint32_t connection_key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef ENABLE_SECURITY security_manager::SSLContext* context = @@ -1265,37 +1233,35 @@ bool ProtocolHandlerImpl::IsRPCServiceSecure( } RESULT_CODE ProtocolHandlerImpl::SendFrame(const ProtocolFramePtr packet) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!packet) { - LOG4CXX_ERROR(logger_, "Failed to send empty packet."); + SDL_LOG_ERROR("Failed to send empty packet."); return RESULT_FAIL; } #ifdef ENABLE_SECURITY // and return protect flag to Packet constructor for makeing design by Policy const RESULT_CODE result = EncryptFrame(packet); if (result != RESULT_OK) { - LOG4CXX_WARN(logger_, "Error frame encryption. Frame droped."); + SDL_LOG_WARN("Error frame encryption. Frame droped."); return RESULT_FAIL; } #endif // ENABLE_SECURITY - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Packet to be sent: " - << ConvertPacketDataToString(packet->data(), packet->data_size()) - << " of size: " << packet->data_size()); + << ConvertPacketDataToString(packet->data(), packet->data_size()) + << " of size: " << packet->data_size()); const RawMessagePtr message_to_send = packet->serializePacket(); if (!message_to_send) { - LOG4CXX_ERROR(logger_, "Serialization error"); + SDL_LOG_ERROR("Serialization error"); return RESULT_FAIL; } - LOG4CXX_DEBUG(logger_, - "Message to send with connection id " - << static_cast<int>(packet->connection_id())); + SDL_LOG_DEBUG("Message to send with connection id " + << static_cast<int>(packet->connection_id())); if (transport_manager::E_SUCCESS != transport_manager_.SendMessageToDevice(message_to_send)) { - LOG4CXX_WARN(logger_, "Can't send message to device"); + SDL_LOG_WARN("Can't send message to device"); return RESULT_FAIL; } return RESULT_OK; @@ -1310,11 +1276,10 @@ RESULT_CODE ProtocolHandlerImpl::SendSingleFrameMessage( const uint8_t* data, const bool needs_encryption, const bool is_final_message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); - LOG4CXX_DEBUG( - logger_, - "Packet needs encryption: " << std::boolalpha << needs_encryption); + SDL_LOG_DEBUG("Packet needs encryption: " << std::boolalpha + << needs_encryption); ProtocolFramePtr ptr( new protocol_handler::ProtocolPacket(connection_id, @@ -1343,11 +1308,10 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage( const size_t max_frame_size, const bool needs_encryption, const bool is_final_message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); - LOG4CXX_DEBUG( - logger_, - " data size " << data_size << " max_frame_size " << max_frame_size); + SDL_LOG_DEBUG(" data size " << data_size << " max_frame_size " + << max_frame_size); // remainder of last frame const size_t lastframe_remainder = data_size % max_frame_size; @@ -1359,8 +1323,7 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage( // add last frame if not empty (lastframe_remainder > 0 ? 1 : 0); - LOG4CXX_DEBUG(logger_, - "Data " << data_size << " bytes in " << frames_count + SDL_LOG_DEBUG("Data " << data_size << " bytes in " << frames_count << " frames with last frame size " << lastframe_size); DCHECK(max_frame_size >= FIRST_FRAME_DATA_SIZE); @@ -1393,7 +1356,7 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage( raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(firstPacket, false)); - LOG4CXX_DEBUG(logger_, "First frame is sent."); + SDL_LOG_DEBUG("First frame is sent."); for (uint32_t i = 0; i < frames_count; ++i) { const bool is_last_frame = (i == (frames_count - 1)); @@ -1417,27 +1380,27 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage( raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, is_final_packet)); - LOG4CXX_DEBUG(logger_, '#' << i << " frame is sent."); + SDL_LOG_DEBUG('#' << i << " frame is sent."); } return RESULT_OK; } RESULT_CODE ProtocolHandlerImpl::HandleMessage(const ProtocolFramePtr packet) { DCHECK_OR_RETURN(packet, RESULT_UNKNOWN); - LOG4CXX_DEBUG(logger_, "Handling message " << packet); + SDL_LOG_DEBUG("Handling message " << packet); switch (packet->frame_type()) { case FRAME_TYPE_CONTROL: - LOG4CXX_TRACE(logger_, "FRAME_TYPE_CONTROL"); + SDL_LOG_TRACE("FRAME_TYPE_CONTROL"); return HandleControlMessage(packet); case FRAME_TYPE_SINGLE: - LOG4CXX_TRACE(logger_, "FRAME_TYPE_SINGLE"); + SDL_LOG_TRACE("FRAME_TYPE_SINGLE"); return HandleSingleFrameMessage(packet); case FRAME_TYPE_FIRST: case FRAME_TYPE_CONSECUTIVE: - LOG4CXX_TRACE(logger_, "FRAME_TYPE_FIRST or FRAME_TYPE_CONSECUTIVE"); + SDL_LOG_TRACE("FRAME_TYPE_FIRST or FRAME_TYPE_CONSECUTIVE"); return HandleMultiFrameMessage(packet); default: { - LOG4CXX_WARN(logger_, "Unknown frame type" << packet->frame_type()); + SDL_LOG_WARN("Unknown frame type" << packet->frame_type()); return RESULT_FAIL; } } @@ -1446,13 +1409,13 @@ RESULT_CODE ProtocolHandlerImpl::HandleMessage(const ProtocolFramePtr packet) { RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage( const ProtocolFramePtr packet) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); + + SDL_LOG_DEBUG( - LOG4CXX_DEBUG( - logger_, "FRAME_TYPE_SINGLE message of size " - << packet->data_size() << "; message " - << ConvertPacketDataToString(packet->data(), packet->data_size())); + << packet->data_size() << "; message " + << ConvertPacketDataToString(packet->data(), packet->data_size())); // Replace a potential secondary transport ID in the packet with the primary // transport ID @@ -1491,7 +1454,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage( RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage( const ProtocolFramePtr packet) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Replace a potential secondary transport ID in the packet with the primary // transport ID @@ -1502,7 +1465,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage( } if (multiframe_builder_.AddFrame(packet) != RESULT_OK) { - LOG4CXX_WARN(logger_, "Frame assembling issue"); + SDL_LOG_WARN("Frame assembling issue"); } return RESULT_OK; @@ -1510,42 +1473,41 @@ RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage( RESULT_CODE ProtocolHandlerImpl::HandleControlMessage( const ProtocolFramePtr packet) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO{ALeshin}: Rename "Session" to "Service" on PH, CH, AM levels switch (packet->frame_data()) { case FRAME_DATA_START_SERVICE: { - LOG4CXX_TRACE(logger_, "FrameData: StartService"); + SDL_LOG_TRACE("FrameData: StartService"); return HandleControlMessageStartSession(packet); } case FRAME_DATA_END_SERVICE: { - LOG4CXX_TRACE(logger_, "FrameData: StopService"); + SDL_LOG_TRACE("FrameData: StopService"); return HandleControlMessageEndSession(*packet); } case FRAME_DATA_END_SERVICE_ACK: { - LOG4CXX_TRACE(logger_, "FrameData: StopService ACK"); + SDL_LOG_TRACE("FrameData: StopService ACK"); return HandleControlMessageEndServiceACK(*packet); } case FRAME_DATA_HEART_BEAT: { - LOG4CXX_TRACE(logger_, "FrameData: Heartbeat"); + SDL_LOG_TRACE("FrameData: Heartbeat"); return HandleControlMessageHeartBeat(*packet); } case FRAME_DATA_HEART_BEAT_ACK: { - LOG4CXX_TRACE(logger_, "FrameData Heartbeat ACK"); - LOG4CXX_DEBUG(logger_, - "Received Heartbeat ACK from mobile," - " connection: " - << packet->connection_id()); + SDL_LOG_TRACE("FrameData Heartbeat ACK"); + SDL_LOG_DEBUG( + "Received Heartbeat ACK from mobile," + " connection: " + << packet->connection_id()); return RESULT_OK; } case FRAME_DATA_REGISTER_SECONDARY_TRANSPORT: { - LOG4CXX_TRACE(logger_, "FrameData: RegisterSecondaryTransport"); + SDL_LOG_TRACE("FrameData: RegisterSecondaryTransport"); return HandleControlMessageRegisterSecondaryTransport(packet); } default: - LOG4CXX_WARN(logger_, - "Control message of type " - << static_cast<int>(packet->frame_data()) << " ignored"); + SDL_LOG_WARN("Control message of type " + << static_cast<int>(packet->frame_data()) << " ignored"); return RESULT_OK; } return RESULT_OK; @@ -1553,12 +1515,11 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessage( uint32_t get_hash_id(const ProtocolPacket& packet) { if (packet.protocol_version() < PROTOCOL_VERSION_2) { - LOG4CXX_DEBUG(logger_, - "Packet without hash data (protocol version less 2)"); + SDL_LOG_DEBUG("Packet without hash data (protocol version less 2)"); return HASH_ID_NOT_SUPPORTED; } if (packet.data_size() < 4) { - LOG4CXX_WARN(logger_, "Packet without hash data (data size less 4)"); + SDL_LOG_WARN("Packet without hash data (data size less 4)"); return HASH_ID_WRONG; } if (packet.protocol_version() >= PROTOCOL_VERSION_5) { @@ -1571,7 +1532,7 @@ uint32_t get_hash_id(const ProtocolPacket& packet) { bson_object_deinitialize(&obj); return hash_id; } else { - LOG4CXX_WARN(logger_, "Failed to parse BSON field for hash ID"); + SDL_LOG_WARN("Failed to parse BSON field for hash ID"); return HASH_ID_WRONG; } } else { @@ -1585,7 +1546,7 @@ uint32_t get_hash_id(const ProtocolPacket& packet) { RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession( const ProtocolPacket& packet) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint8_t current_session_id = packet.session_id(); uint32_t hash_id = get_hash_id(packet); @@ -1603,8 +1564,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession( service_type); message_counters_.erase(current_session_id); } else { - LOG4CXX_WARN(logger_, - "Refused to end session " << static_cast<int>(service_type) + SDL_LOG_WARN("Refused to end session " << static_cast<int>(service_type) << " type."); if (packet.protocol_version() >= PROTOCOL_VERSION_5) { std::vector<std::string> rejectedParams; @@ -1632,7 +1592,7 @@ const ServiceStatus ProtocolHandlerImpl::ServiceDisallowedBySettings( const ConnectionID connection_id, const uint8_t session_id, const bool protection) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string& transport = session_observer_.TransportTypeProfileStringFromConnHandle(connection_id); @@ -1682,7 +1642,7 @@ const ServiceStatus ProtocolHandlerImpl::ServiceDisallowedBySettings( RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK( const ProtocolPacket& packet) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint8_t current_session_id = packet.session_id(); uint32_t hash_id = get_hash_id(packet); @@ -1693,7 +1653,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK( connection_id, current_session_id, &hash_id, service_type); if (0 == session_key) { - LOG4CXX_WARN(logger_, "Refused to end service"); + SDL_LOG_WARN("Refused to end service"); return RESULT_FAIL; } @@ -1702,9 +1662,9 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK( RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( const ProtocolFramePtr packet) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG( + "Protocol version:" << static_cast<int>(packet->protocol_version())); const ServiceType service_type = ServiceTypeFromByte(packet->service_type()); @@ -1730,9 +1690,8 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( service_type, connection_id, session_id, protection); if (ServiceStatus::INVALID_ENUM != settings_check) { - LOG4CXX_DEBUG(logger_, - "Rejecting StartService for service:" - << service_type << ", disallowed by settings."); + SDL_LOG_DEBUG("Rejecting StartService for service:" + << service_type << ", disallowed by settings."); service_status_update_handler_->OnServiceUpdate( connection_key, service_type, settings_check); SendStartSessionNAck( @@ -1740,8 +1699,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( return RESULT_OK; } - LOG4CXX_INFO(logger_, - "StartSession ID " << static_cast<int>(session_id) + SDL_LOG_INFO("StartSession ID " << static_cast<int>(session_id) << " and Connection ID " << static_cast<int>(connection_id)); @@ -1756,8 +1714,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( size_t bson_obj_size = bson_object_from_bytes_len( &bson_obj, packet->data(), packet->total_data_bytes()); if (bson_obj_size == 0) { - LOG4CXX_WARN(logger_, - "Failed to parse BSON field of start service packet"); + SDL_LOG_WARN("Failed to parse BSON field of start service packet"); bson_object_initialize_default(&bson_obj); } } else { @@ -1773,15 +1730,14 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( RESULT_CODE ProtocolHandlerImpl::HandleControlMessageRegisterSecondaryTransport( const ProtocolFramePtr packet) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const uint8_t session_id = packet->session_id(); const ConnectionID connection_id = packet->connection_id(); ConnectionID primary_connection_id = 0; - LOG4CXX_INFO(logger_, - "RegisterSecondaryTransport ID " - << static_cast<int>(session_id) << " and Connection ID " - << static_cast<int>(connection_id)); + SDL_LOG_INFO("RegisterSecondaryTransport ID " + << static_cast<int>(session_id) << " and Connection ID " + << static_cast<int>(connection_id)); if (connection_handler_.OnSecondaryTransportStarted( primary_connection_id, connection_id, session_id)) { @@ -1817,7 +1773,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageRegisterSecondaryTransport( void ProtocolHandlerImpl::NotifySessionStarted( const SessionContext& context, std::vector<std::string>& rejected_params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ProtocolFramePtr packet; { @@ -1825,7 +1781,7 @@ void ProtocolHandlerImpl::NotifySessionStarted( StartSessionFrameMap::iterator it = start_session_frame_map_.find( std::make_pair(context.connection_id_, context.initial_session_id_)); if (it == start_session_frame_map_.end()) { - LOG4CXX_ERROR(logger_, "Cannot find Session Started packet"); + SDL_LOG_ERROR("Cannot find Session Started packet"); return; } packet = it->second; @@ -1836,9 +1792,8 @@ void ProtocolHandlerImpl::NotifySessionStarted( const uint8_t protocol_version = packet->protocol_version(); if (0 == context.new_session_id_) { - LOG4CXX_WARN(logger_, - "Refused by session_observer to create service " - << static_cast<int32_t>(service_type) << " type."); + SDL_LOG_WARN("Refused by session_observer to create service " + << static_cast<int32_t>(service_type) << " type."); const auto session_id = packet->session_id(); const auto connection_key = session_observer_.KeyFromPair(context.connection_id_, session_id); @@ -1896,8 +1851,7 @@ void ProtocolHandlerImpl::NotifySessionStarted( } bson_object_deinitialize(&req_param); } else { - LOG4CXX_WARN(logger_, - "Failed to parse BSON field of start service (video)"); + SDL_LOG_WARN("Failed to parse BSON field of start service (video)"); } } @@ -1921,8 +1875,7 @@ void ProtocolHandlerImpl::NotifySessionStarted( } bson_object_deinitialize(&request_params); } else { - LOG4CXX_WARN(logger_, - "Failed to parse start service packet for version string"); + SDL_LOG_WARN("Failed to parse start service packet for version string"); fullVersion = std::make_shared<utils::SemanticVersion>(); } } else { @@ -1952,7 +1905,7 @@ void ProtocolHandlerImpl::NotifySessionStarted( kUseExisting); if (!ssl_context) { const std::string error("CreateSSLContext failed"); - LOG4CXX_ERROR(logger_, error); + SDL_LOG_ERROR(error); security_manager_->SendInternalError( connection_key, security_manager::SecurityManager::ERROR_INTERNAL, @@ -1987,8 +1940,7 @@ void ProtocolHandlerImpl::NotifySessionStarted( *fullVersion, *start_session_ack_params); } else { - LOG4CXX_DEBUG(logger_, - "Adding Handshake handler to listeners: " << handler.get()); + SDL_LOG_DEBUG("Adding Handshake handler to listeners: " << handler.get()); security_manager::SecurityManagerListener* listener = new HandshakeHandler(*handler); security_manager_->AddListener(listener); @@ -2008,9 +1960,8 @@ void ProtocolHandlerImpl::NotifySessionStarted( } } - LOG4CXX_DEBUG(logger_, - "Protection establishing for connection " - << connection_key << " is in progress"); + SDL_LOG_DEBUG("Protection establishing for connection " + << connection_key << " is in progress"); return; } #endif // ENABLE_SECURITY @@ -2043,8 +1994,8 @@ void ProtocolHandlerImpl::NotifySessionStarted( RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat( const ProtocolPacket& packet) { const ConnectionID connection_id = packet.connection_id(); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Sending heart beat acknowledgment for connection " << connection_id); uint8_t protocol_version; if (session_observer_.ProtocolVersionUsed( @@ -2055,20 +2006,19 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat( return SendHeartBeatAck( connection_id, packet.session_id(), packet.message_id()); } else { - LOG4CXX_WARN(logger_, "HeartBeat is not supported"); + SDL_LOG_WARN("HeartBeat is not supported"); return RESULT_HEARTBEAT_IS_NOT_SUPPORTED; } } else { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "SendHeartBeatAck is failed connection or session does not exist"); return RESULT_FAIL; } } void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const ProtocolFramePtrList& frame_list = multiframe_builder_.PopMultiframes(); for (ProtocolFramePtrList::const_iterator it = frame_list.begin(); it != frame_list.end(); @@ -2081,9 +2031,8 @@ void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() { const uint32_t connection_key = session_observer_.KeyFromPair( frame->connection_id(), frame->session_id()); - LOG4CXX_DEBUG( - logger_, - "Result frame" << frame << "for connection " << connection_key); + SDL_LOG_DEBUG("Result frame" << frame << "for connection " + << connection_key); const RawMessagePtr rawMessage(new RawMessage(connection_key, frame->protocol_version(), frame->data(), @@ -2105,18 +2054,16 @@ void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() { } bool ProtocolHandlerImpl::TrackMessage(const uint32_t& connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const size_t& frequency_time = get_settings().message_frequency_time(); const size_t& frequency_count = get_settings().message_frequency_count(); if (frequency_time > 0u && frequency_count > 0u) { const size_t message_frequency = message_meter_.TrackMessage(connection_key); - LOG4CXX_DEBUG( - logger_, - "Frequency of " << connection_key << " is " << message_frequency); + SDL_LOG_DEBUG("Frequency of " << connection_key << " is " + << message_frequency); if (message_frequency > frequency_count) { - LOG4CXX_WARN(logger_, - "Frequency of " << connection_key << " is marked as high."); + SDL_LOG_WARN("Frequency of " << connection_key << " is marked as high."); session_observer_.OnApplicationFloodCallBack(connection_key); message_meter_.RemoveIdentifier(connection_key); return true; @@ -2129,18 +2076,17 @@ bool ProtocolHandlerImpl::TrackMalformedMessage(const uint32_t& connection_key, const size_t count) { const size_t& malformed_frequency_count = get_settings().malformed_frequency_count(); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (get_settings().malformed_frequency_time() > 0u && malformed_frequency_count > 0u) { const size_t malformed_message_frequency = malformed_message_meter_.TrackMessages(connection_key, count); - LOG4CXX_DEBUG(logger_, - "Malformed frequency of " << connection_key << " is " + SDL_LOG_DEBUG("Malformed frequency of " << connection_key << " is " << malformed_message_frequency); if (!get_settings().malformed_message_filtering() || malformed_message_frequency > malformed_frequency_count) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Malformed frequency of " << connection_key << " is marked as high."); session_observer_.OnMalformedMessageCallback(connection_key); malformed_message_meter_.RemoveIdentifier(connection_key); @@ -2151,7 +2097,7 @@ bool ProtocolHandlerImpl::TrackMalformedMessage(const uint32_t& connection_key, } void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); switch (message->service_type()) { case kMobileNav: @@ -2165,7 +2111,7 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) { } } break; } - LOG4CXX_DEBUG(logger_, "Message : " << message.get()); + SDL_LOG_DEBUG("Message : " << message.get()); const uint8_t c_id = message->connection_id(); const uint32_t m_id = message->session_id(); @@ -2177,25 +2123,23 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) { if (((0 != message->data()) && (0 != message->data_size())) || FRAME_TYPE_CONTROL == message->frame_type() || FRAME_TYPE_FIRST == message->frame_type()) { - LOG4CXX_DEBUG(logger_, "Packet: dataSize " << message->data_size()); + SDL_LOG_DEBUG("Packet: dataSize " << message->data_size()); HandleMessage(message); PopValideAndExpirateMultiframes(); } else { - LOG4CXX_WARN(logger_, - "handleMessagesFromMobileApp() - incorrect or NULL data"); + SDL_LOG_WARN("handleMessagesFromMobileApp() - incorrect or NULL data"); } } void ProtocolHandlerImpl::Handle(const impl::RawFordMessageToMobile message) { - LOG4CXX_DEBUG(logger_, - "Message to mobile app: connection id " - << static_cast<int>(message->connection_id()) - << ";" - " dataSize: " - << message->data_size() - << " ;" - " protocolVersion " - << static_cast<int>(message->protocol_version())); + SDL_LOG_DEBUG("Message to mobile app: connection id " + << static_cast<int>(message->connection_id()) + << ";" + " dataSize: " + << message->data_size() + << " ;" + " protocolVersion " + << static_cast<int>(message->protocol_version())); if (message.is_final) { sessions_last_message_id_.insert(std::pair<uint8_t, uint32_t>( @@ -2222,7 +2166,7 @@ void ProtocolHandlerImpl::set_service_status_update_handler( void ProtocolHandlerImpl::set_security_manager( security_manager::SecurityManager* security_manager) { if (!security_manager) { - LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to SecurityManager."); + SDL_LOG_ERROR("Invalid (NULL) pointer to SecurityManager."); return; } security_manager_ = security_manager; @@ -2238,7 +2182,7 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) { return RESULT_OK; } if (!security_manager_) { - LOG4CXX_WARN(logger_, "No security_manager_ set."); + SDL_LOG_WARN("No security_manager_ set."); return RESULT_FAIL; } const uint32_t connection_key = session_observer_.KeyFromPair( @@ -2246,11 +2190,11 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) { security_manager::SSLContext* context = session_observer_.GetSSLContext( connection_key, ServiceTypeFromByte(packet->service_type())); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Protection flag is: " << packet->protection_flag() << std::boolalpha); if ((!context || !context->IsInitCompleted()) || !packet->protection_flag()) { - LOG4CXX_DEBUG(logger_, "Ecryption is skipped!"); + SDL_LOG_DEBUG("Ecryption is skipped!"); return RESULT_OK; } const uint8_t* out_data; @@ -2258,7 +2202,7 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) { if (!context->Encrypt( packet->data(), packet->data_size(), &out_data, &out_data_size)) { const std::string error_text(context->LastError()); - LOG4CXX_ERROR(logger_, "Enryption failed: " << error_text); + SDL_LOG_ERROR("Enryption failed: " << error_text); security_manager_->SendInternalError( connection_key, security_manager::SecurityManager::ERROR_ENCRYPTION_FAILED, @@ -2270,8 +2214,7 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) { packet->connection_id(), packet->session_id(), &hash_id, kRpc); return RESULT_OK; } - LOG4CXX_DEBUG(logger_, - "Encrypted " << packet->data_size() << " bytes to " + SDL_LOG_DEBUG("Encrypted " << packet->data_size() << " bytes to " << out_data_size << " bytes"); DCHECK(out_data); DCHECK(out_data_size); @@ -2302,12 +2245,12 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { } if (shoud_not_decrypt) { - LOG4CXX_DEBUG(logger_, "Frame will not be decrypted"); + SDL_LOG_DEBUG("Frame will not be decrypted"); return RESULT_OK; } if (!security_manager_) { - LOG4CXX_WARN(logger_, "No security_manager_ set."); + SDL_LOG_WARN("No security_manager_ set."); return RESULT_FAIL; } const uint32_t connection_key = session_observer_.KeyFromPair( @@ -2316,8 +2259,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { connection_key, ServiceTypeFromByte(packet->service_type())); if (!context || !context->IsInitCompleted()) { const std::string error_text("Fail decryption for unprotected service "); - LOG4CXX_ERROR(logger_, - error_text << static_cast<int>(packet->service_type())); + SDL_LOG_ERROR(error_text << static_cast<int>(packet->service_type())); security_manager_->SendInternalError( connection_key, security_manager::SecurityManager::ERROR_SERVICE_NOT_PROTECTED, @@ -2329,7 +2271,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { if (!context->Decrypt( packet->data(), packet->data_size(), &out_data, &out_data_size)) { const std::string error_text(context->LastError()); - LOG4CXX_ERROR(logger_, "Decryption failed: " << error_text); + SDL_LOG_ERROR("Decryption failed: " << error_text); security_manager_->SendInternalError( connection_key, security_manager::SecurityManager::ERROR_DECRYPTION_FAILED, @@ -2341,8 +2283,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { packet->connection_id(), packet->session_id(), &hash_id, kRpc); return RESULT_ENCRYPTION_FAILED; } - LOG4CXX_DEBUG(logger_, - "Decrypted " << packet->data_size() << " bytes to " + SDL_LOG_DEBUG("Decrypted " << packet->data_size() << " bytes to " << out_data_size << " bytes"); DCHECK(out_data); DCHECK(out_data_size); @@ -2358,8 +2299,8 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { void ProtocolHandlerImpl::SendFramesNumber(uint32_t connection_key, int32_t number_of_frames) { - LOG4CXX_DEBUG( - logger_, "SendFramesNumber MobileNaviAck for session " << connection_key); + SDL_LOG_DEBUG("SendFramesNumber MobileNaviAck for session " + << connection_key); transport_manager::ConnectionUID connection_id = 0; uint8_t session_id = 0; @@ -2387,11 +2328,10 @@ void ProtocolHandlerImpl::SendFramesNumber(uint32_t connection_key, sizeof(number_of_frames)); raw_ford_messages_to_mobile_.PostMessage( impl::RawFordMessageToMobile(ptr, false)); - LOG4CXX_DEBUG(logger_, "SendFramesNumber finished successfully"); + SDL_LOG_DEBUG("SendFramesNumber finished successfully"); } } else { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "SendFramesNumber is failed connection or session does not exist"); } } @@ -2421,7 +2361,7 @@ std::string ConvertPacketDataToString(const uint8_t* data, } uint8_t ProtocolHandlerImpl::SupportedSDLProtocolVersion() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return get_settings().max_supported_protocol_version(); } @@ -2464,7 +2404,7 @@ ProtocolHandlerImpl::GetTransportTypeFromConnectionType( if (it != transportTypes.end()) { result = it->second; } else { - LOG4CXX_ERROR(logger_, "Unknown connection type " << connection_type); + SDL_LOG_ERROR("Unknown connection type " << connection_type); } return result; @@ -2475,7 +2415,7 @@ const bool ProtocolHandlerImpl::ParseSecondaryTransportConfiguration( std::vector<std::string>& secondaryTransports, std::vector<int32_t>& audioServiceTransports, std::vector<int32_t>& videoServiceTransports) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<std::string> secondary_transport_types; // First discover what the connection type of the primary transport is @@ -2493,8 +2433,8 @@ const bool ProtocolHandlerImpl::ParseSecondaryTransportConfiguration( } else if (td.transport_type_ == impl::TransportType::TT_WIFI) { secondary_transport_types = settings_.secondary_transports_for_wifi(); } else { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Bad or unknown device type in ParseSecondaryTransportConfiguration"); return false; } @@ -2535,7 +2475,7 @@ void ProtocolHandlerImpl::GenerateSecondaryTransportsForStartSessionAck( bool device_is_ios, bool device_is_android, std::vector<std::string>& secondaryTransports) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Parse the "secondary_transport_types" vector (which comes from // smartDeviceLink.ini). For each entry in the vector, add an @@ -2546,34 +2486,31 @@ void ProtocolHandlerImpl::GenerateSecondaryTransportsForStartSessionAck( const utils::custom_string::CustomString transport_type(*it); if (transport_type.CompareIgnoreCase("USB")) { if (device_is_ios) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( "Adding IAP_USB to secondaryTransports for StartSessionAck"); secondaryTransports.push_back("IAP_USB"); } if (device_is_android) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( "Adding AOA_USB to secondaryTransports for StartSessionAck"); secondaryTransports.push_back("AOA_USB"); } } else if (transport_type.CompareIgnoreCase("Bluetooth")) { if (device_is_ios) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "Adding IAP_BLUETOOTH to secondaryTransports for StartSessionAck"); secondaryTransports.push_back("IAP_BLUETOOTH"); } if (device_is_android) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "Adding SPP_BLUETOOTH to secondaryTransports for StartSessionAck"); secondaryTransports.push_back("SPP_BLUETOOTH"); } } if (transport_type.CompareIgnoreCase("WiFi")) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( "Adding TCP_WIFI to secondaryTransports for StartSessionAck"); secondaryTransports.push_back("TCP_WIFI"); } @@ -2589,13 +2526,13 @@ void ProtocolHandlerImpl::GenerateServiceTransportsForStartSessionAck( const impl::TransportType primary_transport_type, const std::vector<std::string>& secondary_transport_types, std::vector<int32_t>& serviceTransports) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (service_transports.size() == 0) { if (secondary_enabled && !secondary_transport_types.empty()) { - LOG4CXX_TRACE(logger_, - "Empty Service Transports. Allowing service to run on both " - "connections"); + SDL_LOG_TRACE( + "Empty Service Transports. Allowing service to run on both " + "connections"); serviceTransports.push_back(1); serviceTransports.push_back(2); } else { @@ -2607,15 +2544,15 @@ void ProtocolHandlerImpl::GenerateServiceTransportsForStartSessionAck( std::vector<std::string>::const_iterator it = service_transports.begin(); for (; it != service_transports.end(); it++) { const utils::custom_string::CustomString transport(*it); - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "Service Allowed to run on " << transport.c_str() << " transport"); if (!fPrimaryAdded && (transport.CompareIgnoreCase(primary_connection_type.c_str()) || (transport.CompareIgnoreCase("IAP_USB") && primary_transport_type == impl::TransportType::TT_USB))) { - LOG4CXX_TRACE(logger_, "Service allowed on primary transport"); + SDL_LOG_TRACE("Service allowed on primary transport"); serviceTransports.push_back(1); fPrimaryAdded = true; } @@ -2631,7 +2568,7 @@ void ProtocolHandlerImpl::GenerateServiceTransportsForStartSessionAck( secondary_transport_type.c_str()); }); if (found != secondary_transport_types.end()) { - LOG4CXX_TRACE(logger_, "Service allowed on secondary transport"); + SDL_LOG_TRACE("Service allowed on secondary transport"); serviceTransports.push_back(2); fSecondaryAdded = true; } diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc index 5bee1c16b2..bd052c8660 100644 --- a/src/components/protocol_handler/src/protocol_packet.cc +++ b/src/components/protocol_handler/src/protocol_packet.cc @@ -46,7 +46,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") +SDL_CREATE_LOG_VARIABLE("ProtocolHandler") namespace { std::string StringifyFrameType(uint8_t type) { @@ -64,7 +64,7 @@ std::string StringifyFrameType(uint8_t type) { return "FRAME_TYPE_FIRST"; default: - LOG4CXX_ERROR(logger_, "Unknown frame type:" << static_cast<int>(type)); + SDL_LOG_ERROR("Unknown frame type:" << static_cast<int>(type)); break; } @@ -117,11 +117,10 @@ inline uint32_t read_be_uint32(const uint8_t* const data) { void ProtocolPacket::ProtocolHeader::deserialize(const uint8_t* message, const size_t messageSize) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(message); if (messageSize < PROTOCOL_HEADER_V1_SIZE) { - LOG4CXX_DEBUG(logger_, - "Message size less " << PROTOCOL_HEADER_V1_SIZE << " bytes"); + SDL_LOG_DEBUG("Message size less " << PROTOCOL_HEADER_V1_SIZE << " bytes"); return; } // first 4 bits @@ -143,15 +142,14 @@ void ProtocolPacket::ProtocolHeader::deserialize(const uint8_t* message, case PROTOCOL_VERSION_4: case PROTOCOL_VERSION_5: { if (messageSize < PROTOCOL_HEADER_V2_SIZE) { - LOG4CXX_DEBUG( - logger_, - "Message size less " << PROTOCOL_HEADER_V2_SIZE << " bytes"); + SDL_LOG_DEBUG("Message size less " << PROTOCOL_HEADER_V2_SIZE + << " bytes"); return; } messageId = read_be_uint32(message + 8); } break; default: - LOG4CXX_WARN(logger_, "Unknown version:" << static_cast<int>(version)); + SDL_LOG_WARN("Unknown version:" << static_cast<int>(version)); messageId = 0; break; } @@ -167,44 +165,39 @@ ProtocolPacket::ProtocolHeaderValidator::ProtocolHeaderValidator() void ProtocolPacket::ProtocolHeaderValidator::set_max_payload_size( const size_t max_payload_size) { - LOG4CXX_DEBUG(logger_, "New maximum payload size is " << max_payload_size); + SDL_LOG_DEBUG("New maximum payload size is " << max_payload_size); max_payload_size_ = max_payload_size; } void ProtocolPacket::ProtocolHeaderValidator::set_max_control_payload_size( const size_t max_payload_size) { - LOG4CXX_DEBUG(logger_, - "New maximum Control payload size is " << max_payload_size); + SDL_LOG_DEBUG("New maximum Control payload size is " << max_payload_size); max_control_payload_size_ = max_payload_size; } void ProtocolPacket::ProtocolHeaderValidator::set_max_rpc_payload_size( const size_t max_payload_size) { - LOG4CXX_DEBUG(logger_, - "New maximum RPC payload size is " << max_payload_size); + SDL_LOG_DEBUG("New maximum RPC payload size is " << max_payload_size); max_rpc_payload_size_ = max_payload_size; } void ProtocolPacket::ProtocolHeaderValidator::set_max_audio_payload_size( const size_t max_payload_size) { - LOG4CXX_DEBUG(logger_, - "New maximum audio payload size is " << max_payload_size); + SDL_LOG_DEBUG("New maximum audio payload size is " << max_payload_size); max_audio_payload_size_ = max_payload_size; } void ProtocolPacket::ProtocolHeaderValidator::set_max_video_payload_size( const size_t max_payload_size) { - LOG4CXX_DEBUG(logger_, - "New maximum video payload size is " << max_payload_size); + SDL_LOG_DEBUG("New maximum video payload size is " << max_payload_size); max_video_payload_size_ = max_payload_size; } void ProtocolPacket::ProtocolHeaderValidator:: set_max_protocol_version_supported( const uint16_t max_protocol_version_supported) { - LOG4CXX_DEBUG(logger_, - "New maximum protocol version supported is " - << max_protocol_version_supported); + SDL_LOG_DEBUG("New maximum protocol version supported is " + << max_protocol_version_supported); max_protocol_version_supported_ = max_protocol_version_supported; } @@ -262,14 +255,14 @@ ProtocolPacket::ProtocolHeaderValidator::max_payload_size_by_service_type( : max_video_payload_size_; break; case kInvalidServiceType: - LOG4CXX_WARN(logger_, "Invalid service type: " << static_cast<int>(type)); + SDL_LOG_WARN("Invalid service type: " << static_cast<int>(type)); } return payload_size; } RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( const ProtocolHeader& header) const { - LOG4CXX_DEBUG(logger_, "Validating header - " << header); + SDL_LOG_DEBUG("Validating header - " << header); // expected payload size will be calculated depending // on used protocol version and service type size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE; @@ -290,17 +283,15 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( ServiceTypeFromByte(header.serviceType)); break; default: - LOG4CXX_WARN(logger_, - "Unknown version:" << static_cast<int>(header.version)); + SDL_LOG_WARN("Unknown version:" << static_cast<int>(header.version)); return RESULT_FAIL; } // ServiceType shall be equal 0x0 (Control), 0x07 (RPC), 0x0A (PCM), 0x0B // (Video), 0x0F (Bulk) if (ServiceTypeFromByte(header.serviceType) == kInvalidServiceType) { - LOG4CXX_WARN( - logger_, - "Invalide service type" << static_cast<int>(header.serviceType)); + SDL_LOG_WARN("Invalide service type" + << static_cast<int>(header.serviceType)); return RESULT_FAIL; } // Check frame info for each frame type @@ -327,26 +318,23 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( case FRAME_DATA_HEART_BEAT_ACK: break; default: - LOG4CXX_WARN(logger_, - "FRAME_TYPE_CONTROL - Invalide frame data " - << static_cast<int>(header.frameData)); + SDL_LOG_WARN("FRAME_TYPE_CONTROL - Invalide frame data " + << static_cast<int>(header.frameData)); return RESULT_FAIL; } break; } case FRAME_TYPE_SINGLE: if (header.frameData != FRAME_DATA_SINGLE) { - LOG4CXX_WARN(logger_, - "FRAME_TYPE_SINGLE - Invalide frame data " - << static_cast<int>(header.frameData)); + SDL_LOG_WARN("FRAME_TYPE_SINGLE - Invalide frame data " + << static_cast<int>(header.frameData)); return RESULT_FAIL; } break; case FRAME_TYPE_FIRST: if (header.frameData != FRAME_DATA_FIRST) { - LOG4CXX_WARN(logger_, - "FRAME_TYPE_FIRST - Invalide frame data " - << static_cast<int>(header.frameData)); + SDL_LOG_WARN("FRAME_TYPE_FIRST - Invalide frame data " + << static_cast<int>(header.frameData)); return RESULT_FAIL; } break; @@ -354,8 +342,7 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( // Could have any FrameInfo value break; default: - LOG4CXX_WARN(logger_, - "Unknown frame type " << static_cast<int>(header.frameType)); + SDL_LOG_WARN("Unknown frame type " << static_cast<int>(header.frameType)); // All other Frame type is invalid return RESULT_FAIL; } @@ -372,29 +359,27 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( if (header.dataSize > payload_size || (FRAME_TYPE_CONTROL != header.frameType && header.dataSize == 0u)) { UNUSED(StringifyFrameType); - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Packet data size of " - << StringifyFrameType(header.frameType) - << " frame must be in range (0, payload_size=" << payload_size - << "], but actual value is " << header.dataSize); + << StringifyFrameType(header.frameType) + << " frame must be in range (0, payload_size=" << payload_size + << "], but actual value is " << header.dataSize); return RESULT_FAIL; } } break; case FRAME_TYPE_FIRST: if (FIRST_FRAME_DATA_SIZE != header.dataSize) { - LOG4CXX_WARN(logger_, - "Packet data size of FRAME_TYPE_FIRST frame must equal " - << static_cast<int>(FIRST_FRAME_DATA_SIZE) - << ", but actual value is " << header.dataSize); + SDL_LOG_WARN("Packet data size of FRAME_TYPE_FIRST frame must equal " + << static_cast<int>(FIRST_FRAME_DATA_SIZE) + << ", but actual value is " << header.dataSize); return RESULT_FAIL; } break; default: - LOG4CXX_WARN(logger_, - "Unknown frame type " << static_cast<int>(header.frameType)); + SDL_LOG_WARN("Unknown frame type " << static_cast<int>(header.frameType)); return RESULT_FAIL; } // Message ID be equal or greater than 0x01 (not actual for 1 protocol version @@ -402,11 +387,11 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( if (header.messageId <= 0) { if (FRAME_TYPE_CONTROL != header.frameType && PROTOCOL_VERSION_1 != header.version) { - LOG4CXX_WARN(logger_, "Message ID shall be greater than 0x00"); + SDL_LOG_WARN("Message ID shall be greater than 0x00"); return RESULT_FAIL; } } - LOG4CXX_DEBUG(logger_, "Message header is completely correct."); + SDL_LOG_DEBUG("Message header is completely correct."); return RESULT_OK; } @@ -444,7 +429,7 @@ ProtocolPacket::ProtocolPacket(ConnectionID connection_id) // Serialization RawMessagePtr ProtocolPacket::serializePacket() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // TODO(EZamakhov): Move header serialization to ProtocolHeader // version is low byte const uint8_t version_byte = packet_header_.version << 4; @@ -541,7 +526,7 @@ bool ProtocolPacket::operator==(const ProtocolPacket& other) const { } void ProtocolPacket::HandleRawFirstFrameData(const uint8_t* message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); payload_size_ = 0; const uint8_t* data = message; uint32_t total_data_bytes = data[0] << 24; @@ -553,7 +538,7 @@ void ProtocolPacket::HandleRawFirstFrameData(const uint8_t* message) { RESULT_CODE ProtocolPacket::deserializePacket(const uint8_t* message, const size_t messageSize) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN(message, RESULT_FAIL); packet_header_.deserialize(message, messageSize); const uint8_t offset = packet_header_.version == PROTOCOL_VERSION_1 @@ -630,8 +615,8 @@ uint8_t* ProtocolPacket::data() const { } void ProtocolPacket::set_total_data_bytes(size_t dataBytes) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Data bytes : " << dataBytes); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Data bytes : " << dataBytes); if (dataBytes) { delete[] packet_data_.data; packet_data_.data = new (std::nothrow) uint8_t[dataBytes]; diff --git a/src/components/protocol_handler/src/service_status_update_handler.cc b/src/components/protocol_handler/src/service_status_update_handler.cc index 7b2c67ea23..71d11bcf5b 100644 --- a/src/components/protocol_handler/src/service_status_update_handler.cc +++ b/src/components/protocol_handler/src/service_status_update_handler.cc @@ -3,7 +3,7 @@ namespace protocol_handler { -CREATE_LOGGERPTR_GLOBAL(logger_, "ServiceStatusUpdateHandler") +SDL_CREATE_LOG_VARIABLE("ServiceStatusUpdateHandler") hmi_apis::Common_ServiceType::eType GetHMIServiceType( protocol_handler::ServiceType service_type) { @@ -30,7 +30,7 @@ void ServiceStatusUpdateHandler::OnServiceUpdate( using namespace hmi_apis; typedef utils::Optional<Common_ServiceStatusUpdateReason::eType> UpdateReasonOptional; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto hmi_service_type = GetHMIServiceType(service_type); switch (service_status) { @@ -107,9 +107,8 @@ void ServiceStatusUpdateHandler::OnServiceUpdate( update_reason); } default: { - LOG4CXX_WARN(logger_, - "Received unknown ServiceStatus: " - << static_cast<int32_t>(service_status)); + SDL_LOG_WARN("Received unknown ServiceStatus: " + << static_cast<int32_t>(service_status)); return; } } diff --git a/src/components/resumption/src/last_state_impl.cc b/src/components/resumption/src/last_state_impl.cc index 05c801d762..f34d793c49 100644 --- a/src/components/resumption/src/last_state_impl.cc +++ b/src/components/resumption/src/last_state_impl.cc @@ -37,23 +37,23 @@ namespace resumption { -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOG_VARIABLE("Resumption") LastStateImpl::LastStateImpl(const std::string& app_storage_folder, const std::string& app_info_storage) : app_storage_folder_(app_storage_folder) , app_info_storage_(app_info_storage) { LoadFromFileSystem(); - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } LastStateImpl::~LastStateImpl() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SaveToFileSystem(); } void LastStateImpl::SaveStateToFileSystem() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string styled_string; { @@ -64,14 +64,13 @@ void LastStateImpl::SaveStateToFileSystem() { const std::vector<uint8_t> char_vector_pdata(styled_string.begin(), styled_string.end()); DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_)); - LOG4CXX_INFO(logger_, - "LastState::SaveStateToFileSystem[DEPRECATED] " - << app_info_storage_ << styled_string); + SDL_LOG_INFO("LastState::SaveStateToFileSystem[DEPRECATED] " + << app_info_storage_ << styled_string); DCHECK(file_system::Write(app_info_storage_, char_vector_pdata)); } void LastStateImpl::SaveToFileSystem() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string styled_string; { @@ -82,8 +81,8 @@ void LastStateImpl::SaveToFileSystem() { const std::vector<uint8_t> char_vector_pdata(styled_string.begin(), styled_string.end()); DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_)); - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "LastState::SaveToFileSystem " << app_info_storage_ << styled_string); DCHECK(file_system::Write(app_info_storage_, char_vector_pdata)); } @@ -94,17 +93,16 @@ void LastStateImpl::LoadFromFileSystem() { utils::JsonReader reader; if (result && reader.parse(buffer, &dictionary_)) { - LOG4CXX_INFO(logger_, - "Valid last state was found." << dictionary_.toStyledString()); + SDL_LOG_INFO("Valid last state was found." << dictionary_.toStyledString()); return; } - LOG4CXX_WARN(logger_, "No valid last state was found."); + SDL_LOG_WARN("No valid last state was found."); } void LastStateImpl::RemoveFromFileSystem() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!file_system::DeleteFile(app_info_storage_)) { - LOG4CXX_WARN(logger_, "Failed attempt to delete " << app_info_storage_); + SDL_LOG_WARN("Failed attempt to delete " << app_info_storage_); } } diff --git a/src/components/resumption/src/last_state_wrapper_impl.cc b/src/components/resumption/src/last_state_wrapper_impl.cc index 61b325f53b..54351395c3 100644 --- a/src/components/resumption/src/last_state_wrapper_impl.cc +++ b/src/components/resumption/src/last_state_wrapper_impl.cc @@ -34,7 +34,7 @@ namespace resumption { -CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +SDL_CREATE_LOG_VARIABLE("Resumption") LastStateWrapperImpl::LastStateWrapperImpl( std::shared_ptr<LastState> last_state) @@ -42,7 +42,7 @@ LastStateWrapperImpl::LastStateWrapperImpl( , lock_(std::make_shared<sync_primitives::Lock>()) {} LastStateAccessor LastStateWrapperImpl::get_accessor() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return MutableDataAccessor<LastState>(*last_state_, lock_); } diff --git a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h index 47cc557976..ae0866705a 100644 --- a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h +++ b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h @@ -6,6 +6,8 @@ namespace security_manager { +SDL_CREATE_LOG_VARIABLE("SecurityManager") + class CryptoManagerSettingsImpl : public CryptoManagerSettings { public: CryptoManagerSettingsImpl(const profile::Profile& profile, @@ -19,8 +21,6 @@ class CryptoManagerSettingsImpl : public CryptoManagerSettings { } Protocol security_manager_protocol_name() const OVERRIDE { - CREATE_LOGGERPTR_LOCAL(logger_, "SecurityManager") - const std::string& protocol_str = profile_.security_manager_protocol_name(); if (protocol_str == "TLSv1.0") { return security_manager::TLSv1; @@ -38,8 +38,8 @@ class CryptoManagerSettingsImpl : public CryptoManagerSettings { return security_manager::DTLSv1; } - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Unknown protocol: " << profile_.security_manager_protocol_name()); return static_cast<security_manager::Protocol>(-1); } diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc index 48b3119bec..9ee820b19d 100644 --- a/src/components/security_manager/src/crypto_manager_impl.cc +++ b/src/components/security_manager/src/crypto_manager_impl.cc @@ -55,7 +55,7 @@ namespace security_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager") +SDL_CREATE_LOG_VARIABLE("SecurityManager") uint32_t CryptoManagerImpl::instance_count_ = 0; sync_primitives::Lock CryptoManagerImpl::instance_lock_; @@ -70,10 +70,9 @@ int debug_callback(int preverify_ok, X509_STORE_CTX* ctx) { // and expiration cert dates will be checked by SDL return 1; } - LOG4CXX_WARN(logger_, - "Certificate verification failed with error " - << error << " \"" << X509_verify_cert_error_string(error) - << '"'); + SDL_LOG_WARN("Certificate verification failed with error " + << error << " \"" << X509_verify_cert_error_string(error) + << '"'); } return preverify_ok; } @@ -89,11 +88,11 @@ void free_ctx(SSL_CTX** ctx) { CryptoManagerImpl::CryptoManagerImpl( const std::shared_ptr<const CryptoManagerSettings> set) : settings_(set), context_(NULL) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(instance_lock_); instance_count_++; if (instance_count_ == 1) { - LOG4CXX_DEBUG(logger_, "Openssl engine initialization"); + SDL_LOG_DEBUG("Openssl engine initialization"); SSL_load_error_strings(); ERR_load_BIO_strings(); OpenSSL_add_all_algorithms(); @@ -102,24 +101,24 @@ CryptoManagerImpl::CryptoManagerImpl( } CryptoManagerImpl::~CryptoManagerImpl() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(instance_lock_); - LOG4CXX_DEBUG(logger_, "Deinitilization"); + SDL_LOG_DEBUG("Deinitialization"); if (!context_) { - LOG4CXX_WARN(logger_, "Manager is not initialized"); + SDL_LOG_WARN("Manager is not initialized"); } else { SSL_CTX_free(context_); } instance_count_--; if (instance_count_ == 0) { - LOG4CXX_DEBUG(logger_, "Openssl engine deinitialization"); + SDL_LOG_DEBUG("Openssl engine deinitialization"); EVP_cleanup(); ERR_free_strings(); } } bool CryptoManagerImpl::AreForceProtectionSettingsCorrect() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::vector<int>& forced_unprotected_services = get_settings().force_unprotected_service(); const std::vector<int>& forced_protected_services = @@ -140,24 +139,23 @@ bool CryptoManagerImpl::AreForceProtectionSettingsCorrect() const { } bool CryptoManagerImpl::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const Mode mode = get_settings().security_manager_mode(); if (!AreForceProtectionSettingsCorrect()) { - LOG4CXX_DEBUG(logger_, "Force protection settings of ini file are wrong!"); + SDL_LOG_DEBUG("Force protection settings of ini file are wrong!"); return false; } const bool is_server = (mode == SERVER); if (is_server) { - LOG4CXX_DEBUG(logger_, "Server mode"); + SDL_LOG_DEBUG("Server mode"); } else { - LOG4CXX_DEBUG(logger_, "Client mode"); + SDL_LOG_DEBUG("Client mode"); } - LOG4CXX_DEBUG(logger_, - "Peer verification " - << (get_settings().verify_peer() ? "enabled" : "disabled")); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG("Peer verification " + << (get_settings().verify_peer() ? "enabled" : "disabled")); + SDL_LOG_DEBUG( + "CA certificate file is \"" << get_settings().ca_cert_path() << '"'); #if OPENSSL_VERSION_NUMBER < CONST_SSL_METHOD_MINIMAL_VERSION @@ -168,22 +166,21 @@ bool CryptoManagerImpl::Init() { switch (get_settings().security_manager_protocol_name()) { case SSLv3: #ifdef OPENSSL_NO_SSL3 - LOG4CXX_WARN(logger_, "OpenSSL does not support SSL3 protocol"); + SDL_LOG_WARN("OpenSSL does not support SSL3 protocol"); return false; #else - LOG4CXX_DEBUG(logger_, "SSLv3 is used"); + SDL_LOG_DEBUG("SSLv3 is used"); method = is_server ? SSLv3_server_method() : SSLv3_client_method(); break; #endif case TLSv1: - LOG4CXX_DEBUG(logger_, "TLSv1 is used"); + SDL_LOG_DEBUG("TLSv1 is used"); method = is_server ? TLSv1_server_method() : TLSv1_client_method(); break; case TLSv1_1: - LOG4CXX_DEBUG(logger_, "TLSv1_1 is used"); + SDL_LOG_DEBUG("TLSv1_1 is used"); #if OPENSSL_VERSION_NUMBER < TLS1_1_MINIMAL_VERSION - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "OpenSSL has no TLSv1.1 with version lower 1.0.1, set TLSv1.0"); method = is_server ? TLSv1_server_method() : TLSv1_client_method(); #else @@ -191,10 +188,9 @@ bool CryptoManagerImpl::Init() { #endif break; case TLSv1_2: - LOG4CXX_DEBUG(logger_, "TLSv1_2 is used"); + SDL_LOG_DEBUG("TLSv1_2 is used"); #if OPENSSL_VERSION_NUMBER < TLS1_1_MINIMAL_VERSION - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "OpenSSL has no TLSv1.2 with version lower 1.0.1, set TLSv1.0"); method = is_server ? TLSv1_server_method() : TLSv1_client_method(); #else @@ -202,13 +198,12 @@ bool CryptoManagerImpl::Init() { #endif break; case DTLSv1: - LOG4CXX_DEBUG(logger_, "DTLSv1 is used"); + SDL_LOG_DEBUG("DTLSv1 is used"); method = is_server ? DTLSv1_server_method() : DTLSv1_client_method(); break; default: - LOG4CXX_ERROR(logger_, - "Unknown protocol: " - << get_settings().security_manager_protocol_name()); + SDL_LOG_ERROR("Unknown protocol: " + << get_settings().security_manager_protocol_name()); return false; } if (context_) { @@ -224,37 +219,34 @@ bool CryptoManagerImpl::Init() { SaveCertificateData(get_settings().certificate_data()); if (get_settings().ciphers_list().empty()) { - LOG4CXX_WARN(logger_, "Empty ciphers list"); + SDL_LOG_WARN("Empty ciphers list"); } else { - LOG4CXX_DEBUG(logger_, "Cipher list: " << get_settings().ciphers_list()); + SDL_LOG_DEBUG("Cipher list: " << get_settings().ciphers_list()); if (!SSL_CTX_set_cipher_list(context_, get_settings().ciphers_list().c_str())) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Could not set cipher list: " << get_settings().ciphers_list()); return false; } } if (get_settings().ca_cert_path().empty()) { - LOG4CXX_WARN(logger_, "Setting up empty CA certificate location"); + SDL_LOG_WARN("Setting up empty CA certificate location"); } - LOG4CXX_DEBUG(logger_, "Setting up CA certificate location"); + SDL_LOG_DEBUG("Setting up CA certificate location"); const int result = SSL_CTX_load_verify_locations( context_, NULL, get_settings().ca_cert_path().c_str()); if (!result) { const unsigned long error = ERR_get_error(); UNUSED(error); - LOG4CXX_WARN(logger_, - "Wrong certificate file '" - << get_settings().ca_cert_path() << "', err 0x" << std::hex - << error << " \"" << ERR_reason_error_string(error) - << '"'); + SDL_LOG_WARN("Wrong certificate file '" + << get_settings().ca_cert_path() << "', err 0x" << std::hex + << error << " \"" << ERR_reason_error_string(error) << '"'); } - LOG4CXX_DEBUG(logger_, "Setting up module certificate and private key"); + SDL_LOG_DEBUG("Setting up module certificate and private key"); X509* module_certificate = LoadModuleCertificateFromFile(); utils::ScopeGuard certificate_guard = @@ -266,7 +258,7 @@ bool CryptoManagerImpl::Init() { UNUSED(key_guard); if (!UpdateModuleCertificateData(module_certificate, module_key)) { - LOG4CXX_WARN(logger_, "Failed to update module key and certificate"); + SDL_LOG_WARN("Failed to update module key and certificate"); } guard.Dismiss(); @@ -275,22 +267,21 @@ bool CryptoManagerImpl::Init() { get_settings().verify_peer() ? SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT : SSL_VERIFY_NONE; - LOG4CXX_DEBUG(logger_, - "Setting up peer verification in mode: " << verify_mode); + SDL_LOG_DEBUG("Setting up peer verification in mode: " << verify_mode); SSL_CTX_set_verify(context_, verify_mode, &debug_callback); return true; } bool CryptoManagerImpl::OnCertificateUpdated(const std::string& data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(crypto_manager_lock_); if (!context_) { - LOG4CXX_WARN(logger_, "Not initialized"); + SDL_LOG_WARN("Not initialized"); return false; } if (!SaveCertificateData(data)) { - LOG4CXX_ERROR(logger_, "Failed to save certificate data"); + SDL_LOG_ERROR("Failed to save certificate data"); return false; } @@ -308,7 +299,7 @@ bool CryptoManagerImpl::OnCertificateUpdated(const std::string& data) { } SSLContext* CryptoManagerImpl::CreateSSLContext() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(crypto_manager_lock_); if (NULL == context_) { return NULL; @@ -343,17 +334,17 @@ std::string CryptoManagerImpl::LastError() const { bool CryptoManagerImpl::IsCertificateUpdateRequired( const time_t system_time, const time_t certificates_time) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const double seconds = difftime(certificates_time, system_time); - LOG4CXX_DEBUG( - logger_, "Certificate UTC time: " << asctime(gmtime(&certificates_time))); + SDL_LOG_DEBUG( + "Certificate UTC time: " << asctime(gmtime(&certificates_time))); - LOG4CXX_DEBUG(logger_, "Host UTC time: " << asctime(gmtime(&system_time))); - LOG4CXX_DEBUG(logger_, "Seconds before expiration: " << seconds); + SDL_LOG_DEBUG("Host UTC time: " << asctime(gmtime(&system_time))); + SDL_LOG_DEBUG("Seconds before expiration: " << seconds); if (seconds < 0) { - LOG4CXX_WARN(logger_, "Certificate is already expired."); + SDL_LOG_WARN("Certificate is already expired."); return true; } @@ -367,10 +358,10 @@ const CryptoManagerSettings& CryptoManagerImpl::get_settings() const { bool CryptoManagerImpl::SaveCertificateData( const std::string& cert_data) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (cert_data.empty()) { - LOG4CXX_WARN(logger_, "Empty certificate"); + SDL_LOG_WARN("Empty certificate"); return false; } @@ -382,7 +373,7 @@ bool CryptoManagerImpl::SaveCertificateData( X509* cert = NULL; if (!PEM_read_bio_X509(bio_cert, &cert, 0, 0)) { - LOG4CXX_WARN(logger_, "Could not read certificate data: " << LastError()); + SDL_LOG_WARN("Could not read certificate data: " << LastError()); return false; } @@ -390,14 +381,14 @@ bool CryptoManagerImpl::SaveCertificateData( UNUSED(cert_guard); if (1 != BIO_reset(bio_cert)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Unabled to reset BIO in order to read private key, " << LastError()); } EVP_PKEY* pkey = NULL; if (!PEM_read_bio_PrivateKey(bio_cert, &pkey, 0, 0)) { - LOG4CXX_WARN(logger_, "Could not read private key data: " << LastError()); + SDL_LOG_WARN("Could not read private key data: " << LastError()); return false; } @@ -409,38 +400,37 @@ bool CryptoManagerImpl::SaveCertificateData( bool CryptoManagerImpl::UpdateModuleCertificateData(X509* certificate, EVP_PKEY* key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (certificate) { if (!SSL_CTX_use_certificate(context_, certificate)) { - LOG4CXX_WARN(logger_, "Could not use certificate: " << LastError()); + SDL_LOG_WARN("Could not use certificate: " << LastError()); return false; } } if (key) { if (!SSL_CTX_use_PrivateKey(context_, key)) { - LOG4CXX_ERROR(logger_, "Could not use key: " << LastError()); + SDL_LOG_ERROR("Could not use key: " << LastError()); return false; } if (!SSL_CTX_check_private_key(context_)) { - LOG4CXX_ERROR(logger_, "Private key is invalid: " << LastError()); + SDL_LOG_ERROR("Private key is invalid: " << LastError()); return false; } } - LOG4CXX_DEBUG(logger_, "Certificate and key are successfully updated"); + SDL_LOG_DEBUG("Certificate and key are successfully updated"); return true; } X509* CryptoManagerImpl::LoadModuleCertificateFromFile() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string cert_path = get_settings().module_cert_path(); BIO* bio_cert = BIO_new_file(cert_path.c_str(), "r"); if (!bio_cert) { - LOG4CXX_WARN(logger_, - "Failed to open " << cert_path << " file: " << LastError()); + SDL_LOG_WARN("Failed to open " << cert_path << " file: " << LastError()); return NULL; } @@ -449,24 +439,21 @@ X509* CryptoManagerImpl::LoadModuleCertificateFromFile() { X509* module_certificate = NULL; if (!PEM_read_bio_X509(bio_cert, &module_certificate, NULL, NULL)) { - LOG4CXX_ERROR(logger_, - "Failed to read certificate data from file: " << LastError()); + SDL_LOG_ERROR("Failed to read certificate data from file: " << LastError()); return NULL; } - LOG4CXX_DEBUG(logger_, - "Module certificate was loaded: " << module_certificate); + SDL_LOG_DEBUG("Module certificate was loaded: " << module_certificate); return module_certificate; } EVP_PKEY* CryptoManagerImpl::LoadModulePrivateKeyFromFile() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string key_path = get_settings().module_key_path(); BIO* bio_key = BIO_new_file(key_path.c_str(), "r"); if (!bio_key) { - LOG4CXX_WARN(logger_, - "Failed to open " << key_path << " file: " << LastError()); + SDL_LOG_WARN("Failed to open " << key_path << " file: " << LastError()); return NULL; } @@ -475,28 +462,26 @@ EVP_PKEY* CryptoManagerImpl::LoadModulePrivateKeyFromFile() { EVP_PKEY* module_key = NULL; if (!PEM_read_bio_PrivateKey(bio_key, &module_key, NULL, NULL)) { - LOG4CXX_ERROR(logger_, - "Failed to read private key data from file: " << LastError()); + SDL_LOG_ERROR("Failed to read private key data from file: " << LastError()); return NULL; } - LOG4CXX_DEBUG(logger_, "Module private key was loaded: " << module_key); + SDL_LOG_DEBUG("Module private key was loaded: " << module_key); return module_key; } bool CryptoManagerImpl::SaveModuleCertificateToFile(X509* certificate) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!certificate) { - LOG4CXX_WARN(logger_, "Empty certificate. Saving will be skipped"); + SDL_LOG_WARN("Empty certificate. Saving will be skipped"); return false; } const std::string cert_path = get_settings().module_cert_path(); BIO* bio_cert = BIO_new_file(cert_path.c_str(), "w"); if (!bio_cert) { - LOG4CXX_ERROR(logger_, - "Failed to open " << cert_path << " file: " << LastError()); + SDL_LOG_ERROR("Failed to open " << cert_path << " file: " << LastError()); return false; } @@ -504,8 +489,7 @@ bool CryptoManagerImpl::SaveModuleCertificateToFile(X509* certificate) const { UNUSED(bio_guard); if (!PEM_write_bio_X509(bio_cert, certificate)) { - LOG4CXX_ERROR(logger_, - "Failed to write certificate to file: " << LastError()); + SDL_LOG_ERROR("Failed to write certificate to file: " << LastError()); return false; } @@ -513,18 +497,17 @@ bool CryptoManagerImpl::SaveModuleCertificateToFile(X509* certificate) const { } bool CryptoManagerImpl::SaveModuleKeyToFile(EVP_PKEY* key) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!key) { - LOG4CXX_WARN(logger_, "Empty private key. Saving will be skipped"); + SDL_LOG_WARN("Empty private key. Saving will be skipped"); return false; } const std::string key_path = get_settings().module_key_path(); BIO* bio_key = BIO_new_file(key_path.c_str(), "w"); if (!bio_key) { - LOG4CXX_ERROR(logger_, - "Failed to open " << key_path << " file: " << LastError()); + SDL_LOG_ERROR("Failed to open " << key_path << " file: " << LastError()); return false; } @@ -532,7 +515,7 @@ bool CryptoManagerImpl::SaveModuleKeyToFile(EVP_PKEY* key) const { UNUSED(bio_guard); if (!PEM_write_bio_PrivateKey(bio_key, key, NULL, NULL, 0, NULL, NULL)) { - LOG4CXX_ERROR(logger_, "Failed to write key to file: " << LastError()); + SDL_LOG_ERROR("Failed to write key to file: " << LastError()); return false; } diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc index 5ae8c35084..50a58e0486 100644 --- a/src/components/security_manager/src/security_manager_impl.cc +++ b/src/components/security_manager/src/security_manager_impl.cc @@ -42,7 +42,7 @@ namespace security_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager") +SDL_CREATE_LOG_VARIABLE("SecurityManager") static const char* kErrId = "id"; static const char* kErrText = "text"; @@ -76,7 +76,7 @@ void SecurityManagerImpl::OnMessageReceived( if (!result) { // result will be false only if data less then query header const std::string error_text("Incorrect message received"); - LOG4CXX_ERROR(logger_, error_text); + SDL_LOG_ERROR(error_text); SendInternalError( message->connection_key(), ERROR_INVALID_QUERY_SIZE, error_text); return; @@ -93,7 +93,7 @@ void SecurityManagerImpl::OnMobileMessageSent( void SecurityManagerImpl::set_session_observer( protocol_handler::SessionObserver* observer) { if (!observer) { - LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to SessionObserver."); + SDL_LOG_ERROR("Invalid (NULL) pointer to SessionObserver."); return; } session_observer_ = observer; @@ -102,7 +102,7 @@ void SecurityManagerImpl::set_session_observer( void SecurityManagerImpl::set_protocol_handler( protocol_handler::ProtocolHandler* handler) { if (!handler) { - LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to ProtocolHandler."); + SDL_LOG_ERROR("Invalid (NULL) pointer to ProtocolHandler."); return; } protocol_handler_ = handler; @@ -110,7 +110,7 @@ void SecurityManagerImpl::set_protocol_handler( void SecurityManagerImpl::set_crypto_manager(CryptoManager* crypto_manager) { if (!crypto_manager) { - LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to CryptoManager."); + SDL_LOG_ERROR("Invalid (NULL) pointer to CryptoManager."); return; } crypto_manager_ = crypto_manager; @@ -118,10 +118,10 @@ void SecurityManagerImpl::set_crypto_manager(CryptoManager* crypto_manager) { void SecurityManagerImpl::Handle(const SecurityMessage message) { DCHECK(message); - LOG4CXX_INFO(logger_, "Received Security message from Mobile side"); + SDL_LOG_INFO("Received Security message from Mobile side"); if (!crypto_manager_) { const std::string error_text("Invalid (NULL) CryptoManager."); - LOG4CXX_ERROR(logger_, error_text); + SDL_LOG_ERROR(error_text); SendInternalError( message->get_connection_key(), ERROR_NOT_SUPPORTED, error_text); return; @@ -129,18 +129,18 @@ void SecurityManagerImpl::Handle(const SecurityMessage message) { switch (message->get_header().query_id) { case SecurityQuery::SEND_HANDSHAKE_DATA: if (!ProcessHandshakeData(message)) { - LOG4CXX_ERROR(logger_, "Process HandshakeData failed"); + SDL_LOG_ERROR("Process HandshakeData failed"); } break; case SecurityQuery::SEND_INTERNAL_ERROR: if (!ProcessInternalError(message)) { - LOG4CXX_ERROR(logger_, "Processing income InternalError failed"); + SDL_LOG_ERROR("Processing income InternalError failed"); } break; default: { // SecurityQuery::InvalidQuery const std::string error_text("Unknown query identifier."); - LOG4CXX_ERROR(logger_, error_text); + SDL_LOG_ERROR(error_text); SendInternalError(message->get_connection_key(), ERROR_INVALID_QUERY_ID, error_text, @@ -151,7 +151,7 @@ void SecurityManagerImpl::Handle(const SecurityMessage message) { security_manager::SSLContext* SecurityManagerImpl::CreateSSLContext( const uint32_t& connection_key, ContextCreationStrategy cc_strategy) { - LOG4CXX_INFO(logger_, "ProtectService processing"); + SDL_LOG_INFO("ProtectService processing"); DCHECK(session_observer_); DCHECK(crypto_manager_); @@ -169,7 +169,7 @@ security_manager::SSLContext* SecurityManagerImpl::CreateSSLContext( crypto_manager_->CreateSSLContext(); if (!ssl_context) { const std::string error_text("CryptoManager could not create SSL context."); - LOG4CXX_ERROR(logger_, error_text); + SDL_LOG_ERROR(error_text); // Generate response query and post to security_messages_ SendInternalError(connection_key, ERROR_INTERNAL, error_text); return NULL; @@ -185,13 +185,12 @@ security_manager::SSLContext* SecurityManagerImpl::CreateSSLContext( } DCHECK(session_observer_->GetSSLContext(connection_key, protocol_handler::kControl)); - LOG4CXX_DEBUG(logger_, - "Set SSL context to connection_key " << connection_key); + SDL_LOG_DEBUG("Set SSL context to connection_key " << connection_key); return ssl_context; } void SecurityManagerImpl::PostponeHandshake(const uint32_t connection_key) { - LOG4CXX_TRACE(logger_, "Handshake postponed"); + SDL_LOG_TRACE("Handshake postponed"); sync_primitives::AutoLock lock(connections_lock_); if (waiting_for_certificate_) { awaiting_certificate_connections_.insert(connection_key); @@ -202,24 +201,21 @@ void SecurityManagerImpl::PostponeHandshake(const uint32_t connection_key) { } void SecurityManagerImpl::ResumeHandshake(uint32_t connection_key) { - LOG4CXX_TRACE(logger_, "Handshake resumed"); + SDL_LOG_TRACE("Handshake resumed"); security_manager::SSLContext* ssl_context = CreateSSLContext(connection_key, kForceRecreation); if (!ssl_context) { - LOG4CXX_WARN(logger_, - "Unable to resume handshake. No SSL context for key " - << connection_key); + SDL_LOG_WARN("Unable to resume handshake. No SSL context for key " + << connection_key); return; } - LOG4CXX_DEBUG(logger_, - "Connection key : " - << connection_key - << " is waiting for certificate: " << std::boolalpha - << waiting_for_certificate_ << " and has certificate: " - << ssl_context->HasCertificate()); + SDL_LOG_DEBUG("Connection key : " + << connection_key << " is waiting for certificate: " + << std::boolalpha << waiting_for_certificate_ + << " and has certificate: " << ssl_context->HasCertificate()); ssl_context->ResetConnection(); if (!waiting_for_certificate_ && !ssl_context->HasCertificate()) { @@ -233,7 +229,7 @@ void SecurityManagerImpl::ResumeHandshake(uint32_t connection_key) { void SecurityManagerImpl::StartHandshake(uint32_t connection_key) { DCHECK(session_observer_); - LOG4CXX_INFO(logger_, "StartHandshake: connection_key " << connection_key); + SDL_LOG_INFO("StartHandshake: connection_key " << connection_key); security_manager::SSLContext* ssl_context = session_observer_->GetSSLContext( connection_key, protocol_handler::kControl); @@ -241,14 +237,14 @@ void SecurityManagerImpl::StartHandshake(uint32_t connection_key) { const std::string error_text( "StartHandshake failed, " "connection is not protected"); - LOG4CXX_ERROR(logger_, error_text); + SDL_LOG_ERROR(error_text); SendInternalError(connection_key, ERROR_INTERNAL, error_text); NotifyListenersOnHandshakeDone(connection_key, SSLContext::Handshake_Result_Fail); return; } if (!ssl_context->HasCertificate()) { - LOG4CXX_ERROR(logger_, "Security certificate is absent"); + SDL_LOG_ERROR("Security certificate is absent"); sync_primitives::AutoLock lock(waiters_lock_); waiting_for_certificate_ = true; NotifyOnCertificateUpdateRequired(); @@ -269,11 +265,10 @@ bool SecurityManagerImpl::IsSystemTimeProviderReady() const { void SecurityManagerImpl::ProceedHandshake( security_manager::SSLContext* ssl_context, uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!ssl_context) { - LOG4CXX_WARN(logger_, - "Unable to process handshake. No SSL context for key " - << connection_key); + SDL_LOG_WARN("Unable to process handshake. No SSL context for key " + << connection_key); return; } @@ -285,14 +280,14 @@ void SecurityManagerImpl::ProceedHandshake( time_t cert_due_date; if (!ssl_context->GetCertificateDueDate(cert_due_date)) { - LOG4CXX_ERROR(logger_, "Failed to get certificate due date!"); + SDL_LOG_ERROR("Failed to get certificate due date!"); PostponeHandshake(connection_key); return; } if (crypto_manager_->IsCertificateUpdateRequired( system_time_handler_->GetUTCTime(), cert_due_date)) { - LOG4CXX_DEBUG(logger_, "Host certificate update required"); + SDL_LOG_DEBUG("Host certificate update required"); if (helpers::in_range(awaiting_certificate_connections_, connection_key)) { NotifyListenersOnHandshakeDone(connection_key, SSLContext::Handshake_Result_CertExpired); @@ -319,7 +314,7 @@ void SecurityManagerImpl::ProceedHandshake( ssl_context->StartHandshake(&data, &data_size); if (security_manager::SSLContext::Handshake_Result_Success != result) { const std::string error_text("StartHandshake failed, handshake step fail"); - LOG4CXX_ERROR(logger_, error_text); + SDL_LOG_ERROR(error_text); SendInternalError(connection_key, ERROR_INTERNAL, error_text); NotifyListenersOnHandshakeDone(connection_key, SSLContext::Handshake_Result_Fail); @@ -333,15 +328,14 @@ void SecurityManagerImpl::ProceedHandshake( bool SecurityManagerImpl::IsCertificateUpdateRequired( const uint32_t connection_key) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); security_manager::SSLContext* ssl_context = CreateSSLContext(connection_key, kUseExisting); DCHECK_OR_RETURN(ssl_context, true); - LOG4CXX_DEBUG(logger_, - "Set SSL context to connection_key " << connection_key); + SDL_LOG_DEBUG("Set SSL context to connection_key " << connection_key); time_t cert_due_date; if (!ssl_context->GetCertificateDueDate(cert_due_date)) { - LOG4CXX_ERROR(logger_, "Failed to get certificate due date!"); + SDL_LOG_ERROR("Failed to get certificate due date!"); return true; } return crypto_manager_->IsCertificateUpdateRequired( @@ -350,8 +344,7 @@ bool SecurityManagerImpl::IsCertificateUpdateRequired( void SecurityManagerImpl::AddListener(SecurityManagerListener* const listener) { if (!listener) { - LOG4CXX_ERROR(logger_, - "Invalid (NULL) pointer to SecurityManagerListener."); + SDL_LOG_ERROR("Invalid (NULL) pointer to SecurityManagerListener."); return; } listeners_.push_back(listener); @@ -360,15 +353,14 @@ void SecurityManagerImpl::AddListener(SecurityManagerListener* const listener) { void SecurityManagerImpl::RemoveListener( SecurityManagerListener* const listener) { if (!listener) { - LOG4CXX_ERROR(logger_, - "Invalid (NULL) pointer to SecurityManagerListener."); + SDL_LOG_ERROR("Invalid (NULL) pointer to SecurityManagerListener."); return; } listeners_.remove(listener); } bool SecurityManagerImpl::OnCertificateUpdated(const std::string& data) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock lock(waiters_lock_); waiting_for_certificate_ = false; @@ -384,7 +376,7 @@ bool SecurityManagerImpl::OnCertificateUpdated(const std::string& data) { } void SecurityManagerImpl::OnSystemTimeArrived(const time_t utc_time) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock lock(waiters_lock_); waiting_for_time_ = false; @@ -399,7 +391,7 @@ void SecurityManagerImpl::OnSystemTimeArrived(const time_t utc_time) { } void SecurityManagerImpl::OnSystemTimeFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock lock(waiters_lock_); waiting_for_time_ = false; @@ -411,9 +403,9 @@ void SecurityManagerImpl::OnSystemTimeFailed() { } void SecurityManagerImpl::ProcessFailedPTU() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (listeners_.empty()) { - LOG4CXX_DEBUG(logger_, "listeners arrays IS EMPTY!"); + SDL_LOG_DEBUG("listeners arrays IS EMPTY!"); return; } @@ -427,7 +419,7 @@ void SecurityManagerImpl::ProcessFailedPTU() { for (auto& listener : listeners_to_remove) { auto it = std::find(listeners_.begin(), listeners_.end(), listener); DCHECK(it != listeners_.end()); - LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it); + SDL_LOG_DEBUG("Destroying listener: " << *it); delete (*it); listeners_.erase(it); } @@ -435,7 +427,7 @@ void SecurityManagerImpl::ProcessFailedPTU() { #ifdef EXTERNAL_PROPRIETARY_MODE void SecurityManagerImpl::ProcessFailedCertDecrypt() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { sync_primitives::AutoLock lock(waiters_lock_); waiting_for_certificate_ = false; @@ -451,7 +443,7 @@ void SecurityManagerImpl::ProcessFailedCertDecrypt() { for (auto& listener : listeners_to_remove) { auto it = std::find(listeners_.begin(), listeners_.end(), listener); DCHECK(it != listeners_.end()); - LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it); + SDL_LOG_DEBUG("Destroying listener: " << *it); delete (*it); listeners_.erase(it); } @@ -462,11 +454,11 @@ void SecurityManagerImpl::ProcessFailedCertDecrypt() { void SecurityManagerImpl::NotifyListenersOnHandshakeDone( const uint32_t& connection_key, SSLContext::HandshakeResult error) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::list<SecurityManagerListener*>::iterator it = listeners_.begin(); while (it != listeners_.end()) { if ((*it)->OnHandshakeDone(connection_key, error)) { - LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it); + SDL_LOG_DEBUG("Destroying listener: " << *it); delete (*it); it = listeners_.erase(it); } else { @@ -476,7 +468,7 @@ void SecurityManagerImpl::NotifyListenersOnHandshakeDone( } void SecurityManagerImpl::NotifyOnCertificateUpdateRequired() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::list<SecurityManagerListener*>::iterator it = listeners_.begin(); while (it != listeners_.end()) { (*it)->OnCertificateUpdateRequired(); @@ -489,11 +481,11 @@ void SecurityManagerImpl::ResetPendingSystemTimeRequests() { } void SecurityManagerImpl::NotifyListenersOnGetSystemTimeFailed() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::list<SecurityManagerListener*>::iterator it = listeners_.begin(); while (it != listeners_.end()) { if ((*it)->OnGetSystemTimeFailed()) { - LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it); + SDL_LOG_DEBUG("Destroying listener: " << *it); delete (*it); it = listeners_.erase(it); } else { @@ -503,12 +495,12 @@ void SecurityManagerImpl::NotifyListenersOnGetSystemTimeFailed() { } bool SecurityManagerImpl::IsPolicyCertificateDataEmpty() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string certificate_data; for (auto it = listeners_.begin(); it != listeners_.end(); ++it) { if ((*it)->GetPolicyCertificateData(certificate_data)) { - LOG4CXX_DEBUG(logger_, "Certificate data received from listener"); + SDL_LOG_DEBUG("Certificate data received from listener"); return certificate_data.empty(); } } @@ -517,20 +509,20 @@ bool SecurityManagerImpl::IsPolicyCertificateDataEmpty() { bool SecurityManagerImpl::ProcessHandshakeData( const SecurityMessage& inMessage) { - LOG4CXX_INFO(logger_, "SendHandshakeData processing"); + SDL_LOG_INFO("SendHandshakeData processing"); DCHECK(inMessage); DCHECK(inMessage->get_header().query_id == SecurityQuery::SEND_HANDSHAKE_DATA); const uint32_t seqNumber = inMessage->get_header().seq_number; const uint32_t connection_key = inMessage->get_connection_key(); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Received " << inMessage->get_data_size() << " bytes handshake data "); if (!inMessage->get_data_size()) { const std::string error_text("SendHandshakeData: null arguments size."); - LOG4CXX_ERROR(logger_, error_text); + SDL_LOG_ERROR(error_text); SendInternalError( connection_key, ERROR_INVALID_QUERY_SIZE, error_text, seqNumber); return false; @@ -540,7 +532,7 @@ bool SecurityManagerImpl::ProcessHandshakeData( connection_key, protocol_handler::kControl); if (!sslContext) { const std::string error_text("SendHandshakeData: No ssl context."); - LOG4CXX_ERROR(logger_, error_text); + SDL_LOG_ERROR(error_text); SendInternalError( connection_key, ERROR_SERVICE_NOT_PROTECTED, error_text, seqNumber); NotifyListenersOnHandshakeDone(connection_key, @@ -557,8 +549,7 @@ bool SecurityManagerImpl::ProcessHandshakeData( if (handshake_result == SSLContext::Handshake_Result_AbnormalFail) { // Do not return handshake data on AbnormalFail or null returned values const std::string error_text(sslContext->LastError()); - LOG4CXX_ERROR(logger_, - "SendHandshakeData: Handshake failed: " << error_text); + SDL_LOG_ERROR("SendHandshakeData: Handshake failed: " << error_text); SendInternalError( connection_key, ERROR_SSL_INVALID_DATA, error_text, seqNumber); NotifyListenersOnHandshakeDone(connection_key, @@ -568,12 +559,12 @@ bool SecurityManagerImpl::ProcessHandshakeData( } if (sslContext->IsInitCompleted()) { // On handshake success - LOG4CXX_DEBUG(logger_, "SSL initialization finished success."); + SDL_LOG_DEBUG("SSL initialization finished success."); NotifyListenersOnHandshakeDone(connection_key, SSLContext::Handshake_Result_Success); } else if (handshake_result != SSLContext::Handshake_Result_Success) { // On handshake fail - LOG4CXX_WARN(logger_, "SSL initialization finished with fail."); + SDL_LOG_WARN("SSL initialization finished with fail."); NotifyListenersOnHandshakeDone(connection_key, handshake_result); } @@ -588,17 +579,16 @@ bool SecurityManagerImpl::ProcessInternalError( const SecurityMessage& inMessage) { std::string str = inMessage->get_json_message(); const uint32_t connection_key = inMessage->get_connection_key(); - LOG4CXX_INFO(logger_, "Received InternalError with Json message" << str); + SDL_LOG_INFO("Received InternalError with Json message" << str); Json::Value root; utils::JsonReader reader; if (!reader.parse(str, &root)) { - LOG4CXX_DEBUG(logger_, "Json parsing fails."); + SDL_LOG_DEBUG("Json parsing fails."); return false; } uint8_t id = root[kErrId].asInt(); - LOG4CXX_DEBUG(logger_, - "Received InternalError id " << std::to_string(id) << ", text: " + SDL_LOG_DEBUG("Received InternalError id " << std::to_string(id) << ", text: " << root[kErrText].asString()); if (ERROR_SSL_INVALID_DATA == id || ERROR_NOT_SUPPORTED == id) { NotifyListenersOnHandshakeDone(connection_key, @@ -618,7 +608,7 @@ void SecurityManagerImpl::SendHandshakeBinData(const uint32_t connection_key, const SecurityQuery query = SecurityQuery(header, connection_key, data, data_size); SendQuery(query, connection_key); - LOG4CXX_DEBUG(logger_, "Sent " << data_size << " bytes handshake data "); + SDL_LOG_DEBUG("Sent " << data_size << " bytes handshake data "); } void SecurityManagerImpl::SendInternalError(const uint32_t connection_key, @@ -644,8 +634,7 @@ void SecurityManagerImpl::SendInternalError(const uint32_t connection_key, const SecurityQuery query( header, connection_key, &data_sending[0], data_sending.size()); SendQuery(query, connection_key); - LOG4CXX_DEBUG(logger_, - "Sent Internal error id " << static_cast<int>(error_id) + SDL_LOG_DEBUG("Sent Internal error id " << static_cast<int>(error_id) << " : \"" << error_text << "\"."); } diff --git a/src/components/security_manager/src/ssl_context_impl.cc b/src/components/security_manager/src/ssl_context_impl.cc index d5c892c07a..5d151e854a 100644 --- a/src/components/security_manager/src/ssl_context_impl.cc +++ b/src/components/security_manager/src/ssl_context_impl.cc @@ -46,7 +46,7 @@ namespace security_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager") +SDL_CREATE_LOG_VARIABLE("SecurityManager") CryptoManagerImpl::SSLContextImpl::SSLContextImpl(SSL* conn, Mode mode, @@ -78,7 +78,7 @@ bool CryptoManagerImpl::SSLContextImpl::IsInitCompleted() const { SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::StartHandshake( const uint8_t** const out_data, size_t* out_data_size) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); is_handshake_pending_ = true; return DoHandshakeStep(NULL, 0, out_data, out_data_size); } @@ -182,40 +182,38 @@ const std::string CryptoManagerImpl::SSLContextImpl::RemoveDisallowedInfo( void CryptoManagerImpl::SSLContextImpl::PrintCertData( X509* cert, const std::string& cert_owner) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!cert) { - LOG4CXX_DEBUG(logger_, "Empty certificate data"); + SDL_LOG_DEBUG("Empty certificate data"); return; } std::string subj = RemoveDisallowedInfo(X509_get_subject_name(cert)); if (!subj.empty()) { std::replace(subj.begin(), subj.end(), '/', ' '); - LOG4CXX_DEBUG(logger_, cert_owner << " subject:" << subj); + SDL_LOG_DEBUG(cert_owner << " subject:" << subj); } std::string issuer = RemoveDisallowedInfo(X509_get_issuer_name(cert)); if (!issuer.empty()) { std::replace(issuer.begin(), issuer.end(), '/', ' '); - LOG4CXX_DEBUG(logger_, cert_owner << " issuer:" << issuer); + SDL_LOG_DEBUG(cert_owner << " issuer:" << issuer); } ASN1_TIME* not_before = X509_get_notBefore(cert); if (not_before) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "Start date: " << static_cast<unsigned char*>(not_before->data)); } ASN1_TIME* not_after = X509_get_notAfter(cert); if (not_after) { - LOG4CXX_DEBUG(logger_, - "End date: " << static_cast<unsigned char*>(not_after->data)); + SDL_LOG_DEBUG("End date: " << static_cast<unsigned char*>(not_after->data)); } } void CryptoManagerImpl::SSLContextImpl::PrintCertInfo() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); PrintCertData(SSL_get_certificate(connection_), "HU's"); STACK_OF(X509)* peer_certs = SSL_get_peer_cert_chain(connection_); @@ -227,7 +225,7 @@ void CryptoManagerImpl::SSLContextImpl::PrintCertInfo() { SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::CheckCertContext() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); X509* cert = SSL_get_peer_certificate(connection_); if (!cert) { // According to the openssl documentation the peer certificate @@ -244,24 +242,20 @@ CryptoManagerImpl::SSLContextImpl::CheckCertContext() { const double end_seconds = difftime(end, hsh_context_.system_time); if (start_seconds < 0) { - LOG4CXX_ERROR(logger_, - "Certificate is not yet valid. Time before validity " - << start_seconds << " seconds"); + SDL_LOG_ERROR("Certificate is not yet valid. Time before validity " + << start_seconds << " seconds"); return Handshake_Result_NotYetValid; } else { - LOG4CXX_DEBUG( - logger_, - "Time since certificate validity " << start_seconds << "seconds"); + SDL_LOG_DEBUG("Time since certificate validity " << start_seconds + << "seconds"); } if (end_seconds < 0) { - LOG4CXX_ERROR(logger_, - "Certificate already expired. Time after expiration " - << end_seconds << " seconds"); + SDL_LOG_ERROR("Certificate already expired. Time after expiration " + << end_seconds << " seconds"); return Handshake_Result_CertExpired; } else { - LOG4CXX_DEBUG(logger_, - "Time until expiration " << end_seconds << "seconds"); + SDL_LOG_DEBUG("Time until expiration " << end_seconds << "seconds"); } X509_NAME* subj_name = X509_get_subject_name(cert); @@ -269,10 +263,9 @@ CryptoManagerImpl::SSLContextImpl::CheckCertContext() { const std::string& sn = GetTextBy(subj_name, NID_serialNumber); if (!(hsh_context_.expected_sn.CompareIgnoreCase(sn.c_str()))) { - LOG4CXX_ERROR(logger_, - "Trying to run handshake with wrong app id: " - << sn << ". Expected app id: " - << hsh_context_.expected_sn.AsMBString()); + SDL_LOG_ERROR("Trying to run handshake with wrong app id: " + << sn << ". Expected app id: " + << hsh_context_.expected_sn.AsMBString()); return Handshake_Result_AppIDMismatch; } return Handshake_Result_Success; @@ -334,12 +327,12 @@ time_t CryptoManagerImpl::SSLContextImpl::convert_asn1_time_to_time_t( bool CryptoManagerImpl::SSLContextImpl::ReadHandshakeData( const uint8_t** const out_data, size_t* out_data_size) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const size_t pend = BIO_ctrl_pending(bioOut_); - LOG4CXX_DEBUG(logger_, "Available " << pend << " bytes for handshake"); + SDL_LOG_DEBUG("Available " << pend << " bytes for handshake"); if (pend > 0) { - LOG4CXX_DEBUG(logger_, "Reading handshake data"); + SDL_LOG_DEBUG("Reading handshake data"); EnsureBufferSizeEnough(pend); const int read_count = BIO_read(bioOut_, buffer_, pend); @@ -347,7 +340,7 @@ bool CryptoManagerImpl::SSLContextImpl::ReadHandshakeData( *out_data_size = read_count; *out_data = buffer_; } else { - LOG4CXX_WARN(logger_, "BIO read fail"); + SDL_LOG_WARN("BIO read fail"); is_handshake_pending_ = false; ResetConnection(); return false; @@ -359,7 +352,7 @@ bool CryptoManagerImpl::SSLContextImpl::ReadHandshakeData( bool CryptoManagerImpl::SSLContextImpl::WriteHandshakeData( const uint8_t* const in_data, size_t in_data_size) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (in_data && in_data_size) { const int ret = BIO_write(bioIn_, in_data, in_data_size); if (ret <= 0) { @@ -373,9 +366,9 @@ bool CryptoManagerImpl::SSLContextImpl::WriteHandshakeData( SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::PerformHandshake() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const int handshake_result = SSL_do_handshake(connection_); - LOG4CXX_TRACE(logger_, "Handshake result: " << handshake_result); + SDL_LOG_TRACE("Handshake result: " << handshake_result); if (handshake_result == 1) { const HandshakeResult result = CheckCertContext(); if (result != Handshake_Result_Success) { @@ -384,7 +377,7 @@ CryptoManagerImpl::SSLContextImpl::PerformHandshake() { return result; } - LOG4CXX_DEBUG(logger_, "SSL handshake successfully finished"); + SDL_LOG_DEBUG("SSL handshake successfully finished"); // Handshake is successful bioFilter_ = BIO_new(BIO_f_ssl()); BIO_set_ssl(bioFilter_, connection_, BIO_NOCLOSE); @@ -394,7 +387,7 @@ CryptoManagerImpl::SSLContextImpl::PerformHandshake() { is_handshake_pending_ = false; } else if (handshake_result == 0) { - LOG4CXX_DEBUG(logger_, "SSL handshake failed"); + SDL_LOG_DEBUG("SSL handshake failed"); SSL_clear(connection_); is_handshake_pending_ = false; return Handshake_Result_Fail; @@ -403,10 +396,9 @@ CryptoManagerImpl::SSLContextImpl::PerformHandshake() { if (error != SSL_ERROR_WANT_READ) { const long error = SSL_get_verify_result(connection_); SetHandshakeError(error); - LOG4CXX_WARN(logger_, - "Handshake failed with error " - << " -> " << SSL_get_error(connection_, error) << " \"" - << LastError() << '"'); + SDL_LOG_WARN("Handshake failed with error " + << " -> " << SSL_get_error(connection_, error) << " \"" + << LastError() << '"'); ResetConnection(); is_handshake_pending_ = false; @@ -426,7 +418,7 @@ SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::DoHandshakeStep( size_t in_data_size, const uint8_t** const out_data, size_t* out_data_size) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(out_data); DCHECK(out_data_size); *out_data = NULL; @@ -437,7 +429,7 @@ SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::DoHandshakeStep( sync_primitives::AutoLock locker(bio_locker); if (SSL_is_init_finished(connection_)) { - LOG4CXX_DEBUG(logger_, "SSL initilization is finished"); + SDL_LOG_DEBUG("SSL initialization is finished"); is_handshake_pending_ = false; return Handshake_Result_Success; } @@ -491,15 +483,15 @@ bool CryptoManagerImpl::SSLContextImpl::Decrypt(const uint8_t* const in_data, size_t in_data_size, const uint8_t** const out_data, size_t* out_data_size) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock locker(bio_locker); if (!SSL_is_init_finished(connection_)) { - LOG4CXX_ERROR(logger_, "SSL initilization is not finished"); + SDL_LOG_ERROR("SSL initialization is not finished"); return false; } if (!in_data || (0 == in_data_size)) { - LOG4CXX_ERROR(logger_, "IN data ptr or IN data size is 0"); + SDL_LOG_ERROR("IN data ptr or IN data size is 0"); return false; } @@ -516,7 +508,7 @@ bool CryptoManagerImpl::SSLContextImpl::Decrypt(const uint8_t* const in_data, // TODO(EZamakhov): investigate BIO_read return 0, -1 and -2 meanings if (len <= 0) { // Reset filter and connection deinitilization instead - LOG4CXX_ERROR(logger_, "Read error occured. Read data lenght : " << len); + SDL_LOG_ERROR("Read error occurred. Read data length: " << len); BIO_ctrl(bioFilter_, BIO_CTRL_RESET, 0, NULL); return false; } @@ -529,7 +521,7 @@ bool CryptoManagerImpl::SSLContextImpl::Decrypt(const uint8_t* const in_data, } size_t CryptoManagerImpl::SSLContextImpl::get_max_block_size(size_t mtu) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!max_block_size_) { // FIXME(EZamakhov): add correct logics for TLS1/1.2/SSL3 // For SSL3.0 set temporary value 90, old TLS1.2 value is 29 @@ -549,11 +541,11 @@ bool CryptoManagerImpl::SSLContextImpl::IsHandshakePending() const { bool CryptoManagerImpl::SSLContextImpl::GetCertificateDueDate( time_t& due_date) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); X509* cert = SSL_get_certificate(connection_); if (!cert) { - LOG4CXX_DEBUG(logger_, "Get certificate failed."); + SDL_LOG_DEBUG("Get certificate failed."); return false; } @@ -583,19 +575,19 @@ void CryptoManagerImpl::SSLContextImpl::SetHandshakeError(const int error) { } void CryptoManagerImpl::SSLContextImpl::ResetConnection() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const int shutdown_result = SSL_shutdown(connection_); if (shutdown_result != 1) { const size_t pend = BIO_ctrl_pending(bioOut_); - LOG4CXX_DEBUG(logger_, "Available " << pend << " bytes for shutdown"); + SDL_LOG_DEBUG("Available " << pend << " bytes for shutdown"); if (pend > 0) { - LOG4CXX_DEBUG(logger_, "Reading shutdown data"); + SDL_LOG_DEBUG("Reading shutdown data"); EnsureBufferSizeEnough(pend); BIO_read(bioOut_, buffer_, pend); } SSL_shutdown(connection_); } - LOG4CXX_DEBUG(logger_, "SSL connection recreation"); + SDL_LOG_DEBUG("SSL connection recreation"); SSL_CTX* ssl_context = connection_->ctx; SSL_free(connection_); connection_ = SSL_new(ssl_context); @@ -647,8 +639,7 @@ std::string CryptoManagerImpl::SSLContextImpl::GetTextBy(X509_NAME* name, const int req_len = X509_NAME_get_text_by_NID(name, object, NULL, 0); if (-1 == req_len) { - LOG4CXX_WARN(logger_, - "Unable to obtain object: " << object << " from certificate"); + SDL_LOG_WARN("Unable to obtain object: " << object << " from certificate"); return std::string(); } diff --git a/src/components/telemetry_monitor/src/protocol_handler_observer.cc b/src/components/telemetry_monitor/src/protocol_handler_observer.cc index e696e58506..7752e6fb94 100644 --- a/src/components/telemetry_monitor/src/protocol_handler_observer.cc +++ b/src/components/telemetry_monitor/src/protocol_handler_observer.cc @@ -37,7 +37,7 @@ namespace telemetry_monitor { -CREATE_LOGGERPTR_GLOBAL(logger_, "TelemetryMonitor") +SDL_CREATE_LOG_VARIABLE("TelemetryMonitor") ProtocolHandlerObserver::ProtocolHandlerObserver( TelemetryMonitor* telemetry_monitor) @@ -49,8 +49,8 @@ void ProtocolHandlerObserver::StartMessageProcess( return; } if (time_starts.find(message_id) != time_starts.end()) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Already waiting for stop processing for Message ID: " << message_id); return; } @@ -63,7 +63,7 @@ void ProtocolHandlerObserver::EndMessageProcess( std::map<uint32_t, date_time::TimeDuration>::const_iterator it = time_starts.find(message_id); if (it == time_starts.end()) { - LOG4CXX_WARN(logger_, "Cant find start time for message" << message_id); + SDL_LOG_WARN("Cant find start time for message" << message_id); return; } m->begin = time_starts[message_id]; diff --git a/src/components/telemetry_monitor/src/telemetry_monitor.cc b/src/components/telemetry_monitor/src/telemetry_monitor.cc index 427ecada76..b1bb605de3 100644 --- a/src/components/telemetry_monitor/src/telemetry_monitor.cc +++ b/src/components/telemetry_monitor/src/telemetry_monitor.cc @@ -47,7 +47,7 @@ namespace telemetry_monitor { -CREATE_LOGGERPTR_GLOBAL(logger_, "TelemetryMonitor") +SDL_CREATE_LOG_VARIABLE("TelemetryMonitor") TelemetryMonitor::TelemetryMonitor(const std::string& server_address, uint16_t port) @@ -64,12 +64,12 @@ void TelemetryMonitor::Start() { } void TelemetryMonitor::set_streamer(std::shared_ptr<Streamer> streamer) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (thread_ && !thread_->IsRunning()) { thread_->SetDelegate(streamer_.get()); streamer_ = streamer; } else { - LOG4CXX_ERROR(logger_, "Unable to replace streamer if it is active"); + SDL_LOG_ERROR("Unable to replace streamer if it is active"); } } @@ -91,7 +91,7 @@ void TelemetryMonitor::Init( TelemetryObservable<application_manager::AMTelemetryObserver>* app_manager, TelemetryObservable<transport_manager::TMTelemetryObserver>* transport_manager) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(streamer_); app_manager->SetTelemetryObserver(&app_observer); @@ -103,7 +103,7 @@ void TelemetryMonitor::Init( } void TelemetryMonitor::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (thread_) { thread_->Stop(threads::Thread::kThreadSoftStop); if (thread_->GetDelegate()) { @@ -132,18 +132,18 @@ Streamer::~Streamer() { } void Streamer::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Start(); while (!stop_flag_) { - LOG4CXX_INFO(logger_, "Server socket is listening "); + SDL_LOG_INFO("Server socket is listening "); client_socket_fd_ = accept(server_socket_fd_, NULL, NULL); if (0 > client_socket_fd_) { - LOG4CXX_ERROR(logger_, "Cant open socket . Socket is busy "); + SDL_LOG_ERROR("Cant open socket . Socket is busy "); Stop(); break; } - LOG4CXX_INFO(logger_, "Client connected"); + SDL_LOG_INFO("Client connected"); is_client_connected_ = true; while (is_client_connected_) { @@ -156,7 +156,7 @@ void Streamer::threadMain() { } if (!IsReady()) { - LOG4CXX_INFO(logger_, "Client disconnected."); + SDL_LOG_INFO("Client disconnected."); break; } @@ -166,21 +166,21 @@ void Streamer::threadMain() { } void Streamer::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Stop(); messages_.Shutdown(); ThreadDelegate::exitThreadMain(); } void Streamer::Start() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); server_socket_fd_ = socket(AF_INET, SOCK_STREAM, 0); if (0 >= server_socket_fd_) { - LOG4CXX_ERROR(logger_, "Server open error"); + SDL_LOG_ERROR("Server open error"); return; } else { - LOG4CXX_DEBUG(logger_, "Server socket : " << server_socket_fd_); + SDL_LOG_DEBUG("Server socket : " << server_socket_fd_); } int32_t optval = 1; @@ -189,7 +189,7 @@ void Streamer::Start() { SO_REUSEADDR, &optval, sizeof optval)) { - LOG4CXX_ERROR(logger_, "Unable to set sockopt"); + SDL_LOG_ERROR("Unable to set sockopt"); return; } @@ -201,45 +201,44 @@ void Streamer::Start() { if (-1 == bind(server_socket_fd_, reinterpret_cast<struct sockaddr*>(&serv_addr_), sizeof(serv_addr_))) { - LOG4CXX_ERROR(logger_, - "Unable to bind server " << kserver_->ip().c_str() << ':' + SDL_LOG_ERROR("Unable to bind server " << kserver_->ip().c_str() << ':' << kserver_->port()); return; } if (-1 == listen(server_socket_fd_, 1)) { - LOG4CXX_ERROR(logger_, "Streamer listen error " << strerror(errno)); + SDL_LOG_ERROR("Streamer listen error " << strerror(errno)); return; } } void Streamer::ShutDownAndCloseSocket(int32_t socket_fd) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (0 < socket_fd) { - LOG4CXX_INFO(logger_, "Shutdown socket"); + SDL_LOG_INFO("Shutdown socket"); if (-1 == ::shutdown(socket_fd, SHUT_RDWR)) { - LOG4CXX_ERROR(logger_, "Unable to shutdown socket"); + SDL_LOG_ERROR("Unable to shutdown socket"); } if (-1 == close(socket_fd)) { - LOG4CXX_ERROR(logger_, "Unable to close socket"); + SDL_LOG_ERROR("Unable to close socket"); } } else { - LOG4CXX_WARN(logger_, "Socket in not connected: " << socket_fd); + SDL_LOG_WARN("Socket in not connected: " << socket_fd); } } void Streamer::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (stop_flag_) { - LOG4CXX_WARN(logger_, "Already Stopped"); + SDL_LOG_WARN("Already Stopped"); return; } stop_flag_ = true; messages_.Reset(); - LOG4CXX_WARN(logger_, "Stop server_socket_fd_"); + SDL_LOG_WARN("Stop server_socket_fd_"); ShutDownAndCloseSocket(server_socket_fd_); server_socket_fd_ = -1; - LOG4CXX_WARN(logger_, "Stop client_socket_fd_"); + SDL_LOG_WARN("Stop client_socket_fd_"); ShutDownAndCloseSocket(client_socket_fd_); client_socket_fd_ = -1; is_client_connected_ = false; @@ -258,10 +257,10 @@ bool Streamer::IsReady() const { const int retval = select(client_socket_fd_ + 1, 0, &fds, 0, &tv); if (-1 == retval) { - LOG4CXX_ERROR(logger_, "An error occurred"); + SDL_LOG_ERROR("An error occurred"); result = false; } else if (0 == retval) { - LOG4CXX_ERROR(logger_, "The timeout expired"); + SDL_LOG_ERROR("The timeout expired"); result = false; } @@ -269,14 +268,14 @@ bool Streamer::IsReady() const { } bool Streamer::Send(const std::string& msg) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!IsReady()) { - LOG4CXX_ERROR(logger_, " Socket is not ready"); + SDL_LOG_ERROR(" Socket is not ready"); return false; } if (-1 == ::send(client_socket_fd_, msg.c_str(), msg.size(), MSG_NOSIGNAL)) { - LOG4CXX_ERROR(logger_, " Unable to send"); + SDL_LOG_ERROR(" Unable to send"); return false; } return true; diff --git a/src/components/test_main.cc b/src/components/test_main.cc index 8912ed9bd2..62442cb64f 100644 --- a/src/components/test_main.cc +++ b/src/components/test_main.cc @@ -1,16 +1,33 @@ #include <iostream>
#include "gmock/gmock.h"
#include "utils/custom_string.h"
+
+#ifdef ENABLE_LOG
+#include "utils/logger/log4cxxlogger.h"
+#include "utils/logger/logger_impl.h"
+#endif // ENABLE_LOG
+
#include "utils/logger.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain")
+SDL_CREATE_LOG_VARIABLE("SDLMain")
int main(int argc, char** argv) {
+#ifdef ENABLE_LOG
+ // --------------------------------------------------------------------------
+ // Logger initialization
+ // Redefine for each paticular logger implementation
+ auto logger = std::unique_ptr<logger::Log4CXXLogger>(
+ new logger::Log4CXXLogger("log4cxx.properties"));
+ auto logger_impl =
+ std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl(false));
+ logger::Logger::instance(logger_impl.get());
+#endif // ENABLE_LOG
+
namespace custom_str = utils::custom_string;
testing::InitGoogleMock(&argc, argv);
::testing::DefaultValue<custom_str::CustomString>::Set(
custom_str::CustomString(""));
const int result = RUN_ALL_TESTS();
- DEINIT_LOGGER();
+ SDL_DEINIT_LOGGER();
return result;
}
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h index cfeedd16fc..ed42207200 100644 --- a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h +++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h @@ -37,8 +37,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(wss_logger_, "WebSocketSecureSession") - template <typename ExecutorType = ssl::stream<tcp::socket&> > class WebSocketSecureSession : public WebSocketSession<ExecutorType> { public: diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h index 53dd6a366a..f1be1a3b54 100644 --- a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h +++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h @@ -62,8 +62,6 @@ namespace websocket = namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp> #endif // ENABLE_SECURITY -CREATE_LOGGERPTR_GLOBAL(ws_logger_, "WebSocketSession") - class TransportAdapterController; template <typename ExecutorType = tcp::socket&> diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc b/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc index 19f4078443..ba48624adb 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc @@ -41,7 +41,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") BluetoothConnectionFactory::BluetoothConnectionFactory( TransportAdapterController* controller) @@ -53,15 +53,14 @@ TransportAdapter::Error BluetoothConnectionFactory::Init() { TransportAdapter::Error BluetoothConnectionFactory::CreateConnection( const DeviceUID& device_uid, const ApplicationHandle& app_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::shared_ptr<BluetoothSocketConnection> connection = std::make_shared<BluetoothSocketConnection>( device_uid, app_handle, controller_); controller_->ConnectionCreated(connection, device_uid, app_handle); TransportAdapter::Error error = connection->Start(); if (TransportAdapter::OK != error) { - LOG4CXX_ERROR(logger_, - "Bluetooth connection::Start() failed with error: " << error); + SDL_LOG_ERROR("Bluetooth connection::Start() failed with error: " << error); } return error; } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device.cc index 734d8fe1e9..91f561a7d9 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_device.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_device.cc @@ -51,39 +51,38 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") bool BluetoothDevice::GetRfcommChannel(const ApplicationHandle app_handle, uint8_t* channel_out) { - LOG4CXX_TRACE(logger_, - "enter. app_handle: " << app_handle + SDL_LOG_TRACE("enter. app_handle: " << app_handle << ", channel_out: " << std::hex << reinterpret_cast<void*>(channel_out)); if (app_handle < 0 || app_handle > std::numeric_limits<uint8_t>::max()) { - LOG4CXX_TRACE(logger_, - "exit with FALSE. Condition: app_handle < 0 || app_handle > " - "numeric_limits::max()"); + SDL_LOG_TRACE( + "exit with FALSE. Condition: app_handle < 0 || app_handle > " + "numeric_limits::max()"); return false; } const uint8_t channel = static_cast<uint8_t>(app_handle); RfcommChannelVector::const_iterator it = std::find(rfcomm_channels_.begin(), rfcomm_channels_.end(), channel); if (it == rfcomm_channels_.end()) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "exit with FALSE. Condition: channel not found in RfcommChannelVector"); return false; } *channel_out = channel; - LOG4CXX_TRACE(logger_, "exit with TRUE"); + SDL_LOG_TRACE("exit with TRUE"); return true; } std::string BluetoothDevice::GetUniqueDeviceId(const bdaddr_t& device_address) { - LOG4CXX_TRACE(logger_, "enter. device_adress: " << &device_address); + SDL_LOG_TRACE("enter. device_adress: " << &device_address); char device_address_string[32]; ba2str(&device_address, device_address_string); - LOG4CXX_TRACE(logger_, "exit with BT-" << device_address_string); + SDL_LOG_TRACE("exit with BT-" << device_address_string); return std::string("BT-") + device_address_string; } @@ -95,7 +94,7 @@ BluetoothDevice::BluetoothDevice(const bdaddr_t& device_address, , rfcomm_channels_(rfcomm_channels) {} bool BluetoothDevice::IsSameAs(const Device* other) const { - LOG4CXX_TRACE(logger_, "enter. device: " << other); + SDL_LOG_TRACE("enter. device: " << other); bool result = false; const BluetoothDevice* other_bluetooth_device = @@ -109,9 +108,9 @@ bool BluetoothDevice::IsSameAs(const Device* other) const { } } if (result) { - LOG4CXX_TRACE(logger_, "exit with TRUE"); + SDL_LOG_TRACE("exit with TRUE"); } else { - LOG4CXX_TRACE(logger_, "exit with FALSE"); + SDL_LOG_TRACE("exit with FALSE"); } return result; } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc index d95ed72b14..f152f1f78d 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc @@ -57,7 +57,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") namespace { char* SplitToAddr(char* dev_list_entry) { @@ -71,14 +71,14 @@ char* SplitToAddr(char* dev_list_entry) { } int FindPairedDevs(std::vector<bdaddr_t>* result) { - LOG4CXX_TRACE(logger_, "enter. result adress: " << result); + SDL_LOG_TRACE("enter. result address: " << result); DCHECK(result != NULL); const char* cmd = "bt-device -l"; FILE* pipe = popen(cmd, "r"); if (!pipe) { - LOG4CXX_TRACE(logger_, "exit -1. Condition: !pipe"); + SDL_LOG_TRACE("exit -1. Condition: !pipe"); return -1; } char* buffer = new char[1028]; @@ -96,7 +96,7 @@ int FindPairedDevs(std::vector<bdaddr_t>* result) { buffer = new char[1028]; } pclose(pipe); - LOG4CXX_TRACE(logger_, "exit with 0"); + SDL_LOG_TRACE("exit with 0"); delete[] buffer; return 0; } @@ -168,7 +168,7 @@ bool BluetoothDeviceScanner::IsInitialised() const { } void BluetoothDeviceScanner::UpdateTotalDeviceList() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeviceVector devices; devices.insert(devices.end(), paired_devices_with_sdl_.begin(), @@ -180,11 +180,11 @@ void BluetoothDeviceScanner::UpdateTotalDeviceList() { } void BluetoothDeviceScanner::DoInquiry() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const int device_id = hci_get_route(0); if (device_id < 0) { - LOG4CXX_INFO(logger_, "HCI device is not available"); + SDL_LOG_INFO("HCI device is not available"); shutdown_requested_ = true; controller_->SearchDeviceFailed(SearchDeviceError()); return; @@ -197,15 +197,14 @@ void BluetoothDeviceScanner::DoInquiry() { } if (paired_devices_.empty()) { - LOG4CXX_INFO(logger_, "Searching for paired devices."); + SDL_LOG_INFO("Searching for paired devices."); if (-1 == FindPairedDevs(&paired_devices_)) { - LOG4CXX_ERROR(logger_, "Failed to retrieve list of paired devices."); + SDL_LOG_ERROR("Failed to retrieve list of paired devices."); controller_->SearchDeviceFailed(SearchDeviceError()); } } - LOG4CXX_INFO(logger_, - "Check rfcomm channel on " << paired_devices_.size() + SDL_LOG_INFO("Check rfcomm channel on " << paired_devices_.size() << " paired devices."); paired_devices_with_sdl_.clear(); @@ -213,7 +212,7 @@ void BluetoothDeviceScanner::DoInquiry() { paired_devices_, device_handle, &paired_devices_with_sdl_); UpdateTotalDeviceList(); - LOG4CXX_INFO(logger_, "Starting hci_inquiry on device " << device_id); + SDL_LOG_INFO("Starting hci_inquiry on device " << device_id); const uint8_t inquiry_time = 8u; // Time unit is 1.28 seconds const size_t max_devices = 256u; inquiry_info* inquiry_info_list = new inquiry_info[max_devices]; @@ -226,8 +225,7 @@ void BluetoothDeviceScanner::DoInquiry() { IREQ_CACHE_FLUSH); if (number_of_devices >= 0) { - LOG4CXX_INFO(logger_, - "hci_inquiry: found " << number_of_devices << " devices"); + SDL_LOG_INFO("hci_inquiry: found " << number_of_devices << " devices"); std::vector<bdaddr_t> found_devices(number_of_devices); for (int i = 0; i < number_of_devices; ++i) { found_devices[i] = inquiry_info_list[i].bdaddr; @@ -243,7 +241,7 @@ void BluetoothDeviceScanner::DoInquiry() { delete[] inquiry_info_list; if (number_of_devices < 0) { - LOG4CXX_DEBUG(logger_, "number_of_devices < 0"); + SDL_LOG_DEBUG("number_of_devices < 0"); controller_->SearchDeviceFailed(SearchDeviceError()); } } @@ -252,10 +250,9 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices( const std::vector<bdaddr_t>& bd_addresses, int device_handle, DeviceVector* discovered_devices) { - LOG4CXX_TRACE(logger_, - "enter. bd_addresses: " - << &bd_addresses << ", device_handle: " << device_handle - << ", discovered_devices: " << discovered_devices); + SDL_LOG_TRACE("enter. bd_addresses: " + << &bd_addresses << ", device_handle: " << device_handle + << ", discovered_devices: " << discovered_devices); std::vector<RfcommChannelVector> sdl_rfcomm_channels = DiscoverSmartDeviceLinkRFCOMMChannels(bd_addresses); @@ -274,7 +271,7 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices( 0); if (hci_read_remote_name_ret != 0) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "hci_read_remote_name failed"); + SDL_LOG_ERROR_WITH_ERRNO("hci_read_remote_name failed"); int name_len = sizeof(deviceName) / sizeof(deviceName[0]); strncpy(deviceName, BluetoothDevice::GetUniqueDeviceId(bd_address).c_str(), @@ -285,19 +282,19 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices( auto bluetooth_device = std::make_shared<BluetoothDevice>( bd_address, deviceName, sdl_rfcomm_channels[i]); if (bluetooth_device) { - LOG4CXX_INFO(logger_, "Bluetooth device created successfully"); + SDL_LOG_INFO("Bluetooth device created successfully"); discovered_devices->push_back(bluetooth_device); } else { - LOG4CXX_WARN(logger_, "Can't create bluetooth device " << deviceName); + SDL_LOG_WARN("Can't create bluetooth device " << deviceName); } } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } std::vector<BluetoothDeviceScanner::RfcommChannelVector> BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( const std::vector<bdaddr_t>& device_addresses) { - LOG4CXX_TRACE(logger_, "enter device_addresses: " << &device_addresses); + SDL_LOG_TRACE("enter device_addresses: " << &device_addresses); const size_t size = device_addresses.size(); std::vector<RfcommChannelVector> result(size); @@ -322,16 +319,14 @@ BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( } sleep(attempt_timeout); } - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( "exit with vector<RfcommChannelVector>: size = " << result.size()); return result; } bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( const bdaddr_t& device_address, RfcommChannelVector* channels) { - LOG4CXX_TRACE(logger_, - "enter. device_address: " << &device_address + SDL_LOG_TRACE("enter. device_address: " << &device_address << ", channels: " << channels); static bdaddr_t any_address = {{0, 0, 0, 0, 0, 0}}; @@ -340,9 +335,9 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( if (sdp_session == 0) { bool result = !(errno == 31 || errno == 16 || errno == 117 || errno == 114); if (result) { - LOG4CXX_TRACE(logger_, "exit with TRUE. Condition: sdp_session == 0"); + SDL_LOG_TRACE("exit with TRUE. Condition: sdp_session == 0"); } else { - LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: sdp_session == 0"); + SDL_LOG_TRACE("exit with FALSE. Condition: sdp_session == 0"); } return result; } @@ -400,7 +395,7 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( sdp_close(sdp_session); if (!channels->empty()) { - LOG4CXX_INFO(logger_, "channels not empty"); + SDL_LOG_INFO("channels not empty"); std::stringstream rfcomm_channels_string; for (RfcommChannelVector::const_iterator it = channels->begin(); @@ -412,22 +407,19 @@ bool BluetoothDeviceScanner::DiscoverSmartDeviceLinkRFCOMMChannels( rfcomm_channels_string << static_cast<uint32_t>(*it); } - LOG4CXX_INFO( - logger_, - "SmartDeviceLink service was discovered on device " - << BluetoothDevice::GetUniqueDeviceId(device_address) - << " at channel(s): " << rfcomm_channels_string.str().c_str()); + SDL_LOG_INFO("SmartDeviceLink service was discovered on device " + << BluetoothDevice::GetUniqueDeviceId(device_address) + << " at channel(s): " << rfcomm_channels_string.str().c_str()); } else { - LOG4CXX_INFO(logger_, - "SmartDeviceLink service was not discovered on device " - << BluetoothDevice::GetUniqueDeviceId(device_address)); + SDL_LOG_INFO("SmartDeviceLink service was not discovered on device " + << BluetoothDevice::GetUniqueDeviceId(device_address)); } - LOG4CXX_TRACE(logger_, "exit with TRUE"); + SDL_LOG_TRACE("exit with TRUE"); return true; } void BluetoothDeviceScanner::Thread() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ready_ = true; if (auto_repeat_search_) { while (!shutdown_requested_) { @@ -453,10 +445,10 @@ void BluetoothDeviceScanner::Thread() { } void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (auto_repeat_pause_sec_ == 0) { - LOG4CXX_TRACE(logger_, "exit. Condition: auto_repeat_pause_sec_ == 0"); + SDL_LOG_TRACE("exit. Condition: auto_repeat_pause_sec_ == 0"); return; } @@ -467,7 +459,7 @@ void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() { device_scan_requested_cv_.WaitFor(auto_lock, auto_repeat_pause_sec_ * 1000); if (wait_status == sync_primitives::ConditionalVariable::kTimeout) { - LOG4CXX_INFO(logger_, "Bluetooth scanner timeout, performing scan"); + SDL_LOG_INFO("Bluetooth scanner timeout, performing scan"); device_scan_requested_ = true; } } @@ -475,17 +467,17 @@ void BluetoothDeviceScanner::TimedWaitForDeviceScanRequest() { } TransportAdapter::Error BluetoothDeviceScanner::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!thread_->Start()) { - LOG4CXX_ERROR(logger_, "Bluetooth device scanner thread start failed"); + SDL_LOG_ERROR("Bluetooth device scanner thread start failed"); return TransportAdapter::FAIL; } - LOG4CXX_INFO(logger_, "Bluetooth device scanner thread started"); + SDL_LOG_INFO("Bluetooth device scanner thread started"); return TransportAdapter::OK; } void BluetoothDeviceScanner::Terminate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); shutdown_requested_ = true; if (thread_) { { @@ -493,17 +485,16 @@ void BluetoothDeviceScanner::Terminate() { device_scan_requested_ = false; device_scan_requested_cv_.NotifyOne(); } - LOG4CXX_INFO(logger_, - "Waiting for bluetooth device scanner thread termination"); + SDL_LOG_INFO("Waiting for bluetooth device scanner thread termination"); thread_->Stop(threads::Thread::kThreadStopDelegate); - LOG4CXX_INFO(logger_, "Bluetooth device scanner thread stopped"); + SDL_LOG_INFO("Bluetooth device scanner thread stopped"); } } TransportAdapter::Error BluetoothDeviceScanner::Scan() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if ((!IsInitialised()) || shutdown_requested_) { - LOG4CXX_WARN(logger_, "BAD_STATE"); + SDL_LOG_WARN("BAD_STATE"); return TransportAdapter::BAD_STATE; } if (auto_repeat_pause_sec_ == 0) { @@ -513,12 +504,12 @@ TransportAdapter::Error BluetoothDeviceScanner::Scan() { sync_primitives::AutoLock auto_lock(device_scan_requested_lock_); if (!device_scan_requested_) { - LOG4CXX_TRACE(logger_, "Requesting device Scan"); + SDL_LOG_TRACE("Requesting device Scan"); device_scan_requested_ = true; device_scan_requested_cv_.NotifyOne(); } else { ret = TransportAdapter::BAD_STATE; - LOG4CXX_WARN(logger_, "BAD_STATE"); + SDL_LOG_WARN("BAD_STATE"); } return ret; } @@ -528,7 +519,7 @@ BluetoothDeviceScanner::BluetoothDeviceScannerDelegate:: : scanner_(scanner) {} void BluetoothDeviceScanner::BluetoothDeviceScannerDelegate::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(scanner_); scanner_->Thread(); } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc index 78597ac2ad..b527bf1ef0 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc @@ -48,7 +48,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") BluetoothSocketConnection::BluetoothSocketConnection( const DeviceUID& device_uid, @@ -61,8 +61,8 @@ BluetoothSocketConnection::~BluetoothSocketConnection() { } bool BluetoothSocketConnection::Establish(ConnectError** error) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "error: " << error); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("error: " << error); DeviceSptr device = controller()->FindDevice(device_handle()); BluetoothDevice* bluetooth_device = @@ -71,10 +71,9 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) { uint8_t rfcomm_channel; if (!bluetooth_device->GetRfcommChannel(application_handle(), &rfcomm_channel)) { - LOG4CXX_DEBUG(logger_, - "Application " << application_handle() << " not found"); + SDL_LOG_DEBUG("Application " << application_handle() << " not found"); *error = new ConnectError(); - LOG4CXX_TRACE(logger_, "exit with FALSE"); + SDL_LOG_TRACE("exit with FALSE"); return false; } @@ -89,25 +88,25 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) { int attempts = 4; int connect_status = 0; - LOG4CXX_DEBUG(logger_, "start rfcomm Connect attempts"); + SDL_LOG_DEBUG("start rfcomm Connect attempts"); do { rfcomm_socket = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); if (-1 == rfcomm_socket) { - LOG4CXX_ERROR_WITH_ERRNO( - logger_, + SDL_LOG_ERROR_WITH_ERRNO( + "Failed to create RFCOMM socket for device " << device_handle()); *error = new ConnectError(); - LOG4CXX_TRACE(logger_, "exit with FALSE"); + SDL_LOG_TRACE("exit with FALSE"); return false; } connect_status = ::connect(rfcomm_socket, (struct sockaddr*)&remoteSocketAddress, sizeof(remoteSocketAddress)); if (0 == connect_status) { - LOG4CXX_DEBUG(logger_, "rfcomm Connect ok"); + SDL_LOG_DEBUG("rfcomm Connect ok"); break; } else { // If connect_status is not 0, an errno is returned - LOG4CXX_WARN_WITH_ERRNO(logger_, "rfcomm Connect failed"); + SDL_LOG_WARN_WITH_ERRNO("rfcomm Connect failed"); close(rfcomm_socket); // Always close the socket upon error if (errno != ECONNREFUSED && errno != ECONNRESET) { break; @@ -115,20 +114,20 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) { } sleep(2); } while (--attempts > 0); - LOG4CXX_INFO(logger_, "rfcomm Connect attempts finished"); + SDL_LOG_INFO("rfcomm Connect attempts finished"); if (0 != connect_status) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Failed to Connect to remote device " - << BluetoothDevice::GetUniqueDeviceId(remoteSocketAddress.rc_bdaddr) - << " for session " << this); + << BluetoothDevice::GetUniqueDeviceId(remoteSocketAddress.rc_bdaddr) + << " for session " << this); *error = new ConnectError(); - LOG4CXX_TRACE(logger_, "exit with FALSE"); + SDL_LOG_TRACE("exit with FALSE"); return false; } set_socket(rfcomm_socket); - LOG4CXX_TRACE(logger_, "exit with TRUE"); + SDL_LOG_TRACE("exit with TRUE"); return true; } diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc index 41e77af5bd..abeb50e798 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc @@ -52,7 +52,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") BluetoothTransportAdapter::BluetoothTransportAdapter( resumption::LastStateWrapperPtr last_state_wrapper, @@ -69,7 +69,7 @@ DeviceType BluetoothTransportAdapter::GetDeviceType() const { } void BluetoothTransportAdapter::Store() const { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); Json::Value bluetooth_adapter_dictionary; Json::Value devices_dictionary; DeviceList device_ids = GetDeviceList(); @@ -116,11 +116,11 @@ void BluetoothTransportAdapter::Store() const { dictionary["TransportManager"]["BluetoothAdapter"] = bluetooth_adapter_dictionary; accessor.GetMutableData().set_dictionary(dictionary); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } bool BluetoothTransportAdapter::Restore() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); bool errors_occured = false; resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); @@ -159,9 +159,9 @@ bool BluetoothTransportAdapter::Restore() { } bool result = !errors_occured; if (result) { - LOG4CXX_TRACE(logger_, "exit with TRUE"); + SDL_LOG_TRACE("exit with TRUE"); } else { - LOG4CXX_TRACE(logger_, "exit with FALSE"); + SDL_LOG_TRACE("exit with FALSE"); } return result; } diff --git a/src/components/transport_manager/src/cloud/cloud_device.cc b/src/components/transport_manager/src/cloud/cloud_device.cc index 9225589d57..06a8e66495 100644 --- a/src/components/transport_manager/src/cloud/cloud_device.cc +++ b/src/components/transport_manager/src/cloud/cloud_device.cc @@ -37,7 +37,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") CloudDevice::CloudDevice(std::string& host, std::string& port, @@ -53,7 +53,7 @@ CloudDevice::CloudDevice(CloudAppEndpoint& endpoint, std::string& name) : Device(name, std::string(name)), endpoint_(endpoint) {} bool CloudDevice::IsSameAs(const Device* other) const { - LOG4CXX_TRACE(logger_, "enter. device: " << other); + SDL_LOG_TRACE("enter. device: " << other); const CloudDevice* other_cloud_device = dynamic_cast<const CloudDevice*>(other); diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc b/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc index d072685eef..a5d25c56c1 100644 --- a/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc +++ b/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc @@ -43,7 +43,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") CloudWebsocketConnectionFactory::CloudWebsocketConnectionFactory( TransportAdapterController* controller) @@ -55,7 +55,7 @@ TransportAdapter::Error CloudWebsocketConnectionFactory::Init() { TransportAdapter::Error CloudWebsocketConnectionFactory::CreateConnection( const DeviceUID& device_uid, const ApplicationHandle& app_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto connection = controller_->FindPendingConnection(device_uid, app_handle); std::shared_ptr<WebsocketClientConnection> ws_connection = @@ -66,8 +66,8 @@ TransportAdapter::Error CloudWebsocketConnectionFactory::CreateConnection( TransportAdapter::Error error = ws_connection->Start(); if (TransportAdapter::OK != error) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Cloud Websocket connection::Start() failed with error: " << error); } return error; diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc index 2d1de703b1..402a103910 100644 --- a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc +++ b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc @@ -41,7 +41,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") CloudWebsocketTransportAdapter::CloudWebsocketTransportAdapter( resumption::LastStateWrapperPtr last_state_wrapper, @@ -99,18 +99,18 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) { std::string str = uid; if (!boost::regex_search(str, results, group_pattern)) { - LOG4CXX_DEBUG(logger_, "Invalid Pattern: " << uid); + SDL_LOG_DEBUG("Invalid Pattern: " << uid); return; } - LOG4CXX_DEBUG(logger_, "#Results: " << results.size()); + SDL_LOG_DEBUG("#Results: " << results.size()); std::string results_str; for (size_t i = 0; i < results.size(); i++) { results_str += " R[" + std::to_string(i) + "]:"; results_str += (results[i].length() != 0) ? results[i] : std::string("<EMPTY>"); } - LOG4CXX_DEBUG(logger_, "Results: " << results_str); + SDL_LOG_DEBUG("Results: " << results_str); std::string device_id = uid; @@ -120,11 +120,10 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) { .query = results[9], .fragment = results[10]}; - LOG4CXX_DEBUG(logger_, - "Creating Cloud Device For Host: " - << endpoint.host << " at Port: " << endpoint.port - << " with Target: " - << (endpoint.path + endpoint.query + endpoint.fragment)); + SDL_LOG_DEBUG("Creating Cloud Device For Host: " + << endpoint.host << " at Port: " << endpoint.port + << " with Target: " + << (endpoint.path + endpoint.query + endpoint.fragment)); auto cloud_device = std::make_shared<CloudDevice>(endpoint, device_id); diff --git a/src/components/transport_manager/src/cloud/websocket_client_connection.cc b/src/components/transport_manager/src/cloud/websocket_client_connection.cc index 81e503131f..f6b791f886 100644 --- a/src/components/transport_manager/src/cloud/websocket_client_connection.cc +++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc @@ -40,7 +40,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") WebsocketClientConnection::WebsocketClientConnection( const DeviceUID& device_uid, @@ -80,7 +80,7 @@ void WebsocketClientConnection::AddCertificateAuthority( #endif // ENABLE_SECURITY TransportAdapter::Error WebsocketClientConnection::Start() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeviceSptr device = controller_->FindDevice(device_uid_); CloudDevice* cloud_device = static_cast<CloudDevice*>(device.get()); CloudWebsocketTransportAdapter* cloud_ta = @@ -90,23 +90,20 @@ TransportAdapter::Error WebsocketClientConnection::Start() { auto const port = cloud_device->GetPort(); boost::system::error_code ec; - LOG4CXX_DEBUG(logger_, "Cloud app endpoint: " << cloud_properties.endpoint); - LOG4CXX_DEBUG(logger_, - "Cloud app certificate: " << cloud_properties.certificate); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG("Cloud app endpoint: " << cloud_properties.endpoint); + SDL_LOG_DEBUG("Cloud app certificate: " << cloud_properties.certificate); + SDL_LOG_DEBUG( "Cloud app authentication token: " << cloud_properties.auth_token); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Cloud app transport type: " << cloud_properties.cloud_transport_type); - LOG4CXX_DEBUG(logger_, - "Cloud app hybrid app preference: " - << cloud_properties.hybrid_app_preference); + SDL_LOG_DEBUG("Cloud app hybrid app preference: " + << cloud_properties.hybrid_app_preference); auto const results = resolver_.resolve(host, port, ec); if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR(logger_, "Could not resolve host/port: " << str_err); + SDL_LOG_ERROR("Could not resolve host/port: " << str_err); return TransportAdapter::FAIL; } @@ -123,9 +120,8 @@ TransportAdapter::Error WebsocketClientConnection::Start() { if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR(logger_, - "Could not connect to websocket: " << host << ":" << port); - LOG4CXX_ERROR(logger_, str_err); + SDL_LOG_ERROR("Could not connect to websocket: " << host << ":" << port); + SDL_LOG_ERROR(str_err); return TransportAdapter::FAIL; } @@ -135,10 +131,9 @@ TransportAdapter::Error WebsocketClientConnection::Start() { if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR(logger_, - "Failed to add certificate authority: " - << cloud_properties.certificate); - LOG4CXX_ERROR(logger_, str_err); + SDL_LOG_ERROR("Failed to add certificate authority: " + << cloud_properties.certificate); + SDL_LOG_ERROR(str_err); Shutdown(); return TransportAdapter::FAIL; } @@ -148,10 +143,9 @@ TransportAdapter::Error WebsocketClientConnection::Start() { if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR(logger_, - "Could not complete SSL Handshake failed with host/port: " - << host << ":" << port); - LOG4CXX_ERROR(logger_, str_err); + SDL_LOG_ERROR("Could not complete SSL Handshake failed with host/port: " + << host << ":" << port); + SDL_LOG_ERROR(str_err); Shutdown(); return TransportAdapter::FAIL; } @@ -169,10 +163,10 @@ TransportAdapter::Error WebsocketClientConnection::Start() { #endif // ENABLE_SECURITY if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Could not complete handshake with host/port: " << host << ":" << port); - LOG4CXX_ERROR(logger_, str_err); + SDL_LOG_ERROR(str_err); return TransportAdapter::FAIL; } @@ -208,8 +202,8 @@ TransportAdapter::Error WebsocketClientConnection::Start() { boost::asio::post(io_pool_, [&]() { ioc_.run(); }); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Successfully started websocket connection @: " << host << ":" << port); return TransportAdapter::OK; } @@ -221,7 +215,7 @@ void WebsocketClientConnection::Recv(boost::system::error_code ec) { if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR(logger_, str_err); + SDL_LOG_ERROR(str_err); Shutdown(); return; } @@ -248,7 +242,7 @@ void WebsocketClientConnection::OnRead(boost::system::error_code ec, boost::ignore_unused(bytes_transferred); if (ec) { std::string str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR(logger_, str_err); + SDL_LOG_ERROR(str_err); ws_.lowest_layer().close(); ioc_.stop(); Shutdown(); @@ -271,20 +265,20 @@ void WebsocketClientConnection::OnRead(boost::system::error_code ec, TransportAdapter::Error WebsocketClientConnection::SendData( ::protocol_handler::RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); message_queue_.push(message); return TransportAdapter::OK; } TransportAdapter::Error WebsocketClientConnection::Disconnect() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Shutdown(); return TransportAdapter::OK; } void WebsocketClientConnection::Shutdown() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); shutdown_ = true; if (thread_delegate_) { @@ -338,7 +332,7 @@ void WebsocketClientConnection::LoopThreadDelegate::DrainQueue() { } #endif // ENABLE_SECURITY if (ec) { - LOG4CXX_ERROR(logger_, "Error writing to websocket"); + SDL_LOG_ERROR("Error writing to websocket"); handler_.controller_->DataSendFailed(handler_.device_uid_, handler_.app_handle_, message_ptr, diff --git a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc index e509252dec..9fe79cade1 100644 --- a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc +++ b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc @@ -50,7 +50,7 @@ static const auto out_signals_channel = "iap_signals_out"; namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "IAP2Emulation"); +SDL_CREATE_LOG_VARIABLE("IAP2Emulation"); IAP2BluetoothEmulationTransportAdapter::IAP2BluetoothEmulationTransportAdapter( const uint16_t port, @@ -60,7 +60,7 @@ IAP2BluetoothEmulationTransportAdapter::IAP2BluetoothEmulationTransportAdapter( void IAP2BluetoothEmulationTransportAdapter::DeviceSwitched( const DeviceUID& device_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); UNUSED(device_handle); DCHECK(!"Switching for iAP2 Bluetooth is not supported."); } @@ -84,7 +84,7 @@ IAP2USBEmulationTransportAdapter::IAP2USBEmulationTransportAdapter( signal_handler_->Start(); const auto result = mkfifo(out_signals_channel, mode); UNUSED(result); - LOG4CXX_DEBUG(logger_, "Out signals channel creation result: " << result); + SDL_LOG_DEBUG("Out signals channel creation result: " << result); } IAP2USBEmulationTransportAdapter::~IAP2USBEmulationTransportAdapter() { @@ -93,31 +93,31 @@ IAP2USBEmulationTransportAdapter::~IAP2USBEmulationTransportAdapter() { signal_handler_->SetDelegate(NULL); delete delegate; threads::DeleteThread(signal_handler_); - LOG4CXX_DEBUG(logger_, "Out close result: " << close(out_)); - LOG4CXX_DEBUG(logger_, "Out unlink result: " << unlink(out_signals_channel)); + SDL_LOG_DEBUG("Out close result: " << close(out_)); + SDL_LOG_DEBUG("Out unlink result: " << unlink(out_signals_channel)); } void IAP2USBEmulationTransportAdapter::DeviceSwitched( const DeviceUID& device_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); UNUSED(device_handle); const auto switch_signal_ack = std::string("SDL_TRANSPORT_SWITCH_ACK\n"); auto out_ = open(out_signals_channel, O_WRONLY); - LOG4CXX_DEBUG(logger_, "Out channel descriptor: " << out_); + SDL_LOG_DEBUG("Out channel descriptor: " << out_); if (out_ < 0) { - LOG4CXX_ERROR(logger_, "Failed to open out signals channel"); + SDL_LOG_ERROR("Failed to open out signals channel"); return; } const auto bytes = write(out_, switch_signal_ack.c_str(), switch_signal_ack.size()); UNUSED(bytes); - LOG4CXX_DEBUG(logger_, "Written bytes to out: " << bytes); + SDL_LOG_DEBUG("Written bytes to out: " << bytes); - LOG4CXX_DEBUG(logger_, "Switching signal ACK is sent"); - LOG4CXX_DEBUG(logger_, "iAP2 USB device is switched with iAP2 Bluetooth"); + SDL_LOG_DEBUG("Switching signal ACK is sent"); + SDL_LOG_DEBUG("iAP2 USB device is switched with iAP2 Bluetooth"); close(out_); } @@ -135,19 +135,19 @@ IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate:: : adapter_(adapter), run_flag_(true), in_(0) { const auto result = mkfifo(in_signals_channel, mode); UNUSED(result); - LOG4CXX_DEBUG(logger_, "In signals channel creation result: " << result); + SDL_LOG_DEBUG("In signals channel creation result: " << result); } void IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Signal handling is started"); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Signal handling is started"); const auto switch_signal = "SDL_TRANSPORT_SWITCH"; - LOG4CXX_DEBUG(logger_, "Waiting for signal: " << switch_signal); + SDL_LOG_DEBUG("Waiting for signal: " << switch_signal); in_ = open(in_signals_channel, O_RDONLY); - LOG4CXX_DEBUG(logger_, "In channel descriptor: " << in_); + SDL_LOG_DEBUG("In channel descriptor: " << in_); if (in_ < 0) { - LOG4CXX_ERROR(logger_, "Failed to open in signals channel"); + SDL_LOG_ERROR("Failed to open in signals channel"); return; } @@ -159,26 +159,26 @@ void IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate::threadMain() { continue; } if (-1 == bytes) { - LOG4CXX_DEBUG(logger_, "Error during input pipe read"); + SDL_LOG_DEBUG("Error during input pipe read"); break; } - LOG4CXX_DEBUG(logger_, "Read in bytes: " << bytes); + SDL_LOG_DEBUG("Read in bytes: " << bytes); buffer[bytes] = '\0'; std::string str(buffer); if (std::string::npos != str.find(switch_signal)) { - LOG4CXX_DEBUG(logger_, "Switch signal received."); + SDL_LOG_DEBUG("Switch signal received."); adapter_.DoTransportSwitch(); } } - LOG4CXX_DEBUG(logger_, "In close result: " << close(in_)); - LOG4CXX_DEBUG(logger_, "In unlink result: " << unlink(in_signals_channel)); + SDL_LOG_DEBUG("In close result: " << close(in_)); + SDL_LOG_DEBUG("In unlink result: " << unlink(in_signals_channel)); } void IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate:: exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Stopping signal handling."); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Stopping signal handling."); run_flag_ = false; ThreadDelegate::exitThreadMain(); } diff --git a/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc b/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc index 85c479134d..3c2df28aca 100644 --- a/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc +++ b/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc @@ -4,37 +4,37 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") NetworkInterfaceListenerImpl::NetworkInterfaceListenerImpl( TcpClientListener* tcp_client_listener, const std::string designated_interface) : platform_specific_impl_(new PlatformSpecificNetworkInterfaceListener( tcp_client_listener, designated_interface)) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } NetworkInterfaceListenerImpl::~NetworkInterfaceListenerImpl() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } bool NetworkInterfaceListenerImpl::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return platform_specific_impl_->Init(); } void NetworkInterfaceListenerImpl::Deinit() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); platform_specific_impl_->Deinit(); } bool NetworkInterfaceListenerImpl::Start() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return platform_specific_impl_->Start(); } bool NetworkInterfaceListenerImpl::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return platform_specific_impl_->Stop(); } diff --git a/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc b/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc index 8eaaca868a..8da69b5f6b 100644 --- a/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc +++ b/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc @@ -21,7 +21,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") static bool SetNonblocking(int s); @@ -93,7 +93,7 @@ PlatformSpecificNetworkInterfaceListener:: PlatformSpecificNetworkInterfaceListener:: ~PlatformSpecificNetworkInterfaceListener() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Stop(); Deinit(); @@ -103,21 +103,21 @@ PlatformSpecificNetworkInterfaceListener:: } bool PlatformSpecificNetworkInterfaceListener::Init() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Init socket: " << socket_); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Init socket: " << socket_); if (socket_ >= 0) { - LOG4CXX_WARN(logger_, "Network interface listener is already initialized"); + SDL_LOG_WARN("Network interface listener is already initialized"); return false; } socket_ = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (socket_ == -1) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create netlink socket"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to create netlink socket"); return false; } if (!SetNonblocking(socket_)) { - LOG4CXX_WARN(logger_, "Failed to configure netlink socket to non-blocking"); + SDL_LOG_WARN("Failed to configure netlink socket to non-blocking"); } struct sockaddr_nl addr; @@ -128,29 +128,29 @@ bool PlatformSpecificNetworkInterfaceListener::Init() { addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR; if (bind(socket_, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) != 0) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to bind netlink socket"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to bind netlink socket"); close(socket_); socket_ = -1; return false; } if (pipe(pipe_fds_) != 0) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create internal pipe"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to create internal pipe"); close(socket_); socket_ = -1; return false; } if (!SetNonblocking(pipe_fds_[0])) { - LOG4CXX_WARN(logger_, "Failed to configure pipe to non-blocking"); + SDL_LOG_WARN("Failed to configure pipe to non-blocking"); } return true; } void PlatformSpecificNetworkInterfaceListener::Deinit() { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Deinit socket: " << socket_); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Deinit socket: " << socket_); if (socket_ >= 0) { close(socket_); socket_ = -1; @@ -166,43 +166,43 @@ void PlatformSpecificNetworkInterfaceListener::Deinit() { } bool PlatformSpecificNetworkInterfaceListener::Start() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (socket_ < 0) { - LOG4CXX_WARN(logger_, "Interface listener is not initialized"); + SDL_LOG_WARN("Interface listener is not initialized"); return false; } if (thread_->IsRunning()) { - LOG4CXX_WARN(logger_, "Interface listener is already started"); + SDL_LOG_WARN("Interface listener is already started"); return false; } if (!thread_->Start()) { - LOG4CXX_ERROR(logger_, "Failed to start interface listener"); + SDL_LOG_ERROR("Failed to start interface listener"); return false; } - LOG4CXX_INFO(logger_, "Network interface listener started"); + SDL_LOG_INFO("Network interface listener started"); return true; } bool PlatformSpecificNetworkInterfaceListener::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!thread_->IsRunning()) { - LOG4CXX_DEBUG(logger_, "interface listener is not running"); + SDL_LOG_DEBUG("interface listener is not running"); return false; } thread_->Stop(threads::Thread::kThreadStopDelegate); - LOG4CXX_INFO(logger_, "Network interface listener stopped"); + SDL_LOG_INFO("Network interface listener stopped"); return true; } void PlatformSpecificNetworkInterfaceListener::Loop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Initialize status_table_ by acquiring a list of interfaces and their // current statuses. Also we will notify an event to the listener if IP @@ -227,8 +227,7 @@ void PlatformSpecificNetworkInterfaceListener::Loop() { if (errno == EINTR) { continue; } else { - LOG4CXX_WARN(logger_, - "select failed for netlink. Aborting interface listener."); + SDL_LOG_WARN("select failed for netlink. Aborting interface listener."); break; } } @@ -239,17 +238,15 @@ void PlatformSpecificNetworkInterfaceListener::Loop() { ret = read(pipe_fds_[0], buf, sizeof(buf)); if (ret < 0) { if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Failed to read from pipe. Aborting interface listener."); break; } } else if (ret == 0) { - LOG4CXX_WARN(logger_, - "Pipe disconnected. Aborting interface listener."); + SDL_LOG_WARN("Pipe disconnected. Aborting interface listener."); break; } else { - LOG4CXX_DEBUG(logger_, "received terminating event through pipe"); + SDL_LOG_DEBUG("received terminating event through pipe"); break; } } @@ -265,14 +262,13 @@ void PlatformSpecificNetworkInterfaceListener::Loop() { ret = recv(socket_, buf, sizeof(buf), 0); if (ret < 0) { if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) { - LOG4CXX_WARN(logger_, - "Failed to read from netlink socket. Aborting interface " - "listener."); + SDL_LOG_WARN( + "Failed to read from netlink socket. Aborting interface " + "listener."); break; } } else if (ret == 0) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Netlink socket disconnected. Aborting interface listener."); break; } else { @@ -283,7 +279,7 @@ void PlatformSpecificNetworkInterfaceListener::Loop() { // time so we use for-loop to go through. for (; NLMSG_OK(header, len); header = NLMSG_NEXT(header, len)) { if (header->nlmsg_type == NLMSG_ERROR) { - LOG4CXX_WARN(logger_, "received error event from netlink"); + SDL_LOG_WARN("received error event from netlink"); break; } @@ -325,20 +321,20 @@ void PlatformSpecificNetworkInterfaceListener::Loop() { } bool PlatformSpecificNetworkInterfaceListener::StopLoop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); - LOG4CXX_INFO(logger_, "Stopping network interface listener"); + SDL_LOG_INFO("Stopping network interface listener"); if (pipe_fds_[1] < 0) { - LOG4CXX_WARN(logger_, "StopLoop called in invalid state"); + SDL_LOG_WARN("StopLoop called in invalid state"); return false; } char dummy[1] = {0}; int ret = write(pipe_fds_[1], dummy, sizeof(dummy)); if (ret <= 0) { - LOG4CXX_WARN_WITH_ERRNO( - logger_, "Failed to send stop message to interface listener"); + SDL_LOG_WARN_WITH_ERRNO( + "Failed to send stop message to interface listener"); return false; } @@ -346,7 +342,7 @@ bool PlatformSpecificNetworkInterfaceListener::StopLoop() { } bool PlatformSpecificNetworkInterfaceListener::InitializeStatus() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef BUILD_TESTS if (testing_) { @@ -357,9 +353,9 @@ bool PlatformSpecificNetworkInterfaceListener::InitializeStatus() { struct ifaddrs *if_list, *interface; if (getifaddrs(&if_list) != 0) { - LOG4CXX_WARN(logger_, - "getifaddr failed, interface status won't be available until " - "a change occurs"); + SDL_LOG_WARN( + "getifaddr failed, interface status won't be available until " + "a change occurs"); return false; } @@ -405,14 +401,14 @@ bool PlatformSpecificNetworkInterfaceListener::InitializeStatus() { freeifaddrs(if_list); - LOG4CXX_DEBUG(logger_, "Successfully acquired network interface status"); + SDL_LOG_DEBUG("Successfully acquired network interface status"); DumpTable(); return true; } bool PlatformSpecificNetworkInterfaceListener::UpdateStatus( uint16_t type, std::vector<EventParam>& params) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (std::vector<EventParam>::iterator it = params.begin(); it != params.end(); @@ -421,16 +417,16 @@ bool PlatformSpecificNetworkInterfaceListener::UpdateStatus( switch (type) { case RTM_NEWLINK: { const std::string& ifname = GetInterfaceName(it->if_index); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "netlink event: interface " << ifname << " created or updated"); status.SetName(ifname); status.SetFlags(it->flags); break; } case RTM_DELLINK: - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "netlink event: interface " << status.GetName() << " removed"); status_table_.erase(it->if_index); break; @@ -439,37 +435,33 @@ bool PlatformSpecificNetworkInterfaceListener::UpdateStatus( if (addr->sa_family == AF_INET) { sockaddr_in* addr_in = reinterpret_cast<sockaddr_in*>(addr); status.SetIPv4Address(&addr_in->sin_addr); - LOG4CXX_DEBUG(logger_, - "netlink event: IPv4 address of interface " - << status.GetName() << " updated to " - << status.GetIPv4Address()); + SDL_LOG_DEBUG("netlink event: IPv4 address of interface " + << status.GetName() << " updated to " + << status.GetIPv4Address()); } else if (addr->sa_family == AF_INET6) { sockaddr_in6* addr_in6 = reinterpret_cast<sockaddr_in6*>(addr); status.SetIPv6Address(&addr_in6->sin6_addr); - LOG4CXX_DEBUG(logger_, - "netlink event: IPv6 address of interface " - << status.GetName() << " updated to " - << status.GetIPv6Address()); + SDL_LOG_DEBUG("netlink event: IPv6 address of interface " + << status.GetName() << " updated to " + << status.GetIPv6Address()); } break; } case RTM_DELADDR: { sockaddr* addr = reinterpret_cast<sockaddr*>(&it->address); if (addr->sa_family == AF_INET) { - LOG4CXX_DEBUG(logger_, - "netlink event: IPv4 address of interface " - << status.GetName() << " removed"); + SDL_LOG_DEBUG("netlink event: IPv4 address of interface " + << status.GetName() << " removed"); status.SetIPv4Address(NULL); } else if (addr->sa_family == AF_INET6) { - LOG4CXX_DEBUG(logger_, - "netlink event: IPv6 address of interface " - << status.GetName() << " removed"); + SDL_LOG_DEBUG("netlink event: IPv6 address of interface " + << status.GetName() << " removed"); status.SetIPv6Address(NULL); } break; } default: - LOG4CXX_WARN(logger_, "Unsupported netlink event (" << type << ")"); + SDL_LOG_WARN("Unsupported netlink event (" << type << ")"); break; } } @@ -477,7 +469,7 @@ bool PlatformSpecificNetworkInterfaceListener::UpdateStatus( } void PlatformSpecificNetworkInterfaceListener::NotifyIPAddresses() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::string ipv4_addr; std::string ipv6_addr; @@ -498,11 +490,9 @@ void PlatformSpecificNetworkInterfaceListener::NotifyIPAddresses() { } if (notified_ipv4_addr_ != ipv4_addr || notified_ipv6_addr_ != ipv6_addr) { - LOG4CXX_INFO(logger_, - "IP address updated: \"" << notified_ipv4_addr_ << "\" -> \"" - << ipv4_addr << "\", \"" - << notified_ipv6_addr_ << "\" -> \"" - << ipv6_addr << "\""); + SDL_LOG_INFO("IP address updated: \"" + << notified_ipv4_addr_ << "\" -> \"" << ipv4_addr << "\", \"" + << notified_ipv6_addr_ << "\" -> \"" << ipv6_addr << "\""); notified_ipv4_addr_ = ipv4_addr; notified_ipv6_addr_ = ipv6_addr; @@ -513,7 +503,7 @@ void PlatformSpecificNetworkInterfaceListener::NotifyIPAddresses() { } const std::string PlatformSpecificNetworkInterfaceListener::SelectInterface() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!designated_interface_.empty()) { return designated_interface_; @@ -548,8 +538,7 @@ const std::string PlatformSpecificNetworkInterfaceListener::SelectInterface() { } selected_interface_ = status.GetName(); - LOG4CXX_DEBUG(logger_, - "selecting network interface: " << selected_interface_); + SDL_LOG_DEBUG("selecting network interface: " << selected_interface_); return selected_interface_; } @@ -560,7 +549,7 @@ const std::string PlatformSpecificNetworkInterfaceListener::SelectInterface() { std::vector<PlatformSpecificNetworkInterfaceListener::EventParam> PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage( struct ifaddrmsg* message, unsigned int size) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::vector<EventParam> params; @@ -577,8 +566,7 @@ PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage( if (message->ifa_family == AF_INET) { // make sure the size of data is >= 4 bytes if (RTA_PAYLOAD(attr) < sizeof(struct in_addr)) { - LOG4CXX_DEBUG(logger_, - "Invalid netlink event: insufficient IPv4 address data"); + SDL_LOG_DEBUG("Invalid netlink event: insufficient IPv4 address data"); continue; } @@ -594,8 +582,7 @@ PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage( } else if (message->ifa_family == AF_INET6) { // make sure the size of data is >= 16 bytes if (RTA_PAYLOAD(attr) < sizeof(struct in6_addr)) { - LOG4CXX_DEBUG(logger_, - "Invalid netlink event: insufficient IPv6 address data"); + SDL_LOG_DEBUG("Invalid netlink event: insufficient IPv6 address data"); continue; } @@ -609,8 +596,7 @@ PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage( sockaddr->sin6_addr = *ipv6_addr; } else { - LOG4CXX_WARN(logger_, - "Unsupported family (" << message->ifa_family << ")"); + SDL_LOG_WARN("Unsupported family (" << message->ifa_family << ")"); continue; } @@ -621,20 +607,18 @@ PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage( } void PlatformSpecificNetworkInterfaceListener::DumpTable() const { - LOG4CXX_DEBUG(logger_, - "Number of network interfaces: " << status_table_.size()); + SDL_LOG_DEBUG("Number of network interfaces: " << status_table_.size()); for (auto it = status_table_.begin(); it != status_table_.end(); ++it) { const InterfaceStatus& status = it->second; UNUSED(status); - LOG4CXX_DEBUG( - logger_, - " " << status.GetName() << " : flags=" << status.GetFlags() - << " : available: " << (status.IsAvailable() ? "yes" : "no") - << " IPv4: " << status.GetIPv4Address() - << " IPv6: " << status.GetIPv6Address() - << (status.IsLoopback() ? " (loopback)" : "")); + SDL_LOG_DEBUG(" " << status.GetName() << " : flags=" << status.GetFlags() + << " : available: " + << (status.IsAvailable() ? "yes" : "no") + << " IPv4: " << status.GetIPv4Address() + << " IPv6: " << status.GetIPv6Address() + << (status.IsLoopback() ? " (loopback)" : "")); } } @@ -677,14 +661,13 @@ void PlatformSpecificNetworkInterfaceListener::ListenerThreadDelegate:: static bool SetNonblocking(int s) { int prev_flag = fcntl(s, F_GETFL, 0); if (prev_flag == -1) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to acquire socket flag"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to acquire socket flag"); return false; } int ret = fcntl(s, F_SETFL, prev_flag | O_NONBLOCK); if (ret == -1) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Failed to configure socket to non-blocking"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to configure socket to non-blocking"); return false; } diff --git a/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc b/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc index 15b3814999..27046dab0b 100644 --- a/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc +++ b/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc @@ -3,7 +3,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") PlatformSpecificNetworkInterfaceListener:: PlatformSpecificNetworkInterfaceListener( @@ -12,25 +12,25 @@ PlatformSpecificNetworkInterfaceListener:: PlatformSpecificNetworkInterfaceListener:: ~PlatformSpecificNetworkInterfaceListener() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } bool PlatformSpecificNetworkInterfaceListener::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return true; } void PlatformSpecificNetworkInterfaceListener::Deinit() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } bool PlatformSpecificNetworkInterfaceListener::Start() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return true; } bool PlatformSpecificNetworkInterfaceListener::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return true; } diff --git a/src/components/transport_manager/src/tcp/tcp_client_listener.cc b/src/components/transport_manager/src/tcp/tcp_client_listener.cc index adc6ab3f18..0812cd39c9 100644 --- a/src/components/transport_manager/src/tcp/tcp_client_listener.cc +++ b/src/components/transport_manager/src/tcp/tcp_client_listener.cc @@ -66,7 +66,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") static bool SetNonblocking(int s); @@ -96,7 +96,7 @@ TcpClientListener::TcpClientListener(TransportAdapterController* controller, } TransportAdapter::Error TcpClientListener::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); thread_stop_requested_ = false; if (!IsListeningOnSpecificInterface()) { @@ -104,17 +104,15 @@ TransportAdapter::Error TcpClientListener::Init() { // using INADDR_ANY. If socket creation fails, we will treat it an error. socket_ = CreateIPv4ServerSocket(port_); if (-1 == socket_) { - LOG4CXX_ERROR(logger_, "Failed to create TCP socket"); + SDL_LOG_ERROR("Failed to create TCP socket"); return TransportAdapter::FAIL; } } else { // Network interface is specified and we will listen only on the interface. // In this case, the server socket will be created once // NetworkInterfaceListener notifies the interface's IP address. - LOG4CXX_INFO(logger_, - "TCP server socket will listen on " - << designated_interface_ - << " once it has an IPv4 address."); + SDL_LOG_INFO("TCP server socket will listen on " + << designated_interface_ << " once it has an IPv4 address."); } if (!interface_listener_->Init()) { @@ -130,7 +128,7 @@ TransportAdapter::Error TcpClientListener::Init() { } void TcpClientListener::Terminate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!initialized_) { return; @@ -154,7 +152,7 @@ bool TcpClientListener::IsInitialised() const { } TcpClientListener::~TcpClientListener() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); StopListening(); delete thread_->GetDelegate(); threads::DeleteThread(thread_); @@ -163,8 +161,8 @@ TcpClientListener::~TcpClientListener() { } void SetKeepaliveOptions(const int fd) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "fd: " << fd); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("fd: " << fd); int yes = 1; int keepidle = 3; // 3 seconds to disconnection detecting int keepcnt = 5; @@ -172,26 +170,26 @@ void SetKeepaliveOptions(const int fd) { #ifdef __linux__ int user_timeout = 7000; // milliseconds if (0 != setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &yes, sizeof(yes))) { - LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt SO_KEEPALIVE failed"); + SDL_LOG_WARN_WITH_ERRNO("setsockopt SO_KEEPALIVE failed"); } if (0 != setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepidle, sizeof(keepidle))) { - LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_KEEPIDLE failed"); + SDL_LOG_WARN_WITH_ERRNO("setsockopt TCP_KEEPIDLE failed"); } if (0 != setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &keepcnt, sizeof(keepcnt))) { - LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_KEEPCNT failed"); + SDL_LOG_WARN_WITH_ERRNO("setsockopt TCP_KEEPCNT failed"); } if (0 != setsockopt( fd, IPPROTO_TCP, TCP_KEEPINTVL, &keepintvl, sizeof(keepintvl))) { - LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_KEEPINTVL failed"); + SDL_LOG_WARN_WITH_ERRNO("setsockopt TCP_KEEPINTVL failed"); } if (0 != setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &user_timeout, sizeof(user_timeout))) { - LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_USER_TIMEOUT failed"); + SDL_LOG_WARN_WITH_ERRNO("setsockopt TCP_USER_TIMEOUT failed"); } #elif defined(__QNX__) // __linux__ // TODO(KKolodiy): Out of order! @@ -224,7 +222,7 @@ void SetKeepaliveOptions(const int fd) { } void TcpClientListener::Loop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); fd_set rfds; char dummy[16]; std::vector<DeviceUID> device_uid_list; @@ -240,7 +238,7 @@ void TcpClientListener::Loop() { if (errno == EINTR) { continue; } else { - LOG4CXX_WARN(logger_, "select failed for TCP server socket"); + SDL_LOG_WARN("select failed for TCP server socket"); break; } } @@ -249,18 +247,16 @@ void TcpClientListener::Loop() { ret = read(pipe_fds_[0], dummy, sizeof(dummy)); if (ret < 0) { if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Failed to read from pipe, aborting TCP server socket loop."); break; } } else if (ret == 0) { - LOG4CXX_WARN(logger_, - "Pipe disconnected, aborting TCP server socket loop."); + SDL_LOG_WARN("Pipe disconnected, aborting TCP server socket loop."); break; } else { - LOG4CXX_DEBUG(logger_, - "received stop command of TCP server socket loop"); + SDL_LOG_DEBUG("received stop command of TCP server socket loop"); break; } } @@ -271,18 +267,18 @@ void TcpClientListener::Loop() { const int connection_fd = accept( socket_, (struct sockaddr*)&client_address, &client_address_size); if (thread_stop_requested_) { - LOG4CXX_DEBUG(logger_, "thread_stop_requested_"); + SDL_LOG_DEBUG("thread_stop_requested_"); close(connection_fd); break; } if (connection_fd < 0) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "accept() failed"); + SDL_LOG_ERROR_WITH_ERRNO("accept() failed"); continue; } if (AF_INET != client_address.sin_family) { - LOG4CXX_DEBUG(logger_, "Address of connected client is invalid"); + SDL_LOG_DEBUG("Address of connected client is invalid"); close(connection_fd); continue; } @@ -292,8 +288,8 @@ void TcpClientListener::Loop() { strncpy(device_name, inet_ntoa(client_address.sin_addr), size); device_name[size - 1] = '\0'; - LOG4CXX_INFO(logger_, "Connected client " << device_name); - LOG4CXX_INFO(logger_, "Port is: " << port_); + SDL_LOG_INFO("Connected client " << device_name); + SDL_LOG_INFO("Port is: " << port_); if (enable_keepalive_) { SetKeepaliveOptions(connection_fd); @@ -323,8 +319,7 @@ void TcpClientListener::Loop() { connection->set_socket(connection_fd); const TransportAdapter::Error error = connection->Start(); if (TransportAdapter::OK != error) { - LOG4CXX_ERROR(logger_, - "TCP connection::Start() failed with error: " << error); + SDL_LOG_ERROR("TCP connection::Start() failed with error: " << error); } else { device_uid_list.push_back(device->unique_device_id()); } @@ -338,13 +333,13 @@ void TcpClientListener::Loop() { controller_->DeviceDisconnected(*it, DisconnectDeviceError()); } } - LOG4CXX_INFO(logger_, "TCP server socket loop is terminated."); + SDL_LOG_INFO("TCP server socket loop is terminated."); } void TcpClientListener::StopLoop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (pipe_fds_[1] < 0) { - LOG4CXX_WARN(logger_, "StopLoop called in invalid state"); + SDL_LOG_WARN("StopLoop called in invalid state"); return; } @@ -353,16 +348,15 @@ void TcpClientListener::StopLoop() { char dummy[1] = {0}; int ret = write(pipe_fds_[1], dummy, sizeof(dummy)); if (ret <= 0) { - LOG4CXX_WARN_WITH_ERRNO( - logger_, "Failed to send stop message to TCP server socket loop"); + SDL_LOG_WARN_WITH_ERRNO( + "Failed to send stop message to TCP server socket loop"); } } TransportAdapter::Error TcpClientListener::StartListening() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (started_) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "TransportAdapter::BAD_STATE. Listener has already been started"); return TransportAdapter::BAD_STATE; } @@ -374,32 +368,32 @@ TransportAdapter::Error TcpClientListener::StartListening() { if (!IsListeningOnSpecificInterface()) { TransportAdapter::Error ret = StartListeningThread(); if (TransportAdapter::OK != ret) { - LOG4CXX_ERROR(logger_, "Tcp client listener thread start failed"); + SDL_LOG_ERROR("Tcp client listener thread start failed"); interface_listener_->Stop(); return ret; } } started_ = true; - LOG4CXX_INFO(logger_, "Tcp client listener has started successfully"); + SDL_LOG_INFO("Tcp client listener has started successfully"); return TransportAdapter::OK; } TransportAdapter::Error TcpClientListener::ResumeListening() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); interface_listener_->Init(); StartListeningThread(); started_ = true; - LOG4CXX_INFO(logger_, "Tcp client listener was resumed successfully"); + SDL_LOG_INFO("Tcp client listener was resumed successfully"); return TransportAdapter::OK; } TransportAdapter::Error TcpClientListener::StopListening() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!started_) { - LOG4CXX_DEBUG(logger_, "TcpClientListener is not running now"); + SDL_LOG_DEBUG("TcpClientListener is not running now"); return TransportAdapter::BAD_STATE; } @@ -408,30 +402,30 @@ TransportAdapter::Error TcpClientListener::StopListening() { StopListeningThread(); started_ = false; - LOG4CXX_INFO(logger_, "Tcp client listener was stopped successfully"); + SDL_LOG_INFO("Tcp client listener was stopped successfully"); return TransportAdapter::OK; } TransportAdapter::Error TcpClientListener::SuspendListening() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!started_) { - LOG4CXX_DEBUG(logger_, "TcpClientListener is not running now"); + SDL_LOG_DEBUG("TcpClientListener is not running now"); return TransportAdapter::BAD_STATE; } if (shutdown(socket_, SHUT_RDWR) != 0) { - LOG4CXX_WARN(logger_, "Socket was unable to be shutdowned"); + SDL_LOG_WARN("Socket was unable to be shutdowned"); } if (close(socket_) != 0) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to close socket"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to close socket"); } interface_listener_->Deinit(); StopListeningThread(); started_ = false; - LOG4CXX_INFO(logger_, "Tcp client listener was suspended"); + SDL_LOG_INFO("Tcp client listener was suspended"); return TransportAdapter::OK; } @@ -448,7 +442,7 @@ TcpClientListener::ListeningThreadDelegate::ListeningThreadDelegate( : parent_(parent) {} TransportAdapter::Error TcpClientListener::StartListeningThread() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // StartListening() can be called from multiple threads sync_primitives::AutoLock auto_lock(start_stop_lock_); @@ -457,11 +451,11 @@ TransportAdapter::Error TcpClientListener::StartListeningThread() { // recreate the pipe every time, so that the thread loop will not get // leftover data inside pipe after it is started if (pipe(pipe_fds_) != 0) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create internal pipe"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to create internal pipe"); return TransportAdapter::FAIL; } if (!SetNonblocking(pipe_fds_[0])) { - LOG4CXX_WARN(logger_, "Failed to configure pipe to non-blocking"); + SDL_LOG_WARN("Failed to configure pipe to non-blocking"); } } @@ -474,7 +468,7 @@ TransportAdapter::Error TcpClientListener::StartListeningThread() { } TransportAdapter::Error TcpClientListener::StopListeningThread() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // StopListening() can be called from multiple threads sync_primitives::AutoLock auto_lock(start_stop_lock_); @@ -491,7 +485,7 @@ TransportAdapter::Error TcpClientListener::StopListeningThread() { void TcpClientListener::OnIPAddressUpdated(const std::string ipv4_addr, const std::string ipv6_addr) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Since we only create a TCP socket with IPv4 option (AF_INET), currently we // do not use IPv6 address. @@ -499,15 +493,15 @@ void TcpClientListener::OnIPAddressUpdated(const std::string ipv4_addr, if (IsListeningOnSpecificInterface()) { if (!current_ip_address_.empty()) { // the server socket is running, terminate it - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Stopping current TCP server socket on " << designated_interface_); StopOnNetworkInterface(); } if (!ipv4_addr.empty()) { // start (or restart) server socket with the new IP address - LOG4CXX_DEBUG( - logger_, "Starting TCP server socket on " << designated_interface_); + SDL_LOG_DEBUG("Starting TCP server socket on " + << designated_interface_); StartOnNetworkInterface(); } } @@ -528,7 +522,7 @@ void TcpClientListener::OnIPAddressUpdated(const std::string ipv4_addr, } bool TcpClientListener::StartOnNetworkInterface() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // this method is only for the case that network interface is specified if (IsListeningOnSpecificInterface()) { @@ -538,7 +532,7 @@ bool TcpClientListener::StartOnNetworkInterface() { if (socket_ < 0) { socket_ = CreateIPv4ServerSocket(port_, designated_interface_); if (-1 == socket_) { - LOG4CXX_WARN(logger_, "Failed to create TCP socket"); + SDL_LOG_WARN("Failed to create TCP socket"); return false; } } @@ -547,21 +541,20 @@ bool TcpClientListener::StartOnNetworkInterface() { remove_devices_on_terminate_ = true; if (TransportAdapter::OK != StartListeningThread()) { - LOG4CXX_WARN(logger_, "Failed to start TCP client listener"); + SDL_LOG_WARN("Failed to start TCP client listener"); return false; } - LOG4CXX_INFO(logger_, - "TCP server socket started on " << designated_interface_); + SDL_LOG_INFO("TCP server socket started on " << designated_interface_); } return true; } bool TcpClientListener::StopOnNetworkInterface() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (IsListeningOnSpecificInterface()) { if (TransportAdapter::OK != StopListeningThread()) { - LOG4CXX_WARN(logger_, "Failed to stop TCP client listener"); + SDL_LOG_WARN("Failed to stop TCP client listener"); return false; } @@ -573,9 +566,8 @@ bool TcpClientListener::StopOnNetworkInterface() { remove_devices_on_terminate_ = false; - LOG4CXX_INFO( - logger_, - "TCP server socket on " << designated_interface_ << " stopped"); + SDL_LOG_INFO("TCP server socket on " << designated_interface_ + << " stopped"); } return true; } @@ -586,7 +578,7 @@ bool TcpClientListener::IsListeningOnSpecificInterface() const { int TcpClientListener::CreateIPv4ServerSocket( uint16_t port, const std::string interface_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); struct in_addr ipv4_address; memset(&ipv4_address, 0, sizeof(ipv4_address)); @@ -598,7 +590,7 @@ int TcpClientListener::CreateIPv4ServerSocket( int sock = socket(AF_INET, SOCK_STREAM, 0); if (-1 == sock) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create socket"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to create socket"); return -1; } @@ -610,20 +602,20 @@ int TcpClientListener::CreateIPv4ServerSocket( int optval = 1; if (0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval))) { - LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt SO_REUSEADDR failed"); + SDL_LOG_WARN_WITH_ERRNO("setsockopt SO_REUSEADDR failed"); } if (bind(sock, reinterpret_cast<sockaddr*>(&server_address), sizeof(server_address)) != 0) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "bind() failed"); + SDL_LOG_ERROR_WITH_ERRNO("bind() failed"); close(sock); return -1; } const int kBacklog = 128; if (0 != listen(sock, kBacklog)) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "listen() failed"); + SDL_LOG_ERROR_WITH_ERRNO("listen() failed"); close(sock); return -1; } @@ -632,20 +624,20 @@ int TcpClientListener::CreateIPv4ServerSocket( } void TcpClientListener::DestroyServerSocket(int sock) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (sock >= 0) { if (shutdown(sock, SHUT_RDWR) != 0) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to shutdown socket"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to shutdown socket"); } if (close(sock) != 0) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to close socket"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to close socket"); } } } bool TcpClientListener::GetIPv4Address(const std::string interface_name, struct in_addr* ip_address) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); #ifdef BUILD_TESTS if (testing_) { @@ -663,7 +655,7 @@ bool TcpClientListener::GetIPv4Address(const std::string interface_name, struct ifaddrs* if_list; if (getifaddrs(&if_list) != 0) { - LOG4CXX_WARN(logger_, "getifaddrs failed"); + SDL_LOG_WARN("getifaddrs failed"); return false; } @@ -703,14 +695,13 @@ bool TcpClientListener::GetIPv4Address(const std::string interface_name, static bool SetNonblocking(int s) { int prev_flag = fcntl(s, F_GETFL, 0); if (prev_flag == -1) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to acquire socket flag"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to acquire socket flag"); return false; } int ret = fcntl(s, F_SETFL, prev_flag | O_NONBLOCK); if (ret == -1) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Failed to configure socket to non-blocking"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to configure socket to non-blocking"); return false; } diff --git a/src/components/transport_manager/src/tcp/tcp_connection_factory.cc b/src/components/transport_manager/src/tcp/tcp_connection_factory.cc index 50d1c74fa7..42da741611 100644 --- a/src/components/transport_manager/src/tcp/tcp_connection_factory.cc +++ b/src/components/transport_manager/src/tcp/tcp_connection_factory.cc @@ -39,7 +39,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") TcpConnectionFactory::TcpConnectionFactory( TransportAdapterController* controller) @@ -51,9 +51,9 @@ TransportAdapter::Error TcpConnectionFactory::Init() { TransportAdapter::Error TcpConnectionFactory::CreateConnection( const DeviceUID& device_uid, const ApplicationHandle& app_handle) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG( + "DeviceUID: " << &device_uid << ", ApplicationHandle: " << &app_handle); std::shared_ptr<TcpServerOriginatedSocketConnection> connection = std::make_shared<TcpServerOriginatedSocketConnection>( @@ -61,9 +61,8 @@ TransportAdapter::Error TcpConnectionFactory::CreateConnection( controller_->ConnectionCreated(connection, device_uid, app_handle); const TransportAdapter::Error error = connection->Start(); if (TransportAdapter::OK != error) { - LOG4CXX_ERROR(logger_, - "TCP ServerOriginated connection::Start() failed with error: " - << error); + SDL_LOG_ERROR("TCP ServerOriginated connection::Start() failed with error: " + << error); } return error; } diff --git a/src/components/transport_manager/src/tcp/tcp_device.cc b/src/components/transport_manager/src/tcp/tcp_device.cc index d9bc8aec78..bccafd934f 100644 --- a/src/components/transport_manager/src/tcp/tcp_device.cc +++ b/src/components/transport_manager/src/tcp/tcp_device.cc @@ -36,14 +36,14 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") TcpDevice::TcpDevice(const in_addr_t& in_addr, const std::string& name) : Device(name, name) , applications_mutex_() , in_addr_(in_addr) , last_handle_(0) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } #if defined(ENABLE_IAP2EMULATION) @@ -54,33 +54,32 @@ TcpDevice::TcpDevice(const in_addr_t& in_addr, , applications_mutex_() , in_addr_(in_addr) , last_handle_(0) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "Device created with transport switch emulation support."); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device created with transport switch emulation support."); + SDL_LOG_DEBUG( + "Device parameters: " << device_uid << " / " << transport_switch_id); } #endif // ENABLE_IAP2EMULATION bool TcpDevice::IsSameAs(const Device* other) const { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Device: " << other); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Device: " << other); const TcpDevice* other_tcp_device = dynamic_cast<const TcpDevice*>(other); if (other_tcp_device && other_tcp_device->in_addr_ == in_addr_) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "exit with TRUE. Condition: other_tcp_device->in_addr_ == in_addr_"); return true; } else { - LOG4CXX_TRACE(logger_, "exit with FALSE"); + SDL_LOG_TRACE("exit with FALSE"); return false; } } ApplicationList TcpDevice::GetApplicationList() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock locker(applications_mutex_); ApplicationList app_list; for (std::map<ApplicationHandle, Application>::const_iterator it = @@ -93,8 +92,8 @@ ApplicationList TcpDevice::GetApplicationList() const { } ApplicationHandle TcpDevice::AddIncomingApplication(int socket_fd) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Socket_fd: " << socket_fd); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Socket_fd: " << socket_fd); Application app; app.incoming = true; app.socket = socket_fd; @@ -102,13 +101,13 @@ ApplicationHandle TcpDevice::AddIncomingApplication(int socket_fd) { sync_primitives::AutoLock locker(applications_mutex_); const ApplicationHandle app_handle = ++last_handle_; applications_[app_handle] = app; - LOG4CXX_DEBUG(logger_, "App_handle " << app_handle); + SDL_LOG_DEBUG("App_handle " << app_handle); return app_handle; } ApplicationHandle TcpDevice::AddDiscoveredApplication(int port) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Port " << port); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Port " << port); Application app; app.incoming = false; app.socket = 0; // this line removes compiler warning @@ -116,52 +115,52 @@ ApplicationHandle TcpDevice::AddDiscoveredApplication(int port) { sync_primitives::AutoLock locker(applications_mutex_); const ApplicationHandle app_handle = ++last_handle_; applications_[app_handle] = app; - LOG4CXX_DEBUG(logger_, "App_handle " << app_handle); + SDL_LOG_DEBUG("App_handle " << app_handle); return app_handle; } void TcpDevice::RemoveApplication(const ApplicationHandle app_handle) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "ApplicationHandle: " << app_handle); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("ApplicationHandle: " << app_handle); sync_primitives::AutoLock locker(applications_mutex_); applications_.erase(app_handle); } TcpDevice::~TcpDevice() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } int TcpDevice::GetApplicationSocket(const ApplicationHandle app_handle) const { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "ApplicationHandle: " << app_handle); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("ApplicationHandle: " << app_handle); std::map<ApplicationHandle, Application>::const_iterator it = applications_.find(app_handle); if (applications_.end() == it) { - LOG4CXX_WARN(logger_, "Application was not found"); + SDL_LOG_WARN("Application was not found"); return -1; } if (!it->second.incoming) { - LOG4CXX_WARN(logger_, "Application is not incoming"); + SDL_LOG_WARN("Application is not incoming"); return -1; } - LOG4CXX_DEBUG(logger_, "socket " << it->second.socket); + SDL_LOG_DEBUG("socket " << it->second.socket); return it->second.socket; } int TcpDevice::GetApplicationPort(const ApplicationHandle app_handle) const { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "ApplicationHandle: " << app_handle); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("ApplicationHandle: " << app_handle); std::map<ApplicationHandle, Application>::const_iterator it = applications_.find(app_handle); if (applications_.end() == it) { - LOG4CXX_WARN(logger_, "Application was not found"); + SDL_LOG_WARN("Application was not found"); return -1; } if (it->second.incoming) { - LOG4CXX_DEBUG(logger_, "Application is incoming"); + SDL_LOG_DEBUG("Application is incoming"); return -1; } - LOG4CXX_DEBUG(logger_, "port " << it->second.port); + SDL_LOG_DEBUG("port " << it->second.port); return it->second.port; } diff --git a/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc b/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc index 690b2d25b3..0571867c10 100644 --- a/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc +++ b/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc @@ -39,7 +39,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") TcpServerOriginatedSocketConnection::TcpServerOriginatedSocketConnection( const DeviceUID& device_uid, @@ -52,12 +52,12 @@ TcpServerOriginatedSocketConnection::~TcpServerOriginatedSocketConnection() { } bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(error); - LOG4CXX_DEBUG(logger_, "error " << error); + SDL_LOG_DEBUG("error " << error); DeviceSptr device = controller()->FindDevice(device_handle()); if (device.use_count() == 0) { - LOG4CXX_ERROR(logger_, "Device " << device_handle() << " not found"); + SDL_LOG_ERROR("Device " << device_handle() << " not found"); *error = new ConnectError(); return false; } @@ -65,16 +65,14 @@ bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) { const int port = tcp_device->GetApplicationPort(application_handle()); if (-1 == port) { - LOG4CXX_ERROR( - logger_, - "Application port for " << application_handle() << " not found"); + SDL_LOG_ERROR("Application port for " << application_handle() + << " not found"); *error = new ConnectError(); return false; } if (IsConnectionTerminated()) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Connection is already terminated. Socket will not be created"); *error = new ConnectError(); return false; @@ -82,7 +80,7 @@ bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) { const int socket = ::socket(AF_INET, SOCK_STREAM, 0); if (socket < 0) { - LOG4CXX_ERROR(logger_, "Failed to create socket"); + SDL_LOG_ERROR("Failed to create socket"); *error = new ConnectError(); return false; } @@ -92,12 +90,10 @@ bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) { addr.sin_addr.s_addr = tcp_device->in_addr(); addr.sin_port = htons(port); - LOG4CXX_DEBUG(logger_, - "Connecting " << inet_ntoa(addr.sin_addr) << ":" << port); + SDL_LOG_DEBUG("Connecting " << inet_ntoa(addr.sin_addr) << ":" << port); set_socket(socket); if (::connect(get_socket(), (struct sockaddr*)&addr, sizeof(addr)) < 0) { - LOG4CXX_ERROR(logger_, - "Failed to connect for application " << application_handle() + SDL_LOG_ERROR("Failed to connect for application " << application_handle() << ", error " << errno); *error = new ConnectError(); ShutdownAndCloseSocket(); diff --git a/src/components/transport_manager/src/tcp/tcp_socket_connection.cc b/src/components/transport_manager/src/tcp/tcp_socket_connection.cc index a2ef38f3cb..85e02318c3 100644 --- a/src/components/transport_manager/src/tcp/tcp_socket_connection.cc +++ b/src/components/transport_manager/src/tcp/tcp_socket_connection.cc @@ -39,7 +39,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") TcpSocketConnection::TcpSocketConnection(const DeviceUID& device_uid, const ApplicationHandle& app_handle, diff --git a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc index 54eb3a7b6d..8d174d89a1 100644 --- a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc +++ b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc @@ -49,7 +49,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") TcpTransportAdapter::TcpTransportAdapter( const uint16_t port, @@ -70,7 +70,7 @@ TcpTransportAdapter::~TcpTransportAdapter() {} void TcpTransportAdapter::TransportConfigUpdated( const TransportConfig& new_config) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_config_ = new_config; @@ -80,7 +80,7 @@ void TcpTransportAdapter::TransportConfigUpdated( } TransportConfig TcpTransportAdapter::GetTransportConfiguration() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return transport_config_; } @@ -89,7 +89,7 @@ DeviceType TcpTransportAdapter::GetDeviceType() const { } void TcpTransportAdapter::Store() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Json::Value tcp_adapter_dictionary; Json::Value devices_dictionary; DeviceList device_ids = GetDeviceList(); @@ -138,7 +138,7 @@ void TcpTransportAdapter::Store() const { } bool TcpTransportAdapter::Restore() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool errors_occurred = false; resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); Json::Value dictionary = accessor.GetData().dictionary(); @@ -166,7 +166,7 @@ bool TcpTransportAdapter::Restore() { } } bool result = !errors_occurred; - LOG4CXX_DEBUG(logger_, "result " << std::boolalpha << result); + SDL_LOG_DEBUG("result " << std::boolalpha << result); return result; } diff --git a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc index 637e3f840a..eb92599ae5 100644 --- a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc +++ b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc @@ -46,7 +46,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") ThreadedSocketConnection::ThreadedSocketConnection( const DeviceUID& device_id, @@ -69,7 +69,7 @@ ThreadedSocketConnection::ThreadedSocketConnection( } ThreadedSocketConnection::~ThreadedSocketConnection() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(nullptr == thread_); if (-1 != read_fd_) { @@ -91,46 +91,46 @@ void ThreadedSocketConnection::StopAndJoinThread() { } void ThreadedSocketConnection::Abort() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); unexpected_disconnect_ = true; terminate_flag_ = true; } TransportAdapter::Error ThreadedSocketConnection::Start() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); int fds[2]; const int pipe_ret = pipe(fds); if (0 == pipe_ret) { - LOG4CXX_DEBUG(logger_, "pipe created"); + SDL_LOG_DEBUG("pipe created"); read_fd_ = fds[0]; write_fd_ = fds[1]; } else { - LOG4CXX_ERROR(logger_, "pipe creation failed"); + SDL_LOG_ERROR("pipe creation failed"); return TransportAdapter::FAIL; } const int fcntl_ret = fcntl(read_fd_, F_SETFL, fcntl(read_fd_, F_GETFL) | O_NONBLOCK); if (0 != fcntl_ret) { - LOG4CXX_ERROR(logger_, "fcntl failed"); + SDL_LOG_ERROR("fcntl failed"); return TransportAdapter::FAIL; } if (!thread_->Start()) { - LOG4CXX_ERROR(logger_, "thread creation failed"); + SDL_LOG_ERROR("thread creation failed"); return TransportAdapter::FAIL; } - LOG4CXX_INFO(logger_, "thread created"); + SDL_LOG_INFO("thread created"); return TransportAdapter::OK; } void ThreadedSocketConnection::Finalize() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (unexpected_disconnect_) { - LOG4CXX_DEBUG(logger_, "unexpected_disconnect"); + SDL_LOG_DEBUG("unexpected_disconnect"); controller_->ConnectionAborted( device_handle(), application_handle(), CommunicationError()); } else { - LOG4CXX_DEBUG(logger_, "not unexpected_disconnect"); + SDL_LOG_DEBUG("not unexpected_disconnect"); controller_->ConnectionFinished(device_handle(), application_handle()); } @@ -138,17 +138,17 @@ void ThreadedSocketConnection::Finalize() { } TransportAdapter::Error ThreadedSocketConnection::Notify() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (-1 == write_fd_) { - LOG4CXX_ERROR_WITH_ERRNO( - logger_, "Failed to wake up connection thread for connection " << this); - LOG4CXX_TRACE(logger_, "exit with TransportAdapter::BAD_STATE"); + SDL_LOG_ERROR_WITH_ERRNO( + "Failed to wake up connection thread for connection " << this); + SDL_LOG_TRACE("exit with TransportAdapter::BAD_STATE"); return TransportAdapter::BAD_STATE; } uint8_t c = 0; if (1 != write(write_fd_, &c, 1)) { - LOG4CXX_ERROR_WITH_ERRNO( - logger_, "Failed to wake up connection thread for connection " << this); + SDL_LOG_ERROR_WITH_ERRNO( + "Failed to wake up connection thread for connection " << this); return TransportAdapter::FAIL; } return TransportAdapter::OK; @@ -156,44 +156,44 @@ TransportAdapter::Error ThreadedSocketConnection::Notify() const { TransportAdapter::Error ThreadedSocketConnection::SendData( ::protocol_handler::RawMessagePtr message) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); frames_to_send_.push(message); return Notify(); } TransportAdapter::Error ThreadedSocketConnection::Disconnect() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); terminate_flag_ = true; ShutdownAndCloseSocket(); return Notify(); } void ThreadedSocketConnection::Terminate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); StopAndJoinThread(); } void ThreadedSocketConnection::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ConnectError* connect_error = nullptr; if (!Establish(&connect_error)) { - LOG4CXX_ERROR(logger_, "Connection Establish failed"); + SDL_LOG_ERROR("Connection Establish failed"); delete connect_error; Abort(); } else { - LOG4CXX_DEBUG(logger_, "Connection established"); + SDL_LOG_DEBUG("Connection established"); controller_->ConnectDone(device_handle(), application_handle()); } while (!terminate_flag_) { Transmit(); } - LOG4CXX_DEBUG(logger_, "Connection is to finalize"); + SDL_LOG_DEBUG("Connection is to finalize"); Finalize(); sync_primitives::AutoLock auto_lock(frames_to_send_mutex_); while (!frames_to_send_.empty()) { - LOG4CXX_INFO(logger_, "removing message"); + SDL_LOG_INFO("removing message"); ::protocol_handler::RawMessagePtr message = frames_to_send_.front(); frames_to_send_.pop(); controller_->DataSendFailed( @@ -208,23 +208,23 @@ bool ThreadedSocketConnection::IsFramesToSendQueueEmpty() const { } void ThreadedSocketConnection::ShutdownAndCloseSocket() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const int socket = socket_; socket_ = -1; if (socket != -1) { if (shutdown(socket, SHUT_RDWR) != 0) { - LOG4CXX_WARN(logger_, "Socket was unable to be shutdowned"); + SDL_LOG_WARN("Socket was unable to be shutdowned"); } if (close(socket) != 0) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to close socket"); + SDL_LOG_ERROR_WITH_ERRNO("Failed to close socket"); } } else { - LOG4CXX_WARN(logger_, "Socket has been already closed or not created yet"); + SDL_LOG_WARN("Socket has been already closed or not created yet"); } } void ThreadedSocketConnection::Transmit() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const nfds_t kPollFdsSize = 2; pollfd poll_fds[kPollFdsSize]; @@ -237,26 +237,24 @@ void ThreadedSocketConnection::Transmit() { poll_fds[1].fd = read_fd_; poll_fds[1].events = POLLIN | POLLPRI; - LOG4CXX_DEBUG(logger_, "poll " << this); + SDL_LOG_DEBUG("poll " << this); if (-1 == poll(poll_fds, kPollFdsSize, -1)) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "poll failed for connection " << this); + SDL_LOG_ERROR_WITH_ERRNO("poll failed for connection " << this); Abort(); return; } - LOG4CXX_DEBUG(logger_, - "poll is ok " << this << " revents0: " << std::hex + SDL_LOG_DEBUG("poll is ok " << this << " revents0: " << std::hex << poll_fds[0].revents << " revents1:" << std::hex << poll_fds[1].revents); // error check if (0 != (poll_fds[1].revents & (POLLERR | POLLHUP | POLLNVAL))) { - LOG4CXX_ERROR(logger_, - "Notification pipe for connection " << this << " terminated"); + SDL_LOG_ERROR("Notification pipe for connection " << this << " terminated"); Abort(); return; } if (poll_fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) { - LOG4CXX_WARN(logger_, "Connection " << this << " terminated"); + SDL_LOG_WARN("Connection " << this << " terminated"); Abort(); return; } @@ -268,8 +266,8 @@ void ThreadedSocketConnection::Transmit() { bytes_read = read(read_fd_, buffer, sizeof(buffer)); } while (bytes_read > 0); if ((bytes_read < 0) && (EAGAIN != errno)) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to clear notification pipe"); - LOG4CXX_ERROR_WITH_ERRNO(logger_, "poll failed for connection " << this); + SDL_LOG_ERROR_WITH_ERRNO("Failed to clear notification pipe"); + SDL_LOG_ERROR_WITH_ERRNO("poll failed for connection " << this); Abort(); return; } @@ -278,12 +276,12 @@ void ThreadedSocketConnection::Transmit() { // Send data if possible if (!is_queue_empty && (poll_fds[0].revents & POLLOUT)) { - LOG4CXX_DEBUG(logger_, "frames_to_send_ not empty() "); + SDL_LOG_DEBUG("frames_to_send_ not empty() "); // send data const bool send_ok = Send(); if (!send_ok) { - LOG4CXX_ERROR(logger_, "Send() failed "); + SDL_LOG_ERROR("Send() failed "); Abort(); return; } @@ -293,7 +291,7 @@ void ThreadedSocketConnection::Transmit() { if (poll_fds[0].revents & (POLLIN | POLLPRI)) { const bool receive_ok = Receive(); if (!receive_ok) { - LOG4CXX_ERROR(logger_, "Receive() failed "); + SDL_LOG_ERROR("Receive() failed "); Abort(); return; } @@ -301,7 +299,7 @@ void ThreadedSocketConnection::Transmit() { } bool ThreadedSocketConnection::Receive() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); uint8_t buffer[4096]; ssize_t bytes_read = -1; @@ -309,21 +307,19 @@ bool ThreadedSocketConnection::Receive() { bytes_read = recv(socket_, buffer, sizeof(buffer), MSG_DONTWAIT); if (bytes_read > 0) { - LOG4CXX_DEBUG( - logger_, - "Received " << bytes_read << " bytes for connection " << this); + SDL_LOG_DEBUG("Received " << bytes_read << " bytes for connection " + << this); ::protocol_handler::RawMessagePtr frame( new protocol_handler::RawMessage(0, 0, buffer, bytes_read, false)); controller_->DataReceiveDone( device_handle(), application_handle(), frame); } else if (bytes_read < 0) { if (EAGAIN != errno && EWOULDBLOCK != errno) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "recv() failed for connection " << this); + SDL_LOG_ERROR_WITH_ERRNO("recv() failed for connection " << this); return false; } } else { - LOG4CXX_WARN(logger_, "Connection " << this << " closed by remote peer"); + SDL_LOG_WARN("Connection " << this << " closed by remote peer"); return false; } } while (bytes_read > 0); @@ -332,7 +328,7 @@ bool ThreadedSocketConnection::Receive() { } bool ThreadedSocketConnection::Send() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); FrameQueue frames_to_send_local; { @@ -342,13 +338,13 @@ bool ThreadedSocketConnection::Send() { size_t offset = 0; while (!frames_to_send_local.empty()) { - LOG4CXX_INFO(logger_, "frames_to_send is not empty"); + SDL_LOG_INFO("frames_to_send is not empty"); ::protocol_handler::RawMessagePtr frame = frames_to_send_local.front(); const ssize_t bytes_sent = ::send(socket_, frame->data() + offset, frame->data_size() - offset, 0); if (bytes_sent >= 0) { - LOG4CXX_DEBUG(logger_, "bytes_sent >= 0"); + SDL_LOG_DEBUG("bytes_sent >= 0"); offset += bytes_sent; if (offset == frame->data_size()) { frames_to_send_local.pop(); @@ -356,8 +352,8 @@ bool ThreadedSocketConnection::Send() { controller_->DataSendDone(device_handle(), application_handle(), frame); } } else { - LOG4CXX_DEBUG(logger_, "bytes_sent < 0"); - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Send failed for connection " << this); + SDL_LOG_DEBUG("bytes_sent < 0"); + SDL_LOG_ERROR_WITH_ERRNO("Send failed for connection " << this); frames_to_send_local.pop(); offset = 0; controller_->DataSendFailed( @@ -373,13 +369,13 @@ ThreadedSocketConnection::SocketConnectionDelegate::SocketConnectionDelegate( : connection_(connection) {} void ThreadedSocketConnection::SocketConnectionDelegate::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(connection_); connection_->threadMain(); } void ThreadedSocketConnection::SocketConnectionDelegate::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } } // namespace transport_adapter diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc index 8301c50a4e..7d0eda9773 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc @@ -51,7 +51,7 @@ const char* tc_enabled = "enabled"; const char* tc_tcp_port = "tcp_port"; const char* tc_tcp_ip_address = "tcp_ip_address"; -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") namespace { DeviceTypes devicesType = { std::make_pair(DeviceType::AOA, std::string("USB_AOA")), @@ -99,42 +99,39 @@ TransportAdapterImpl::~TransportAdapterImpl() { Terminate(); if (device_scanner_) { - LOG4CXX_DEBUG(logger_, "Deleting device_scanner_ " << device_scanner_); + SDL_LOG_DEBUG("Deleting device_scanner_ " << device_scanner_); delete device_scanner_; - LOG4CXX_DEBUG(logger_, "device_scanner_ deleted."); + SDL_LOG_DEBUG("device_scanner_ deleted."); } if (server_connection_factory_) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Deleting server_connection_factory " << server_connection_factory_); delete server_connection_factory_; - LOG4CXX_DEBUG(logger_, "server_connection_factory deleted."); + SDL_LOG_DEBUG("server_connection_factory deleted."); } if (client_connection_listener_) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Deleting client_connection_listener_ " << client_connection_listener_); delete client_connection_listener_; - LOG4CXX_DEBUG(logger_, "client_connection_listener_ deleted."); + SDL_LOG_DEBUG("client_connection_listener_ deleted."); } } void TransportAdapterImpl::Terminate() { if (device_scanner_) { device_scanner_->Terminate(); - LOG4CXX_DEBUG(logger_, - "device_scanner_ " << device_scanner_ << " terminated."); + SDL_LOG_DEBUG("device_scanner_ " << device_scanner_ << " terminated."); } if (server_connection_factory_) { server_connection_factory_->Terminate(); - LOG4CXX_DEBUG(logger_, - "server_connection_factory " << server_connection_factory_ + SDL_LOG_DEBUG("server_connection_factory " << server_connection_factory_ << " terminated."); } if (client_connection_listener_) { client_connection_listener_->Terminate(); - LOG4CXX_DEBUG(logger_, - "client_connection_listener_ " << client_connection_listener_ + SDL_LOG_DEBUG("client_connection_listener_ " << client_connection_listener_ << " terminated."); } @@ -150,7 +147,7 @@ void TransportAdapterImpl::Terminate() { } connections.clear(); - LOG4CXX_DEBUG(logger_, "Connections deleted"); + SDL_LOG_DEBUG("Connections deleted"); DeviceMap devices; devices_mutex_.Acquire(); @@ -158,11 +155,11 @@ void TransportAdapterImpl::Terminate() { devices_mutex_.Release(); devices.clear(); - LOG4CXX_DEBUG(logger_, "Devices deleted"); + SDL_LOG_DEBUG("Devices deleted"); } TransportAdapter::Error TransportAdapterImpl::Init() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); Error error = OK; @@ -180,42 +177,42 @@ TransportAdapter::Error TransportAdapterImpl::Init() { if (get_settings().use_last_state() && initialised_) { if (!Restore()) { - LOG4CXX_WARN(logger_, "could not restore transport adapter state"); + SDL_LOG_WARN("could not restore transport adapter state"); } } - LOG4CXX_TRACE(logger_, "exit with error: " << error); + SDL_LOG_TRACE("exit with error: " << error); return error; } TransportAdapter::Error TransportAdapterImpl::SearchDevices() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); if (device_scanner_ == NULL) { - LOG4CXX_TRACE(logger_, "exit with NOT_SUPPORTED"); + SDL_LOG_TRACE("exit with NOT_SUPPORTED"); return NOT_SUPPORTED; } else if (!device_scanner_->IsInitialised()) { - LOG4CXX_TRACE(logger_, "exit with BAD_STATE"); + SDL_LOG_TRACE("exit with BAD_STATE"); return BAD_STATE; } TransportAdapter::Error er = device_scanner_->Scan(); - LOG4CXX_TRACE(logger_, "exit with error: " << er); + SDL_LOG_TRACE("exit with error: " << er); return er; } TransportAdapter::Error TransportAdapterImpl::Connect( const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "enter. DeviceUID " << device_id << " ApplicationHandle " << app_handle); if (server_connection_factory_ == 0) { - LOG4CXX_TRACE(logger_, "exit with NOT_SUPPORTED"); + SDL_LOG_TRACE("exit with NOT_SUPPORTED"); return NOT_SUPPORTED; } if (!server_connection_factory_->IsInitialised()) { - LOG4CXX_TRACE(logger_, "exit with BAD_STATE"); + SDL_LOG_TRACE("exit with BAD_STATE"); return BAD_STATE; } if (!initialised_) { - LOG4CXX_TRACE(logger_, "exit with BAD_STATE"); + SDL_LOG_TRACE("exit with BAD_STATE"); return BAD_STATE; } @@ -235,7 +232,7 @@ TransportAdapter::Error TransportAdapterImpl::Connect( connections_lock_.Release(); if (already_exists && !pending_app) { - LOG4CXX_TRACE(logger_, "exit with ALREADY_EXISTS"); + SDL_LOG_TRACE("exit with ALREADY_EXISTS"); return ALREADY_EXISTS; } @@ -246,19 +243,18 @@ TransportAdapter::Error TransportAdapterImpl::Connect( RemoveConnection(device_id, app_handle); } } - LOG4CXX_TRACE(logger_, "exit with error: " << err); + SDL_LOG_TRACE("exit with error: " << err); return err; } TransportAdapter::Error TransportAdapterImpl::ConnectDevice( const DeviceUID& device_handle) { - LOG4CXX_TRACE(logger_, "enter with device_handle: " << &device_handle); + SDL_LOG_TRACE("enter with device_handle: " << &device_handle); DeviceSptr device = FindDevice(device_handle); if (device) { TransportAdapter::Error err = ConnectDevice(device); if (FAIL == err && GetDeviceType() == DeviceType::CLOUD_WEBSOCKET) { - LOG4CXX_TRACE(logger_, - "Error occurred while connecting cloud app: " << err); + SDL_LOG_TRACE("Error occurred while connecting cloud app: " << err); // Update retry count if (device->retry_count() >= get_settings().cloud_app_max_retry_attempts()) { @@ -283,10 +279,10 @@ TransportAdapter::Error TransportAdapterImpl::ConnectDevice( } else if (OK == err) { ConnectionStatusUpdated(device, ConnectionStatus::CONNECTED); } - LOG4CXX_TRACE(logger_, "exit with error: " << err); + SDL_LOG_TRACE("exit with error: " << err); return err; } else { - LOG4CXX_TRACE(logger_, "exit with BAD_PARAM"); + SDL_LOG_TRACE("exit with BAD_PARAM"); return BAD_PARAM; } } @@ -295,8 +291,7 @@ void TransportAdapterImpl::RetryConnection() { ClearCompletedTimers(); const DeviceUID device_id = GetNextRetryDevice(); if (device_id.empty()) { - LOG4CXX_ERROR(logger_, - "Unable to find timer, ignoring RetryConnection request"); + SDL_LOG_ERROR("Unable to find timer, ignoring RetryConnection request"); return; } ConnectDevice(device_id); @@ -347,36 +342,36 @@ void TransportAdapterImpl::ConnectionStatusUpdated(DeviceSptr device, TransportAdapter::Error TransportAdapterImpl::Disconnect( const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "enter. device_id: " << &device_id << ", device_id: " << &device_id); if (!initialised_) { - LOG4CXX_TRACE(logger_, "exit with BAD_STATE"); + SDL_LOG_TRACE("exit with BAD_STATE"); return BAD_STATE; } ConnectionSPtr connection = FindEstablishedConnection(device_id, app_handle); if (connection) { TransportAdapter::Error err = connection->Disconnect(); - LOG4CXX_TRACE(logger_, "exit with error: " << err); + SDL_LOG_TRACE("exit with error: " << err); return err; } else { - LOG4CXX_TRACE(logger_, "exit with BAD_PARAM"); + SDL_LOG_TRACE("exit with BAD_PARAM"); return BAD_PARAM; } } TransportAdapter::Error TransportAdapterImpl::DisconnectDevice( const DeviceUID& device_id) { - LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id); + SDL_LOG_TRACE("enter. device_id: " << &device_id); if (!initialised_) { - LOG4CXX_TRACE(logger_, "exit with BAD_STATE"); + SDL_LOG_TRACE("exit with BAD_STATE"); return BAD_STATE; } Error error = OK; DeviceSptr device = FindDevice(device_id); if (!device) { - LOG4CXX_WARN(logger_, "Device with id: " << device_id << " Not found"); + SDL_LOG_WARN("Device with id: " << device_id << " Not found"); return BAD_PARAM; } ConnectionStatusUpdated(device, ConnectionStatus::CLOSING); @@ -400,7 +395,7 @@ TransportAdapter::Error TransportAdapterImpl::DisconnectDevice( ConnectionInfo info = *j; if (OK != info.connection->Disconnect()) { error = FAIL; - LOG4CXX_ERROR(logger_, "Error on disconnect " << error); + SDL_LOG_ERROR("Error on disconnect " << error); } } @@ -411,34 +406,33 @@ TransportAdapter::Error TransportAdapterImpl::SendData( const DeviceUID& device_id, const ApplicationHandle& app_handle, const ::protocol_handler::RawMessagePtr data) { - LOG4CXX_TRACE(logger_, - "enter. device_id: " << &device_id << ", app_handle: " + SDL_LOG_TRACE("enter. device_id: " << &device_id << ", app_handle: " << &app_handle << ", data: " << data); if (!initialised_) { - LOG4CXX_TRACE(logger_, "exit with BAD_STATE"); + SDL_LOG_TRACE("exit with BAD_STATE"); return BAD_STATE; } ConnectionSPtr connection = FindEstablishedConnection(device_id, app_handle); if (connection) { TransportAdapter::Error err = connection->SendData(data); - LOG4CXX_TRACE(logger_, "exit with error: " << err); + SDL_LOG_TRACE("exit with error: " << err); return err; } else { - LOG4CXX_TRACE(logger_, "exit with BAD_PARAM"); + SDL_LOG_TRACE("exit with BAD_PARAM"); return BAD_PARAM; } } TransportAdapter::Error TransportAdapterImpl::ChangeClientListening( TransportAction required_change) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (client_connection_listener_ == 0) { - LOG4CXX_TRACE(logger_, "exit with NOT_SUPPORTED"); + SDL_LOG_TRACE("exit with NOT_SUPPORTED"); return NOT_SUPPORTED; } if (!client_connection_listener_->IsInitialised()) { - LOG4CXX_TRACE(logger_, "exit with BAD_STATE"); + SDL_LOG_TRACE("exit with BAD_STATE"); return BAD_STATE; } @@ -477,30 +471,28 @@ TransportAdapter::Error TransportAdapterImpl::ChangeClientListening( default: NOTREACHED(); } - LOG4CXX_TRACE(logger_, "Exit with error: " << err); + SDL_LOG_TRACE("Exit with error: " << err); return err; } DeviceList TransportAdapterImpl::GetDeviceList() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeviceList devices; sync_primitives::AutoLock locker(devices_mutex_); for (DeviceMap::const_iterator it = devices_.begin(); it != devices_.end(); ++it) { devices.push_back(it->first); } - LOG4CXX_TRACE(logger_, - "exit with DeviceList. It's' size = " << devices.size()); + SDL_LOG_TRACE("exit with DeviceList. It's' size = " << devices.size()); return devices; } DeviceSptr TransportAdapterImpl::GetWebEngineDevice() const { #ifndef WEBSOCKET_SERVER_TRANSPORT_SUPPORT - LOG4CXX_TRACE(logger_, - "Web engine support is disabled. Device does not exist"); + SDL_LOG_TRACE("Web engine support is disabled. Device does not exist"); return DeviceSptr(); #else - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock locker(devices_mutex_); auto web_engine_device = @@ -515,14 +507,14 @@ DeviceSptr TransportAdapterImpl::GetWebEngineDevice() const { return web_engine_device->second; } - LOG4CXX_ERROR(logger_, "WebEngine device not found!"); + SDL_LOG_ERROR("WebEngine device not found!"); return std::make_shared<transport_adapter::WebSocketDevice>("", ""); #endif } DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_TRACE(logger_, "enter. device: " << device); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_TRACE("enter. device: " << device); DeviceSptr existing_device; bool same_device_found = false; devices_mutex_.Acquire(); @@ -531,7 +523,7 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) { existing_device = i->second; if (device->IsSameAs(existing_device.get())) { same_device_found = true; - LOG4CXX_DEBUG(logger_, "Device " << device << " already exists"); + SDL_LOG_DEBUG("Device " << device << " already exists"); break; } } @@ -540,7 +532,7 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) { } devices_mutex_.Release(); if (same_device_found) { - LOG4CXX_TRACE(logger_, "Exit with TRUE. Condition: same_device_found"); + SDL_LOG_TRACE("Exit with TRUE. Condition: same_device_found"); return existing_device; } else { device->set_connection_status(ConnectionStatus::PENDING); @@ -552,13 +544,13 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) { if (ToBeAutoConnected(device)) { ConnectDevice(device); } - LOG4CXX_TRACE(logger_, "exit with DeviceSptr " << device); + SDL_LOG_TRACE("exit with DeviceSptr " << device); return device; } } void TransportAdapterImpl::SearchDeviceDone(const DeviceVector& devices) { - LOG4CXX_TRACE(logger_, "enter. devices: " << &devices); + SDL_LOG_TRACE("enter. devices: " << &devices); DeviceMap new_devices; for (DeviceVector::const_iterator it = devices.begin(); it != devices.end(); ++it) { @@ -572,15 +564,14 @@ void TransportAdapterImpl::SearchDeviceDone(const DeviceVector& devices) { if (device->IsSameAs(existing_device.get())) { existing_device->set_keep_on_disconnect(true); device_found = true; - LOG4CXX_DEBUG(logger_, "device found. DeviceSptr" << it->second); + SDL_LOG_DEBUG("device found. DeviceSptr" << it->second); break; } } devices_mutex_.Release(); if (!device_found) { - LOG4CXX_INFO(logger_, - "Adding new device " << device->unique_device_id() << " (\"" + SDL_LOG_INFO("Adding new device " << device->unique_device_id() << " (\"" << device->name() << "\")"); } @@ -629,7 +620,7 @@ void TransportAdapterImpl::SearchDeviceDone(const DeviceVector& devices) { ConnectDevice(device); } } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterImpl::ApplicationListUpdated( @@ -639,38 +630,38 @@ void TransportAdapterImpl::ApplicationListUpdated( } void TransportAdapterImpl::FindNewApplicationsRequest() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); for (TransportAdapterListenerList::iterator i = listeners_.begin(); i != listeners_.end(); ++i) { TransportAdapterListener* listener = *i; listener->OnFindNewApplicationsRequest(this); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterImpl::SearchDeviceFailed(const SearchDeviceError& error) { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { (*it)->OnSearchDeviceFailed(this, error); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } bool TransportAdapterImpl::IsSearchDevicesSupported() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return device_scanner_ != 0; } bool TransportAdapterImpl::IsServerOriginatedConnectSupported() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return server_connection_factory_ != 0; } bool TransportAdapterImpl::IsClientOriginatedConnectSupported() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return client_connection_listener_ != 0; } @@ -678,9 +669,8 @@ void TransportAdapterImpl::ConnectionCreated( ConnectionSPtr connection, const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_TRACE(logger_, - "enter connection:" << connection + SDL_LOG_AUTO_TRACE(); + SDL_LOG_TRACE("enter connection:" << connection << ", device_id: " << &device_id << ", app_handle: " << &app_handle); connections_lock_.AcquireForReading(); @@ -694,11 +684,10 @@ void TransportAdapterImpl::ConnectionCreated( void TransportAdapterImpl::DeviceDisconnected( const DeviceUID& device_handle, const DisconnectDeviceError& error) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const DeviceUID device_uid = device_handle; - LOG4CXX_TRACE( - logger_, - "enter. device_handle: " << &device_uid << ", error: " << &error); + SDL_LOG_TRACE("enter. device_handle: " << &device_uid + << ", error: " << &error); ApplicationList app_list = GetApplicationList(device_uid); for (ApplicationList::const_iterator i = app_list.begin(); i != app_list.end(); @@ -728,12 +717,12 @@ void TransportAdapterImpl::DeviceDisconnected( } RemoveDevice(device_uid); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } bool TransportAdapterImpl::IsSingleApplication( const DeviceUID& device_uid, const ApplicationHandle& app_uid) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoReadLock locker(connections_lock_); for (ConnectionMap::const_iterator it = connections_.begin(); it != connections_.end(); @@ -741,9 +730,9 @@ bool TransportAdapterImpl::IsSingleApplication( const DeviceUID& current_device_id = it->first.first; const ApplicationHandle& current_app_handle = it->first.second; if (current_device_id == device_uid && current_app_handle != app_uid) { - LOG4CXX_DEBUG(logger_, - "break. Condition: current_device_id == device_id && " - "current_app_handle != app_handle"); + SDL_LOG_DEBUG( + "break. Condition: current_device_id == device_id && " + "current_app_handle != app_handle"); return false; } @@ -753,15 +742,15 @@ bool TransportAdapterImpl::IsSingleApplication( void TransportAdapterImpl::DisconnectDone(const DeviceUID& device_handle, const ApplicationHandle& app_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const DeviceUID device_uid = device_handle; const ApplicationHandle app_uid = app_handle; - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "enter. device_id: " << &device_uid << ", app_handle: " << &app_uid); DeviceSptr device = FindDevice(device_handle); if (!device) { - LOG4CXX_WARN(logger_, "Device: uid " << &device_uid << " not found"); + SDL_LOG_WARN("Device: uid " << &device_uid << " not found"); return; } @@ -780,20 +769,19 @@ void TransportAdapterImpl::DisconnectDone(const DeviceUID& device_handle, RemoveConnection(device_uid, app_uid); if (device_disconnected) { - LOG4CXX_DEBUG(logger_, "Removing device..."); + SDL_LOG_DEBUG("Removing device..."); RemoveDevice(device_uid); } Store(); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterImpl::DataReceiveDone( const DeviceUID& device_id, const ApplicationHandle& app_handle, ::protocol_handler::RawMessagePtr message) { - LOG4CXX_TRACE(logger_, - "enter. device_id: " << &device_id + SDL_LOG_TRACE("enter. device_id: " << &device_id << ", app_handle: " << &app_handle << ", message: " << message); @@ -808,33 +796,33 @@ void TransportAdapterImpl::DataReceiveDone( ++it) { (*it)->OnDataReceiveDone(this, device_id, app_handle, message); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterImpl::DataReceiveFailed( const DeviceUID& device_id, const ApplicationHandle& app_handle, const DataReceiveError& error) { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { (*it)->OnDataReceiveFailed(this, device_id, app_handle, error); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterImpl::DataSendDone( const DeviceUID& device_id, const ApplicationHandle& app_handle, ::protocol_handler::RawMessagePtr message) { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { (*it)->OnDataSendDone(this, device_id, app_handle, message); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterImpl::DataSendFailed( @@ -842,18 +830,18 @@ void TransportAdapterImpl::DataSendFailed( const ApplicationHandle& app_handle, ::protocol_handler::RawMessagePtr message, const DataSendError& error) { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { (*it)->OnDataSendFailed(this, device_id, app_handle, message, error); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterImpl::TransportConfigUpdated( const TransportConfig& new_config) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { @@ -862,7 +850,7 @@ void TransportAdapterImpl::TransportConfigUpdated( } void TransportAdapterImpl::DoTransportSwitch() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::for_each( listeners_.begin(), listeners_.end(), @@ -872,16 +860,15 @@ void TransportAdapterImpl::DoTransportSwitch() const { } void TransportAdapterImpl::DeviceSwitched(const DeviceUID& device_handle) { - LOG4CXX_DEBUG(logger_, - "Switching is not implemented for that adapter type " - << GetConnectionType().c_str()); + SDL_LOG_DEBUG("Switching is not implemented for that adapter type " + << GetConnectionType().c_str()); UNUSED(device_handle); } ConnectionSPtr TransportAdapterImpl::FindPendingConnection( const DeviceUID& device_id, const ApplicationHandle& app_handle) const { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "enter. device_id: " << &device_id << ", app_handle: " << &app_handle); ConnectionSPtr connection; connections_lock_.AcquireForReading(); @@ -894,28 +881,28 @@ ConnectionSPtr TransportAdapterImpl::FindPendingConnection( } } connections_lock_.Release(); - LOG4CXX_TRACE(logger_, "exit with Connection: " << connection); + SDL_LOG_TRACE("exit with Connection: " << connection); return connection; } DeviceSptr TransportAdapterImpl::FindDevice(const DeviceUID& device_id) const { - LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id); + SDL_LOG_TRACE("enter. device_id: " << &device_id); DeviceSptr ret; sync_primitives::AutoLock locker(devices_mutex_); - LOG4CXX_DEBUG(logger_, "devices_.size() = " << devices_.size()); + SDL_LOG_DEBUG("devices_.size() = " << devices_.size()); DeviceMap::const_iterator it = devices_.find(device_id); if (it != devices_.end()) { ret = it->second; } else { - LOG4CXX_WARN(logger_, "Device " << device_id << " not found."); + SDL_LOG_WARN("Device " << device_id << " not found."); } - LOG4CXX_TRACE(logger_, "exit with DeviceSptr: " << ret); + SDL_LOG_TRACE("exit with DeviceSptr: " << ret); return ret; } void TransportAdapterImpl::ConnectPending(const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); connections_lock_.AcquireForWriting(); ConnectionMap::iterator it_conn = connections_.find(std::make_pair(device_id, app_handle)); @@ -927,8 +914,8 @@ void TransportAdapterImpl::ConnectPending(const DeviceUID& device_id, DeviceSptr device = FindDevice(device_id); if (device.use_count() == 0) { - LOG4CXX_ERROR( - logger_, "Unable to find device, cannot set connection pending status"); + SDL_LOG_ERROR( + "Unable to find device, cannot set connection pending status"); return; } else { device->set_connection_status(ConnectionStatus::PENDING); @@ -943,8 +930,8 @@ void TransportAdapterImpl::ConnectPending(const DeviceUID& device_id, void TransportAdapterImpl::ConnectDone(const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "enter. device_id: " << &device_id << ", app_handle: " << &app_handle); connections_lock_.AcquireForReading(); ConnectionMap::iterator it_conn = @@ -962,7 +949,7 @@ void TransportAdapterImpl::ConnectDone(const DeviceUID& device_id, } Store(); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterImpl::ConnectFailed(const DeviceUID& device_handle, @@ -970,8 +957,7 @@ void TransportAdapterImpl::ConnectFailed(const DeviceUID& device_handle, const ConnectError& error) { const DeviceUID device_uid = device_handle; const ApplicationHandle app_uid = app_handle; - LOG4CXX_TRACE(logger_, - "enter. device_id: " << &device_uid << ", app_handle: " + SDL_LOG_TRACE("enter. device_id: " << &device_uid << ", app_handle: " << &app_uid << ", error: " << &error); RemoveConnection(device_uid, app_uid); for (TransportAdapterListenerList::iterator it = listeners_.begin(); @@ -979,27 +965,25 @@ void TransportAdapterImpl::ConnectFailed(const DeviceUID& device_handle, ++it) { (*it)->OnConnectFailed(this, device_uid, app_uid, error); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterImpl::RemoveFinalizedConnection( const DeviceUID& device_handle, const ApplicationHandle& app_handle) { const DeviceUID device_uid = device_handle; - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); { connections_lock_.AcquireForWriting(); auto it_conn = connections_.find(std::make_pair(device_uid, app_handle)); if (connections_.end() == it_conn) { - LOG4CXX_WARN(logger_, - "Device_id: " << &device_uid << ", app_handle: " + SDL_LOG_WARN("Device_id: " << &device_uid << ", app_handle: " << &app_handle << " connection not found"); connections_lock_.Release(); return; } const ConnectionInfo& info = it_conn->second; if (ConnectionInfo::FINALISING != info.state) { - LOG4CXX_WARN(logger_, - "Device_id: " << &device_uid << ", app_handle: " + SDL_LOG_WARN("Device_id: " << &device_uid << ", app_handle: " << &app_handle << " connection not finalized"); connections_lock_.Release(); return; @@ -1007,20 +991,18 @@ void TransportAdapterImpl::RemoveFinalizedConnection( // By copying the info.connection shared pointer into this local variable, // we can delay the connection's destructor until after // connections_lock_.Release. - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "RemoveFinalizedConnection copying connection with Device_id: " - << &device_uid << ", app_handle: " << &app_handle); + << &device_uid << ", app_handle: " << &app_handle); ConnectionSPtr connection = info.connection; connections_.erase(it_conn); connections_lock_.Release(); - LOG4CXX_DEBUG(logger_, - "RemoveFinalizedConnection Connections Lock Released"); + SDL_LOG_DEBUG("RemoveFinalizedConnection Connections Lock Released"); } DeviceSptr device = FindDevice(device_handle); if (!device) { - LOG4CXX_WARN(logger_, "Device: uid " << &device_uid << " not found"); + SDL_LOG_WARN("Device: uid " << &device_uid << " not found"); return; } @@ -1032,7 +1014,7 @@ void TransportAdapterImpl::RemoveFinalizedConnection( void TransportAdapterImpl::RemoveConnection( const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ConnectionSPtr connection; connections_lock_.AcquireForWriting(); ConnectionMap::const_iterator it = @@ -1040,48 +1022,45 @@ void TransportAdapterImpl::RemoveConnection( if (it != connections_.end()) { // By copying the connection from the map to this shared pointer, // we can erase the object from the map without triggering the destructor - LOG4CXX_DEBUG(logger_, - "Copying connection with Device_id: " - << &device_id << ", app_handle: " << &app_handle); + SDL_LOG_DEBUG("Copying connection with Device_id: " + << &device_id << ", app_handle: " << &app_handle); connection = it->second.connection; connections_.erase(it); } connections_lock_.Release(); - LOG4CXX_DEBUG(logger_, "Connections Lock Released"); + SDL_LOG_DEBUG("Connections Lock Released"); // And now, "connection" goes out of scope, triggering the destructor outside // of the "connections_lock_" } void TransportAdapterImpl::AddListener(TransportAdapterListener* listener) { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); listeners_.push_back(listener); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } ApplicationList TransportAdapterImpl::GetApplicationList( const DeviceUID& device_id) const { - LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id); + SDL_LOG_TRACE("enter. device_id: " << &device_id); DeviceSptr device = FindDevice(device_id); if (device.use_count() != 0) { ApplicationList lst = device->GetApplicationList(); - LOG4CXX_TRACE(logger_, - "exit with ApplicationList. It's size = " - << lst.size() << " Condition: device.use_count() != 0"); + SDL_LOG_TRACE("exit with ApplicationList. It's size = " + << lst.size() << " Condition: device.use_count() != 0"); return lst; } - LOG4CXX_TRACE(logger_, - "exit with empty ApplicationList. Condition: NOT " - "device.use_count() != 0"); + SDL_LOG_TRACE( + "exit with empty ApplicationList. Condition: NOT " + "device.use_count() != 0"); return ApplicationList(); } void TransportAdapterImpl::ConnectionFinished( const DeviceUID& device_id, const ApplicationHandle& app_handle) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_TRACE( - logger_, - "enter. device_id: " << &device_id << ", app_handle: " << &app_handle); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_TRACE("enter. device_id: " << &device_id + << ", app_handle: " << &app_handle); connections_lock_.AcquireForReading(); ConnectionMap::iterator it = connections_.find(std::make_pair(device_id, app_handle)); @@ -1096,7 +1075,7 @@ void TransportAdapterImpl::ConnectionAborted( const DeviceUID& device_id, const ApplicationHandle& app_handle, const CommunicationError& error) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); ConnectionFinished(device_id, app_handle); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); @@ -1106,32 +1085,32 @@ void TransportAdapterImpl::ConnectionAborted( } bool TransportAdapterImpl::IsInitialised() const { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); if (!initialised_) { - LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: !initialised_"); + SDL_LOG_TRACE("exit with FALSE. Condition: !initialised_"); return false; } if (device_scanner_ && !device_scanner_->IsInitialised()) { - LOG4CXX_TRACE(logger_, - "exit with FALSE. Condition: device_scanner_ && " - "!device_scanner_->IsInitialised()"); + SDL_LOG_TRACE( + "exit with FALSE. Condition: device_scanner_ && " + "!device_scanner_->IsInitialised()"); return false; } if (server_connection_factory_ && !server_connection_factory_->IsInitialised()) { - LOG4CXX_TRACE(logger_, - "exit with FALSE. Condition: server_connection_factory_ && " - "!server_connection_factory_->IsInitialised()"); + SDL_LOG_TRACE( + "exit with FALSE. Condition: server_connection_factory_ && " + "!server_connection_factory_->IsInitialised()"); return false; } if (client_connection_listener_ && !client_connection_listener_->IsInitialised()) { - LOG4CXX_TRACE(logger_, - "exit with FALSE. Condition: client_connection_listener_ && " - "!client_connection_listener_->IsInitialised()"); + SDL_LOG_TRACE( + "exit with FALSE. Condition: client_connection_listener_ && " + "!client_connection_listener_->IsInitialised()"); return false; } - LOG4CXX_TRACE(logger_, "exit with TRUE"); + SDL_LOG_TRACE("exit with TRUE"); return true; } @@ -1145,7 +1124,7 @@ std::string TransportAdapterImpl::DeviceName(const DeviceUID& device_id) const { } void TransportAdapterImpl::StopDevice(const DeviceUID& device_id) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeviceSptr device = FindDevice(device_id); if (device) { device->Stop(); @@ -1157,7 +1136,7 @@ std::string TransportAdapterImpl::GetConnectionType() const { } SwitchableDevices TransportAdapterImpl::GetSwitchableDevices() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); SwitchableDevices devices; sync_primitives::AutoLock locker(devices_mutex_); for (DeviceMap::const_iterator it = devices_.begin(); it != devices_.end(); @@ -1166,15 +1145,13 @@ SwitchableDevices TransportAdapterImpl::GetSwitchableDevices() const { const auto device = it->second; const auto transport_switch_id = device->transport_switch_id(); if (transport_switch_id.empty()) { - LOG4CXX_DEBUG(logger_, - "Device is not suitable for switching: " << device_uid); + SDL_LOG_DEBUG("Device is not suitable for switching: " << device_uid); continue; } - LOG4CXX_DEBUG(logger_, "Device is suitable for switching: " << device_uid); + SDL_LOG_DEBUG("Device is suitable for switching: " << device_uid); devices.insert(std::make_pair(device_uid, transport_switch_id)); } - LOG4CXX_INFO(logger_, - "Found number of switchable devices: " << devices.size()); + SDL_LOG_INFO("Found number of switchable devices: " << devices.size()); return devices; } @@ -1201,14 +1178,14 @@ bool TransportAdapterImpl::ToBeAutoConnected(DeviceSptr device) const { } bool TransportAdapterImpl::ToBeAutoDisconnected(DeviceSptr device) const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return true; } ConnectionSPtr TransportAdapterImpl::FindEstablishedConnection( const DeviceUID& device_id, const ApplicationHandle& app_handle) const { - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "enter. device_id: " << &device_id << ", app_handle: " << &app_handle); ConnectionSPtr connection; connections_lock_.AcquireForReading(); @@ -1221,59 +1198,55 @@ ConnectionSPtr TransportAdapterImpl::FindEstablishedConnection( } } connections_lock_.Release(); - LOG4CXX_TRACE(logger_, "exit with Connection: " << connection); + SDL_LOG_TRACE("exit with Connection: " << connection); return connection; } TransportAdapter::Error TransportAdapterImpl::ConnectDevice(DeviceSptr device) { - LOG4CXX_TRACE(logger_, "enter. device: " << device); + SDL_LOG_TRACE("enter. device: " << device); DeviceUID device_id = device->unique_device_id(); ApplicationList app_list = device->GetApplicationList(); - LOG4CXX_INFO(logger_, - "Device " << device->name() << " has " << app_list.size() + SDL_LOG_INFO("Device " << device->name() << " has " << app_list.size() << " applications."); bool errors_occurred = false; for (ApplicationList::iterator it = app_list.begin(); it != app_list.end(); ++it) { const ApplicationHandle app_handle = *it; - LOG4CXX_DEBUG(logger_, - "Attempt to connect device " << device_id << ", channel " + SDL_LOG_DEBUG("Attempt to connect device " << device_id << ", channel " << app_handle); const Error error = Connect(device_id, app_handle); switch (error) { case OK: - LOG4CXX_DEBUG(logger_, "error = OK"); + SDL_LOG_DEBUG("error = OK"); break; case ALREADY_EXISTS: - LOG4CXX_DEBUG(logger_, "error = ALREADY_EXISTS"); + SDL_LOG_DEBUG("error = ALREADY_EXISTS"); break; default: - LOG4CXX_ERROR(logger_, - "Connect to device " << device_id << ", channel " + SDL_LOG_ERROR("Connect to device " << device_id << ", channel " << app_handle << " failed with error " << error); errors_occurred = true; - LOG4CXX_DEBUG(logger_, "switch (error), default case"); + SDL_LOG_DEBUG("switch (error), default case"); break; } } if (errors_occurred) { - LOG4CXX_TRACE(logger_, "exit with error:FAIL"); + SDL_LOG_TRACE("exit with error:FAIL"); return FAIL; } else { - LOG4CXX_TRACE(logger_, "exit with error:OK"); + SDL_LOG_TRACE("exit with error:OK"); return OK; } } void TransportAdapterImpl::RunAppOnDevice(const DeviceUID& device_uid, const std::string& bundle_id) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeviceSptr device = FindDevice(device_uid); if (!device) { - LOG4CXX_WARN(logger_, - "Device with id: " << device_uid << " Not found" + SDL_LOG_WARN("Device with id: " << device_uid << " Not found" << "withing list of connected deviced"); return; } @@ -1282,8 +1255,8 @@ void TransportAdapterImpl::RunAppOnDevice(const DeviceUID& device_uid, } void TransportAdapterImpl::RemoveDevice(const DeviceUID& device_handle) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Remove Device_handle: " << &device_handle); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Remove Device_handle: " << &device_handle); sync_primitives::AutoLock locker(devices_mutex_); DeviceMap::iterator i = devices_.find(device_handle); if (i != devices_.end()) { diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc index 2e411a4f87..1d07e01c7a 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc @@ -39,7 +39,7 @@ #include "transport_manager/transport_manager_impl.h" namespace transport_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") TransportAdapterListenerImpl::TransportAdapterListenerImpl( TransportManager* manager, TransportAdapter* adapter) @@ -47,7 +47,7 @@ TransportAdapterListenerImpl::TransportAdapterListenerImpl( void TransportAdapterListenerImpl::OnSearchDeviceDone( const TransportAdapter* adapter) { - LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter); + SDL_LOG_TRACE("enter. adapter* " << adapter); const TransportAdapterEvent event(EventTypeEnum::ON_SEARCH_DONE, transport_adapter_, "", @@ -57,15 +57,14 @@ void TransportAdapterListenerImpl::OnSearchDeviceDone( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnSearchDeviceFailed( const TransportAdapter* adapter, const SearchDeviceError& error) { - LOG4CXX_TRACE(logger_, - "enter. adapter: " << adapter << ", error: " << &error); + SDL_LOG_TRACE("enter. adapter: " << adapter << ", error: " << &error); SearchDeviceError* err = new SearchDeviceError(error); const TransportAdapterEvent event(EventTypeEnum::ON_SEARCH_FAIL, transport_adapter_, @@ -76,14 +75,14 @@ void TransportAdapterListenerImpl::OnSearchDeviceFailed( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnDeviceListUpdated( const TransportAdapter* adapter) { - LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter); + SDL_LOG_TRACE("enter. adapter* " << adapter); const TransportAdapterEvent event(EventTypeEnum::ON_DEVICE_LIST_UPDATED, transport_adapter_, "", @@ -93,14 +92,14 @@ void TransportAdapterListenerImpl::OnDeviceListUpdated( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnFindNewApplicationsRequest( const TransportAdapter* adapter) { - LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter); + SDL_LOG_TRACE("enter. adapter* " << adapter); const TransportAdapterEvent event( EventTypeEnum::ON_FIND_NEW_APPLICATIONS_REQUEST, transport_adapter_, @@ -111,14 +110,14 @@ void TransportAdapterListenerImpl::OnFindNewApplicationsRequest( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnConnectionStatusUpdated( const TransportAdapter* adapter) { - LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter); + SDL_LOG_TRACE("enter. adapter* " << adapter); const TransportAdapterEvent event(EventTypeEnum::ON_CONNECTION_STATUS_UPDATED, transport_adapter_, "", @@ -128,17 +127,16 @@ void TransportAdapterListenerImpl::OnConnectionStatusUpdated( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnConnectPending( const TransportAdapter* adapter, const DeviceUID& device, const ApplicationHandle& application_id) { - LOG4CXX_TRACE(logger_, - "enter adapter*: " << adapter << ", device: " << &device + SDL_LOG_TRACE("enter adapter*: " << adapter << ", device: " << &device << ", application_id: " << &application_id); const TransportAdapterEvent event(EventTypeEnum::ON_CONNECT_PENDING, transport_adapter_, @@ -149,17 +147,16 @@ void TransportAdapterListenerImpl::OnConnectPending( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnConnectDone( const TransportAdapter* adapter, const DeviceUID& device, const ApplicationHandle& application_id) { - LOG4CXX_TRACE(logger_, - "enter adapter*: " << adapter << ", device: " << &device + SDL_LOG_TRACE("enter adapter*: " << adapter << ", device: " << &device << ", application_id: " << &application_id); const TransportAdapterEvent event(EventTypeEnum::ON_CONNECT_DONE, transport_adapter_, @@ -170,9 +167,9 @@ void TransportAdapterListenerImpl::OnConnectDone( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnConnectFailed( @@ -180,8 +177,7 @@ void TransportAdapterListenerImpl::OnConnectFailed( const DeviceUID& device, const ApplicationHandle& app_id, const ConnectError& error) { - LOG4CXX_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device + SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", error: " << &error); ConnectError* err = new ConnectError(error); @@ -194,18 +190,17 @@ void TransportAdapterListenerImpl::OnConnectFailed( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnDisconnectDone( const TransportAdapter* adapter, const DeviceUID& device, const ApplicationHandle& app_id) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device + SDL_LOG_AUTO_TRACE(); + SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id); const TransportAdapterEvent event(EventTypeEnum::ON_DISCONNECT_DONE, transport_adapter_, @@ -216,9 +211,9 @@ void TransportAdapterListenerImpl::OnDisconnectDone( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnDisconnectFailed( @@ -226,8 +221,7 @@ void TransportAdapterListenerImpl::OnDisconnectFailed( const DeviceUID& device, const ApplicationHandle& app_id, const DisconnectError& error) { - LOG4CXX_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device + SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", error: " << &error); DisconnectError* err = new DisconnectError(error); @@ -240,14 +234,14 @@ void TransportAdapterListenerImpl::OnDisconnectFailed( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnDisconnectDeviceDone( const TransportAdapter* adapter, const DeviceUID& device) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); } void TransportAdapterListenerImpl::OnDisconnectDeviceFailed( @@ -260,8 +254,7 @@ void TransportAdapterListenerImpl::OnDataReceiveDone( const DeviceUID& device, const ApplicationHandle& app_id, const ::protocol_handler::RawMessagePtr data_container) { - LOG4CXX_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device + SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", data_container: " << data_container); const TransportAdapterEvent event(EventTypeEnum::ON_RECEIVED_DONE, @@ -273,9 +266,9 @@ void TransportAdapterListenerImpl::OnDataReceiveDone( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnDataReceiveFailed( @@ -283,8 +276,7 @@ void TransportAdapterListenerImpl::OnDataReceiveFailed( const DeviceUID& device, const ApplicationHandle& app_id, const DataReceiveError& error) { - LOG4CXX_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device + SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", error: " << &error); DataReceiveError* err = new DataReceiveError(error); @@ -297,9 +289,9 @@ void TransportAdapterListenerImpl::OnDataReceiveFailed( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnDataSendDone( @@ -307,8 +299,7 @@ void TransportAdapterListenerImpl::OnDataSendDone( const DeviceUID& device, const ApplicationHandle& app_id, const ::protocol_handler::RawMessagePtr data_container) { - LOG4CXX_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device + SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", data_container: " << data_container); const TransportAdapterEvent event(EventTypeEnum::ON_SEND_DONE, @@ -320,9 +311,9 @@ void TransportAdapterListenerImpl::OnDataSendDone( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnDataSendFailed( @@ -331,8 +322,7 @@ void TransportAdapterListenerImpl::OnDataSendFailed( const ApplicationHandle& app_id, const ::protocol_handler::RawMessagePtr data_container, const DataSendError& error) { - LOG4CXX_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device + SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", data_container: " << data_container << ", error: " << &error); @@ -346,9 +336,9 @@ void TransportAdapterListenerImpl::OnDataSendFailed( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnConnectRequested( @@ -361,8 +351,7 @@ void TransportAdapterListenerImpl::OnUnexpectedDisconnect( const DeviceUID& device, const ApplicationHandle& application, const CommunicationError& error) { - LOG4CXX_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device + SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device << ", application: " << &application << ", error: " << &error); CommunicationError* err = new CommunicationError(error); @@ -375,17 +364,16 @@ void TransportAdapterListenerImpl::OnUnexpectedDisconnect( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnCommunicationError( const TransportAdapter* adapter, const DeviceUID& device, const ApplicationHandle& app_id) { - LOG4CXX_TRACE(logger_, - "enter. adapter: " << adapter << ", device: " << &device + SDL_LOG_TRACE("enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id); const TransportAdapterEvent event(EventTypeEnum::ON_COMMUNICATION_ERROR, transport_adapter_, @@ -396,14 +384,14 @@ void TransportAdapterListenerImpl::OnCommunicationError( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportAdapterListenerImpl::OnTransportSwitchRequested( const transport_adapter::TransportAdapter* adapter) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const TransportAdapterEvent event( EventTypeEnum::ON_TRANSPORT_SWITCH_REQUESTED, transport_adapter_, @@ -414,13 +402,13 @@ void TransportAdapterListenerImpl::OnTransportSwitchRequested( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } } void TransportAdapterListenerImpl::OnTransportConfigUpdated( const transport_adapter::TransportAdapter* adapter) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const TransportAdapterEvent event(EventTypeEnum::ON_TRANSPORT_CONFIG_UPDATED, transport_adapter_, @@ -432,7 +420,7 @@ void TransportAdapterListenerImpl::OnTransportConfigUpdated( if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { - LOG4CXX_WARN(logger_, "Failed to receive event from device"); + SDL_LOG_WARN("Failed to receive event from device"); } } diff --git a/src/components/transport_manager/src/transport_manager_default.cc b/src/components/transport_manager/src/transport_manager_default.cc index 74c5b9ceee..45d0b04528 100644 --- a/src/components/transport_manager/src/transport_manager_default.cc +++ b/src/components/transport_manager/src/transport_manager_default.cc @@ -57,7 +57,7 @@ #endif // ENABLE_IAP2EMULATION namespace transport_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") TransportAdapterFactory::TransportAdapterFactory() { #ifdef BLUETOOTH_SUPPORT @@ -104,11 +104,11 @@ TransportManagerDefault::TransportManagerDefault( int TransportManagerDefault::Init( resumption::LastStateWrapperPtr last_state_wrapper) { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); if (E_SUCCESS != TransportManagerImpl::Init(last_state_wrapper)) { - LOG4CXX_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: E_SUCCESS != " - "TransportManagerImpl::Init()"); + SDL_LOG_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: E_SUCCESS != " + "TransportManagerImpl::Init()"); return E_TM_IS_NOT_INITIALIZED; } @@ -186,7 +186,7 @@ int TransportManagerDefault::Init( AddTransportAdapter(iap2_usb_emu_adapter); #endif // ENABLE_IAP2EMULATION - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc index 62fd75b7dd..a0d019cd69 100644 --- a/src/components/transport_manager/src/transport_manager_impl.cc +++ b/src/components/transport_manager/src/transport_manager_impl.cc @@ -76,19 +76,18 @@ struct ConnectionFinder { namespace transport_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") TransportManagerImpl::Connection TransportManagerImpl::convert( const TransportManagerImpl::ConnectionInternal& p) { - LOG4CXX_TRACE(logger_, "enter. ConnectionInternal: " << &p); + SDL_LOG_TRACE("enter. ConnectionInternal: " << &p); TransportManagerImpl::Connection c; c.application = p.application; c.device = p.device; c.id = p.id; - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( "exit with TransportManagerImpl::Connection. It's ConnectionUID = " - << c.id); + << c.id); return c; } @@ -113,11 +112,11 @@ TransportManagerImpl::TransportManagerImpl( "", webengine_constants::kWebEngineDeviceName, webengine_constants::kWebEngineConnectionType) { - LOG4CXX_TRACE(logger_, "TransportManager has created"); + SDL_LOG_TRACE("TransportManager has created"); } TransportManagerImpl::~TransportManagerImpl() { - LOG4CXX_DEBUG(logger_, "TransportManager object destroying"); + SDL_LOG_DEBUG("TransportManager object destroying"); message_queue_.Shutdown(); event_queue_.Shutdown(); @@ -135,11 +134,11 @@ TransportManagerImpl::~TransportManagerImpl() { delete it->second; } - LOG4CXX_INFO(logger_, "TransportManager object destroyed"); + SDL_LOG_INFO("TransportManager object destroyed"); } void TransportManagerImpl::ReconnectionTimeout() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); RaiseEvent(&TransportManagerListener::OnDeviceSwitchingFinish, device_to_reconnect_); } @@ -148,7 +147,7 @@ void TransportManagerImpl::AddCloudDevice( const transport_manager::transport_adapter::CloudAppProperties& cloud_properties) { #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"); #else transport_adapter::DeviceType type = transport_adapter::DeviceType::UNKNOWN; if (cloud_properties.cloud_transport_type == "WS") { @@ -179,7 +178,7 @@ void TransportManagerImpl::AddCloudDevice( void TransportManagerImpl::RemoveCloudDevice(const DeviceHandle device_handle) { #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 DisconnectDevice(device_handle); @@ -187,30 +186,30 @@ void TransportManagerImpl::RemoveCloudDevice(const DeviceHandle device_handle) { } int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) { - LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle); + SDL_LOG_TRACE("enter. DeviceHandle: " << &device_handle); if (!this->is_initialized_) { - LOG4CXX_ERROR(logger_, "TransportManager is not initialized."); - LOG4CXX_TRACE( - logger_, + SDL_LOG_ERROR("TransportManager is not initialized."); + SDL_LOG_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } DeviceUID device_id = converter_.HandleToUid(device_handle); - LOG4CXX_DEBUG(logger_, "Convert handle to id:" << device_id); + SDL_LOG_DEBUG("Convert handle to id:" << device_id); sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_); DeviceToAdapterMap::iterator it = device_to_adapter_map_.find(device_id); if (it == device_to_adapter_map_.end()) { - LOG4CXX_ERROR(logger_, "No device adapter found by id " << device_id); - LOG4CXX_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta"); + SDL_LOG_ERROR("No device adapter found by id " << device_id); + SDL_LOG_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == ta"); return E_INVALID_HANDLE; } transport_adapter::TransportAdapter* ta = it->second; TransportAdapter::Error ta_error = ta->ConnectDevice(device_id); int err = (TransportAdapter::OK == ta_error) ? E_SUCCESS : E_INTERNAL_ERROR; - LOG4CXX_TRACE(logger_, "exit with error: " << err); + SDL_LOG_TRACE("exit with error: " << err); return err; } @@ -222,8 +221,8 @@ ConnectionStatus TransportManagerImpl::GetConnectionStatus( DeviceToAdapterMap::const_iterator it = device_to_adapter_map_.find(device_id); if (it == device_to_adapter_map_.end()) { - LOG4CXX_ERROR(logger_, "No device adapter found by id " << device_handle); - LOG4CXX_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta"); + SDL_LOG_ERROR("No device adapter found by id " << device_handle); + SDL_LOG_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == ta"); return ConnectionStatus::INVALID; } transport_adapter::TransportAdapter* ta = it->second; @@ -231,36 +230,36 @@ ConnectionStatus TransportManagerImpl::GetConnectionStatus( } int TransportManagerImpl::DisconnectDevice(const DeviceHandle device_handle) { - LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle); + SDL_LOG_TRACE("enter. DeviceHandle: " << &device_handle); if (!this->is_initialized_) { - LOG4CXX_ERROR(logger_, "TransportManager is not initialized."); - LOG4CXX_TRACE( - logger_, + SDL_LOG_ERROR("TransportManager is not initialized."); + SDL_LOG_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } DeviceUID device_id = converter_.HandleToUid(device_handle); - LOG4CXX_DEBUG(logger_, "Convert handle to id:" << device_id); + SDL_LOG_DEBUG("Convert handle to id:" << device_id); sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_); DeviceToAdapterMap::iterator it = device_to_adapter_map_.find(device_id); if (it == device_to_adapter_map_.end()) { - LOG4CXX_WARN(logger_, "No device adapter found by id " << device_id); - LOG4CXX_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta"); + SDL_LOG_WARN("No device adapter found by id " << device_id); + SDL_LOG_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == ta"); return E_INVALID_HANDLE; } transport_adapter::TransportAdapter* ta = it->second; ta->DisconnectDevice(device_id); - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::Disconnect(const ConnectionUID cid) { - LOG4CXX_TRACE(logger_, "enter. ConnectionUID: " << &cid); + SDL_LOG_TRACE("enter. ConnectionUID: " << &cid); if (!this->is_initialized_) { - LOG4CXX_ERROR(logger_, "TransportManager is not initialized."); - LOG4CXX_TRACE( - logger_, + SDL_LOG_ERROR("TransportManager is not initialized."); + SDL_LOG_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } @@ -268,11 +267,9 @@ int TransportManagerImpl::Disconnect(const ConnectionUID cid) { sync_primitives::AutoReadLock lock(connections_lock_); ConnectionInternal* connection = GetConnection(cid); if (NULL == connection) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "TransportManagerImpl::Disconnect: Connection does not exist."); - LOG4CXX_TRACE(logger_, - "exit with E_INVALID_HANDLE. Condition: NULL == connection"); + SDL_LOG_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == connection"); return E_INVALID_HANDLE; } @@ -303,44 +300,43 @@ int TransportManagerImpl::Disconnect(const ConnectionUID cid) { connection->application); } */ - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::DisconnectForce(const ConnectionUID cid) { - LOG4CXX_TRACE(logger_, "enter ConnectionUID: " << &cid); + SDL_LOG_TRACE("enter ConnectionUID: " << &cid); if (false == this->is_initialized_) { - LOG4CXX_ERROR(logger_, "TransportManager is not initialized."); - LOG4CXX_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " - "this->is_initialized_"); + SDL_LOG_ERROR("TransportManager is not initialized."); + SDL_LOG_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " + "this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } sync_primitives::AutoReadLock lock(connections_lock_); const ConnectionInternal* connection = GetConnection(cid); if (NULL == connection) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "TransportManagerImpl::DisconnectForce: Connection does not exist."); - LOG4CXX_TRACE(logger_, - "exit with E_INVALID_HANDLE. Condition: NULL == connection"); + SDL_LOG_TRACE("exit with E_INVALID_HANDLE. Condition: NULL == connection"); return E_INVALID_HANDLE; } connection->transport_adapter->Disconnect(connection->device, connection->application); - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::AddEventListener(TransportManagerListener* listener) { - LOG4CXX_TRACE(logger_, "enter. TransportManagerListener: " << listener); + SDL_LOG_TRACE("enter. TransportManagerListener: " << listener); transport_manager_listener_.push_back(listener); - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } void TransportManagerImpl::DisconnectAllDevices() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoReadLock lock(device_list_lock_); for (DeviceInfoList::iterator i = device_list_.begin(); i != device_list_.end(); @@ -351,7 +347,7 @@ void TransportManagerImpl::DisconnectAllDevices() { } void TransportManagerImpl::TerminateAllAdapters() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (std::vector<TransportAdapter*>::iterator i = transport_adapters_.begin(); i != transport_adapters_.end(); ++i) { @@ -360,7 +356,7 @@ void TransportManagerImpl::TerminateAllAdapters() { } int TransportManagerImpl::InitAllAdapters() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); for (std::vector<TransportAdapter*>::iterator i = transport_adapters_.begin(); i != transport_adapters_.end(); ++i) { @@ -372,9 +368,9 @@ int TransportManagerImpl::InitAllAdapters() { } int TransportManagerImpl::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!is_initialized_) { - LOG4CXX_WARN(logger_, "TransportManager is not initialized_"); + SDL_LOG_WARN("TransportManager is not initialized_"); return E_TM_IS_NOT_INITIALIZED; } @@ -390,15 +386,14 @@ int TransportManagerImpl::Stop() { int TransportManagerImpl::SendMessageToDevice( const ::protocol_handler::RawMessagePtr message) { - LOG4CXX_TRACE(logger_, "enter. RawMessageSptr: " << message); - LOG4CXX_INFO( - logger_, - "Send message to device called with arguments " << message.get()); + SDL_LOG_TRACE("enter. RawMessageSptr: " << message); + SDL_LOG_INFO("Send message to device called with arguments " + << message.get()); if (false == this->is_initialized_) { - LOG4CXX_ERROR(logger_, "TM is not initialized."); - LOG4CXX_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " - "this->is_initialized_"); + SDL_LOG_ERROR("TM is not initialized."); + SDL_LOG_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " + "this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } @@ -407,21 +402,20 @@ int TransportManagerImpl::SendMessageToDevice( const ConnectionInternal* connection = GetConnection(message->connection_key()); if (NULL == connection) { - LOG4CXX_ERROR(logger_, - "Connection with id " << message->connection_key() + SDL_LOG_ERROR("Connection with id " << message->connection_key() << " does not exist."); - LOG4CXX_TRACE( - logger_, "exit with E_INVALID_HANDLE. Condition: NULL == connection"); + SDL_LOG_TRACE( + "exit with E_INVALID_HANDLE. Condition: NULL == connection"); return E_INVALID_HANDLE; } if (connection->shutdown_) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "TransportManagerImpl::Disconnect: Connection is to shut down."); - LOG4CXX_TRACE(logger_, - "exit with E_CONNECTION_IS_TO_SHUTDOWN. Condition: " - "connection->shutDown"); + SDL_LOG_TRACE( + "exit with E_CONNECTION_IS_TO_SHUTDOWN. Condition: " + "connection->shutDown"); return E_CONNECTION_IS_TO_SHUTDOWN; } } @@ -431,30 +425,29 @@ int TransportManagerImpl::SendMessageToDevice( } #endif // TELEMETRY_MONITOR this->PostMessage(message); - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } void TransportManagerImpl::RunAppOnDevice(const DeviceHandle device_handle, const std::string& bundle_id) { if (!this->is_initialized_) { - LOG4CXX_ERROR(logger_, "TransportManager is not initialized."); + SDL_LOG_ERROR("TransportManager is not initialized."); return; } DeviceUID device_id = converter_.HandleToUid(device_handle); - LOG4CXX_DEBUG(logger_, "Convert handle to id:" << device_id); + SDL_LOG_DEBUG("Convert handle to id:" << device_id); sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_); DeviceToAdapterMap::iterator it = device_to_adapter_map_.find(device_id); if (it == device_to_adapter_map_.end()) { - LOG4CXX_ERROR(logger_, "No device adapter found by id " << device_id); + SDL_LOG_ERROR("No device adapter found by id " << device_id); return; } transport_adapter::TransportAdapter* ta = it->second; if (!ta) { - LOG4CXX_ERROR(logger_, - "Transport adapter for device: " << device_id << " is NULL"); + SDL_LOG_ERROR("Transport adapter for device: " << device_id << " is NULL"); return; } @@ -465,46 +458,46 @@ void TransportManagerImpl::RunAppOnDevice(const DeviceHandle device_handle, int TransportManagerImpl::ReceiveEventFromDevice( const TransportAdapterEvent& event) { - LOG4CXX_TRACE(logger_, "enter. TransportAdapterEvent: " << &event); + SDL_LOG_TRACE("enter. TransportAdapterEvent: " << &event); if (!is_initialized_) { - LOG4CXX_ERROR(logger_, "TM is not initialized."); - LOG4CXX_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " - "this->is_initialized_"); + SDL_LOG_ERROR("TM is not initialized."); + SDL_LOG_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " + "this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } this->PostEvent(event); - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::RemoveDevice(const DeviceHandle device_handle) { - LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle); + SDL_LOG_TRACE("enter. DeviceHandle: " << &device_handle); DeviceUID device_id = converter_.HandleToUid(device_handle); if (false == this->is_initialized_) { - LOG4CXX_ERROR(logger_, "TM is not initialized."); - LOG4CXX_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " - "this->is_initialized_"); + SDL_LOG_ERROR("TM is not initialized."); + SDL_LOG_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " + "this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } sync_primitives::AutoWriteLock lock(device_to_adapter_map_lock_); device_to_adapter_map_.erase(device_id); - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::AddTransportAdapter( transport_adapter::TransportAdapter* transport_adapter) { - LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << transport_adapter); + SDL_LOG_TRACE("enter. TransportAdapter: " << transport_adapter); if (transport_adapter_listeners_.find(transport_adapter) != transport_adapter_listeners_.end()) { - LOG4CXX_ERROR(logger_, "Adapter already exists."); - LOG4CXX_TRACE(logger_, - "exit with E_ADAPTER_EXISTS. Condition: " - "transport_adapter_listeners_.find(transport_adapter) != " - "transport_adapter_listeners_.end()"); + SDL_LOG_ERROR("Adapter already exists."); + SDL_LOG_TRACE( + "exit with E_ADAPTER_EXISTS. Condition: " + "transport_adapter_listeners_.find(transport_adapter) != " + "transport_adapter_listeners_.end()"); return E_ADAPTER_EXISTS; } @@ -520,21 +513,21 @@ int TransportManagerImpl::AddTransportAdapter( delete listener; delete transport_adapter; } - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::SearchDevices() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); if (!this->is_initialized_) { - LOG4CXX_ERROR(logger_, "TM is not initialized"); - LOG4CXX_TRACE( - logger_, + SDL_LOG_ERROR("TM is not initialized"); + SDL_LOG_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: !this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } - LOG4CXX_INFO(logger_, "Search device called"); + SDL_LOG_INFO("Search device called"); bool success_occurred = false; @@ -542,33 +535,29 @@ int TransportManagerImpl::SearchDevices() { transport_adapters_.begin(); it != transport_adapters_.end(); ++it) { - LOG4CXX_DEBUG(logger_, "Iterating over transport adapters"); + SDL_LOG_DEBUG("Iterating over transport adapters"); TransportAdapter::Error scanResult = (*it)->SearchDevices(); if (transport_adapter::TransportAdapter::OK == scanResult) { success_occurred = true; } else { - LOG4CXX_ERROR(logger_, - "Transport Adapter search failed " - << *it << "[" << (*it)->GetDeviceType() << "]"); + SDL_LOG_ERROR("Transport Adapter search failed " + << *it << "[" << (*it)->GetDeviceType() << "]"); switch (scanResult) { case transport_adapter::TransportAdapter::NOT_SUPPORTED: { - LOG4CXX_ERROR(logger_, - "Search feature is not supported " - << *it << "[" << (*it)->GetDeviceType() << "]"); - LOG4CXX_DEBUG(logger_, - "scanResult = TransportAdapter::NOT_SUPPORTED"); + SDL_LOG_ERROR("Search feature is not supported " + << *it << "[" << (*it)->GetDeviceType() << "]"); + SDL_LOG_DEBUG("scanResult = TransportAdapter::NOT_SUPPORTED"); break; } case transport_adapter::TransportAdapter::BAD_STATE: { - LOG4CXX_ERROR(logger_, - "Transport Adapter has bad state " - << *it << "[" << (*it)->GetDeviceType() << "]"); - LOG4CXX_DEBUG(logger_, "scanResult = TransportAdapter::BAD_STATE"); + SDL_LOG_ERROR("Transport Adapter has bad state " + << *it << "[" << (*it)->GetDeviceType() << "]"); + SDL_LOG_DEBUG("scanResult = TransportAdapter::BAD_STATE"); break; } default: { - LOG4CXX_ERROR(logger_, "Invalid scan result"); - LOG4CXX_DEBUG(logger_, "scanResult = default switch case"); + SDL_LOG_ERROR("Invalid scan result"); + SDL_LOG_DEBUG("scanResult = default switch case"); return E_ADAPTERS_FAIL; } } @@ -578,13 +567,13 @@ int TransportManagerImpl::SearchDevices() { (success_occurred || transport_adapters_.empty()) ? E_SUCCESS : E_ADAPTERS_FAIL; if (transport_adapter_search == E_SUCCESS) { - LOG4CXX_TRACE(logger_, - "exit with E_SUCCESS. Condition: success_occured || " - "transport_adapters_.empty()"); + SDL_LOG_TRACE( + "exit with E_SUCCESS. Condition: success_occured || " + "transport_adapters_.empty()"); } else { - LOG4CXX_TRACE(logger_, - "exit with E_ADAPTERS_FAIL. Condition: success_occured || " - "transport_adapters_.empty()"); + SDL_LOG_TRACE( + "exit with E_ADAPTERS_FAIL. Condition: success_occured || " + "transport_adapters_.empty()"); } return transport_adapter_search; } @@ -593,23 +582,23 @@ int TransportManagerImpl::Init( resumption::LastStateWrapperPtr last_state_wrapper) { // Last state wrapper required to initialize Transport adapters UNUSED(last_state_wrapper); - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); is_initialized_ = true; - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } int TransportManagerImpl::Init(resumption::LastState& last_state) { // Last state required to initialize Transport adapters UNUSED(last_state); - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); is_initialized_ = true; - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } void TransportManagerImpl::Deinit() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DisconnectAllDevices(); TerminateAllAdapters(); device_to_adapter_map_.clear(); @@ -622,27 +611,26 @@ int TransportManagerImpl::Reinit() { } void TransportManagerImpl::StopEventsProcessing() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); events_processing_is_active_ = false; } void TransportManagerImpl::StartEventsProcessing() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); events_processing_is_active_ = true; events_processing_cond_var_.Broadcast(); } int TransportManagerImpl::PerformActionOnClients( const TransportAction required_action) const { - LOG4CXX_TRACE(logger_, - "The following action requested: " - << static_cast<int>(required_action) - << " to be performed on connected clients"); + SDL_LOG_TRACE("The following action requested: " + << static_cast<int>(required_action) + << " to be performed on connected clients"); if (!is_initialized_) { - LOG4CXX_ERROR(logger_, "TM is not initialized"); - LOG4CXX_TRACE(logger_, - "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " - "is_initialized_"); + SDL_LOG_ERROR("TM is not initialized"); + SDL_LOG_TRACE( + "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == " + "is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } @@ -652,22 +640,21 @@ int TransportManagerImpl::PerformActionOnClients( ret = adapter_ptr->ChangeClientListening(required_action); if (TransportAdapter::Error::NOT_SUPPORTED == ret) { - LOG4CXX_DEBUG(logger_, - "Requested action on client is not supported for adapter " - << adapter_ptr << "[" << adapter_ptr->GetDeviceType() - << "]"); + SDL_LOG_DEBUG("Requested action on client is not supported for adapter " + << adapter_ptr << "[" << adapter_ptr->GetDeviceType() + << "]"); } } - LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); + SDL_LOG_TRACE("exit with E_SUCCESS"); return E_SUCCESS; } void TransportManagerImpl::CreateWebEngineDevice() { #ifndef WEBSOCKET_SERVER_TRANSPORT_SUPPORT - LOG4CXX_TRACE(logger_, "Web engine support is disabled. Exiting function"); + SDL_LOG_TRACE("Web engine support is disabled. Exiting function"); #else - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); auto web_socket_ta_iterator = std::find_if( transport_adapters_.begin(), transport_adapters_.end(), @@ -677,9 +664,9 @@ void TransportManagerImpl::CreateWebEngineDevice() { }); if (transport_adapters_.end() == web_socket_ta_iterator) { - LOG4CXX_WARN(logger_, - "WebSocketServerTransportAdapter not found." - "Impossible to create WebEngineDevice"); + SDL_LOG_WARN( + "WebSocketServerTransportAdapter not found." + "Impossible to create WebEngineDevice"); return; } @@ -688,10 +675,10 @@ void TransportManagerImpl::CreateWebEngineDevice() { *web_socket_ta_iterator); if (!web_socket_ta) { - LOG4CXX_ERROR(logger_, - "Unable to cast from Transport Adapter to " - "WebSocketServerTransportAdapter." - "Impossible to create WebEngineDevice"); + SDL_LOG_ERROR( + "Unable to cast from Transport Adapter to " + "WebSocketServerTransportAdapter." + "Impossible to create WebEngineDevice"); return; } @@ -717,12 +704,12 @@ void TransportManagerImpl::CreateWebEngineDevice() { } const DeviceInfo& TransportManagerImpl::GetWebEngineDeviceInfo() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return web_engine_device_info_; } bool TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) { - LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << ta); + SDL_LOG_TRACE("enter. TransportAdapter: " << ta); std::set<DeviceInfo> old_devices; std::set<DeviceInfo> new_devices; { @@ -774,20 +761,20 @@ bool TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) { RaiseEvent(&TransportManagerListener::OnDeviceRemoved, *it); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); return added_devices.size() + removed_devices.size() > 0; } void TransportManagerImpl::PostMessage( const ::protocol_handler::RawMessagePtr message) { - LOG4CXX_TRACE(logger_, "enter. RawMessageSptr: " << message); + SDL_LOG_TRACE("enter. RawMessageSptr: " << message); message_queue_.PostMessage(message); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportManagerImpl::PostEvent(const TransportAdapterEvent& event) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "TransportAdapterEvent: " << &event); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("TransportAdapterEvent: " << &event); event_queue_.PostMessage(event); } @@ -796,18 +783,18 @@ const TransportManagerSettings& TransportManagerImpl::get_settings() const { } void TransportManagerImpl::AddConnection(const ConnectionInternal& c) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "ConnectionInternal: " << &c); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("ConnectionInternal: " << &c); sync_primitives::AutoWriteLock lock(connections_lock_); connections_.push_back(c); } void TransportManagerImpl::RemoveConnection( const uint32_t id, transport_adapter::TransportAdapter* transport_adapter) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Id: " << id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Id: " << id); sync_primitives::AutoWriteLock lock(connections_lock_); - LOG4CXX_DEBUG(logger_, "Removing connection with id: " << id); + SDL_LOG_DEBUG("Removing connection with id: " << id); const std::vector<ConnectionInternal>::iterator it = std::find_if( connections_.begin(), connections_.end(), ConnectionFinder(id)); if (connections_.end() != it) { @@ -820,11 +807,10 @@ void TransportManagerImpl::RemoveConnection( void TransportManagerImpl::DeactivateDeviceConnections( const DeviceUID& device_uid) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoWriteLock lock(connections_lock_); - LOG4CXX_DEBUG(logger_, - "Deactivating connections for device with UID: " << device_uid); + SDL_LOG_DEBUG("Deactivating connections for device with UID: " << device_uid); size_t counter = 0; for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); @@ -835,21 +821,20 @@ void TransportManagerImpl::DeactivateDeviceConnections( ++counter; } } - LOG4CXX_DEBUG(logger_, - "Deactivated " - << counter - << " connections for device with UID: " << device_uid); + SDL_LOG_DEBUG("Deactivated " + << counter + << " connections for device with UID: " << device_uid); } TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( const ConnectionUID id) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "ConnectionUID: " << id); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("ConnectionUID: " << id); for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); it != connections_.end(); ++it) { if (it->id == id) { - LOG4CXX_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it); + SDL_LOG_DEBUG("ConnectionInternal. It's address: " << &*it); return &*it; } } @@ -858,14 +843,14 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( const DeviceUID& device, const ApplicationHandle& application) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG( - logger_, "DeviceUID: " << device << "ApplicationHandle: " << application); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("DeviceUID: " << device + << "ApplicationHandle: " << application); for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); it != connections_.end(); ++it) { if (it->device == device && it->application == application) { - LOG4CXX_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it); + SDL_LOG_DEBUG("ConnectionInternal. It's address: " << &*it); return &*it; } } @@ -875,15 +860,14 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetActiveConnection( const DeviceUID& device, const ApplicationHandle& application) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG( - logger_, - "DeviceUID: " << device << " ApplicationHandle: " << application); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("DeviceUID: " << device + << " ApplicationHandle: " << application); for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); it != connections_.end(); ++it) { if (it->device == device && it->application == application && it->active_) { - LOG4CXX_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it); + SDL_LOG_DEBUG("ConnectionInternal. It's address: " << &*it); return &*it; } } @@ -913,9 +897,9 @@ struct SwitchableFinder { void TransportManagerImpl::TryDeviceSwitch( transport_adapter::TransportAdapter* adapter) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (adapter->GetDeviceType() != transport_adapter::DeviceType::IOS_USB) { - LOG4CXX_ERROR(logger_, "Switching requested not from iAP-USB transport."); + SDL_LOG_ERROR("Switching requested not from iAP-USB transport."); return; } @@ -924,9 +908,9 @@ void TransportManagerImpl::TryDeviceSwitch( IOSBTAdapterFinder()); if (transport_adapters_.end() == ios_bt_adapter) { - LOG4CXX_WARN(logger_, - "There is no iAP2 Bluetooth adapter found. Switching is not " - "possible."); + SDL_LOG_WARN( + "There is no iAP2 Bluetooth adapter found. Switching is not " + "possible."); return; } @@ -946,25 +930,22 @@ void TransportManagerImpl::TryDeviceSwitch( } if (bt_switchable_devices.end() == bt) { - LOG4CXX_WARN(logger_, - "No suitable for switching iAP2 Bluetooth device found."); + SDL_LOG_WARN("No suitable for switching iAP2 Bluetooth device found."); return; } - LOG4CXX_DEBUG(logger_, - "Found UUID suitable for transport switching: " << bt->second); - LOG4CXX_DEBUG( - logger_, "Device to switch from: " << bt->first << " to: " << usb->first); + SDL_LOG_DEBUG("Found UUID suitable for transport switching: " << bt->second); + SDL_LOG_DEBUG("Device to switch from: " << bt->first + << " to: " << usb->first); sync_primitives::AutoWriteLock lock(device_to_adapter_map_lock_); const auto bt_device_uid = bt->first; const auto device_to_switch = device_to_adapter_map_.find(bt_device_uid); if (device_to_adapter_map_.end() == device_to_switch) { - LOG4CXX_ERROR(logger_, - "There is no known device found with UID " - << bt_device_uid - << " . Transport switching is not possible."); + SDL_LOG_ERROR("There is no known device found with UID " + << bt_device_uid + << " . Transport switching is not possible."); DCHECK_OR_RETURN_VOID(false); return; } @@ -973,9 +954,8 @@ void TransportManagerImpl::TryDeviceSwitch( const auto bt_uid = device_to_switch->first; const auto bt_adapter = device_to_switch->second; - LOG4CXX_DEBUG(logger_, - "Known device with UID " - << bt_uid << " is appropriate for transport switching."); + SDL_LOG_DEBUG("Known device with UID " + << bt_uid << " is appropriate for transport switching."); RaiseEvent( &TransportManagerListener::OnDeviceSwitchingStart, bt_uid, usb_uid); @@ -991,21 +971,19 @@ void TransportManagerImpl::TryDeviceSwitch( get_settings().app_transport_change_timer_addition(); device_switch_timer_.Start(timeout, timer::kSingleShot); - LOG4CXX_DEBUG(logger_, - "Device switch for device id " << bt_uid << " is done."); + SDL_LOG_DEBUG("Device switch for device id " << bt_uid << " is done."); return; } bool TransportManagerImpl::UpdateDeviceMapping( transport_adapter::TransportAdapter* ta) { const DeviceList adapter_device_list = ta->GetDeviceList(); - LOG4CXX_DEBUG(logger_, "DEVICE_LIST_UPDATED " << adapter_device_list.size()); + SDL_LOG_DEBUG("DEVICE_LIST_UPDATED " << adapter_device_list.size()); sync_primitives::AutoWriteLock lock(device_to_adapter_map_lock_); - LOG4CXX_DEBUG(logger_, - "Before cleanup and update. Device map size is " - << device_to_adapter_map_.size()); + SDL_LOG_DEBUG("Before cleanup and update. Device map size is " + << device_to_adapter_map_.size()); for (auto item = device_to_adapter_map_.begin(); device_to_adapter_map_.end() != item;) { @@ -1027,8 +1005,8 @@ bool TransportManagerImpl::UpdateDeviceMapping( item = device_to_adapter_map_.begin(); } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "After cleanup. Device map size is " << device_to_adapter_map_.size()); for (DeviceList::const_iterator it = adapter_device_list.begin(); @@ -1038,8 +1016,7 @@ bool TransportManagerImpl::UpdateDeviceMapping( const auto result = device_to_adapter_map_.insert(std::make_pair(device_uid, ta)); if (!result.second) { - LOG4CXX_WARN(logger_, - "Device UID " << device_uid + SDL_LOG_WARN("Device UID " << device_uid << " is known already. Processing skipped." "Connection type is: " << ta->GetConnectionType()); @@ -1054,22 +1031,22 @@ bool TransportManagerImpl::UpdateDeviceMapping( RaiseEvent(&TransportManagerListener::OnDeviceFound, info); } - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "After update. Device map size is " << device_to_adapter_map_.size()); return true; } void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) { - LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << ta); + SDL_LOG_TRACE("enter. TransportAdapter: " << ta); if (!UpdateDeviceMapping(ta)) { - LOG4CXX_ERROR(logger_, "Device list update failed."); + SDL_LOG_ERROR("Device list update failed."); return; } if (!UpdateDeviceList(ta)) { - LOG4CXX_DEBUG(logger_, "Device list was not changed"); + SDL_LOG_DEBUG("Device list was not changed"); return; } @@ -1082,14 +1059,14 @@ void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) { } device_list_lock_.Release(); RaiseEvent(&TransportManagerListener::OnDeviceListUpdated, device_infos); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void TransportManagerImpl::Handle(TransportAdapterEvent event) { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); if (!events_processing_is_active_) { - LOG4CXX_DEBUG(logger_, "Waiting for events handling unlock"); + SDL_LOG_DEBUG("Waiting for events handling unlock"); sync_primitives::AutoLock auto_lock(events_processing_lock_); events_processing_cond_var_.Wait(auto_lock); } @@ -1097,34 +1074,34 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { switch (event.event_type) { case EventTypeEnum::ON_SEARCH_DONE: { RaiseEvent(&TransportManagerListener::OnScanDevicesFinished); - LOG4CXX_DEBUG(logger_, "event_type = ON_SEARCH_DONE"); + SDL_LOG_DEBUG("event_type = ON_SEARCH_DONE"); break; } case EventTypeEnum::ON_SEARCH_FAIL: { // error happened in real search process (external error) RaiseEvent(&TransportManagerListener::OnScanDevicesFailed, *static_cast<SearchDeviceError*>(event.event_error.get())); - LOG4CXX_DEBUG(logger_, "event_type = ON_SEARCH_FAIL"); + SDL_LOG_DEBUG("event_type = ON_SEARCH_FAIL"); break; } case EventTypeEnum::ON_DEVICE_LIST_UPDATED: { OnDeviceListUpdated(event.transport_adapter); - LOG4CXX_DEBUG(logger_, "event_type = ON_DEVICE_LIST_UPDATED"); + SDL_LOG_DEBUG("event_type = ON_DEVICE_LIST_UPDATED"); break; } case EventTypeEnum::ON_TRANSPORT_SWITCH_REQUESTED: { TryDeviceSwitch(event.transport_adapter); - LOG4CXX_DEBUG(logger_, "event_type = ON_TRANSPORT_SWITCH_REQUESTED"); + SDL_LOG_DEBUG("event_type = ON_TRANSPORT_SWITCH_REQUESTED"); break; } case EventTypeEnum::ON_FIND_NEW_APPLICATIONS_REQUEST: { RaiseEvent(&TransportManagerListener::OnFindNewApplicationsRequest); - LOG4CXX_DEBUG(logger_, "event_type = ON_FIND_NEW_APPLICATIONS_REQUEST"); + SDL_LOG_DEBUG("event_type = ON_FIND_NEW_APPLICATIONS_REQUEST"); break; } case EventTypeEnum::ON_CONNECTION_STATUS_UPDATED: { RaiseEvent(&TransportManagerListener::OnConnectionStatusUpdated); - LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECTION_STATUS_UPDATED"); + SDL_LOG_DEBUG("event_type = ON_CONNECTION_STATUS_UPDATED"); break; } case EventTypeEnum::ON_CONNECT_PENDING: { @@ -1143,7 +1120,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { } else if (it->device_handle_ != device_handle) { continue; } else { - LOG4CXX_DEBUG(logger_, "Connection Object Already Exists"); + SDL_LOG_DEBUG("Connection Object Already Exists"); connection_id = it->Connection::id; break; } @@ -1166,7 +1143,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { event.transport_adapter->DeviceName(event.device_uid), event.transport_adapter->GetConnectionType()), connection_id); - LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_PENDING"); + SDL_LOG_DEBUG("event_type = ON_CONNECT_PENDING"); break; } case EventTypeEnum::ON_CONNECT_DONE: { @@ -1186,7 +1163,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { } else if (it->device_handle_ != device_handle) { continue; } else { - LOG4CXX_DEBUG(logger_, "Connection Object Already Exists"); + SDL_LOG_DEBUG("Connection Object Already Exists"); connection_id = it->Connection::id; break; } @@ -1209,7 +1186,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { event.transport_adapter->DeviceName(event.device_uid), event.transport_adapter->GetConnectionType()), connection_id); - LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_DONE"); + SDL_LOG_DEBUG("event_type = ON_CONNECT_DONE"); break; } case EventTypeEnum::ON_CONNECT_FAIL: { @@ -1222,7 +1199,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { event.transport_adapter->DeviceName(event.device_uid), event.transport_adapter->GetConnectionType()), ConnectError()); - LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_FAIL"); + SDL_LOG_DEBUG("event_type = ON_CONNECT_FAIL"); break; } case EventTypeEnum::ON_DISCONNECT_DONE: { @@ -1230,9 +1207,8 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); if (NULL == connection) { - LOG4CXX_ERROR(logger_, "Connection not found"); - LOG4CXX_DEBUG(logger_, - "event_type = ON_DISCONNECT_DONE && NULL == connection"); + SDL_LOG_ERROR("Connection not found"); + SDL_LOG_DEBUG("event_type = ON_DISCONNECT_DONE && NULL == connection"); connections_lock_.Release(); break; } @@ -1241,7 +1217,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { RaiseEvent(&TransportManagerListener::OnConnectionClosed, id); RemoveConnection(id, connection->transport_adapter); - LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_DONE"); + SDL_LOG_DEBUG("event_type = ON_DISCONNECT_DONE"); break; } case EventTypeEnum::ON_DISCONNECT_FAIL: { @@ -1250,7 +1226,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { RaiseEvent(&TransportManagerListener::OnDisconnectFailed, device_handle, DisconnectDeviceError()); - LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_FAIL"); + SDL_LOG_DEBUG("event_type = ON_DISCONNECT_FAIL"); break; } case EventTypeEnum::ON_SEND_DONE: { @@ -1263,11 +1239,9 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); if (connection == NULL) { - LOG4CXX_ERROR(logger_, - "Connection ('" << event.device_uid << ", " + SDL_LOG_ERROR("Connection ('" << event.device_uid << ", " << event.application_id << ") not found"); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "event_type = ON_SEND_DONE. Condition: NULL == connection"); break; } @@ -1277,7 +1251,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { connection->transport_adapter->Disconnect(connection->device, connection->application); } - LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_DONE"); + SDL_LOG_DEBUG("event_type = ON_SEND_DONE"); break; } case EventTypeEnum::ON_SEND_FAIL: { @@ -1291,12 +1265,10 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); if (connection == NULL) { - LOG4CXX_ERROR(logger_, - "Connection ('" << event.device_uid << ", " + SDL_LOG_ERROR("Connection ('" << event.device_uid << ", " << event.application_id << ") not found"); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "event_type = ON_SEND_FAIL. Condition: NULL == connection"); break; } @@ -1304,11 +1276,11 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { // TODO(YK): start timer here to wait before notify caller // and remove unsent messages - LOG4CXX_ERROR(logger_, "Transport adapter failed to send data"); + SDL_LOG_ERROR("Transport adapter failed to send data"); RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, DataSendError(), event.event_data); - LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_FAIL"); + SDL_LOG_DEBUG("event_type = ON_SEND_FAIL"); break; } case EventTypeEnum::ON_RECEIVED_DONE: { @@ -1317,12 +1289,10 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { ConnectionInternal* connection = GetActiveConnection(event.device_uid, event.application_id); if (connection == NULL) { - LOG4CXX_ERROR(logger_, - "Connection ('" << event.device_uid << ", " + SDL_LOG_ERROR("Connection ('" << event.device_uid << ", " << event.application_id << ") not found"); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( "event_type = ON_RECEIVED_DONE. Condition: NULL == connection"); break; } @@ -1335,17 +1305,16 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { #endif // TELEMETRY_MONITOR RaiseEvent(&TransportManagerListener::OnTMMessageReceived, event.event_data); - LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_DONE"); + SDL_LOG_DEBUG("event_type = ON_RECEIVED_DONE"); break; } case EventTypeEnum::ON_RECEIVED_FAIL: { - LOG4CXX_DEBUG(logger_, "Event ON_RECEIVED_FAIL"); + SDL_LOG_DEBUG("Event ON_RECEIVED_FAIL"); connections_lock_.AcquireForReading(); ConnectionInternal* connection = GetActiveConnection(event.device_uid, event.application_id); if (connection == NULL) { - LOG4CXX_ERROR(logger_, - "Connection ('" << event.device_uid << ", " + SDL_LOG_ERROR("Connection ('" << event.device_uid << ", " << event.application_id << ") not found"); connections_lock_.Release(); break; @@ -1354,11 +1323,11 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { RaiseEvent(&TransportManagerListener::OnTMMessageReceiveFailed, *static_cast<DataReceiveError*>(event.event_error.get())); - LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_FAIL"); + SDL_LOG_DEBUG("event_type = ON_RECEIVED_FAIL"); break; } case EventTypeEnum::ON_COMMUNICATION_ERROR: { - LOG4CXX_DEBUG(logger_, "event_type = ON_COMMUNICATION_ERROR"); + SDL_LOG_DEBUG("event_type = ON_COMMUNICATION_ERROR"); break; } case EventTypeEnum::ON_UNEXPECTED_DISCONNECT: { @@ -1374,22 +1343,21 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { RemoveConnection(id, connection->transport_adapter); } else { connections_lock_.Release(); - LOG4CXX_ERROR(logger_, - "Connection ('" << event.device_uid << ", " + SDL_LOG_ERROR("Connection ('" << event.device_uid << ", " << event.application_id << ") not found"); } - LOG4CXX_DEBUG(logger_, "eevent_type = ON_UNEXPECTED_DISCONNECT"); + SDL_LOG_DEBUG("eevent_type = ON_UNEXPECTED_DISCONNECT"); break; } case EventTypeEnum::ON_TRANSPORT_CONFIG_UPDATED: { - LOG4CXX_DEBUG(logger_, "event_type = ON_TRANSPORT_CONFIG_UPDATED"); + SDL_LOG_DEBUG("event_type = ON_TRANSPORT_CONFIG_UPDATED"); transport_adapter::TransportConfig config = event.transport_adapter->GetTransportConfiguration(); RaiseEvent(&TransportManagerListener::OnTransportConfigUpdated, config); break; } } // switch - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } #ifdef TELEMETRY_MONITOR @@ -1399,10 +1367,10 @@ void TransportManagerImpl::SetTelemetryObserver(TMTelemetryObserver* observer) { #endif // TELEMETRY_MONITOR void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); if (!events_processing_is_active_) { - LOG4CXX_DEBUG(logger_, "Waiting for events handling unlock"); + SDL_LOG_DEBUG("Waiting for events handling unlock"); sync_primitives::AutoLock auto_lock(events_processing_lock_); events_processing_cond_var_.Wait(auto_lock); } @@ -1410,8 +1378,7 @@ void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) { sync_primitives::AutoReadLock lock(connections_lock_); ConnectionInternal* connection = GetConnection(msg->connection_key()); if (connection == NULL) { - LOG4CXX_WARN(logger_, - "Connection " << msg->connection_key() << " not found"); + SDL_LOG_WARN("Connection " << msg->connection_key() << " not found"); RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, DataSendTimeoutError(), msg); @@ -1421,27 +1388,26 @@ void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) { TransportAdapter* transport_adapter = connection->transport_adapter; if (NULL == transport_adapter) { std::string error_text = "Transport adapter is not found"; - LOG4CXX_ERROR(logger_, error_text); + SDL_LOG_ERROR(error_text); RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, DataSendError(error_text), msg); } else { - LOG4CXX_DEBUG(logger_, - "Got adapter " << transport_adapter << "[" + SDL_LOG_DEBUG("Got adapter " << transport_adapter << "[" << transport_adapter->GetDeviceType() << "]" << " by session id " << msg->connection_key()); if (TransportAdapter::OK == transport_adapter->SendData( connection->device, connection->application, msg)) { - LOG4CXX_TRACE(logger_, "Data sent to adapter"); + SDL_LOG_TRACE("Data sent to adapter"); } else { - LOG4CXX_ERROR(logger_, "Data sent error"); + SDL_LOG_ERROR("Data sent error"); RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, DataSendError("Send failed"), msg); } } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } TransportManagerImpl::ConnectionInternal::ConnectionInternal( @@ -1469,13 +1435,13 @@ TransportManagerImpl::ConnectionInternal::ConnectionInternal( } void TransportManagerImpl::ConnectionInternal::DisconnectFailedRoutine() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); transport_manager->RaiseEvent(&TransportManagerListener::OnDisconnectFailed, device_handle_, DisconnectDeviceError()); shutdown_ = false; timer->Stop(); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } DeviceHandle TransportManagerImpl::Handle2GUIDConverter::UidToHandle( @@ -1490,8 +1456,7 @@ DeviceHandle TransportManagerImpl::Handle2GUIDConverter::UidToHandle( HandleFinder(handle)); if (it != conversion_table_.end()) { - LOG4CXX_DEBUG(logger_, - "Handle for UID is found: " << std::get<0>(*it) << "/" + SDL_LOG_DEBUG("Handle for UID is found: " << std::get<0>(*it) << "/" << std::get<1>(*it) << "/" << std::get<2>(*it)); return std::get<2>(*it); @@ -1503,8 +1468,7 @@ DeviceHandle TransportManagerImpl::Handle2GUIDConverter::UidToHandle( auto t = std::make_tuple(dev_uid, connection_type, handle); conversion_table_.push_back( std::make_tuple(dev_uid, connection_type, handle)); - LOG4CXX_DEBUG(logger_, - "Handle for UID is added: " << std::get<0>(t) << "/" + SDL_LOG_DEBUG("Handle for UID is added: " << std::get<0>(t) << "/" << std::get<1>(t) << "/" << std::get<2>(t)); return handle; @@ -1518,14 +1482,13 @@ DeviceUID TransportManagerImpl::Handle2GUIDConverter::HandleToUid( conversion_table_.begin(), conversion_table_.end(), HandleFinder(handle)); if (it != conversion_table_.end()) { - LOG4CXX_DEBUG(logger_, - "Handle is found: " << std::get<0>(*it) << "/" + SDL_LOG_DEBUG("Handle is found: " << std::get<0>(*it) << "/" << std::get<1>(*it) << "/" << std::get<2>(*it)); return std::get<0>(*it); } - LOG4CXX_DEBUG(logger_, "Handle is not found: " << handle); + SDL_LOG_DEBUG("Handle is not found: " << handle); return DeviceUID("uknown_uid"); } diff --git a/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc b/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc index 7d7fb49e6e..7e55f1caf9 100644 --- a/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc +++ b/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc @@ -39,7 +39,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") PlatformUsbDevice::PlatformUsbDevice( uint8_t bus_number, @@ -56,18 +56,17 @@ PlatformUsbDevice::PlatformUsbDevice( , libusb_device_(device_libusb) {} std::string PlatformUsbDevice::GetDescString(uint8_t index) const { - LOG4CXX_TRACE(logger_, "enter. index: " << int(index)); + SDL_LOG_TRACE("enter. index: " << int(index)); unsigned char buf[128]; const int libusb_ret = libusb_get_string_descriptor_ascii( libusb_device_handle_, index, buf, sizeof(buf)); if (libusb_ret < 0) { - LOG4CXX_ERROR(logger_, - "Failed to get USB string descriptor: " - << libusb_error_name(libusb_ret)); - LOG4CXX_TRACE(logger_, "exit with empty string"); + SDL_LOG_ERROR("Failed to get USB string descriptor: " + << libusb_error_name(libusb_ret)); + SDL_LOG_TRACE("exit with empty string"); return ""; } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); return std::string(reinterpret_cast<char*>(buf)); } diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc index 4b7b22394d..fbe217f243 100644 --- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc +++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc @@ -50,7 +50,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") UsbConnection::UsbConnection(const DeviceUID& device_uid, const ApplicationHandle& app_handle, @@ -79,11 +79,11 @@ UsbConnection::UsbConnection(const DeviceUID& device_uid, , waiting_out_transfer_cancel_(false) {} UsbConnection::~UsbConnection() { - LOG4CXX_TRACE(logger_, "enter with this" << this); + SDL_LOG_TRACE("enter with this" << this); Finalise(); libusb_free_transfer(in_transfer_); delete[] in_buffer_; - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } // Callback for handling income and outcome data from lib_usb @@ -96,7 +96,7 @@ void OutTransferCallback(libusb_transfer* transfer) { } bool UsbConnection::PostInTransfer() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); libusb_fill_bulk_transfer(in_transfer_, device_handle_, in_endpoint_, @@ -107,15 +107,15 @@ bool UsbConnection::PostInTransfer() { 0); const int libusb_ret = libusb_submit_transfer(in_transfer_); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "libusb_submit_transfer failed: " << libusb_error_name(libusb_ret)); - LOG4CXX_TRACE( - logger_, + SDL_LOG_TRACE( + "exit with FALSE. Condition: LIBUSB_SUCCESS != libusb_submit_transfer"); return false; } - LOG4CXX_TRACE(logger_, "exit with TRUE"); + SDL_LOG_TRACE("exit with TRUE"); return true; } @@ -130,19 +130,17 @@ std::string hex_data(const unsigned char* const buffer, } void UsbConnection::OnInTransfer(libusb_transfer* transfer) { - LOG4CXX_TRACE(logger_, "enter with Libusb_transfer*: " << transfer); + SDL_LOG_TRACE("enter with Libusb_transfer*: " << transfer); if (transfer->status == LIBUSB_TRANSFER_COMPLETED) { - LOG4CXX_DEBUG(logger_, - "USB incoming transfer, size:" - << transfer->actual_length << ", data:" - << hex_data(transfer->buffer, transfer->actual_length)); + SDL_LOG_DEBUG("USB incoming transfer, size:" + << transfer->actual_length << ", data:" + << hex_data(transfer->buffer, transfer->actual_length)); ::protocol_handler::RawMessagePtr data(new protocol_handler::RawMessage( 0, 0, in_buffer_, transfer->actual_length, false)); controller_->DataReceiveDone(device_uid_, app_handle_, data); } else { - LOG4CXX_ERROR(logger_, - "USB incoming transfer failed: " - << libusb_error_name(transfer->status)); + SDL_LOG_ERROR("USB incoming transfer failed: " + << libusb_error_name(transfer->status)); controller_->DataReceiveFailed( device_uid_, app_handle_, DataReceiveError()); } @@ -150,17 +148,16 @@ void UsbConnection::OnInTransfer(libusb_transfer* transfer) { waiting_in_transfer_cancel_ = false; } else { if (!PostInTransfer()) { - LOG4CXX_ERROR(logger_, - "USB incoming transfer failed with " - << "LIBUSB_TRANSFER_NO_DEVICE. Abort connection."); + SDL_LOG_ERROR("USB incoming transfer failed with " + << "LIBUSB_TRANSFER_NO_DEVICE. Abort connection."); AbortConnection(); } } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } TransportAdapter::Error UsbConnection::PopOutMessage() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); bytes_sent_ = 0; auto error_code = TransportAdapter::OK; if (out_messages_.empty()) { @@ -170,18 +167,18 @@ TransportAdapter::Error UsbConnection::PopOutMessage() { out_messages_.pop_front(); error_code = PostOutTransfer(); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); return error_code; } TransportAdapter::Error UsbConnection::PostOutTransfer() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); out_transfer_ = libusb_alloc_transfer(0); if (nullptr == out_transfer_) { - LOG4CXX_ERROR(logger_, "libusb_alloc_transfer failed"); - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::BAD_STATE. Condition: nullptr " - "== out_transfer_"); + SDL_LOG_ERROR("libusb_alloc_transfer failed"); + SDL_LOG_TRACE( + "exit with TransportAdapter::BAD_STATE. Condition: nullptr " + "== out_transfer_"); return TransportAdapter::BAD_STATE; } libusb_fill_bulk_transfer(out_transfer_, @@ -194,36 +191,35 @@ TransportAdapter::Error UsbConnection::PostOutTransfer() { 0); const int libusb_ret = libusb_submit_transfer(out_transfer_); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "libusb_submit_transfer failed: " << libusb_error_name(libusb_ret)); - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: " - << "LIBUSB_SUCCESS != libusb_fill_bulk_transfer"); + SDL_LOG_TRACE("exit with TransportAdapter::FAIL. Condition: " + << "LIBUSB_SUCCESS != libusb_fill_bulk_transfer"); return TransportAdapter::FAIL; } - LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK"); + SDL_LOG_TRACE("exit with TransportAdapter::OK"); return TransportAdapter::OK; } void UsbConnection::OnOutTransfer(libusb_transfer* transfer) { - LOG4CXX_TRACE(logger_, "enter with Libusb_transfer*: " << transfer); + SDL_LOG_TRACE("enter with Libusb_transfer*: " << transfer); auto error_code = TransportAdapter::OK; { sync_primitives::AutoLock locker(out_messages_mutex_); if (LIBUSB_TRANSFER_COMPLETED == transfer->status) { bytes_sent_ += transfer->actual_length; if (current_out_message_->data_size() == bytes_sent_) { - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "USB out transfer, data sent: " << current_out_message_.get()); controller_->DataSendDone( device_uid_, app_handle_, current_out_message_); error_code = PopOutMessage(); } } else { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "USB out transfer failed: " << libusb_error_name(transfer->status)); controller_->DataSendFailed( device_uid_, app_handle_, current_out_message_, DataSendError()); @@ -240,16 +236,15 @@ void UsbConnection::OnOutTransfer(libusb_transfer* transfer) { AbortConnection(); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } TransportAdapter::Error UsbConnection::SendData( ::protocol_handler::RawMessagePtr message) { - LOG4CXX_TRACE(logger_, "enter with RawMessagePtr: " << message.get()); + SDL_LOG_TRACE("enter with RawMessagePtr: " << message.get()); if (disconnecting_) { - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::BAD_STATE. Condition: " - << "disconnecting_"); + SDL_LOG_TRACE("exit with TransportAdapter::BAD_STATE. Condition: " + << "disconnecting_"); return TransportAdapter::BAD_STATE; } @@ -266,7 +261,7 @@ TransportAdapter::Error UsbConnection::SendData( auto error_code = process_message(); if (TransportAdapter::OK == error_code) { - LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK."); + SDL_LOG_TRACE("exit with TransportAdapter::OK."); return TransportAdapter::OK; } @@ -277,15 +272,14 @@ TransportAdapter::Error UsbConnection::SendData( AbortConnection(); } - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::FAIL. PostOutTransfer сondition: " - << error_code); + SDL_LOG_TRACE("exit with TransportAdapter::FAIL. PostOutTransfer сondition: " + << error_code); return TransportAdapter::FAIL; } void UsbConnection::Finalise() { - LOG4CXX_TRACE(logger_, "enter"); - LOG4CXX_DEBUG(logger_, "Finalise USB connection " << device_uid_); + SDL_LOG_TRACE("enter"); + SDL_LOG_DEBUG("Finalise USB connection " << device_uid_); { sync_primitives::AutoLock locker(out_messages_mutex_); disconnecting_ = true; @@ -312,15 +306,15 @@ void UsbConnection::Finalise() { while (waiting_in_transfer_cancel_ || waiting_out_transfer_cancel_) { pthread_yield(); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void UsbConnection::AbortConnection() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); Finalise(); controller_->ConnectionAborted( device_uid_, app_handle_, CommunicationError()); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } TransportAdapter::Error UsbConnection::Disconnect() { @@ -330,10 +324,10 @@ TransportAdapter::Error UsbConnection::Disconnect() { } bool UsbConnection::Init() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); if (!FindEndpoints()) { - LOG4CXX_ERROR(logger_, "EndPoints was not found"); - LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: !FindEndpoints()"); + SDL_LOG_ERROR("EndPoints was not found"); + SDL_LOG_TRACE("exit with FALSE. Condition: !FindEndpoints()"); return false; } @@ -346,35 +340,33 @@ bool UsbConnection::Init() { in_buffer_ = new unsigned char[in_buffer_size_]; in_transfer_ = libusb_alloc_transfer(0); if (NULL == in_transfer_) { - LOG4CXX_ERROR(logger_, "libusb_alloc_transfer failed"); - LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: NULL == in_transfer_"); + SDL_LOG_ERROR("libusb_alloc_transfer failed"); + SDL_LOG_TRACE("exit with FALSE. Condition: NULL == in_transfer_"); return false; } controller_->ConnectDone(device_uid_, app_handle_); if (!PostInTransfer()) { - LOG4CXX_ERROR(logger_, "PostInTransfer failed. Call ConnectionAborted"); + SDL_LOG_ERROR("PostInTransfer failed. Call ConnectionAborted"); controller_->ConnectionAborted( device_uid_, app_handle_, CommunicationError()); - LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: !PostInTransfer()"); + SDL_LOG_TRACE("exit with FALSE. Condition: !PostInTransfer()"); return false; } - LOG4CXX_TRACE(logger_, "exit with TRUE"); + SDL_LOG_TRACE("exit with TRUE"); return true; } bool UsbConnection::FindEndpoints() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); struct libusb_config_descriptor* config; const int libusb_ret = libusb_get_active_config_descriptor(libusb_device_, &config); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_ERROR(logger_, - "libusb_get_active_config_descriptor failed: " - << libusb_error_name(libusb_ret)); - LOG4CXX_TRACE(logger_, - "exit with FALSE. Condition: LIBUSB_SUCCESS != libusb_ret"); + SDL_LOG_ERROR("libusb_get_active_config_descriptor failed: " + << libusb_error_name(libusb_ret)); + SDL_LOG_TRACE("exit with FALSE. Condition: LIBUSB_SUCCESS != libusb_ret"); return false; } @@ -406,7 +398,7 @@ bool UsbConnection::FindEndpoints() { libusb_free_config_descriptor(config); const bool result = !(find_in_endpoint || find_out_endpoint); - LOG4CXX_TRACE(logger_, "exit with " << (result ? "TRUE" : "FALSE")); + SDL_LOG_TRACE("exit with " << (result ? "TRUE" : "FALSE")); return result; } } // namespace transport_adapter diff --git a/src/components/transport_manager/src/usb/libusb/usb_handler.cc b/src/components/transport_manager/src/usb/libusb/usb_handler.cc index 8180d257ee..c8973dfcc1 100644 --- a/src/components/transport_manager/src/usb/libusb/usb_handler.cc +++ b/src/components/transport_manager/src/usb/libusb/usb_handler.cc @@ -46,7 +46,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") class UsbHandler::ControlTransferSequenceState { public: @@ -90,7 +90,7 @@ UsbHandler::UsbHandler() UsbHandler::~UsbHandler() { shutdown_requested_ = true; - LOG4CXX_INFO(logger_, "UsbHandler thread finished"); + SDL_LOG_INFO("UsbHandler thread finished"); if (libusb_context_) { // The libusb_hotplug_deregister_callback() wakes up blocking call of @@ -111,34 +111,32 @@ UsbHandler::~UsbHandler() { } void UsbHandler::DeviceArrived(libusb_device* device_libusb) { - LOG4CXX_TRACE(logger_, "enter. libusb_device* " << device_libusb); + SDL_LOG_TRACE("enter. libusb_device* " << device_libusb); const uint8_t bus_number = libusb_get_bus_number(device_libusb); const uint8_t device_address = libusb_get_device_address(device_libusb); libusb_device_descriptor descriptor; int libusb_ret = libusb_get_device_descriptor(device_libusb, &descriptor); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_ERROR(logger_, - "libusb_get_device_descriptor failed: " << libusb_ret); - LOG4CXX_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret"); + SDL_LOG_ERROR("libusb_get_device_descriptor failed: " << libusb_ret); + SDL_LOG_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret"); return; } libusb_device_handle* device_handle_libusb; libusb_ret = libusb_open(device_libusb, &device_handle_libusb); if (libusb_ret != LIBUSB_SUCCESS) { - LOG4CXX_ERROR(logger_, - "libusb_open failed: " << libusb_error_name(libusb_ret)); - LOG4CXX_TRACE(logger_, "exit. Condition: libusb_ret != LIBUSB_SUCCESS"); + SDL_LOG_ERROR("libusb_open failed: " << libusb_error_name(libusb_ret)); + SDL_LOG_TRACE("exit. Condition: libusb_ret != LIBUSB_SUCCESS"); return; } int configuration; libusb_ret = libusb_get_configuration(device_handle_libusb, &configuration); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "libusb_get_configuration failed: " << libusb_error_name(libusb_ret)); - LOG4CXX_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret"); + SDL_LOG_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret"); return; } @@ -146,21 +144,21 @@ void UsbHandler::DeviceArrived(libusb_device* device_libusb) { libusb_ret = libusb_set_configuration(device_handle_libusb, kUsbConfiguration); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "libusb_set_configuration failed: " << libusb_error_name(libusb_ret)); - LOG4CXX_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret"); + SDL_LOG_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret"); return; } } libusb_ret = libusb_claim_interface(device_handle_libusb, 0); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( + "libusb_claim_interface failed: " << libusb_error_name(libusb_ret)); CloseDeviceHandle(device_handle_libusb); - LOG4CXX_TRACE(logger_, "exit. Condition: LIBUSB_SUCCESS != libusb_ret"); + SDL_LOG_TRACE("exit. Condition: LIBUSB_SUCCESS != libusb_ret"); return; } @@ -177,11 +175,11 @@ void UsbHandler::DeviceArrived(libusb_device* device_libusb) { ++it) { (*it)->OnDeviceArrived(device); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void UsbHandler::DeviceLeft(libusb_device* device_libusb) { - LOG4CXX_TRACE(logger_, "enter. libusb_device* " << device_libusb); + SDL_LOG_TRACE("enter. libusb_device* " << device_libusb); PlatformUsbDevice* device = NULL; for (Devices::iterator it = devices_.begin(); it != devices_.end(); ++it) { if ((*it)->GetLibusbDevice() == device_libusb) { @@ -190,7 +188,7 @@ void UsbHandler::DeviceLeft(libusb_device* device_libusb) { } } if (NULL == device) { - LOG4CXX_TRACE(logger_, "enter. Condition: NULL == device"); + SDL_LOG_TRACE("enter. Condition: NULL == device"); return; } @@ -213,19 +211,18 @@ void UsbHandler::DeviceLeft(libusb_device* device_libusb) { CloseDeviceHandle(device->GetLibusbHandle()); } delete device; - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void UsbHandler::StartControlTransferSequence( UsbControlTransferSequence* sequence, PlatformUsbDevice* device) { - LOG4CXX_TRACE(logger_, - "enter. UsbControlTransferSequence* " - << sequence << "PlatformUsbDevice* " << device); + SDL_LOG_TRACE("enter. UsbControlTransferSequence* " + << sequence << "PlatformUsbDevice* " << device); TransferSequences::iterator it = transfer_sequences_.insert( transfer_sequences_.end(), new ControlTransferSequenceState(this, sequence, device)); SubmitControlTransfer(*it); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void UsbHandler::CloseDeviceHandle(libusb_device_handle* device_handle) { @@ -236,15 +233,13 @@ int ArrivedCallback(libusb_context* context, libusb_device* device, libusb_hotplug_event event, void* data) { - LOG4CXX_TRACE(logger_, - "enter. libusb device arrived (bus number " - << static_cast<int>(libusb_get_bus_number(device)) - << ", device address " - << static_cast<int>(libusb_get_device_address(device)) - << ")"); + SDL_LOG_TRACE("enter. libusb device arrived (bus number " + << static_cast<int>(libusb_get_bus_number(device)) + << ", device address " + << static_cast<int>(libusb_get_device_address(device)) << ")"); UsbHandler* usb_handler = static_cast<UsbHandler*>(data); usb_handler->DeviceArrived(device); - LOG4CXX_TRACE(logger_, "exit with 0"); + SDL_LOG_TRACE("exit with 0"); return 0; } @@ -252,35 +247,33 @@ int LeftCallback(libusb_context* context, libusb_device* device, libusb_hotplug_event event, void* data) { - LOG4CXX_TRACE(logger_, - "enter libusb device left (bus number " - << static_cast<int>(libusb_get_bus_number(device)) - << ", device address " - << static_cast<int>(libusb_get_device_address(device)) - << ")"); + SDL_LOG_TRACE("enter libusb device left (bus number " + << static_cast<int>(libusb_get_bus_number(device)) + << ", device address " + << static_cast<int>(libusb_get_device_address(device)) << ")"); UsbHandler* usb_handler = static_cast<UsbHandler*>(data); usb_handler->DeviceLeft(device); - LOG4CXX_TRACE(logger_, "exit with 0"); + SDL_LOG_TRACE("exit with 0"); return 0; } TransportAdapter::Error UsbHandler::Init() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); int libusb_ret = libusb_init(&libusb_context_); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_ERROR(logger_, "libusb_init failed: " << libusb_ret); - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS " - "!= libusb_ret"); + SDL_LOG_ERROR("libusb_init failed: " << libusb_ret); + SDL_LOG_TRACE( + "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS " + "!= libusb_ret"); return TransportAdapter::FAIL; } if (!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)) { - LOG4CXX_ERROR(logger_, "LIBUSB_CAP_HAS_HOTPLUG not supported"); - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: " - "!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)"); + SDL_LOG_ERROR("LIBUSB_CAP_HAS_HOTPLUG not supported"); + SDL_LOG_TRACE( + "exit with TransportAdapter::FAIL. Condition: " + "!libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG)"); return TransportAdapter::FAIL; } @@ -296,11 +289,10 @@ TransportAdapter::Error UsbHandler::Init() { &arrived_callback_handle_); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_ERROR(logger_, - "libusb_hotplug_register_callback failed: " << libusb_ret); - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS " - "!= libusb_ret"); + SDL_LOG_ERROR("libusb_hotplug_register_callback failed: " << libusb_ret); + SDL_LOG_TRACE( + "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS " + "!= libusb_ret"); return TransportAdapter::FAIL; } @@ -316,25 +308,23 @@ TransportAdapter::Error UsbHandler::Init() { &left_callback_handle_); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_ERROR(logger_, - "libusb_hotplug_register_callback failed: " << libusb_ret); - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS " - "!= libusb_ret"); + SDL_LOG_ERROR("libusb_hotplug_register_callback failed: " << libusb_ret); + SDL_LOG_TRACE( + "exit with TransportAdapter::FAIL. Condition: LIBUSB_SUCCESS " + "!= libusb_ret"); return TransportAdapter::FAIL; } if (!thread_->Start()) { - LOG4CXX_ERROR(logger_, - "USB device scanner thread start failed, error code"); - LOG4CXX_TRACE(logger_, "exit with TransportAdapter::FAIL."); + SDL_LOG_ERROR("USB device scanner thread start failed, error code"); + SDL_LOG_TRACE("exit with TransportAdapter::FAIL."); return TransportAdapter::FAIL; } return TransportAdapter::OK; } void UsbHandler::Thread() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); int completed = 0; while (!shutdown_requested_) { libusb_handle_events_completed(libusb_context_, &completed); @@ -357,33 +347,32 @@ void UsbHandler::Thread() { libusb_close(*it); } } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void UsbTransferSequenceCallback(libusb_transfer* transfer) { - LOG4CXX_TRACE(logger_, "enter. libusb_transfer* " << transfer); + SDL_LOG_TRACE("enter. libusb_transfer* " << transfer); UsbHandler::ControlTransferSequenceState* sequence_state = static_cast<UsbHandler::ControlTransferSequenceState*>( transfer->user_data); sequence_state->usb_handler()->ControlTransferCallback(transfer); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void UsbHandler::SubmitControlTransfer( ControlTransferSequenceState* sequence_state) { - LOG4CXX_TRACE(logger_, - "enter. ControlTransferSequenceState* " << sequence_state); + SDL_LOG_TRACE("enter. ControlTransferSequenceState* " << sequence_state); UsbControlTransfer* transfer = sequence_state->CurrentTransfer(); if (NULL == transfer) { - LOG4CXX_TRACE(logger_, "exit. Condition: NULL == transfer"); + SDL_LOG_TRACE("exit. Condition: NULL == transfer"); return; } libusb_transfer* libusb_transfer = libusb_alloc_transfer(0); if (0 == libusb_transfer) { - LOG4CXX_ERROR(logger_, "libusb_alloc_transfer failed"); + SDL_LOG_ERROR("libusb_alloc_transfer failed"); sequence_state->Finish(); - LOG4CXX_TRACE(logger_, "exit. Condition: 0 == libusb_transfer"); + SDL_LOG_TRACE("exit. Condition: 0 == libusb_transfer"); return; } @@ -406,10 +395,10 @@ void UsbHandler::SubmitControlTransfer( unsigned char* buffer = static_cast<unsigned char*>(malloc(length + LIBUSB_CONTROL_SETUP_SIZE)); if (NULL == buffer) { - LOG4CXX_ERROR(logger_, "buffer allocation failed"); + SDL_LOG_ERROR("buffer allocation failed"); libusb_free_transfer(libusb_transfer); sequence_state->Finish(); - LOG4CXX_TRACE(logger_, "exit. Condition: NULL == buffer"); + SDL_LOG_TRACE("exit. Condition: NULL == buffer"); return; } @@ -430,21 +419,21 @@ void UsbHandler::SubmitControlTransfer( const int libusb_ret = libusb_submit_transfer(libusb_transfer); if (LIBUSB_SUCCESS != libusb_ret) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "libusb_submit_transfer failed: " << libusb_error_name(libusb_ret)); libusb_free_transfer(libusb_transfer); sequence_state->Finish(); } - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } void UsbHandler::ControlTransferCallback(libusb_transfer* transfer) { - LOG4CXX_TRACE(logger_, "enter. libusb_transfer* " << transfer); + SDL_LOG_TRACE("enter. libusb_transfer* " << transfer); ControlTransferSequenceState* sequence_state = static_cast<ControlTransferSequenceState*>(transfer->user_data); if (transfer->status == LIBUSB_TRANSFER_COMPLETED) { - LOG4CXX_INFO(logger_, "USB control transfer completed"); + SDL_LOG_INFO("USB control transfer completed"); UsbControlTransfer* current_transfer = sequence_state->CurrentTransfer(); bool submit_next = true; if (current_transfer && @@ -461,11 +450,11 @@ void UsbHandler::ControlTransferCallback(libusb_transfer* transfer) { sequence_state->Finish(); } } else { - LOG4CXX_ERROR(logger_, "USB control transfer failed: " << transfer->status); + SDL_LOG_ERROR("USB control transfer failed: " << transfer->status); sequence_state->Finish(); } libusb_free_transfer(transfer); - LOG4CXX_TRACE(logger_, "exit"); + SDL_LOG_TRACE("exit"); } UsbHandler::ControlTransferSequenceState::ControlTransferSequenceState( @@ -483,23 +472,22 @@ UsbHandler::ControlTransferSequenceState::~ControlTransferSequenceState() { } UsbControlTransfer* UsbHandler::ControlTransferSequenceState::Next() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); if (finished_) { - LOG4CXX_TRACE(logger_, "exit with NULL. Condition: finished_"); + SDL_LOG_TRACE("exit with NULL. Condition: finished_"); return NULL; } if (++current_transfer_ == sequence_->transfers().end()) { Finish(); - LOG4CXX_TRACE(logger_, - "exit with NULL. Condition: ++current_transfer_ == " - "sequence_->transfers().end()"); + SDL_LOG_TRACE( + "exit with NULL. Condition: ++current_transfer_ == " + "sequence_->transfers().end()"); return NULL; } else { - LOG4CXX_TRACE(logger_, - "exit with UsbControlTransfer* " - << *current_transfer_ - << ".Condition: ++current_transfer_ !== " - "sequence_->transfers().end()"); + SDL_LOG_TRACE("exit with UsbControlTransfer* " + << *current_transfer_ + << ".Condition: ++current_transfer_ !== " + "sequence_->transfers().end()"); return *current_transfer_; } } @@ -517,13 +505,13 @@ UsbHandler::UsbHandlerDelegate::UsbHandlerDelegate(UsbHandler* handler) : handler_(handler) {} void UsbHandler::UsbHandlerDelegate::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(handler_); handler_->Thread(); } void UsbHandler::UsbHandlerDelegate::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Empty method required in order to avoid force delegate thread // finishing by exitThreadMain() of the base class } diff --git a/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc b/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc index bb6e341659..61d3f08b28 100644 --- a/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc +++ b/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc @@ -41,7 +41,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") PlatformUsbDevice::PlatformUsbDevice( usbd_device_instance_t* instance, @@ -58,7 +58,7 @@ PlatformUsbDevice::PlatformUsbDevice( std::string PlatformUsbDevice::GetDescString(uint8_t index) const { char* str = usbd_string(usbd_device_, index, 0); if (NULL == str) { - LOG4CXX_INFO(logger_, "Failed to get USB string descriptor"); + SDL_LOG_INFO("Failed to get USB string descriptor"); return ""; } return std::string(str); diff --git a/src/components/transport_manager/src/usb/qnx/usb_connection.cc b/src/components/transport_manager/src/usb/qnx/usb_connection.cc index 2945639ce9..eeaa758621 100644 --- a/src/components/transport_manager/src/usb/qnx/usb_connection.cc +++ b/src/components/transport_manager/src/usb/qnx/usb_connection.cc @@ -45,7 +45,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") UsbConnection::UsbConnection(const DeviceUID& device_uid, const ApplicationHandle& app_handle, @@ -81,13 +81,13 @@ UsbConnection::~UsbConnection() { if (in_pipe_) { const int close_pipe_rc = usbd_close_pipe(in_pipe_); if (EOK != close_pipe_rc) { - LOG4CXX_ERROR(logger_, "Failed to close pipe: " << close_pipe_rc); + SDL_LOG_ERROR("Failed to close pipe: " << close_pipe_rc); } } if (out_pipe_) { const int close_pipe_rc = usbd_close_pipe(out_pipe_); if (EOK != close_pipe_rc) { - LOG4CXX_ERROR(logger_, "Failed to close pipe: " << close_pipe_rc); + SDL_LOG_ERROR("Failed to close pipe: " << close_pipe_rc); } } } @@ -107,7 +107,7 @@ bool UsbConnection::PostInTransfer() { usbd_io(in_urb_, in_pipe_, InTransferCallback, this, USBD_TIME_INFINITY); if (EOK != io_rc) { pending_in_transfer_ = false; - LOG4CXX_ERROR(logger_, "Failed to post in transfer: " << io_rc); + SDL_LOG_ERROR("Failed to post in transfer: " << io_rc); return false; } return true; @@ -119,11 +119,10 @@ void UsbConnection::OnInTransfer(usbd_urb* urb) { bool error = false; const int urb_status_rc = usbd_urb_status(urb, &status, &len); if (EOK != urb_status_rc && EIO != urb_status_rc) { // EIO is OK - LOG4CXX_ERROR(logger_, "Get in urb status failed: " << urb_status_rc); + SDL_LOG_ERROR("Get in urb status failed: " << urb_status_rc); error = true; } - LOG4CXX_INFO(logger_, - "USB in transfer, status " << std::hex << status << ", length " + SDL_LOG_INFO("USB in transfer, status " << std::hex << status << ", length " << std::dec << len); if (!error) { @@ -139,7 +138,7 @@ void UsbConnection::OnInTransfer(usbd_urb* urb) { } if (error) { - LOG4CXX_ERROR(logger_, "USB in transfer failed"); + SDL_LOG_ERROR("USB in transfer failed"); controller_->DataReceiveFailed( device_uid_, app_handle_, DataReceiveError()); } else { @@ -173,14 +172,14 @@ bool UsbConnection::PostOutTransfer() { out_buffer_ = usbd_alloc(len); memmove(out_buffer_, current_out_message_->data() + bytes_sent_, len); usbd_setup_bulk(out_urb_, URB_DIR_OUT, out_buffer_, len); - LOG4CXX_INFO(logger_, "out transfer :" << len); + SDL_LOG_INFO("out transfer :" << len); pending_out_transfer_ = true; const int io_rc = usbd_io( out_urb_, out_pipe_, OutTransferCallback, this, USBD_TIME_INFINITY); if (EOK != io_rc) { pending_out_transfer_ = false; usbd_free(out_buffer_); - LOG4CXX_ERROR(logger_, "Failed to post out transfer: " << io_rc); + SDL_LOG_ERROR("Failed to post out transfer: " << io_rc); return false; } return true; @@ -193,11 +192,10 @@ void UsbConnection::OnOutTransfer(usbd_urb* urb) { bool error = false; const int urb_status_rc = usbd_urb_status(urb, &status, &len); if (EOK != urb_status_rc && EIO != urb_status_rc) { // EIO is OK - LOG4CXX_ERROR(logger_, "Get out urb status failed: " << urb_status_rc); + SDL_LOG_ERROR("Get out urb status failed: " << urb_status_rc); error = true; } - LOG4CXX_INFO(logger_, - "USB out transfer, status " << std::hex << status << ", length " + SDL_LOG_INFO("USB out transfer, status " << std::hex << status << ", length " << std::dec << len); if (!error) { @@ -215,15 +213,14 @@ void UsbConnection::OnOutTransfer(usbd_urb* urb) { sync_primitives::AutoLock locker(out_messages_mutex_); if (error) { - LOG4CXX_ERROR(logger_, "USB out transfer failed"); + SDL_LOG_ERROR("USB out transfer failed"); controller_->DataSendFailed( device_uid_, app_handle_, current_out_message_, DataSendError()); PopOutMessage(); } else { bytes_sent_ += len; if (bytes_sent_ == current_out_message_->data_size()) { - LOG4CXX_INFO( - logger_, + SDL_LOG_INFO( "USB out transfer, data sent: " << current_out_message_.get()); controller_->DataSendDone(device_uid_, app_handle_, current_out_message_); PopOutMessage(); @@ -256,7 +253,7 @@ TransportAdapter::Error UsbConnection::SendData( } void UsbConnection::Finalise() { - LOG4CXX_INFO(logger_, "Finalising"); + SDL_LOG_INFO("Finalising"); sync_primitives::AutoLock locker(out_messages_mutex_); disconnecting_ = true; usbd_abort_pipe(in_pipe_); @@ -272,7 +269,7 @@ void UsbConnection::Finalise() { } TransportAdapter::Error UsbConnection::Disconnect() { - LOG4CXX_INFO(logger_, "Disconnecting"); + SDL_LOG_INFO("Disconnecting"); Finalise(); controller_->DisconnectDone(device_uid_, app_handle_); return TransportAdapter::OK; @@ -285,13 +282,13 @@ bool UsbConnection::Init() { in_urb_ = usbd_alloc_urb(NULL); out_urb_ = usbd_alloc_urb(NULL); if (NULL == in_urb_ || NULL == out_urb_) { - LOG4CXX_ERROR(logger_, "usbd_alloc_urb failed"); + SDL_LOG_ERROR("usbd_alloc_urb failed"); return false; } in_buffer_ = static_cast<unsigned char*>(usbd_alloc(kInBufferSize)); if (NULL == in_buffer_) { - LOG4CXX_ERROR(logger_, "usbd_alloc failed"); + SDL_LOG_ERROR("usbd_alloc failed"); return false; } @@ -314,7 +311,7 @@ bool UsbConnection::OpenEndpoints() { usbd_device_descriptor_t* device_desc = usbd_device_descriptor(usbd_device_, &device_desc_node); if (0 == device_desc) { - LOG4CXX_ERROR(logger_, "Device descriptor not found"); + SDL_LOG_ERROR("Device descriptor not found"); return false; } usbd_desc_node* cfg_desc_node = NULL; @@ -331,8 +328,7 @@ bool UsbConnection::OpenEndpoints() { if (config_desc == NULL) { break; } - LOG4CXX_INFO(logger_, - "USB configuration " << static_cast<int>( + SDL_LOG_INFO("USB configuration " << static_cast<int>( config_desc->configuration.bConfigurationValue)); int iface = 0; usbd_desc_node* iface_desc_node; @@ -350,11 +346,10 @@ bool UsbConnection::OpenEndpoints() { #endif const uint8_t interface_subclass = iface_desc->interface.bInterfaceSubClass; - LOG4CXX_INFO(logger_, - "USB interface number " - << static_cast<int>(interface_number) << ", subclass " - << std::hex << static_cast<int>(interface_subclass) - << std::dec); + SDL_LOG_INFO("USB interface number " + << static_cast<int>(interface_number) << ", subclass " + << std::hex << static_cast<int>(interface_subclass) + << std::dec); if (interface_subclass != 0xff) { continue; } @@ -370,10 +365,9 @@ bool UsbConnection::OpenEndpoints() { if ((attributes & 0x03) == USB_ATTRIB_BULK) { const uint8_t endpoint_address = endpoint_desc->endpoint.bEndpointAddress; - LOG4CXX_INFO(logger_, - "Endpoint with address " - << std::hex << static_cast<int>(endpoint_address) - << std::dec << " found"); + SDL_LOG_INFO("Endpoint with address " + << std::hex << static_cast<int>(endpoint_address) + << std::dec << " found"); if (endpoint_address & USB_ENDPOINT_IN) { if (NULL == in_endpoint_desc) { in_endpoint_desc = endpoint_desc; @@ -396,13 +390,13 @@ bool UsbConnection::OpenEndpoints() { int open_pipe_rc = usbd_open_pipe(usbd_device_, in_endpoint_desc, &in_pipe_); if (EOK != open_pipe_rc) { - LOG4CXX_ERROR(logger_, "Cannot open input pipe, error " << open_pipe_rc); + SDL_LOG_ERROR("Cannot open input pipe, error " << open_pipe_rc); return false; } open_pipe_rc = usbd_open_pipe(usbd_device_, out_endpoint_desc, &out_pipe_); if (EOK != open_pipe_rc) { - LOG4CXX_ERROR(logger_, "Cannot open output pipe, error " << open_pipe_rc); + SDL_LOG_ERROR("Cannot open output pipe, error " << open_pipe_rc); return false; } diff --git a/src/components/transport_manager/src/usb/qnx/usb_handler.cc b/src/components/transport_manager/src/usb/qnx/usb_handler.cc index 9ac4a40d92..441fc8b664 100644 --- a/src/components/transport_manager/src/usb/qnx/usb_handler.cc +++ b/src/components/transport_manager/src/usb/qnx/usb_handler.cc @@ -46,7 +46,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") namespace { UsbHandler* usb_handler; @@ -65,15 +65,13 @@ UsbHandler::~UsbHandler() { if (usbd_general_connection_) { const int disconnect_rc = usbd_disconnect(usbd_general_connection_); if (EOK != disconnect_rc) { - LOG4CXX_ERROR(logger_, - "usbd_disconnect failed, error code " << disconnect_rc); + SDL_LOG_ERROR("usbd_disconnect failed, error code " << disconnect_rc); } } if (usbd_aoa_connection_) { const int disconnect_rc = usbd_disconnect(usbd_aoa_connection_); if (EOK != disconnect_rc) { - LOG4CXX_ERROR(logger_, - "usbd_disconnect failed, error code " << disconnect_rc); + SDL_LOG_ERROR("usbd_disconnect failed, error code " << disconnect_rc); } } } @@ -93,7 +91,7 @@ void UsbHandler::DeviceArrived(usbd_connection* connection, usbd_device* device_usbd = 0; const int attach_rc = usbd_attach(connection, instance, 0, &device_usbd); if (EOK != attach_rc) { - LOG4CXX_ERROR(logger_, "usbd_attach failed: " << attach_rc); + SDL_LOG_ERROR("usbd_attach failed: " << attach_rc); return; } @@ -101,7 +99,7 @@ void UsbHandler::DeviceArrived(usbd_connection* connection, usbd_device_descriptor_t* descriptor = usbd_device_descriptor(device_usbd, &node); if (NULL == descriptor) { - LOG4CXX_ERROR(logger_, "usbd_device_descriptor failed"); + SDL_LOG_ERROR("usbd_device_descriptor failed"); return; } @@ -139,7 +137,7 @@ void UsbHandler::DeviceLeft(usbd_device_instance_t* instance) { if ((*it)->GetDeviceInstance() == *instance) { const int detach_rc = usbd_detach((*it)->GetUsbdDevice()); if (EOK != detach_rc) - LOG4CXX_ERROR(logger_, "usbd_detach failed: " << detach_rc); + SDL_LOG_ERROR("usbd_detach failed: " << detach_rc); devices_.erase(it); break; } @@ -153,14 +151,14 @@ void UsbHandler::StartControlTransferSequence( usbd_descriptors_t* descriptor = usbd_parse_descriptors( device->GetUsbdDevice(), NULL, USB_DESC_DEVICE, 0, NULL); if (NULL == descriptor) { - LOG4CXX_ERROR(logger_, "usbd_parse_descriptors failed"); + SDL_LOG_ERROR("usbd_parse_descriptors failed"); } usbd_pipe* usb_pipe = 0; const int open_pipe_rc = usbd_open_pipe(device->GetUsbdDevice(), descriptor, &usb_pipe); if (EOK != open_pipe_rc) { - LOG4CXX_ERROR(logger_, "usbd_open_pipe failed, error " << open_pipe_rc); + SDL_LOG_ERROR("usbd_open_pipe failed, error " << open_pipe_rc); return; } @@ -172,14 +170,14 @@ void UsbHandler::StartControlTransferSequence( usbd_urb* urb = usbd_alloc_urb(NULL); if (NULL == urb) { - LOG4CXX_ERROR(logger_, "usbd_alloc_urb failed"); + SDL_LOG_ERROR("usbd_alloc_urb failed"); break; } unsigned char* buf = static_cast<unsigned char*>(usbd_alloc(transfer->Length())); if (NULL == buf) { - LOG4CXX_ERROR(logger_, "usbd_alloc failed"); + SDL_LOG_ERROR("usbd_alloc failed"); break; } @@ -216,7 +214,7 @@ void UsbHandler::StartControlTransferSequence( static_cast<UsbControlInTransfer*>(transfer)->OnCompleted(buf); } } else { - LOG4CXX_ERROR(logger_, "usbd_io failed, error " << io_rc); + SDL_LOG_ERROR("usbd_io failed, error " << io_rc); submit_next = false; } usbd_free(buf); @@ -233,12 +231,11 @@ void ArrivedCallback(usbd_connection* connection, usbd_device_instance_t* instance) { if (kAoaVid == instance->ident.vendor) return; - LOG4CXX_INFO(logger_, - "USB device arrived (path " - << static_cast<int>(instance->path) << ", devno " - << static_cast<int>(instance->devno) << ", config " - << static_cast<int>(instance->config) << ", iface " - << static_cast<int>(instance->iface) << ")"); + SDL_LOG_INFO("USB device arrived (path " + << static_cast<int>(instance->path) << ", devno " + << static_cast<int>(instance->devno) << ", config " + << static_cast<int>(instance->config) << ", iface " + << static_cast<int>(instance->iface) << ")"); usb_handler->DeviceArrived(connection, instance); } @@ -246,12 +243,11 @@ void ArrivedAoaCallback(usbd_connection* connection, usbd_device_instance_t* instance) { if (kAoaVid != instance->ident.vendor) return; - LOG4CXX_INFO(logger_, - "USB AOA device arrived (path " - << static_cast<int>(instance->path) << ", devno " - << static_cast<int>(instance->devno) << ", config " - << static_cast<int>(instance->config) << ", iface " - << static_cast<int>(instance->iface) << ")"); + SDL_LOG_INFO("USB AOA device arrived (path " + << static_cast<int>(instance->path) << ", devno " + << static_cast<int>(instance->devno) << ", config " + << static_cast<int>(instance->config) << ", iface " + << static_cast<int>(instance->iface) << ")"); usb_handler->DeviceArrived(connection, instance); } @@ -259,12 +255,11 @@ void LeftCallback(usbd_connection* connection, usbd_device_instance_t* instance) { if (kAoaVid == instance->ident.vendor) return; - LOG4CXX_INFO(logger_, - "USB device left (path " - << static_cast<int>(instance->path) << ", devno " - << static_cast<int>(instance->devno) << ", config " - << static_cast<int>(instance->config) << ", iface " - << static_cast<int>(instance->iface) << ")"); + SDL_LOG_INFO("USB device left (path " + << static_cast<int>(instance->path) << ", devno " + << static_cast<int>(instance->devno) << ", config " + << static_cast<int>(instance->config) << ", iface " + << static_cast<int>(instance->iface) << ")"); usb_handler->DeviceLeft(instance); } @@ -272,12 +267,11 @@ void LeftAoaCallback(usbd_connection* connection, usbd_device_instance_t* instance) { if (kAoaVid != instance->ident.vendor) return; - LOG4CXX_INFO(logger_, - "USB AOA device left (path " - << static_cast<int>(instance->path) << ", devno " - << static_cast<int>(instance->devno) << ", config " - << static_cast<int>(instance->config) << ", iface " - << static_cast<int>(instance->iface) << ")"); + SDL_LOG_INFO("USB AOA device left (path " + << static_cast<int>(instance->path) << ", devno " + << static_cast<int>(instance->devno) << ", config " + << static_cast<int>(instance->config) << ", iface " + << static_cast<int>(instance->iface) << ")"); usb_handler->DeviceLeft(instance); } @@ -295,7 +289,7 @@ TransportAdapter::Error UsbHandler::Init() { const int connect_rc = usbd_connect(&cparms, &usbd_general_connection_); if (EOK != connect_rc) { - LOG4CXX_ERROR(logger_, "usbd_connect failed, error code " << connect_rc); + SDL_LOG_ERROR("usbd_connect failed, error code " << connect_rc); return TransportAdapter::FAIL; } } @@ -313,7 +307,7 @@ TransportAdapter::Error UsbHandler::Init() { const int connect_rc = usbd_connect(&cparms, &usbd_aoa_connection_); if (EOK != connect_rc) { - LOG4CXX_ERROR(logger_, "usbd_connect failed, error code " << connect_rc); + SDL_LOG_ERROR("usbd_connect failed, error code " << connect_rc); return TransportAdapter::FAIL; } } diff --git a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc index 9ce571eb6c..a80ce341fa 100644 --- a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc +++ b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc @@ -42,7 +42,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") UsbAoaAdapter::UsbAoaAdapter(resumption::LastStateWrapperPtr last_state_wrapper, const TransportManagerSettings& settings) : TransportAdapterImpl(new UsbDeviceScanner(this, settings), @@ -68,23 +68,21 @@ bool UsbAoaAdapter::IsInitialised() const { } TransportAdapter::Error UsbAoaAdapter::Init() { - LOG4CXX_TRACE(logger_, "enter"); + SDL_LOG_TRACE("enter"); TransportAdapter::Error error = usb_handler_->Init(); if (error != TransportAdapter::OK) { - LOG4CXX_TRACE(logger_, - "exit with error " - << error << ". Condition: error != TransportAdapter::OK"); + SDL_LOG_TRACE("exit with error " + << error << ". Condition: error != TransportAdapter::OK"); return error; } error = TransportAdapterImpl::Init(); if (error != TransportAdapter::OK) { - LOG4CXX_TRACE(logger_, - "exit with error " - << error << ". Condition: error != TransportAdapter::OK"); + SDL_LOG_TRACE("exit with error " + << error << ". Condition: error != TransportAdapter::OK"); return error; } is_initialised_ = true; - LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK"); + SDL_LOG_TRACE("exit with TransportAdapter::OK"); return TransportAdapter::OK; } diff --git a/src/components/transport_manager/src/usb/usb_connection_factory.cc b/src/components/transport_manager/src/usb/usb_connection_factory.cc index 401dde2534..bf1635bd64 100644 --- a/src/components/transport_manager/src/usb/usb_connection_factory.cc +++ b/src/components/transport_manager/src/usb/usb_connection_factory.cc @@ -44,7 +44,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") UsbConnectionFactory::UsbConnectionFactory( TransportAdapterController* controller) @@ -60,15 +60,14 @@ void UsbConnectionFactory::SetUsbHandler(const UsbHandlerSptr usb_handler) { TransportAdapter::Error UsbConnectionFactory::CreateConnection( const DeviceUID& device_uid, const ApplicationHandle& app_handle) { - LOG4CXX_TRACE(logger_, - "enter DeviceUID: " << &device_uid + SDL_LOG_TRACE("enter DeviceUID: " << &device_uid << ", ApplicationHandle: " << &app_handle); DeviceSptr device = controller_->FindDevice(device_uid); if (device.use_count() == 0) { - LOG4CXX_ERROR(logger_, "device " << device_uid << " not found"); - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::BAD_PARAM. Condition: " - "device.use_count() == 0"); + SDL_LOG_ERROR("device " << device_uid << " not found"); + SDL_LOG_TRACE( + "exit with TransportAdapter::BAD_PARAM. Condition: " + "device.use_count() == 0"); return TransportAdapter::BAD_PARAM; } @@ -81,15 +80,15 @@ TransportAdapter::Error UsbConnectionFactory::CreateConnection( usb_device->usb_device()); controller_->ConnectionCreated(connection, device_uid, app_handle); if (connection->Init()) { - LOG4CXX_INFO(logger_, "USB connection initialised"); - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::OK. Condition: USB connection " - "initialised"); + SDL_LOG_INFO("USB connection initialised"); + SDL_LOG_TRACE( + "exit with TransportAdapter::OK. Condition: USB connection " + "initialised"); return TransportAdapter::OK; } else { - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: USB connection " - "NOT initialised"); + SDL_LOG_TRACE( + "exit with TransportAdapter::FAIL. Condition: USB connection " + "NOT initialised"); return TransportAdapter::FAIL; } } diff --git a/src/components/transport_manager/src/usb/usb_device_scanner.cc b/src/components/transport_manager/src/usb/usb_device_scanner.cc index 51d521c1bf..b0749728a6 100644 --- a/src/components/transport_manager/src/usb/usb_device_scanner.cc +++ b/src/components/transport_manager/src/usb/usb_device_scanner.cc @@ -42,7 +42,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") class AoaInitSequence : public UsbControlTransferSequence { public: @@ -57,7 +57,7 @@ class AoaInitSequence : public UsbControlTransferSequence { }; void UsbDeviceScanner::OnDeviceArrived(PlatformUsbDevice* device) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (IsAppleDevice(device)) { SupportedDeviceFound(device); } else { @@ -70,8 +70,8 @@ void UsbDeviceScanner::OnDeviceArrived(PlatformUsbDevice* device) { } void UsbDeviceScanner::OnDeviceLeft(PlatformUsbDevice* device) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "PlatformUsbDevice " << device); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("PlatformUsbDevice " << device); bool list_changed = false; devices_mutex_.Acquire(); for (Devices::iterator it = devices_.begin(); it != devices_.end(); ++it) { @@ -112,7 +112,7 @@ class AoaInitSequence::AoaGetProtocolRequest : public UsbControlInTransfer { } virtual bool OnCompleted(unsigned char* data) const { const int protocol_version = data[1] << 8 | data[0]; - LOG4CXX_DEBUG(logger_, "AOA protocol version " << protocol_version); + SDL_LOG_DEBUG("AOA protocol version " << protocol_version); if (protocol_version == 0) { // AOA protocol not supported return false; @@ -192,26 +192,24 @@ AoaInitSequence::AoaInitSequence(const TransportManagerSettings& settings) } void UsbDeviceScanner::TurnIntoAccessoryMode(PlatformUsbDevice* device) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "PlatformUsbDevice: " << device); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("PlatformUsbDevice: " << device); GetUsbHandler()->StartControlTransferSequence(new AoaInitSequence(settings_), device); } void UsbDeviceScanner::SupportedDeviceFound(PlatformUsbDevice* device) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_TRACE(logger_, "PlatformUsbDevice: " << device); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_TRACE("PlatformUsbDevice: " << device); devices_mutex_.Acquire(); devices_.push_back(device); devices_mutex_.Release(); - LOG4CXX_DEBUG(logger_, - "USB device (bus number " - << static_cast<int>(device->bus_number()) << ", address " - << static_cast<int>(device->address()) - << ") identified as: " << device->GetManufacturer() << ", " - << device->GetProductName() - << ", serial: " << device->GetSerialNumber()); + SDL_LOG_DEBUG("USB device (bus number " + << static_cast<int>(device->bus_number()) << ", address " + << static_cast<int>(device->address()) << ") identified as: " + << device->GetManufacturer() << ", " << device->GetProductName() + << ", serial: " << device->GetSerialNumber()); UpdateList(); } @@ -224,7 +222,7 @@ TransportAdapter::Error UsbDeviceScanner::Scan() { } void UsbDeviceScanner::UpdateList() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DeviceVector device_vector; devices_mutex_.Acquire(); for (Devices::const_iterator it = devices_.begin(); it != devices_.end(); @@ -240,7 +238,7 @@ void UsbDeviceScanner::UpdateList() { } devices_mutex_.Release(); - LOG4CXX_DEBUG(logger_, "USB search done " << device_vector.size()); + SDL_LOG_DEBUG("USB search done " << device_vector.size()); controller_->SearchDeviceDone(device_vector); } diff --git a/src/components/transport_manager/src/websocket_server/websocket_connection.cc b/src/components/transport_manager/src/websocket_server/websocket_connection.cc index 81985315d2..d10d456ca4 100644 --- a/src/components/transport_manager/src/websocket_server/websocket_connection.cc +++ b/src/components/transport_manager/src/websocket_server/websocket_connection.cc @@ -35,7 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(wsc_logger_, "WebSocketConnection") +SDL_CREATE_LOG_VARIABLE("WebSocketConnection") using namespace boost::beast::websocket; @@ -99,10 +99,10 @@ WebSocketConnection<Session>::~WebSocketConnection() { template <typename Session> void WebSocketConnection<Session>::OnError() { - LOG4CXX_AUTO_TRACE(wsc_logger_); + SDL_LOG_AUTO_TRACE(); if (IsShuttingDown()) { - LOG4CXX_DEBUG(wsc_logger_, "Session is shutting down..."); + SDL_LOG_DEBUG("Session is shutting down..."); return; } @@ -119,7 +119,7 @@ void WebSocketConnection<Session>::OnError() { template <typename Session> TransportAdapter::Error WebSocketConnection<Session>::Disconnect() { - LOG4CXX_AUTO_TRACE(wsc_logger_); + SDL_LOG_AUTO_TRACE(); if (!IsShuttingDown()) { Shutdown(); controller_->DisconnectDone(device_uid_, app_handle_); @@ -157,13 +157,13 @@ void WebSocketConnection<Session>::DataSendFailed(Message frame) { template <typename Session> void WebSocketConnection<Session>::Run() { - LOG4CXX_AUTO_TRACE(wsc_logger_); + SDL_LOG_AUTO_TRACE(); session_->AsyncAccept(); } template <typename Session> void WebSocketConnection<Session>::Shutdown() { - LOG4CXX_AUTO_TRACE(wsc_logger_); + SDL_LOG_AUTO_TRACE(); shutdown_ = true; if (thread_delegate_) { session_->Shutdown(); diff --git a/src/components/transport_manager/src/websocket_server/websocket_device.cc b/src/components/transport_manager/src/websocket_server/websocket_device.cc index 502daf349b..401c242caf 100644 --- a/src/components/transport_manager/src/websocket_server/websocket_device.cc +++ b/src/components/transport_manager/src/websocket_server/websocket_device.cc @@ -37,7 +37,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") +SDL_CREATE_LOG_VARIABLE("TransportManager") WebSocketDevice::WebSocketDevice(const std::string& name, const DeviceUID& unique_device_id) @@ -46,7 +46,7 @@ WebSocketDevice::WebSocketDevice(const std::string& name, , protocol_(boost::asio::ip::tcp::v4()) {} bool WebSocketDevice::IsSameAs(const Device* other) const { - LOG4CXX_TRACE(logger_, "enter. device: " << other); + SDL_LOG_TRACE("enter. device: " << other); const WebSocketDevice* other_websocket_device = dynamic_cast<const WebSocketDevice*>(other); diff --git a/src/components/transport_manager/src/websocket_server/websocket_listener.cc b/src/components/transport_manager/src/websocket_server/websocket_listener.cc index 87fff3acbc..fed29fbfb4 100644 --- a/src/components/transport_manager/src/websocket_server/websocket_listener.cc +++ b/src/components/transport_manager/src/websocket_server/websocket_listener.cc @@ -5,7 +5,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "WebSocketListener") +SDL_CREATE_LOG_VARIABLE("WebSocketListener") WebSocketListener::WebSocketListener(TransportAdapterController* controller, const TransportManagerSettings& settings, @@ -29,7 +29,7 @@ WebSocketListener::~WebSocketListener() { } TransportAdapter::Error WebSocketListener::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto old_shutdown_value = shutdown_.exchange(false); if (old_shutdown_value) { ioc_.restart(); @@ -39,12 +39,12 @@ TransportAdapter::Error WebSocketListener::Init() { } void WebSocketListener::Terminate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Shutdown(); } TransportAdapter::Error WebSocketListener::StartListening() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (acceptor_.is_open()) { return TransportAdapter::OK; } @@ -65,8 +65,7 @@ TransportAdapter::Error WebSocketListener::StartListening() { acceptor_.open(endpoint.protocol(), ec); if (ec) { auto str_err = "ErrorOpen: " + ec.message(); - LOG4CXX_ERROR(logger_, - str_err << " host/port: " << endpoint.address().to_string() + SDL_LOG_ERROR(str_err << " host/port: " << endpoint.address().to_string() << "/" << endpoint.port()); return TransportAdapter::FAIL; } @@ -74,8 +73,7 @@ TransportAdapter::Error WebSocketListener::StartListening() { acceptor_.set_option(boost::asio::socket_base::reuse_address(true), ec); if (ec) { std::string str_err = "ErrorSetOption: " + ec.message(); - LOG4CXX_ERROR(logger_, - str_err << " host/port: " << endpoint.address().to_string() + SDL_LOG_ERROR(str_err << " host/port: " << endpoint.address().to_string() << "/" << endpoint.port()); return TransportAdapter::FAIL; } @@ -84,8 +82,7 @@ TransportAdapter::Error WebSocketListener::StartListening() { acceptor_.bind(endpoint, ec); if (ec) { std::string str_err = "ErrorBind: " + ec.message(); - LOG4CXX_ERROR(logger_, - str_err << " host/port: " << endpoint.address().to_string() + SDL_LOG_ERROR(str_err << " host/port: " << endpoint.address().to_string() << "/" << endpoint.port()); return TransportAdapter::FAIL; } @@ -94,8 +91,7 @@ TransportAdapter::Error WebSocketListener::StartListening() { acceptor_.listen(boost::asio::socket_base::max_listen_connections, ec); if (ec) { std::string str_err = "ErrorListen: " + ec.message(); - LOG4CXX_ERROR(logger_, - str_err << " host/port: " << endpoint.address().to_string() + SDL_LOG_ERROR(str_err << " host/port: " << endpoint.address().to_string() << "/" << endpoint.port()); return TransportAdapter::FAIL; } @@ -109,20 +105,20 @@ TransportAdapter::Error WebSocketListener::StartListening() { #ifdef ENABLE_SECURITY TransportAdapter::Error WebSocketListener::AddCertificateAuthority() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const auto cert_path = settings_.ws_server_cert_path(); - LOG4CXX_DEBUG(logger_, "Path to certificate : " << cert_path); + SDL_LOG_DEBUG("Path to certificate : " << cert_path); const auto key_path = settings_.ws_server_key_path(); - LOG4CXX_DEBUG(logger_, "Path to key : " << key_path); + SDL_LOG_DEBUG("Path to key : " << key_path); const auto ca_cert_path = settings_.ws_server_ca_cert_path(); - LOG4CXX_DEBUG(logger_, "Path to ca cert : " << ca_cert_path); + SDL_LOG_DEBUG("Path to ca cert : " << ca_cert_path); start_secure_ = settings_.wss_server_supported(); if (start_secure_ && (!file_system::FileExists(cert_path) || !file_system::FileExists(key_path) || !file_system::FileExists(ca_cert_path))) { - LOG4CXX_ERROR(logger_, "Certificate or key file not found"); + SDL_LOG_ERROR("Certificate or key file not found"); return TransportAdapter::FAIL; } @@ -131,12 +127,11 @@ TransportAdapter::Error WebSocketListener::AddCertificateAuthority() { const std::string config_name) { bool start_unsecure = config.empty(); if (!start_unsecure) { - LOG4CXX_ERROR(logger_, - "Configuration for secure WS is incomplete. " - << config_name - << " config is " - "present, meanwhile others may be missing. Please " - "check INI file"); + SDL_LOG_ERROR("Configuration for secure WS is incomplete. " + << config_name + << " config is " + "present, meanwhile others may be missing. Please " + "check INI file"); } return start_unsecure; }; @@ -146,7 +141,7 @@ TransportAdapter::Error WebSocketListener::AddCertificateAuthority() { return TransportAdapter::FAIL; } } else { - LOG4CXX_INFO(logger_, "WebSocket server will start secure connection"); + SDL_LOG_INFO("WebSocket server will start secure connection"); ctx_.add_verify_path(cert_path); ctx_.set_options(boost::asio::ssl::context::default_workarounds); using context = boost::asio::ssl::context_base; @@ -155,16 +150,14 @@ TransportAdapter::Error WebSocketListener::AddCertificateAuthority() { ctx_.use_certificate_chain_file(cert_path, sec_ec); ctx_.load_verify_file(ca_cert_path); if (sec_ec) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( "Loading WS server certificate failed: " << sec_ec.message()); return TransportAdapter::FAIL; } sec_ec.clear(); ctx_.use_private_key_file(key_path, context::pem, sec_ec); if (sec_ec) { - LOG4CXX_ERROR(logger_, - "Loading WS server key failed: " << sec_ec.message()); + SDL_LOG_ERROR("Loading WS server key failed: " << sec_ec.message()); return TransportAdapter::FAIL; } } @@ -174,19 +167,19 @@ TransportAdapter::Error WebSocketListener::AddCertificateAuthority() { #endif // ENABLE_SECURITY bool WebSocketListener::Run() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool is_connection_open = WaitForConnection(); if (is_connection_open) { boost::asio::post(*io_pool_.get(), [&]() { ioc_.run(); }); } else { - LOG4CXX_ERROR(logger_, "Connection is shutdown or acceptor isn't open"); + SDL_LOG_ERROR("Connection is shutdown or acceptor isn't open"); } return is_connection_open; } bool WebSocketListener::WaitForConnection() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!shutdown_ && acceptor_.is_open()) { acceptor_.async_accept( socket_, @@ -202,7 +195,7 @@ void WebSocketListener::ProcessConnection( std::shared_ptr<WebSocketConnection<WebSocketSession<> > > connection, const DeviceSptr device, const ApplicationHandle app_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); controller_->ConnectionCreated( connection, device->unique_device_id(), app_handle); @@ -223,7 +216,7 @@ void WebSocketListener::ProcessConnection( std::shared_ptr<WebSocketConnection<WebSocketSecureSession<> > > connection, const DeviceSptr device, const ApplicationHandle app_handle) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); controller_->ConnectionCreated( connection, device->unique_device_id(), app_handle); @@ -240,10 +233,10 @@ void WebSocketListener::ProcessConnection( #endif // ENABLE_SECURITY void WebSocketListener::StartSession(boost::system::error_code ec) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (ec) { std::string str_err = "ErrorAccept: " + ec.message(); - LOG4CXX_ERROR(logger_, str_err); + SDL_LOG_ERROR(str_err); return; } @@ -257,7 +250,7 @@ void WebSocketListener::StartSession(boost::system::error_code ec) { std::static_pointer_cast<WebSocketDevice>( controller_->GetWebEngineDevice()); - LOG4CXX_INFO(logger_, "Connected client: " << app_handle); + SDL_LOG_INFO("Connected client: " << app_handle); #ifdef ENABLE_SECURITY if (start_secure_) { @@ -279,7 +272,7 @@ void WebSocketListener::StartSession(boost::system::error_code ec) { } void WebSocketListener::Shutdown() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (false == shutdown_.exchange(true)) { ioc_.stop(); socket_.close(); @@ -287,7 +280,7 @@ void WebSocketListener::Shutdown() { acceptor_.close(ec); if (ec) { - LOG4CXX_ERROR(logger_, "Acceptor closed with error: " << ec); + SDL_LOG_ERROR("Acceptor closed with error: " << ec); } io_pool_->stop(); diff --git a/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc b/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc index 46a1267cab..a533bdcffc 100644 --- a/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc +++ b/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc @@ -35,6 +35,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace transport_manager { namespace transport_adapter { +SDL_CREATE_LOG_VARIABLE("WebSocketSecureSession") + using namespace boost::beast::websocket; template <typename ExecutorType> @@ -54,7 +56,7 @@ WebSocketSecureSession<ExecutorType>::WebSocketSecureSession( template <typename ExecutorType> void WebSocketSecureSession<ExecutorType>::AsyncAccept() { - LOG4CXX_AUTO_TRACE(ws_logger_); + SDL_LOG_AUTO_TRACE(); // Perform the SSL handshake WebSocketSecureSession<ExecutorType>::ws_.next_layer().async_handshake( ssl::stream_base::server, @@ -68,10 +70,10 @@ void WebSocketSecureSession<ExecutorType>::AsyncAccept() { template <typename ExecutorType> void WebSocketSecureSession<ExecutorType>::AsyncHandshake( boost::system::error_code ec) { - LOG4CXX_AUTO_TRACE(ws_logger_); + SDL_LOG_AUTO_TRACE(); if (ec) { auto str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR(ws_logger_, str_err); + SDL_LOG_ERROR(str_err); WebSocketSession<ExecutorType>::on_io_error_(); return; } diff --git a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc index ac8789eee8..68f23a6326 100644 --- a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc +++ b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc @@ -48,7 +48,7 @@ namespace transport_manager { namespace transport_adapter { -CREATE_LOGGERPTR_GLOBAL(logger_, "WebSocketTransportAdapter") +SDL_CREATE_LOG_VARIABLE("WebSocketTransportAdapter") WebSocketServerTransportAdapter::WebSocketServerTransportAdapter( resumption::LastStateWrapperPtr last_state_wrapper, @@ -63,7 +63,7 @@ WebSocketServerTransportAdapter::~WebSocketServerTransportAdapter() {} void WebSocketServerTransportAdapter::TransportConfigUpdated( const TransportConfig& new_config) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); transport_config_ = new_config; @@ -74,7 +74,7 @@ void WebSocketServerTransportAdapter::TransportConfigUpdated( TransportConfig WebSocketServerTransportAdapter::GetTransportConfiguration() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return transport_config_; } @@ -83,14 +83,14 @@ DeviceType WebSocketServerTransportAdapter::GetDeviceType() const { } DeviceSptr WebSocketServerTransportAdapter::AddDevice(DeviceSptr device) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); webengine_device_ = device; Store(); return TransportAdapterImpl::AddDevice(webengine_device_); } TransportAdapter::Error WebSocketServerTransportAdapter::Init() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (webengine_device_) { AddDevice(webengine_device_); } @@ -98,12 +98,12 @@ TransportAdapter::Error WebSocketServerTransportAdapter::Init() { } void WebSocketServerTransportAdapter::Store() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (webengine_device_) { Json::Value& dictionary = last_state().get_dictionary(); if (dictionary["TransportManager"].isMember("WebsocketServerAdapter")) { - LOG4CXX_DEBUG( - logger_, "WebsocketServerAdapter already exists. Storing is skipped"); + SDL_LOG_DEBUG( + "WebsocketServerAdapter already exists. Storing is skipped"); return; } @@ -118,7 +118,7 @@ void WebSocketServerTransportAdapter::Store() const { } bool WebSocketServerTransportAdapter::Restore() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const Json::Value& dictionary = last_state().get_dictionary(); const Json::Value ws_adapter_dictionary = dictionary["TransportManager"]["WebsocketServerAdapter"]; @@ -133,7 +133,7 @@ bool WebSocketServerTransportAdapter::Restore() { } std::string WebSocketServerTransportAdapter::GetStoredDeviceID() const { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return webengine_device_id_; } diff --git a/src/components/transport_manager/src/websocket_server/websocket_session.cc b/src/components/transport_manager/src/websocket_server/websocket_session.cc index 8826243777..8a05b9d9aa 100644 --- a/src/components/transport_manager/src/websocket_server/websocket_session.cc +++ b/src/components/transport_manager/src/websocket_server/websocket_session.cc @@ -35,6 +35,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace transport_manager { namespace transport_adapter { +SDL_CREATE_LOG_VARIABLE("WebSocketSession") + using namespace boost::beast::websocket; template <> @@ -80,7 +82,7 @@ WebSocketSession<ExecutorType>::~WebSocketSession() {} template <typename ExecutorType> void WebSocketSession<ExecutorType>::AsyncAccept() { - LOG4CXX_AUTO_TRACE(ws_logger_); + SDL_LOG_AUTO_TRACE(); ws_.async_accept( boost::asio::bind_executor(strand_, std::bind(&WebSocketSession::AsyncRead, @@ -90,10 +92,10 @@ void WebSocketSession<ExecutorType>::AsyncAccept() { template <typename ExecutorType> void WebSocketSession<ExecutorType>::AsyncRead(boost::system::error_code ec) { - LOG4CXX_AUTO_TRACE(ws_logger_); + SDL_LOG_AUTO_TRACE(); if (ec) { auto str_err = "ErrorMessage: " + ec.message(); - LOG4CXX_ERROR(ws_logger_, str_err); + SDL_LOG_ERROR(str_err); return; } @@ -111,7 +113,7 @@ void WebSocketSession<ExecutorType>::WriteDown(Message message) { ws_.write(boost::asio::buffer(message->data(), message->data_size()), ec); if (ec) { - LOG4CXX_ERROR(ws_logger_, "A system error has occurred: " << ec.message()); + SDL_LOG_ERROR("A system error has occurred: " << ec.message()); data_send_failed_(message); on_io_error_(); return; @@ -122,10 +124,10 @@ void WebSocketSession<ExecutorType>::WriteDown(Message message) { template <typename ExecutorType> void WebSocketSession<ExecutorType>::Read(boost::system::error_code ec, std::size_t bytes_transferred) { - LOG4CXX_AUTO_TRACE(ws_logger_); + SDL_LOG_AUTO_TRACE(); boost::ignore_unused(bytes_transferred); if (ec) { - LOG4CXX_ERROR(ws_logger_, ec.message()); + SDL_LOG_ERROR(ec.message()); buffer_.consume(buffer_.size()); on_io_error_(); return; @@ -135,8 +137,7 @@ void WebSocketSession<ExecutorType>::Read(boost::system::error_code ec, const auto data = boost::asio::buffer_cast<const uint8_t*>( boost::beast::buffers_front(buffer_.data())); - LOG4CXX_DEBUG(ws_logger_, - "Msg: " << boost::beast::buffers_to_string(buffer_.data()) + SDL_LOG_DEBUG("Msg: " << boost::beast::buffers_to_string(buffer_.data()) << " Size: " << size;); auto frame = @@ -150,7 +151,7 @@ void WebSocketSession<ExecutorType>::Read(boost::system::error_code ec, template <typename ExecutorType> bool WebSocketSession<ExecutorType>::Shutdown() { - LOG4CXX_AUTO_TRACE(ws_logger_); + SDL_LOG_AUTO_TRACE(); boost::system::error_code ec; if (socket_.is_open()) { socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); @@ -158,7 +159,7 @@ bool WebSocketSession<ExecutorType>::Shutdown() { } buffer_.consume(buffer_.size()); if (ec) { - LOG4CXX_ERROR(ws_logger_, ec.message()); + SDL_LOG_ERROR(ec.message()); return false; } return true; diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt index 451a8a629e..b65b19253a 100644 --- a/src/components/utils/CMakeLists.txt +++ b/src/components/utils/CMakeLists.txt @@ -78,11 +78,8 @@ if(ENABLE_LOG) ) else() list(APPEND EXCLUDE_PATHS - push_log.cc - log_message_loop_thread.cc - logger_status.cc auto_trace.cc - logger.cc + logger/log4cxxlogger.cc ) endif() diff --git a/src/components/include/utils/push_log.h b/src/components/utils/include/utils/logger/log4cxxlogger.h index f6c396ae71..170e6e871c 100644 --- a/src/components/include/utils/push_log.h +++ b/src/components/utils/include/utils/logger/log4cxxlogger.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Ford Motor Company + * Copyright (c) 2020, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,28 +30,24 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_INCLUDE_UTILS_PUSH_LOG_H_ -#define SRC_COMPONENTS_INCLUDE_UTILS_PUSH_LOG_H_ +#pragma once #include <log4cxx/logger.h> -#include <string> +#include "utils/ilogger.h" namespace logger { -bool push_log(log4cxx::LoggerPtr logger, - log4cxx::LevelPtr level, - const std::string& entry, - log4cxx_time_t timeStamp, - const log4cxx::spi::LocationInfo& location, - const log4cxx::LogString& threadName); +class Log4CXXLogger : public ThirdPartyLoggerInterface { + public: + Log4CXXLogger(const std::string& filename); + void Init() override; + void DeInit() override; + bool IsEnabledFor(const std::string& component, + LogLevel log_level) const override; + void PushLog(const LogMessage& log_message) override; -void flush_logger(); + private: + std::string filename_; +}; -bool logs_enabled(); -void set_logs_enabled(bool state); - -void create_log_message_loop_thread(); -void delete_log_message_loop_thread(log4cxx::LoggerPtr& logger); } // namespace logger - -#endif // SRC_COMPONENTS_INCLUDE_UTILS_PUSH_LOG_H_ diff --git a/src/components/utils/include/utils/log_message_loop_thread.h b/src/components/utils/include/utils/logger/logger_impl.h index b0cac75c71..5f32b45664 100644 --- a/src/components/utils/include/utils/log_message_loop_thread.h +++ b/src/components/utils/include/utils/logger/logger_impl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Ford Motor Company + * Copyright (c) 2020, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,43 +30,57 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOG_MESSAGE_LOOP_THREAD_H_ -#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOG_MESSAGE_LOOP_THREAD_H_ +#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOGGER_LOGGER_IMPL_H_ +#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOGGER_LOGGER_IMPL_H_ -#include <log4cxx/logger.h> -#include <queue> -#include <string> +#include "utils/ilogger.h" -#include "utils/macro.h" +#include <functional> + +#include "utils/logger_status.h" #include "utils/threads/message_loop_thread.h" namespace logger { -typedef struct { - log4cxx::LoggerPtr logger; - log4cxx::LevelPtr level; - std::string entry; - log4cxx_time_t timeStamp; - log4cxx::spi::LocationInfo location; - log4cxx::LogString threadName; -} LogMessage; - typedef std::queue<LogMessage> LogMessageQueue; typedef threads::MessageLoopThread<LogMessageQueue> LogMessageLoopThreadTemplate; +template <typename T> +using LoopThreadPtr = std::unique_ptr<T, std::function<void(T*)> >; + class LogMessageLoopThread : public LogMessageLoopThreadTemplate, public LogMessageLoopThreadTemplate::Handler { public: - LogMessageLoopThread(); + LogMessageLoopThread(std::function<void(LogMessage)> handler); + + void Push(const LogMessage& message); + + void Handle(const LogMessage message); + ~LogMessageLoopThread(); - void Handle(const LogMessage message) OVERRIDE; private: - DISALLOW_COPY_AND_ASSIGN(LogMessageLoopThread); + std::function<void(LogMessage)> force_log_; +}; + +class LoggerImpl : public Logger, public LoggerInitializer { + public: + LoggerImpl(bool use_message_loop_thread = true); + void Init(std::unique_ptr<ThirdPartyLoggerInterface>&& impl) override; + void DeInit() override; + void Flush() override; + + bool IsEnabledFor(const std::string& component, + LogLevel log_level) const override; + void PushLog(const LogMessage& log_message) override; + + std::unique_ptr<ThirdPartyLoggerInterface> impl_; + LoopThreadPtr<LogMessageLoopThread> loop_thread_; + bool use_message_loop_thread_; }; } // namespace logger -#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOG_MESSAGE_LOOP_THREAD_H_ +#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOGGER_LOGGER_IMPL_H_ diff --git a/src/components/utils/src/auto_trace.cc b/src/components/utils/src/auto_trace.cc index 0379630319..8f83494c3c 100644 --- a/src/components/utils/src/auto_trace.cc +++ b/src/components/utils/src/auto_trace.cc @@ -30,36 +30,39 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <apr_time.h> -#include <log4cxx/spi/loggingevent.h> - #include "utils/auto_trace.h" -#include "utils/push_log.h" +#include "utils/logger.h" namespace logger { -AutoTrace::AutoTrace(log4cxx::LoggerPtr logger, - const log4cxx::spi::LocationInfo& location) - : logger_(logger), location_(location) { - if (logger::logs_enabled() && logger_->isTraceEnabled()) { - push_log(logger_, - ::log4cxx::Level::getTrace(), - "Enter", - apr_time_now(), - location_, - ::log4cxx::spi::LoggingEvent::getCurrentThreadName()); +AutoTrace::AutoTrace(const std::string& component, const LocationInfo& location) + : component_(component), location_(location) { + if (logger::logger_status != logger::DeletingLoggerThread) { + if (logger::Logger::instance().IsEnabledFor( + component_, logger::LogLevel::TRACE_LEVEL)) { + logger::LogMessage message{component_, + LogLevel::TRACE_LEVEL, + "Enter", + std::chrono::high_resolution_clock::now(), + location_, + std::this_thread::get_id()}; + logger::Logger::instance().PushLog(message); + } } } AutoTrace::~AutoTrace() { - if (logger::logs_enabled() && logger_->isTraceEnabled()) { - push_log(logger_, - ::log4cxx::Level::getTrace(), - "Exit", - apr_time_now(), - location_, // the location corresponds rather to creation of - // autotrace object than to deletion - ::log4cxx::spi::LoggingEvent::getCurrentThreadName()); + if (logger::logger_status != logger::DeletingLoggerThread) { + if (logger::Logger::instance().IsEnabledFor( + component_, logger::LogLevel::TRACE_LEVEL)) { + logger::LogMessage message{component_, + LogLevel::TRACE_LEVEL, + "Exit", + std::chrono::high_resolution_clock::now(), + location_, + std::this_thread::get_id()}; + logger::Logger::instance().PushLog(message); + } } } diff --git a/src/components/utils/src/conditional_variable_boost.cc b/src/components/utils/src/conditional_variable_boost.cc index c70b727d66..81fad8ebe7 100644 --- a/src/components/utils/src/conditional_variable_boost.cc +++ b/src/components/utils/src/conditional_variable_boost.cc @@ -46,7 +46,7 @@ const long kNanosecondsPerMillisecond = 1000000; namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") ConditionalVariable::ConditionalVariable() {} @@ -75,13 +75,13 @@ bool ConditionalVariable::Wait(BaseLock& lock) { cond_var_.wait<boost::recursive_mutex>(test_rec_lock->mutex_); } else { // unknown, give up the lock - LOG4CXX_ERROR(logger_, "Unknown lock type!"); + SDL_LOG_ERROR("Unknown lock type!"); NOTREACHED(); } lock.AssertFreeAndMarkTaken(); } catch (const boost::exception& error) { std::string error_string = boost::diagnostic_information(error); - LOG4CXX_FATAL(logger_, error_string); + SDL_LOG_FATAL(error_string); NOTREACHED(); } return true; @@ -115,7 +115,7 @@ ConditionalVariable::WaitStatus ConditionalVariable::WaitFor( test_rec_lock->mutex_, boost::posix_time::milliseconds(milliseconds)); } else { // this is an unknown lock, we have an issue - LOG4CXX_ERROR(logger_, "Unknown lock type!"); + SDL_LOG_ERROR("Unknown lock type!"); NOTREACHED(); } @@ -125,7 +125,7 @@ ConditionalVariable::WaitStatus ConditionalVariable::WaitFor( lock.AssertFreeAndMarkTaken(); } catch (const boost::exception& error) { std::string error_string = boost::diagnostic_information(error); - LOG4CXX_FATAL(logger_, error_string); + SDL_LOG_FATAL(error_string); NOTREACHED(); } diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc index c2a31c32b2..e5c98183ac 100644 --- a/src/components/utils/src/file_system.cc +++ b/src/components/utils/src/file_system.cc @@ -47,36 +47,35 @@ #include <cstdio> #include <fstream> -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils::FileSystem") +SDL_CREATE_LOG_VARIABLE("Utils::FileSystem") // Easier reference namespace fs = boost::filesystem; using boost::system::error_code; uint64_t file_system::GetAvailableDiskSpace(const std::string& path) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; fs::space_info si = {0, 0, 0}; si = fs::space(path, ec); if (ec) { // If something went wrong, assume no free space - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Unable to get available disk space: '" - << path << "', reason: " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Unable to get available disk space: '" + << path << "', reason: " << ec.message()); } return si.free; } uint64_t file_system::FileSize(const std::string& path) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; // Boost returns sizes as unsigned const uint64_t fsize = static_cast<uint64_t>(fs::file_size(path, ec)); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO( - logger_, + SDL_LOG_ERROR_WITH_ERRNO( + "Unable to get file size: '" << path << "', reason: " << ec.message()); return 0; } @@ -84,15 +83,14 @@ uint64_t file_system::FileSize(const std::string& path) { } size_t file_system::DirectorySize(const std::string& path) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); size_t dir_size = 0; error_code ec; // Recursively iterate through directory to accumulate file sizes fs::recursive_directory_iterator iter(path, ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Unable to get directory size: '" - << path << "', reason: " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Unable to get directory size: '" + << path << "', reason: " << ec.message()); return 0; } @@ -101,31 +99,28 @@ size_t file_system::DirectorySize(const std::string& path) { while (end != iter) { const bool is_directory = fs::is_directory(iter->path(), ec); if (ec) { - LOG4CXX_WARN_WITH_ERRNO( - logger_, - "Failed check if '" << iter->path() + SDL_LOG_WARN_WITH_ERRNO("Failed check if '" + << iter->path() << "' is directory, reason: " << ec.message()); } if (!is_directory && !ec) { const size_t fsize = fs::file_size(iter->path(), ec); if (ec) { - LOG4CXX_WARN_WITH_ERRNO(logger_, - "Failed to get file_size: '" - << path << "', reason: " << ec.message()); + SDL_LOG_WARN_WITH_ERRNO("Failed to get file_size: '" + << path << "', reason: " << ec.message()); } else { // No error means we can add the file dir_size += fsize; - LOG4CXX_DEBUG(logger_, "Adding: " << fsize << ", total: " << dir_size); + SDL_LOG_DEBUG("Adding: " << fsize << ", total: " << dir_size); } } // Increment the iterator to point to next entry in recursive iteration iter.increment(ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Failed to increment iterator for path '" - << path << "', reason: " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Failed to increment iterator for path '" + << path << "', reason: " << ec.message()); return dir_size; } } @@ -135,11 +130,11 @@ size_t file_system::DirectorySize(const std::string& path) { // NOTE that boost makes 0777 permissions by default bool file_system::CreateDirectory(const std::string& name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; const bool success = fs::create_directory(name, ec); if (!success || ec) { - LOG4CXX_WARN_WITH_ERRNO(logger_, "Unable to create directory: " << name); + SDL_LOG_WARN_WITH_ERRNO("Unable to create directory: " << name); } else { // Set 0700 permissions to maintain previous API fs::permissions(name, fs::perms::owner_all, ec); @@ -148,15 +143,14 @@ bool file_system::CreateDirectory(const std::string& name) { } bool file_system::CreateDirectoryRecursively(const std::string& path) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; // Create directory and all parents fs::create_directories(path, ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Unable to create directory recursively: '" - << path << "', reason: " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Unable to create directory recursively: '" + << path << "', reason: " << ec.message()); return false; } @@ -165,13 +159,12 @@ bool file_system::CreateDirectoryRecursively(const std::string& path) { } bool file_system::IsDirectory(const std::string& name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; const bool is_directory = fs::is_directory(name, ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Unable to check if it is directory: " - << name << " reason: " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Unable to check if it is directory: " + << name << " reason: " << ec.message()); } return is_directory; } @@ -179,22 +172,21 @@ bool file_system::IsDirectory(const std::string& name) { // NOTE this may be a duplicate of IsDirectory since it already checks // existence bool file_system::DirectoryExists(const std::string& name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const bool exists = FileExists(name) && IsDirectory(name); - LOG4CXX_DEBUG( - logger_, + SDL_LOG_DEBUG( + "Directory '" << name << "' " << (exists ? "exists" : "NOT exists")); return exists; } bool file_system::FileExists(const std::string& name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; const bool exists = fs::exists(name, ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Unable to check that file exists: " - << name << " reason: " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Unable to check that file exists: " + << name << " reason: " << ec.message()); } return exists; } @@ -202,7 +194,7 @@ bool file_system::FileExists(const std::string& name) { bool file_system::Write(const std::string& file_name, const std::vector<uint8_t>& data, std::ios_base::openmode mode) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::ofstream file(file_name.c_str(), std::ios_base::binary | mode); if (file.is_open()) { for (uint32_t i = 0; i < data.size(); ++i) { @@ -216,7 +208,7 @@ bool file_system::Write(const std::string& file_name, std::ofstream* file_system::Open(const std::string& file_name, std::ios_base::openmode mode) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::ofstream* file = new std::ofstream(); file->open(file_name.c_str(), std::ios_base::binary | mode); if (file->is_open()) { @@ -230,7 +222,7 @@ std::ofstream* file_system::Open(const std::string& file_name, bool file_system::Write(std::ofstream* const file_stream, const uint8_t* data, uint32_t data_size) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); bool result = false; if (file_stream) { for (size_t i = 0; i < data_size; ++i) { @@ -242,73 +234,67 @@ bool file_system::Write(std::ofstream* const file_stream, } void file_system::Close(std::ofstream* file_stream) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (file_stream) { file_stream->close(); } } std::string file_system::CurrentWorkingDirectory() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; const fs::path currpath = fs::current_path(ec); if (ec) { - LOG4CXX_WARN_WITH_ERRNO(logger_, - "Unable to get current working directory: '" - << currpath << "' reason: " << ec.message()); + SDL_LOG_WARN_WITH_ERRNO("Unable to get current working directory: '" + << currpath << "' reason: " << ec.message()); } return currpath.string(); } std::string file_system::GetAbsolutePath(const std::string& path) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; const fs::path absolute = fs::canonical(path, ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Unable to get absolute path: '" - << path << "', reason: " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Unable to get absolute path: '" + << path << "', reason: " << ec.message()); return std::string(); // invalid path } return absolute.string(); } bool file_system::IsFileNameValid(const std::string& file_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return file_name.end() == std::find(file_name.begin(), file_name.end(), '/'); } // Does not remove if file is write-protected bool file_system::DeleteFile(const std::string& name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (FileExists(name) && IsAccessible(name, W_OK)) { error_code ec; const bool success = fs::remove(name.c_str(), ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Unable to delete file: '" - << name << "', reason: " << ec.message() - << "success: " << success); + SDL_LOG_ERROR_WITH_ERRNO("Unable to delete file: '" + << name << "', reason: " << ec.message() + << "success: " << success); } return success && !ec; } - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Unable to delete file either doesn't exist or is not accessible"); return false; } void file_system::remove_directory_content(const std::string& directory_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; fs::directory_iterator dir_iter(directory_name, ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO( - logger_, - "Unable to remove directory contents: " << directory_name - << " reason: " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Unable to remove directory contents: " + << directory_name << " reason: " << ec.message()); } // According to Boost's documentation, removing shouldn't invalidate the @@ -319,15 +305,15 @@ void file_system::remove_directory_content(const std::string& directory_name) { while (dir_iter != end) { fs::remove_all(dir_iter->path(), ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO( - logger_, + SDL_LOG_ERROR_WITH_ERRNO( + "Unable to remove file: " << dir_iter->path().string() << " reason " << ec.message()); } dir_iter.increment(ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO( - logger_, "Unable to increment dir_iter: reason " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Unable to increment dir_iter: reason " + << ec.message()); break; } } @@ -335,11 +321,11 @@ void file_system::remove_directory_content(const std::string& directory_name) { bool file_system::RemoveDirectory(const std::string& directory_name, const bool is_recursively) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); // Make sure the directory exists if (!DirectoryExists(directory_name) && IsAccessible(directory_name, W_OK)) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( + "Unable to remove directory either doesn't exist or is not accessible"); return false; } @@ -349,8 +335,7 @@ bool file_system::RemoveDirectory(const std::string& directory_name, if (is_recursively) { success = (fs::remove_all(directory_name, ec) != 0); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Unable to remove all: '" << directory_name + SDL_LOG_ERROR_WITH_ERRNO("Unable to remove all: '" << directory_name << "', reason " << ec.message()); } @@ -358,8 +343,7 @@ bool file_system::RemoveDirectory(const std::string& directory_name, // Otherwise try to remove success = fs::remove(directory_name, ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Unable to remove: '" << directory_name + SDL_LOG_ERROR_WITH_ERRNO("Unable to remove: '" << directory_name << "', reason " << ec.message()); } @@ -368,31 +352,29 @@ bool file_system::RemoveDirectory(const std::string& directory_name, } bool file_system::IsAccessible(const std::string& name, const int32_t how) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return !access(name.c_str(), how); } bool file_system::IsWritingAllowed(const std::string& name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return IsAccessible(name, W_OK); } bool file_system::IsReadingAllowed(const std::string& name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); return IsAccessible(name, R_OK); } std::vector<std::string> file_system::ListFiles( const std::string& directory_name) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; fs::directory_iterator iter(directory_name, ec), end; if (ec) { - LOG4CXX_ERROR_WITH_ERRNO( - logger_, - "Unable to get directory_iterator: " << directory_name << " reason " - << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Unable to get directory_iterator: " + << directory_name << " reason " << ec.message()); return std::vector<std::string>(); } @@ -401,10 +383,9 @@ std::vector<std::string> file_system::ListFiles( list_files.push_back(iter->path().filename().string()); iter.increment(ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Failed to increment iterator for path '" - << directory_name - << "', reason: " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Failed to increment iterator for path '" + << directory_name + << "', reason: " << ec.message()); return list_files; } } @@ -422,10 +403,10 @@ bool file_system::WriteBinaryFile(const std::string& name, bool file_system::ReadBinaryFile(const std::string& name, std::vector<uint8_t>& result) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "Filename: " << name); + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("Filename: " << name); if (!FileExists(name) || !IsAccessible(name, R_OK)) { - LOG4CXX_ERROR(logger_, "Not able to read binary file: " << name); + SDL_LOG_ERROR("Not able to read binary file: " << name); return false; } @@ -446,7 +427,7 @@ bool file_system::ReadBinaryFile(const std::string& name, uint32_t offset, uint32_t length) { if (!FileExists(name) || !IsAccessible(name, R_OK)) { - LOG4CXX_ERROR(logger_, "Not able to read binary file: " << name); + SDL_LOG_ERROR("Not able to read binary file: " << name); return false; } @@ -466,14 +447,14 @@ bool file_system::ReadBinaryFile(const std::string& name, } bool file_system::ReadFile(const std::string& name, std::string& result) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!FileExists(name) || !IsAccessible(name, R_OK)) { - LOG4CXX_ERROR(logger_, "Not able to read file: " << name); + SDL_LOG_ERROR("Not able to read file: " << name); return false; } std::ifstream file(name.c_str()); if (!file) { - LOG4CXX_ERROR(logger_, "Not able to open binary file: " << name); + SDL_LOG_ERROR("Not able to open binary file: " << name); return false; } std::ostringstream ss; @@ -483,7 +464,7 @@ bool file_system::ReadFile(const std::string& name, std::string& result) { } const std::string file_system::ConvertPathForURL(const std::string& path) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); const std::string reserved_symbols = "!#$&'()*+,:;=?@[] "; size_t pos = std::string::npos; std::string converted_path; @@ -503,11 +484,11 @@ const std::string file_system::ConvertPathForURL(const std::string& path) { } bool file_system::CreateFile(const std::string& path) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); std::ofstream file(path); if (!(file.is_open())) { - LOG4CXX_WARN(logger_, "failed to create file: " << path); + SDL_LOG_WARN("failed to create file: " << path); return false; } file.close(); @@ -515,14 +496,13 @@ bool file_system::CreateFile(const std::string& path) { } time_t file_system::GetFileModificationTime(const std::string& path) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); error_code ec; std::time_t time = fs::last_write_time(path, ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, - "Unable to get file modification time: " - << path << " reason " << ec.message()); + SDL_LOG_ERROR_WITH_ERRNO("Unable to get file modification time: " + << path << " reason " << ec.message()); return 0; } @@ -530,18 +510,17 @@ time_t file_system::GetFileModificationTime(const std::string& path) { } bool file_system::CopyFile(const std::string& src, const std::string& dst) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (!FileExists(src) || FileExists(dst) || !CreateFile(dst)) { - LOG4CXX_WARN( - logger_, - "Failed to copy file from: '" << src << "', to: '" << dst << "'"); + SDL_LOG_WARN("Failed to copy file from: '" << src << "', to: '" << dst + << "'"); return false; } error_code ec; fs::copy_file(src, dst, ec); if (ec) { - LOG4CXX_ERROR_WITH_ERRNO( - logger_, + SDL_LOG_ERROR_WITH_ERRNO( + "Unable to copy file: '" << src << "', reason: " << ec.message()); // something failed return false; @@ -550,7 +529,7 @@ bool file_system::CopyFile(const std::string& src, const std::string& dst) { } bool file_system::MoveFile(const std::string& src, const std::string& dst) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (std::rename(src.c_str(), dst.c_str()) == 0) { return true; @@ -560,14 +539,13 @@ bool file_system::MoveFile(const std::string& src, const std::string& dst) { // Instead, copy the file over and delete the old one bool success = CopyFile(src, dst); if (!success) { - LOG4CXX_ERROR( - logger_, - "Failed to copy file from: '" << src << "', to: '" << dst << "'"); + SDL_LOG_ERROR("Failed to copy file from: '" << src << "', to: '" << dst + << "'"); return false; } success = DeleteFile(src); if (!success) { - LOG4CXX_ERROR(logger_, "Failed to delete file '" << src << "'"); + SDL_LOG_ERROR("Failed to delete file '" << src << "'"); return false; } return true; diff --git a/src/components/utils/src/jsoncpp_reader_wrapper.cc b/src/components/utils/src/jsoncpp_reader_wrapper.cc index 69da386eed..f347a3253d 100644 --- a/src/components/utils/src/jsoncpp_reader_wrapper.cc +++ b/src/components/utils/src/jsoncpp_reader_wrapper.cc @@ -35,14 +35,14 @@ namespace utils { -CREATE_LOGGERPTR_GLOBAL(logger_, "JsoncppReaderWrapper") +SDL_CREATE_LOG_VARIABLE("JsoncppReaderWrapper") JsonReader::JsonReader() { reader_ = std::unique_ptr<Json::CharReader>(reader_builder_.newCharReader()); } bool JsonReader::parse(const std::string& json, Json::Value* root) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); JSONCPP_STRING err; bool is_parsing_ok = false; const size_t json_len = json.length(); @@ -50,12 +50,12 @@ bool JsonReader::parse(const std::string& json, Json::Value* root) { is_parsing_ok = reader_->parse(json.c_str(), json.c_str() + json_len, root, &err); } catch (Json::RuntimeError& e) { - LOG4CXX_DEBUG(logger_, "Exception caught during parse json: " << e.what()); + SDL_LOG_DEBUG("Exception caught during parse json: " << e.what()); return false; } if (!is_parsing_ok) { - LOG4CXX_ERROR(logger_, "Json parsing fails: " << err); + SDL_LOG_ERROR("Json parsing fails: " << err); } return is_parsing_ok; } diff --git a/src/components/utils/src/lock_boost.cc b/src/components/utils/src/lock_boost.cc index 2299bcf77d..735b31d882 100644 --- a/src/components/utils/src/lock_boost.cc +++ b/src/components/utils/src/lock_boost.cc @@ -39,13 +39,13 @@ namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") Lock::Lock() : lock_taken_(0) {} Lock::~Lock() { if (lock_taken_ > 0) { - LOG4CXX_FATAL(logger_, "Destroying non-released regular mutex " << &mutex_); + SDL_LOG_FATAL("Destroying non-released regular mutex " << &mutex_); } } @@ -69,7 +69,7 @@ bool Lock::Try() { void Lock::AssertFreeAndMarkTaken() { if (lock_taken_ != 0) { - LOG4CXX_FATAL(logger_, "Locking already taken not recursive mutex"); + SDL_LOG_FATAL("Locking already taken not recursive mutex"); NOTREACHED(); } lock_taken_++; @@ -77,7 +77,7 @@ void Lock::AssertFreeAndMarkTaken() { void Lock::AssertTakenAndMarkFree() { if (lock_taken_ == 0) { - LOG4CXX_FATAL(logger_, "Unlocking a mutex that is not taken"); + SDL_LOG_FATAL("Unlocking a mutex that is not taken"); NOTREACHED(); } lock_taken_--; @@ -89,8 +89,7 @@ RecursiveLock::RecursiveLock() : lock_taken_(0) {} RecursiveLock::~RecursiveLock() { if (lock_taken_ > 0) { - LOG4CXX_FATAL(logger_, - "Destroying non-released recursive mutex " << &mutex_); + SDL_LOG_FATAL("Destroying non-released recursive mutex " << &mutex_); } } @@ -118,7 +117,7 @@ void RecursiveLock::AssertFreeAndMarkTaken() { void RecursiveLock::AssertTakenAndMarkFree() { if (lock_taken_ == 0) { - LOG4CXX_FATAL(logger_, "Unlocking a recursive mutex that is not taken"); + SDL_LOG_FATAL("Unlocking a recursive mutex that is not taken"); NOTREACHED(); } lock_taken_--; diff --git a/src/components/utils/src/logger.cc b/src/components/utils/src/logger.cc deleted file mode 100644 index 5a7922afc4..0000000000 --- a/src/components/utils/src/logger.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "utils/logger.h" -#include <apr_time.h> -#include "utils/log_message_loop_thread.h" -#include "utils/logger_status.h" - -void deinit_logger() { - CREATE_LOGGERPTR_LOCAL(logger_, "Utils") - LOG4CXX_DEBUG(logger_, "Logger deinitialization"); - logger::set_logs_enabled(false); - log4cxx::LoggerPtr rootLogger = log4cxx::Logger::getRootLogger(); - logger::delete_log_message_loop_thread(rootLogger); - log4cxx::spi::LoggerRepositoryPtr repository = - rootLogger->getLoggerRepository(); - log4cxx::LoggerList loggers = repository->getCurrentLoggers(); - for (log4cxx::LoggerList::iterator i = loggers.begin(); i != loggers.end(); - ++i) { - log4cxx::LoggerPtr logger = *i; - logger->removeAllAppenders(); - } - rootLogger->removeAllAppenders(); - logger::logger_status = logger::LoggerThreadNotCreated; -} - -log4cxx_time_t time_now() { - return apr_time_now(); -} diff --git a/src/components/utils/src/logger/log4cxxlogger.cc b/src/components/utils/src/logger/log4cxxlogger.cc new file mode 100644 index 0000000000..7d43892073 --- /dev/null +++ b/src/components/utils/src/logger/log4cxxlogger.cc @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2020, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "utils/logger/log4cxxlogger.h" +#include <apr_pools.h> +#include <apr_thread_proc.h> +#include <atomic> +#include <sstream> +#include "assert.h" +#include "log4cxx/propertyconfigurator.h" + +namespace logger { + +Log4CXXLogger::Log4CXXLogger(const std::string& filename) + : filename_(filename) {} + +void Log4CXXLogger::Init() { + log4cxx::PropertyConfigurator::configure(filename_); +} + +void Log4CXXLogger::DeInit() { + log4cxx::LoggerPtr rootLogger = log4cxx::Logger::getRootLogger(); + + if (LOG4CXX_UNLIKELY(rootLogger->isDebugEnabled())) { + ::log4cxx::helpers::MessageBuffer oss_; + rootLogger->forcedLog(::log4cxx::Level::getDebug(), + oss_.str(oss_ << "Logger loop thread deinitialized"), + LOG4CXX_LOCATION); + } + + if (LOG4CXX_UNLIKELY(rootLogger->isDebugEnabled())) { + ::log4cxx::helpers::MessageBuffer oss_; + rootLogger->forcedLog(::log4cxx::Level::getDebug(), + oss_.str(oss_ << "Logger calling removeAllAppenders"), + LOG4CXX_LOCATION); + } + + log4cxx::spi::LoggerRepositoryPtr repository = + rootLogger->getLoggerRepository(); + log4cxx::LoggerList loggers = repository->getCurrentLoggers(); + for (auto logger : loggers) { + logger->removeAllAppenders(); + } + + rootLogger->removeAllAppenders(); +} + +log4cxx::LevelPtr getLogLevel(LogLevel log_level) { + switch (log_level) { + case LogLevel::TRACE_LEVEL: + return log4cxx::Level::getTrace(); + case LogLevel::DEBUG_LEVEL: + return log4cxx::Level::getDebug(); + case LogLevel::INFO_LEVEL: + return log4cxx::Level::getInfo(); + case LogLevel::WARNING_LEVEL: + return log4cxx::Level::getWarn(); + case LogLevel::ERROR_LEVEL: + return log4cxx::Level::getError(); + case LogLevel::FATAL_LEVEL: + return log4cxx::Level::getFatal(); + default: + assert(false); + } +} + +bool Log4CXXLogger::IsEnabledFor(const std::string& component, + LogLevel log_level) const { + log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(component); + return logger->isEnabledFor(getLogLevel(log_level)); +} + +void Log4CXXLogger::PushLog(const LogMessage& log_message) { + log4cxx::LoggerPtr logger = + log4cxx::Logger::getLogger(log_message.component_); + + std::ostringstream ss; + ss << log_message.thread_id_; + + auto time = std::chrono::duration_cast<std::chrono::microseconds>( + log_message.timestamp_.time_since_epoch()) + .count(); + auto location = + log4cxx::spi::LocationInfo(log_message.location_.file_name.c_str(), + log_message.location_.function_name.c_str(), + log_message.location_.line_number); + logger->forcedLog(getLogLevel(log_message.log_level_), + log_message.log_event_, + time, + location, + ss.str()); +} + +} // namespace logger diff --git a/src/components/utils/src/logger/logger_impl.cc b/src/components/utils/src/logger/logger_impl.cc new file mode 100644 index 0000000000..1dae0ede3c --- /dev/null +++ b/src/components/utils/src/logger/logger_impl.cc @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2020, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "utils/logger/logger_impl.h" +#include <assert.h> +#include <iostream> + +namespace logger { + +LoggerImpl::LoggerImpl(bool use_message_loop_thread) + : impl_(nullptr), use_message_loop_thread_(use_message_loop_thread) { + if (!use_message_loop_thread_) + logger::logger_status = LoggerThreadIsNotUsed; +} + +void LoggerImpl::Init(std::unique_ptr<ThirdPartyLoggerInterface>&& impl) { + assert(impl_ == nullptr); + impl_ = std::move(impl); + + impl_->Init(); + + if (use_message_loop_thread_) { + auto deinit_logger = [](LogMessageLoopThread* logMsgThread) { + delete logMsgThread; + logger::logger_status = logger::LoggerThreadNotCreated; + }; + + if (!loop_thread_) { + loop_thread_ = LoopThreadPtr<LogMessageLoopThread>( + new LogMessageLoopThread( + [this](LogMessage message) { impl_->PushLog(message); }), + deinit_logger); + } + logger::logger_status = logger::LoggerThreadCreated; + } +} + +void LoggerImpl::DeInit() { + if (use_message_loop_thread_) { + Flush(); + logger::logger_status = logger::LoggerThreadNotCreated; + loop_thread_.reset(); + } + + if (impl_) { + impl_->DeInit(); + } +} + +void LoggerImpl::Flush() { + if (use_message_loop_thread_ && + (logger::LoggerThreadCreated == logger::logger_status)) { + logger::LoggerStatus old_status = logger::logger_status; + logger::logger_status = logger::DeletingLoggerThread; + loop_thread_->WaitDumpQueue(); + logger::logger_status = old_status; + } +} + +bool LoggerImpl::IsEnabledFor(const std::string& component, + LogLevel log_level) const { + return impl_ ? impl_->IsEnabledFor(component, log_level) : false; +} + +void LoggerImpl::PushLog(const LogMessage& log_message) { + if (impl_) { + if (use_message_loop_thread_ && + (logger::LoggerThreadCreated == logger::logger_status)) { + loop_thread_->Push(log_message); + } else { + impl_->PushLog(log_message); + } + } +} + +Logger& Logger::instance(Logger* pre_init) { + static Logger* instance_; + if (pre_init) { + assert(instance_ == nullptr); + instance_ = pre_init; + } + return *instance_; +} + +LogMessageLoopThread::LogMessageLoopThread( + std::function<void(LogMessage)> handler) + : LogMessageLoopThreadTemplate("Logger", this), force_log_(handler) {} + +void LogMessageLoopThread::Push(const LogMessage& message) { + PostMessage(message); +} + +void LogMessageLoopThread::Handle(const LogMessage message) { + force_log_(message); +} + +LogMessageLoopThread::~LogMessageLoopThread() { + // we'll have to drop messages + // while deleting logger thread + logger::logger_status = logger::DeletingLoggerThread; + LogMessageLoopThreadTemplate::Shutdown(); +} + +} // namespace logger diff --git a/src/components/utils/src/push_log.cc b/src/components/utils/src/push_log.cc deleted file mode 100644 index f9d1cd738a..0000000000 --- a/src/components/utils/src/push_log.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "utils/push_log.h" -#include "utils/log_message_loop_thread.h" -#include "utils/logger_status.h" - -namespace logger { - -struct __attribute__((visibility("default"))) LogsEnabled { - static std::atomic_bool logs_enabled_; -}; - -std::atomic_bool LogsEnabled::logs_enabled_(false); - -template <typename T> -using logger_ptr = std::unique_ptr<T, std::function<void(T*)> >; - -static logger_ptr<LogMessageLoopThread> log_message_loop_thread; - -auto deinit_logger = [](LogMessageLoopThread* logMsgThread) { - delete logMsgThread; - logger::logger_status = logger::LoggerThreadNotCreated; -}; - -bool push_log(log4cxx::LoggerPtr logger, - log4cxx::LevelPtr level, - const std::string& entry, - log4cxx_time_t timeStamp, - const log4cxx::spi::LocationInfo& location, - const log4cxx::LogString& threadName) { - if (LoggerThreadCreated == logger_status) { - LogMessage message = { - logger, level, entry, timeStamp, location, threadName}; - if (log_message_loop_thread) { - log_message_loop_thread->PostMessage(message); - return true; - } - } - - if (LoggerThreadNotCreated == logger_status) { - logger_status = CreatingLoggerThread; - // we'll have to drop messages - // while creating logger thread - create_log_message_loop_thread(); - LogMessage message = { - logger, level, entry, timeStamp, location, threadName}; - log_message_loop_thread->PostMessage(message); - logger_status = LoggerThreadCreated; - return true; - } - - // also we drop messages - // while deleting logger thread - - return false; -} - -bool logs_enabled() { - return LogsEnabled::logs_enabled_; -} - -void set_logs_enabled(bool state) { - LogsEnabled::logs_enabled_ = state; -} - -void create_log_message_loop_thread() { - if (!log_message_loop_thread) { - log_message_loop_thread = logger_ptr<LogMessageLoopThread>( - new LogMessageLoopThread, deinit_logger); - } -} - -void delete_log_message_loop_thread(log4cxx::LoggerPtr& logger) { - if (logger::logger_status == logger::LoggerThreadCreated) { - logger::flush_logger(); - } - - log_message_loop_thread.reset(); - - if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) { - ::log4cxx::helpers::MessageBuffer oss_; - logger->forcedLog(::log4cxx::Level::getDebug(), - oss_.str(oss_ << "Logger loop thread deinitialized"), - LOG4CXX_LOCATION); - } - - if (logger->getRootLogger() == logger) { - return; - } - - if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) { - ::log4cxx::helpers::MessageBuffer oss_; - logger->forcedLog(::log4cxx::Level::getDebug(), - oss_.str(oss_ << "Logger calling removeAllAppenders"), - LOG4CXX_LOCATION); - } - - logger->removeAllAppenders(); -} - -void flush_logger() { - logger::LoggerStatus old_status = logger::logger_status; - // Stop pushing new messages to the log queue - logger::logger_status = logger::DeletingLoggerThread; - log_message_loop_thread->WaitDumpQueue(); - logger::logger_status = old_status; -} - -} // namespace logger diff --git a/src/components/utils/src/qdb_wrapper/sql_database.cc b/src/components/utils/src/qdb_wrapper/sql_database.cc index e2a51753b2..a2063de19e 100644 --- a/src/components/utils/src/qdb_wrapper/sql_database.cc +++ b/src/components/utils/src/qdb_wrapper/sql_database.cc @@ -37,7 +37,7 @@ namespace utils { namespace dbms { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") SQLDatabase::SQLDatabase(const std::string& db_name) : conn_(NULL), db_name_(db_name), error_(Error::OK) {} @@ -101,10 +101,10 @@ qdb_hdl_t* SQLDatabase::conn() const { bool SQLDatabase::Backup() { if (qdb_backup(conn_, QDB_ATTACH_DEFAULT) == -1) { error_ = Error::ERROR; - LOG4CXX_ERROR(logger_, "Backup returned error: " << std::strerror(errno)); + SDL_LOG_ERROR("Backup returned error: " << std::strerror(errno)); return false; } - LOG4CXX_INFO(logger_, "Backup was successful."); + SDL_LOG_INFO("Backup was successful."); return true; } diff --git a/src/components/utils/src/qdb_wrapper/sql_query.cc b/src/components/utils/src/qdb_wrapper/sql_query.cc index d101e80718..ee774d89a2 100644 --- a/src/components/utils/src/qdb_wrapper/sql_query.cc +++ b/src/components/utils/src/qdb_wrapper/sql_query.cc @@ -41,7 +41,7 @@ namespace utils { namespace dbms { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") class SetBindInteger { public: @@ -111,7 +111,7 @@ bool SQLQuery::Prepare(const std::string& query) { query_ = query; statement_ = qdb_stmt_init(db_->conn(), query.c_str(), query.length() + 1); if (statement_ == -1) { - LOG4CXX_DEBUG(logger_, "Prepare error: " << strerror(errno)); + SDL_LOG_DEBUG("Prepare error: " << strerror(errno)); error_ = Error::ERROR; return false; } diff --git a/src/components/utils/src/resource_usage.cc b/src/components/utils/src/resource_usage.cc index 15a8c71e70..cf08be45ce 100644 --- a/src/components/utils/src/resource_usage.cc +++ b/src/components/utils/src/resource_usage.cc @@ -20,19 +20,19 @@ namespace utils { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") const char* Resources::proc = "/proc/"; ResourseUsage* Resources::getCurrentResourseUsage() { PidStats pid_stats; if (false == GetProcInfo(pid_stats)) { - LOG4CXX_ERROR(logger_, "Failed to get cpu proc info"); + SDL_LOG_ERROR("Failed to get cpu proc info"); return NULL; } MemInfo mem_info; if (false == GetMemInfo(mem_info)) { - LOG4CXX_ERROR(logger_, "Failed to get memory info"); + SDL_LOG_ERROR("Failed to get memory info"); return NULL; } ResourseUsage* usage = new ResourseUsage(); @@ -149,16 +149,15 @@ bool Resources::GetProcInfo(Resources::PidStats& output) { &(output.guest_time), &(output.cguest_time)); if (num_succes != 43) { // 43 is number of iteams in Resources::PidStats - LOG4CXX_ERROR(logger_, "Couldn't parse all iteams in /proc/PID/stat file"); + SDL_LOG_ERROR("Couldn't parse all iteams in /proc/PID/stat file"); return false; } return true; #elif defined(__QNXNTO__) int fd = open(GetProcPath().c_str(), O_RDONLY); if (0 >= fd) { - LOG4CXX_ERROR(logger_, - "Failed open process proc file : " - << GetProcPath() << "; error no : " << strerror(errno)); + SDL_LOG_ERROR("Failed open process proc file : " + << GetProcPath() << "; error no : " << strerror(errno)); close(fd); return false; @@ -174,7 +173,7 @@ bool Resources::GetMemInfo(Resources::MemInfo& output) { #if defined(OS_LINUX) Resources::PidStats pid_stat; if (false == GetProcInfo(pid_stat)) { - LOG4CXX_ERROR(logger_, "Failed to get proc info"); + SDL_LOG_ERROR("Failed to get proc info"); result = false; } else { output = pid_stat.vsize; @@ -186,19 +185,19 @@ bool Resources::GetMemInfo(Resources::MemInfo& output) { struct stat st; struct _dir* proc_dir = 0; if (0 == (proc_dir = opendir(proc))) { - LOG4CXX_ERROR(logger_, "Unable to access to " << proc); + SDL_LOG_ERROR("Unable to access to " << proc); result = false; return result; } if (0 == readdir(proc_dir)) { - LOG4CXX_ERROR(logger_, "Unable to read : " << proc_dir); + SDL_LOG_ERROR("Unable to read : " << proc_dir); closedir(proc_dir); result = false; return result; } closedir(proc_dir); if (-1 == stat(as_path.c_str(), &st) || 0 == st.st_size) { - LOG4CXX_ERROR(logger_, "Unable to stat : " << as_path.c_str()); + SDL_LOG_ERROR("Unable to stat : " << as_path.c_str()); result = false; return result; } diff --git a/src/components/utils/src/rwlock_posix.cc b/src/components/utils/src/rwlock_posix.cc index 81bf5feee1..5509449fd1 100644 --- a/src/components/utils/src/rwlock_posix.cc +++ b/src/components/utils/src/rwlock_posix.cc @@ -35,23 +35,23 @@ namespace sync_primitives { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") RWLock::RWLock() { if (pthread_rwlock_init(&rwlock_, 0) != 0) { - LOG4CXX_ERROR(logger_, "Failed to initialize rwlock"); + SDL_LOG_ERROR("Failed to initialize rwlock"); } } RWLock::~RWLock() { if (pthread_rwlock_destroy(&rwlock_) != 0) { - LOG4CXX_ERROR(logger_, "Failed to destroy rwlock"); + SDL_LOG_ERROR("Failed to destroy rwlock"); } } bool RWLock::AcquireForReading() { if (pthread_rwlock_rdlock(&rwlock_) != 0) { - LOG4CXX_ERROR(logger_, "Failed to acquire rwlock for reading"); + SDL_LOG_ERROR("Failed to acquire rwlock for reading"); return false; } return true; @@ -59,7 +59,7 @@ bool RWLock::AcquireForReading() { bool RWLock::TryAcquireForReading() { if (pthread_rwlock_tryrdlock(&rwlock_) != 0) { - LOG4CXX_ERROR(logger_, "Failed to acquire rwlock for reading"); + SDL_LOG_ERROR("Failed to acquire rwlock for reading"); return false; } return true; @@ -67,7 +67,7 @@ bool RWLock::TryAcquireForReading() { bool RWLock::AcquireForWriting() { if (pthread_rwlock_wrlock(&rwlock_) != 0) { - LOG4CXX_ERROR(logger_, "Failed to acquire rwlock for writing"); + SDL_LOG_ERROR("Failed to acquire rwlock for writing"); return false; } return true; @@ -75,7 +75,7 @@ bool RWLock::AcquireForWriting() { bool RWLock::TryAcquireForWriting() { if (pthread_rwlock_trywrlock(&rwlock_) != 0) { - LOG4CXX_ERROR(logger_, "Failed to acquire rwlock for writing"); + SDL_LOG_ERROR("Failed to acquire rwlock for writing"); return false; } return true; @@ -83,7 +83,7 @@ bool RWLock::TryAcquireForWriting() { bool RWLock::Release() { if (pthread_rwlock_unlock(&rwlock_) != 0) { - LOG4CXX_ERROR(logger_, "Failed to release rwlock"); + SDL_LOG_ERROR("Failed to release rwlock"); return false; } return true; diff --git a/src/components/utils/src/system.cc b/src/components/utils/src/system.cc index 2acc7acf92..d8bd034d4a 100644 --- a/src/components/utils/src/system.cc +++ b/src/components/utils/src/system.cc @@ -49,7 +49,7 @@ namespace utils { -CREATE_LOGGERPTR_LOCAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") struct GetCString { char* operator()(const std::string& string) { @@ -96,8 +96,7 @@ bool System::Execute(bool wait) { delete[] argv; if (ret == -1) { - LOG4CXX_ERROR(logger_, - "Can't execute command: " << command_ << " Errno is: " + SDL_LOG_ERROR("Can't execute command: " << command_ << " Errno is: " << std::strerror(errno)); return false; } @@ -117,13 +116,13 @@ bool System::Execute(bool wait) { switch (pid_command) { case -1: { // Error - LOG4CXX_FATAL(logger_, "fork() failed!"); + SDL_LOG_FATAL("fork() failed!"); return false; } case 0: { // Child process int32_t fd_dev0 = open("/dev/null", O_RDWR, S_IWRITE); if (0 > fd_dev0) { - LOG4CXX_FATAL(logger_, "Open dev0 failed!"); + SDL_LOG_FATAL("Open dev0 failed!"); return false; } // close input/output file descriptors. @@ -143,7 +142,7 @@ bool System::Execute(bool wait) { // Execute the program. if (execvp(command_.c_str(), argv) == -1) { - LOG4CXX_ERROR(logger_, "Can't execute command: " << command_); + SDL_LOG_ERROR("Can't execute command: " << command_); _exit(EXIT_FAILURE); } delete[] argv; @@ -151,14 +150,14 @@ bool System::Execute(bool wait) { return true; } default: { /* Parent process */ - LOG4CXX_INFO(logger_, "Process created with pid " << pid_command); + SDL_LOG_INFO("Process created with pid " << pid_command); if (wait) { int status; pid_t wait_pid; do { wait_pid = waitpid(pid_command, &status, WUNTRACED | WCONTINUED); if (wait_pid == -1) { - LOG4CXX_ERROR_WITH_ERRNO(logger_, "Can't wait"); + SDL_LOG_ERROR_WITH_ERRNO("Can't wait"); _exit(EXIT_FAILURE); return false; } diff --git a/src/components/utils/src/threads/async_runner.cc b/src/components/utils/src/threads/async_runner.cc index faa2f24174..3109339340 100644 --- a/src/components/utils/src/threads/async_runner.cc +++ b/src/components/utils/src/threads/async_runner.cc @@ -38,27 +38,27 @@ namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") AsyncRunner::AsyncRunner(const std::string& thread_name) : executor_(new AsyncRunnerDelegate) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); thread_ = threads::CreateThread(thread_name.c_str(), executor_); thread_->Start(); } void AsyncRunner::AsyncRun(ThreadDelegate* delegate) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); executor_->runDelegate(delegate); } void AsyncRunner::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); thread_->Stop(threads::Thread::kThreadStopDelegate); } AsyncRunner::~AsyncRunner() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); thread_->Stop(threads::Thread::kThreadSoftStop); delete executor_; threads::DeleteThread(thread_); @@ -81,7 +81,7 @@ void AsyncRunner::AsyncRunnerDelegate::processDelegate() { } void AsyncRunner::AsyncRunnerDelegate::waitForDelegate() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(delegates_queue_lock_); if (!stop_flag_ && delegates_queue_.empty()) { delegate_notifier_.Wait(lock); @@ -89,7 +89,7 @@ void AsyncRunner::AsyncRunnerDelegate::waitForDelegate() { } void AsyncRunner::AsyncRunnerDelegate::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); while (!stop_flag_) { processDelegate(); waitForDelegate(); @@ -97,14 +97,14 @@ void AsyncRunner::AsyncRunnerDelegate::threadMain() { } void AsyncRunner::AsyncRunnerDelegate::exitThreadMain() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(delegates_queue_lock_); stop_flag_ = true; delegate_notifier_.NotifyOne(); } void AsyncRunner::AsyncRunnerDelegate::runDelegate(ThreadDelegate* delegate) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(delegates_queue_lock_); delegates_queue_.push(delegate); delegate_notifier_.NotifyOne(); diff --git a/src/components/utils/src/threads/pulse_thread_delegate.cc b/src/components/utils/src/threads/pulse_thread_delegate.cc index a76b17368a..79174ae693 100644 --- a/src/components/utils/src/threads/pulse_thread_delegate.cc +++ b/src/components/utils/src/threads/pulse_thread_delegate.cc @@ -37,32 +37,31 @@ namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") PulseThreadDelegate::PulseThreadDelegate() : run_(false) { - LOG4CXX_TRACE(logger_, "Creating QNX channel"); + SDL_LOG_TRACE("Creating QNX channel"); chid_ = ChannelCreate(0); if (chid_ == -1) { - LOG4CXX_ERROR(logger_, "Failed to create QNX channel"); + SDL_LOG_ERROR("Failed to create QNX channel"); return; } - LOG4CXX_DEBUG(logger_, "Created QNX channel " << chid_); + SDL_LOG_DEBUG("Created QNX channel " << chid_); - LOG4CXX_TRACE(logger_, "Connecting to QNX channel " << chid_); + SDL_LOG_TRACE("Connecting to QNX channel " << chid_); coid_ = ConnectAttach(ND_LOCAL_NODE, 0, chid_, _NTO_SIDE_CHANNEL, 0); if (coid_ == -1) { - LOG4CXX_ERROR(logger_, "Failed to connect to QNX channel " << chid_); + SDL_LOG_ERROR("Failed to connect to QNX channel " << chid_); return; } - LOG4CXX_DEBUG(logger_, "Connected to QNX channel " << chid_); + SDL_LOG_DEBUG("Connected to QNX channel " << chid_); run_ = true; } void PulseThreadDelegate::threadMain() { if (!Init()) { - LOG4CXX_ERROR(logger_, - "Failed to initialize thread for QNX channel " << chid_); + SDL_LOG_ERROR("Failed to initialize thread for QNX channel " << chid_); return; } while (run_) { @@ -70,9 +69,9 @@ void PulseThreadDelegate::threadMain() { SIGEV_PULSE_INIT(&event, coid_, SIGEV_PULSE_PRIO_INHERIT, PULSE_CODE, 0); if (ArmEvent(&event)) { struct _pulse pulse; - LOG4CXX_INFO(logger_, "Waiting for pulse on QNX channel " << chid_); + SDL_LOG_INFO("Waiting for pulse on QNX channel " << chid_); if (MsgReceivePulse(chid_, &pulse, sizeof(pulse), 0) != -1) { - LOG4CXX_INFO(logger_, "Received pulse on QNX channel " << chid_); + SDL_LOG_INFO("Received pulse on QNX channel " << chid_); switch (pulse.code) { case PULSE_CODE: OnPulse(); @@ -80,12 +79,10 @@ void PulseThreadDelegate::threadMain() { } } else { if (run_) { - LOG4CXX_WARN(logger_, - "Error occurred while waiting for pulse on QNX channel " - << chid_); + SDL_LOG_WARN("Error occurred while waiting for pulse on QNX channel " + << chid_); } else { - LOG4CXX_INFO(logger_, - "QNX channel " << chid_ << " is apparently destroyed"); + SDL_LOG_INFO("QNX channel " << chid_ << " is apparently destroyed"); } } } @@ -96,18 +93,18 @@ void PulseThreadDelegate::threadMain() { void PulseThreadDelegate::exitThreadMain() { run_ = false; - LOG4CXX_TRACE(logger_, "Disconnecting from QNX channel " << chid_); + SDL_LOG_TRACE("Disconnecting from QNX channel " << chid_); if (ConnectDetach(coid_) != -1) { - LOG4CXX_DEBUG(logger_, "Disconnected from QNX channel " << chid_); + SDL_LOG_DEBUG("Disconnected from QNX channel " << chid_); } else { - LOG4CXX_WARN(logger_, "Failed to disconnect from QNX channel " << chid_); + SDL_LOG_WARN("Failed to disconnect from QNX channel " << chid_); } - LOG4CXX_TRACE(logger_, "Destroying QNX channel " << chid_); + SDL_LOG_TRACE("Destroying QNX channel " << chid_); if (ChannelDestroy(chid_) != -1) { // unblocks MsgReceivePulse() - LOG4CXX_DEBUG(logger_, "QNX channel " << chid_ << " destroyed"); + SDL_LOG_DEBUG("QNX channel " << chid_ << " destroyed"); } else { - LOG4CXX_WARN(logger_, "Failed to destroy QNX channel " << chid_); + SDL_LOG_WARN("Failed to destroy QNX channel " << chid_); } } diff --git a/src/components/utils/src/threads/thread_manager.cc b/src/components/utils/src/threads/thread_manager.cc index 8825510d74..466bd98dc5 100644 --- a/src/components/utils/src/threads/thread_manager.cc +++ b/src/components/utils/src/threads/thread_manager.cc @@ -49,6 +49,6 @@ namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") } // namespace threads diff --git a/src/components/utils/src/threads/thread_posix.cc b/src/components/utils/src/threads/thread_posix.cc index 59ab122ad0..23e3da4a8d 100644 --- a/src/components/utils/src/threads/thread_posix.cc +++ b/src/components/utils/src/threads/thread_posix.cc @@ -53,13 +53,13 @@ const size_t THREAD_NAME_SIZE = 15; namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") size_t Thread::kMinStackSize = PTHREAD_STACK_MIN; /* Ubuntu : 16384 ; QNX : 256; */ void Thread::cleanup(void* arg) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); Thread* thread = static_cast<Thread*>(arg); sync_primitives::AutoLock auto_lock(thread->state_lock_); thread->thread_state_ = kThreadStateCompleted; @@ -95,12 +95,11 @@ void* Thread::threadFunc(void* arg) { while (continueIterations) { thread->thread_state_ = kThreadStateIdle; - LOG4CXX_DEBUG(logger_, "Thread #" << pthread_self() << " iteration"); + SDL_LOG_DEBUG("Thread #" << pthread_self() << " iteration"); thread->state_cond_.Wait(thread->state_lock_); - LOG4CXX_DEBUG(logger_, - "Thread #" - << pthread_self() << " execute. " - << "thread_command_ = " << thread->thread_command_); + SDL_LOG_DEBUG("Thread #" + << pthread_self() << " execute. " + << "thread_command_ = " << thread->thread_command_); switch (thread->thread_command_) { case kThreadCommandRun: @@ -112,15 +111,13 @@ void* Thread::threadFunc(void* arg) { break; default: - LOG4CXX_ERROR(logger_, - "Incorrect thread command: " << thread->thread_command_); + SDL_LOG_ERROR("Incorrect thread command: " << thread->thread_command_); break; } thread->thread_command_ = kThreadCommandNone; // consumed thread->state_cond_.Broadcast(); - LOG4CXX_DEBUG(logger_, - "Thread #" << pthread_self() << " finished iteration"); + SDL_LOG_DEBUG("Thread #" << pthread_self() << " finished iteration"); } thread->state_lock_.Release(); @@ -131,8 +128,7 @@ void* Thread::threadFunc(void* arg) { // (if execute is non-zero). pthread_cleanup_pop(execute_cleanup); - LOG4CXX_DEBUG(logger_, - "Thread #" << pthread_self() << " exited successfully"); + SDL_LOG_DEBUG("Thread #" << pthread_self() << " exited successfully"); return NULL; } @@ -142,8 +138,7 @@ void Thread::SetNameForId(const PlatformThreadHandle& thread_id, name.erase(THREAD_NAME_SIZE); const int rc = pthread_setname_np(thread_id, name.c_str()); if (rc != EOK) { - LOG4CXX_WARN(logger_, - "Couldn't set pthread name \"" << name << "\", error code " + SDL_LOG_WARN("Couldn't set pthread name \"" << name << "\", error code " << rc << " (" << strerror(rc) << ")"); } @@ -170,26 +165,23 @@ bool Thread::IsCurrentThread() const { } bool Thread::Start(const ThreadOptions& options) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); if (!delegate_) { - LOG4CXX_ERROR(logger_, - "Cannot start thread " << name_ << ": delegate is NULL"); + SDL_LOG_ERROR("Cannot start thread " << name_ << ": delegate is NULL"); return false; } if (kThreadStateCompleted == thread_state_) { - LOG4CXX_ERROR(logger_, - "Cannot start thread " << name_ << ": thread completed"); + SDL_LOG_ERROR("Cannot start thread " << name_ << ": thread completed"); return false; } if (kThreadStateRunning == thread_state_) { - LOG4CXX_TRACE( - logger_, - "EXIT thread " << name_ << " #" << handle_ << " is already running"); + SDL_LOG_TRACE("EXIT thread " << name_ << " #" << handle_ + << " is already running"); return true; } @@ -202,16 +194,15 @@ bool Thread::Start(const ThreadOptions& options) { pthread_attr_destroy(&attributes); if (EOK != pthread_result) { - LOG4CXX_ERROR(logger_, - "Couldn't create thread " - << name_ << ". Error code = " << pthread_result - << " (\"" << strerror(pthread_result) << "\")"); + SDL_LOG_ERROR("Couldn't create thread " + << name_ << ". Error code = " << pthread_result << " (\"" + << strerror(pthread_result) << "\")"); handle_ = 0; thread_state_ = kThreadStateError; return false; } - LOG4CXX_DEBUG(logger_, "Created thread: " << name_); + SDL_LOG_DEBUG("Created thread: " << name_); SetNameForId(handle_, name_); // state_lock 0 // possible concurrencies: stop and threadFunc @@ -219,16 +210,15 @@ bool Thread::Start(const ThreadOptions& options) { } if (kThreadCommandFinalize == thread_command_) { - LOG4CXX_DEBUG( - logger_, "Thread " << name_ << " #" << handle_ << " waiting finalize."); + SDL_LOG_DEBUG("Thread " << name_ << " #" << handle_ + << " waiting finalize."); return false; } thread_command_ = kThreadCommandRun; state_cond_.NotifyOne(); - LOG4CXX_DEBUG(logger_, - "Thread " << name_ << " #" << handle_ << " started." + SDL_LOG_DEBUG("Thread " << name_ << " #" << handle_ << " started." << " pthread_result = " << EOK); return true; } @@ -238,7 +228,7 @@ void Thread::SchedYield() { } bool Thread::Stop(const ThreadStopOption stop_option) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN( (kThreadStopDelegate <= stop_option) && (kThreadForceStop >= stop_option), false); @@ -246,8 +236,7 @@ bool Thread::Stop(const ThreadStopOption stop_option) { thread_command_ = kThreadCommandNone; // cancel all active commands if (!handle_ && kThreadStateError != thread_state_) { - LOG4CXX_WARN( - logger_, + SDL_LOG_WARN( "Thread " << name_ << ": can't stopped,thread is not run handle_: " << handle_ << " thread_state_ is: " << thread_state_); return false; @@ -255,14 +244,12 @@ bool Thread::Stop(const ThreadStopOption stop_option) { if (kThreadStateError == thread_state_ || kThreadStateCompleted == thread_state_) { - LOG4CXX_WARN(logger_, - "Thread " << name_ << ": can't stopped thread_state_ is: " + SDL_LOG_WARN("Thread " << name_ << ": can't stopped thread_state_ is: " << thread_state_); return false; } - LOG4CXX_DEBUG(logger_, - "Stopping thread #" << handle_ << " \"" << name_ << "\""); + SDL_LOG_DEBUG("Stopping thread #" << handle_ << " \"" << name_ << "\""); bool result = false; switch (stop_option) { @@ -277,24 +264,22 @@ bool Thread::Stop(const ThreadStopOption stop_option) { result = true; break; default: - LOG4CXX_ERROR(logger_, "Incorrect thread stop option: " << stop_option); + SDL_LOG_ERROR("Incorrect thread stop option: " << stop_option); break; } - LOG4CXX_DEBUG( - logger_, - "Is thread stopped #" << handle_ << " \"" << name_ << " \": " << result); + SDL_LOG_DEBUG("Is thread stopped #" << handle_ << " \"" << name_ + << " \": " << result); return result; } void Thread::Join(const ThreadJoinOption join_option) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(!IsCurrentThread()); DCHECK_OR_RETURN_VOID((kThreadJoinDelegate <= join_option) && (kThreadJoinThread >= join_option)); if (!handle_ || kThreadStateError == thread_state_) { - LOG4CXX_WARN(logger_, - "Thread " << name_ << ": is not joinable handle_: " << handle_ + SDL_LOG_WARN("Thread " << name_ << ": is not joinable handle_: " << handle_ << " thread_state_ is: " << thread_state_); return; } @@ -308,9 +293,8 @@ void Thread::Join(const ThreadJoinOption join_option) { return; } - LOG4CXX_DEBUG( - logger_, - "Waiting for #" << handle_ << " to finished thread #" << pthread_self()); + SDL_LOG_DEBUG("Waiting for #" << handle_ << " to finished thread #" + << pthread_self()); pthread_join(handle_, NULL); } @@ -335,10 +319,9 @@ pthread_attr_t Thread::SetThreadCreationAttributes( pthread_attr_t attributes; int pthread_result = pthread_attr_init(&attributes); if (pthread_result != EOK) { - LOG4CXX_WARN(logger_, - "Couldn't init pthread attributes. Error code = " - << pthread_result << " (\"" << strerror(pthread_result) - << "\")"); + SDL_LOG_WARN("Couldn't init pthread attributes. Error code = " + << pthread_result << " (\"" << strerror(pthread_result) + << "\")"); } if (!thread_options) { @@ -346,16 +329,15 @@ pthread_attr_t Thread::SetThreadCreationAttributes( } if (!thread_options->is_joinable()) { - LOG4CXX_WARN(logger_, - "Set state detach attribute, undefined behavior possible with " - "this attribute"); + SDL_LOG_WARN( + "Set state detach attribute, undefined behavior possible with " + "this attribute"); pthread_result = pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED); if (pthread_result != EOK) { - LOG4CXX_WARN(logger_, - "Couldn't set detach state attribute. Error code = " - << pthread_result << " (\"" << strerror(pthread_result) - << "\")"); + SDL_LOG_WARN("Couldn't set detach state attribute. Error code = " + << pthread_result << " (\"" << strerror(pthread_result) + << "\")"); thread_options->is_joinable(false); } } @@ -364,10 +346,9 @@ pthread_attr_t Thread::SetThreadCreationAttributes( if (stack_size >= Thread::kMinStackSize) { pthread_result = pthread_attr_setstacksize(&attributes, stack_size); if (pthread_result != EOK) { - LOG4CXX_WARN(logger_, - "Couldn't set stacksize = " - << stack_size << ". Error code = " << pthread_result - << " (\"" << strerror(pthread_result) << "\")"); + SDL_LOG_WARN("Couldn't set stacksize = " + << stack_size << ". Error code = " << pthread_result + << " (\"" << strerror(pthread_result) << "\")"); } } else { ThreadOptions thread_options_temp(Thread::kMinStackSize, @@ -379,18 +360,16 @@ pthread_attr_t Thread::SetThreadCreationAttributes( } bool Thread::StopDelegate(sync_primitives::AutoLock& auto_lock) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (kThreadStateRunning != thread_state_) { - LOG4CXX_WARN(logger_, - "Thread " << name_ << ": task can't stopped thread_state_ is: " + SDL_LOG_WARN("Thread " << name_ << ": task can't stopped thread_state_ is: " << thread_state_); return false; } if (!delegate_) { - LOG4CXX_WARN(logger_, - "Thread " << name_ << ": task can't stopped delegate is NULL"); + SDL_LOG_WARN("Thread " << name_ << ": task can't stopped delegate is NULL"); return false; } @@ -402,7 +381,7 @@ bool Thread::StopDelegate(sync_primitives::AutoLock& auto_lock) { } bool Thread::StopSoft(sync_primitives::AutoLock& auto_lock) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (kThreadStateRunning == thread_state_) { bool result = StopDelegate(auto_lock); @@ -412,8 +391,7 @@ bool Thread::StopSoft(sync_primitives::AutoLock& auto_lock) { } if (kThreadStateIdle != thread_state_) { - LOG4CXX_WARN(logger_, - "Thread " << name_ << ": can't stopped thread_state_ is: " + SDL_LOG_WARN("Thread " << name_ << ": can't stopped thread_state_ is: " << thread_state_); return false; } @@ -422,8 +400,7 @@ bool Thread::StopSoft(sync_primitives::AutoLock& auto_lock) { state_cond_.NotifyOne(); if (!pthread_equal(pthread_self(), handle_)) { - LOG4CXX_DEBUG(logger_, - "Waiting for #" << handle_ << " last iteration in thread #" + SDL_LOG_DEBUG("Waiting for #" << handle_ << " last iteration in thread #" << pthread_self()); state_cond_.Wait(auto_lock); } @@ -432,7 +409,7 @@ bool Thread::StopSoft(sync_primitives::AutoLock& auto_lock) { } void Thread::StopForce(sync_primitives::AutoLock& auto_lock) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (kThreadStateRunning == thread_state_ || kThreadStateIdle == thread_state_) { @@ -446,32 +423,29 @@ void Thread::StopForce(sync_primitives::AutoLock& auto_lock) { thread_state_ = kThreadStateCompleted; state_cond_.NotifyOne(); - LOG4CXX_WARN(logger_, - "The thread was not soft stopped, the start of a forced stop"); + SDL_LOG_WARN("The thread was not soft stopped, the start of a forced stop"); if (!pthread_equal(pthread_self(), handle_)) { - LOG4CXX_DEBUG(logger_, "Thread #" << handle_ << " cancel"); + SDL_LOG_DEBUG("Thread #" << handle_ << " cancel"); pthread_cancel(handle_); } else { - LOG4CXX_DEBUG(logger_, "Thread #" << handle_ << " exit"); + SDL_LOG_DEBUG("Thread #" << handle_ << " exit"); pthread_exit(NULL); NOTREACHED(); } } void Thread::JoinDelegate(sync_primitives::AutoLock& auto_lock) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); if (kThreadStateRunning != thread_state_) { - LOG4CXX_WARN(logger_, - "Thread " << name_ + SDL_LOG_WARN("Thread " << name_ << ": delegate is not joinable thread_state_ is: " << thread_state_); return; } if (!pthread_equal(pthread_self(), handle_)) { - LOG4CXX_DEBUG(logger_, - "Waiting for #" << handle_ + SDL_LOG_DEBUG("Waiting for #" << handle_ << " finished iteration in thread #" << pthread_self()); state_cond_.Wait(auto_lock); diff --git a/src/components/utils/src/threads/thread_validator.cc b/src/components/utils/src/threads/thread_validator.cc index 3b753e79b5..218137127b 100644 --- a/src/components/utils/src/threads/thread_validator.cc +++ b/src/components/utils/src/threads/thread_validator.cc @@ -36,7 +36,7 @@ namespace threads { -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") SingleThreadSimpleValidator::SingleThreadSimpleValidator() : creation_thread_id_(Thread::CurrentId()) {} @@ -46,13 +46,13 @@ SingleThreadSimpleValidator::~SingleThreadSimpleValidator() {} void SingleThreadSimpleValidator::AssertRunningOnCreationThread() const { PlatformThreadHandle current_id = Thread::CurrentId(); if (creation_thread_id_ != current_id) { - LOG4CXX_ERROR( - logger_, + SDL_LOG_ERROR( + "Single-threaded object created at thread " - << creation_thread_id_ << " is accessed from thread " << current_id + << creation_thread_id_ << " is accessed from thread " << current_id #ifdef BACKTRACE_SUPPORT - << "\n" - << utils::Backtrace() + << "\n" + << utils::Backtrace() #endif ); } @@ -74,12 +74,11 @@ void SingleThreadValidator::PassToThread(PlatformThreadHandle thread_id) const { void SingleThreadValidator::AssertRunningOnValidThread() const { PlatformThreadHandle current_id = Thread::CurrentId(); if (owning_thread_id_ != current_id) { - LOG4CXX_ERROR(logger_, - "Single-threaded object owned by thread " - << owning_thread_id_ << " is accessed from thread " - << current_id << "\n" + SDL_LOG_ERROR("Single-threaded object owned by thread " + << owning_thread_id_ << " is accessed from thread " + << current_id << "\n" #ifdef BACKTRACE_SUPPORT - << utils::Backtrace() + << utils::Backtrace() #endif ); } diff --git a/src/components/utils/src/timer.cc b/src/components/utils/src/timer.cc index b58ddf2d66..ceade03afb 100644 --- a/src/components/utils/src/timer.cc +++ b/src/components/utils/src/timer.cc @@ -41,7 +41,7 @@ #include "utils/threads/thread_delegate.h" #include "utils/timer_task.h" -CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") +SDL_CREATE_LOG_VARIABLE("Utils") timer::Timer::Timer(const std::string& name, TimerTask* task) : name_(name) @@ -51,15 +51,15 @@ timer::Timer::Timer(const std::string& name, TimerTask* task) , thread_(threads::CreateThread(name_.c_str(), delegate_.get())) , single_shot_(true) , completed_flag_(false) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); DCHECK(!name_.empty()); DCHECK(task_); DCHECK(thread_); - LOG4CXX_DEBUG(logger_, "Timer " << name_ << " has been created"); + SDL_LOG_DEBUG("Timer " << name_ << " has been created"); } timer::Timer::~Timer() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); StopThread(); StopDelegate(); @@ -69,12 +69,12 @@ timer::Timer::~Timer() { DeleteThread(thread_); DCHECK(task_); delete task_; - LOG4CXX_DEBUG(logger_, "Timer " << name_ << " has been destroyed"); + SDL_LOG_DEBUG("Timer " << name_ << " has been destroyed"); } void timer::Timer::Start(const Milliseconds timeout, const TimerType timer_type) { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); StopThread(); completed_flag_ = false; @@ -91,16 +91,16 @@ void timer::Timer::Start(const Milliseconds timeout, }; StartDelegate(timeout); StartThread(); - LOG4CXX_DEBUG(logger_, "Timer " << name_ << " has been started"); + SDL_LOG_DEBUG("Timer " << name_ << " has been started"); } void timer::Timer::Stop() { - LOG4CXX_AUTO_TRACE(logger_); + SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock auto_lock(state_lock_); StopThread(); StopDelegate(); single_shot_ = true; - LOG4CXX_DEBUG(logger_, "Timer " << name_ << " has been stopped"); + SDL_LOG_DEBUG("Timer " << name_ << " has been stopped"); } bool timer::Timer::is_running() const { @@ -206,17 +206,16 @@ bool timer::Timer::TimerDelegate::finalized_flag() const { void timer::Timer::TimerDelegate::threadMain() { sync_primitives::AutoLock auto_lock(state_lock_ref_); while (!stop_flag_ && !finalized_flag_) { - LOG4CXX_DEBUG(logger_, "Milliseconds left to wait: " << timeout_); + SDL_LOG_DEBUG("Milliseconds left to wait: " << timeout_); if (sync_primitives::ConditionalVariable::kTimeout == state_condition_.WaitFor(auto_lock, timeout_)) { - LOG4CXX_DEBUG(logger_, - "Timer has finished counting. Timeout (ms): " << timeout_); + SDL_LOG_DEBUG("Timer has finished counting. Timeout (ms): " << timeout_); if (timer_) { sync_primitives::AutoUnlock auto_unlock(auto_lock); timer_->OnTimeout(); } } else { - LOG4CXX_DEBUG(logger_, "Timer has been force reset"); + SDL_LOG_DEBUG("Timer has been force reset"); } } } diff --git a/src/components/utils/test/auto_trace_test.cc b/src/components/utils/test/auto_trace_test.cc deleted file mode 100644 index 41dc90cae4..0000000000 --- a/src/components/utils/test/auto_trace_test.cc +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2015, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <ctime> -#include <fstream> - -#include "gtest/gtest.h" -#include "utils/auto_trace.h" -#include "utils/date_time.h" -#include "utils/file_system.h" -#include "utils/helpers.h" -#include "utils/log_message_loop_thread.h" -#include "utils/logger.h" -#include "utils/logger_status.h" -#include "utils/threads/message_loop_thread.h" -#include "utils/threads/thread.h" - -namespace test { -namespace components { -namespace utils_test { - -using namespace ::logger; - -CREATE_LOGGERPTR_GLOBAL(logger_, "AutoTraceTestLog") - -namespace { -const std::string kFileName = - file_system::CurrentWorkingDirectory() + "/AutoTraceTestLogFile.log"; -} // namespace - -void Preconditions() { - // Delete file with previous logs - if (file_system::FileExists(kFileName)) { - // If logger is active now deleting log file cause undefined befaviour. - DEINIT_LOGGER(); - ASSERT_TRUE(file_system::DeleteFile(kFileName)) - << "Can't delete AutoTraceTestLogFile.log"; - } -} - -void InitLogger() { - // Set enabled logs - INIT_LOGGER("log4cxx.properties", true); - // DEINIT_LOGGER will be called in test_main.cc -} - -void CreateDeleteAutoTrace(const std::string& testlog) { - LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, testlog); -} - -/** - * @brief IsLogLineContains cheks if log line contains debug message with - * specified debug message - * @param log_line line to search in - * @param debug_level expected debug level - * @param debug_log_message expected debug message - * @return true if debug_message exist in log_line with debug_level - */ -bool IsLogLineContains(const std::string& log_line, - const std::string& debug_level, - const std::string& debug_message) { - return log_line.find(debug_level) != std::string::npos && - log_line.find(debug_message) != std::string::npos; -} - -/** - * @brief CheckAutoTraceDebugInFile chacks if logfile contains autotrace and - * debug for test AutoTrace_WriteToFile_ReadCorrectString - * @param debug_message message that should be logged with DEBUG level - * @return true if trace enter, trace exit, debug message exist in log file - */ -bool CheckAutoTraceDebugInFile(const std::string& debug_message) { - using namespace helpers; - const std::string debug_log_level = "DEBUG"; - const std::string trace_log_level = "TRACE"; - const std::string enter_message = ": Enter"; - const std::string exit_message = ": Exit"; - std::ifstream file_log(kFileName); - if (!file_log.is_open()) { - return false; - } - - bool debug_found = false; - bool trace_enter = false; - bool trace_exit = false; - for (std::string line; - Compare<bool, EQ, ONE>(false, debug_found, trace_enter, trace_exit) && - getline(file_log, line);) { - debug_found = debug_found - ? debug_found - : IsLogLineContains(line, debug_log_level, debug_message); - trace_enter = trace_enter - ? trace_enter - : IsLogLineContains(line, trace_log_level, enter_message); - trace_exit = trace_exit - ? trace_exit - : IsLogLineContains(line, trace_log_level, exit_message); - } - file_log.close(); - return Compare<bool, EQ, ALL>(true, debug_found, trace_enter, trace_exit); -} -// TODO(DTrunov) : Enable after APPLINK-25006 will be resolved -TEST(AutoTraceTest, DISABLED_AutoTrace_WriteToFile_ReadCorrectString) { - const std::string testlog = "Test trace is working!"; - Preconditions(); - InitLogger(); - CreateDeleteAutoTrace(testlog); - - FLUSH_LOGGER(); - ASSERT_TRUE(CheckAutoTraceDebugInFile(testlog)); -} - -} // namespace utils_test -} // namespace components -} // namespace test diff --git a/src/components/utils/test/log_message_loop_thread_test.cc b/src/components/utils/test/log_message_loop_thread_test.cc deleted file mode 100644 index 74b1f5094f..0000000000 --- a/src/components/utils/test/log_message_loop_thread_test.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2015, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "utils/log_message_loop_thread.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "utils/logger_status.h" - -namespace test { -namespace components { -namespace utils_test { - -using namespace ::logger; -using ::testing::_; - -TEST(LogMessageLoopThread, DestroyLogMessage_loggerStatusDeletingLogger) { - logger::logger_status = CreatingLoggerThread; - LogMessageLoopThread* loop_thread = new LogMessageLoopThread(); - // assert - EXPECT_EQ(CreatingLoggerThread, logger::logger_status); - - // act - delete loop_thread; - - // assert - EXPECT_EQ(DeletingLoggerThread, logger::logger_status); - - logger::logger_status = LoggerThreadNotCreated; -} - -class MockLogMessageTest : public LogMessageLoopThread { - public: - MOCK_CONST_METHOD1(Handle, void(const LogMessage message)); -}; - -TEST(LogMessageLoopThread, HandleNeverCalled) { - logger::logger_status = CreatingLoggerThread; - - MockLogMessageTest mmock; - EXPECT_CALL(mmock, Handle(_)).Times(0); - LogMessageLoopThread* loop_thread = new LogMessageLoopThread(); - - delete loop_thread; - logger::logger_status = LoggerThreadNotCreated; -} - -} // namespace utils_test -} // namespace components -} // namespace test diff --git a/tools/policy_table_validator/main.cpp b/tools/policy_table_validator/main.cpp index 80c5e2eddc..7e099c7ae1 100644 --- a/tools/policy_table_validator/main.cpp +++ b/tools/policy_table_validator/main.cpp @@ -5,6 +5,13 @@ #include "utils/jsoncpp_reader_wrapper.h" #include "utils/file_system.h" +#ifdef ENABLE_LOG +#include "utils/logger/logger_impl.h" +#include "utils/logger/log4cxxlogger.h" +#endif // ENABLE_LOG + +#include "utils/logger.h" + namespace policy_table = rpc::policy_table_interface_base; enum ResultCode { @@ -43,6 +50,17 @@ int main(int argc, char** argv) { help(); exit(MISSED_FILE_NAME); } + +#ifdef ENABLE_LOG + // -------------------------------------------------------------------------- + // Logger initialization + // Redefine for each paticular logger implementation + auto logger = std::unique_ptr<logger::Log4CXXLogger>(new logger::Log4CXXLogger("log4cxx.properties")); + auto logger_impl = std::unique_ptr<logger::LoggerImpl>(new logger::LoggerImpl()); + logger::Logger::instance(logger_impl.get()); + logger_impl->Init(std::move(logger)); +#endif // ENABLE_LOG + std::string pt_type_str = argv[1]; std::string file_name = argv[2]; std::string json_string; @@ -51,11 +69,13 @@ int main(int argc, char** argv) { if (rpc::policy_table_interface_base::PolicyTableType::INVALID_PT_TYPE == pt_type) { std::cout << "Invalid policy table type: " << pt_type_str << std::endl; + SDL_DEINIT_LOGGER() exit(PT_TYPE_ERROR); } bool read_result = file_system::ReadFile(file_name, json_string); if (false == read_result) { std::cout << "Read file error: " << file_name << std::endl; + SDL_DEINIT_LOGGER() exit(READ_ERROR); } @@ -64,6 +84,7 @@ int main(int argc, char** argv) { bool parse_result = reader.parse(json_string, &value); if (false == parse_result) { + SDL_DEINIT_LOGGER() exit(PARSE_ERROR); } std::cout << "DEFAULT_POLICY" << std::endl; @@ -72,6 +93,7 @@ int main(int argc, char** argv) { bool is_valid = table.is_valid(); if (true == is_valid) { std::cout << "Table is valid" << std::endl; + SDL_DEINIT_LOGGER() exit(SUCCES); } @@ -81,5 +103,6 @@ int main(int argc, char** argv) { std::cout << "Errors: " << std::endl << rpc::PrettyFormat(report) << std::endl; + SDL_DEINIT_LOGGER() return SUCCES; } |