From: Bartlomiej Grzelewski Date: Wed, 4 Sep 2013 09:52:33 +0000 (+0200) Subject: Remove support for DPL_USE_OLD_STYLE_* environment values in RELEASE build. X-Git-Tag: submit/tizen/20140307.131547~76 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f80c5d647e1e5993cbe45ab0a37b13613cd1b4b;p=platform%2Fcore%2Fsecurity%2Fsecurity-server.git Remove support for DPL_USE_OLD_STYLE_* environment values in RELEASE build. This environment values will be supported in DEBUG build only: * DPL_USE_OLD_STYLE_LOGS * DPL_USE_OLD_STYLE_PEDANTIC_LOGS * DPL_USE_OLD_STYLE_LOGS_MASK This commit turn off all logs except Error logs in RELEASE build. [Issue#] SSDWSSP-447 [Problem] Security-server generates too many logs in RELEASE build. Debug logs may be turn on by environment values. [Solution] Remove support for environment values. [Verification] Successful build. Change-Id: I557a69c007e4d916b2b2ac2f92e21572a9fb9f37 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a0b62e0..b0adb1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,11 @@ ADD_DEFINITIONS("-Wextra") # Generate even more extra warni STRING(REGEX MATCH "([^.]*)" API_VERSION "${VERSION}") ADD_DEFINITIONS("-DAPI_VERSION=\"$(API_VERSION)\"") ADD_DEFINITIONS("-DSMACK_ENABLED") -ADD_DEFINITIONS("-DDPL_LOGS_ENABLED") # Enable LOGS in security-server2 + +IF (CMAKE_BUILD_TYPE MATCHES "DEBUG") + ADD_DEFINITIONS("-DTIZEN_ENGINEER_MODE") + ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG") +ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG") SET(TARGET_SECURITY_SERVER "security-server") SET(TARGET_SECURITY_CLIENT "security-server-client") diff --git a/src/server2/dpl/log/include/dpl/log/log.h b/src/server2/dpl/log/include/dpl/log/log.h index 2478d1f..0fee222 100644 --- a/src/server2/dpl/log/include/dpl/log/log.h +++ b/src/server2/dpl/log/include/dpl/log/log.h @@ -172,36 +172,46 @@ typedef Singleton LogSystemSingleton; // // -#ifdef DPL_LOGS_ENABLED - #define DPL_MACRO_FOR_LOGGING(message, function) \ - do \ - { \ - if (SecurityServer::Log::LogSystemSingleton::Instance().IsLoggingEnabled()) \ - { \ - std::ostringstream platformLog; \ - platformLog << message; \ - SecurityServer::Log::LogSystemSingleton::Instance().function( \ - platformLog.str().c_str(), \ - __FILE__, __LINE__, __FUNCTION__); \ - } \ - } while (0) -#else /* avoid warnings about unused variables */ - #define DPL_MACRO_FOR_LOGGING(message, function) \ +#define DPL_MACRO_DUMMY_LOGGING(message, function) \ do { \ - SecurityServer::Log::NullStream ns; \ + SecurityServer::Log::NullStream ns; \ ns << message; \ } while (0) -#endif -#define LogDebug(message) DPL_MACRO_FOR_LOGGING(message, Debug) -#define LogInfo(message) DPL_MACRO_FOR_LOGGING(message, Info) -#define LogWarning(message) DPL_MACRO_FOR_LOGGING(message, Warning) +#define DPL_MACRO_FOR_LOGGING(message, function) \ +do \ +{ \ + if (SecurityServer::Log::LogSystemSingleton::Instance().IsLoggingEnabled()) \ + { \ + std::ostringstream platformLog; \ + platformLog << message; \ + SecurityServer::Log::LogSystemSingleton::Instance().function( \ + platformLog.str().c_str(), \ + __FILE__, __LINE__, __FUNCTION__); \ + } \ +} while (0) + +/* Errors must be always logged. */ #define LogError(message) DPL_MACRO_FOR_LOGGING(message, Error) -#define LogPedantic(message) DPL_MACRO_FOR_LOGGING(message, Pedantic) -#define LogSecureDebug(message) DPL_MACRO_FOR_LOGGING(message, SecureDebug) -#define LogSecureInfo(message) DPL_MACRO_FOR_LOGGING(message, SecureInfo) -#define LogSecureWarning(message) DPL_MACRO_FOR_LOGGING(message, SecureWarning) #define LogSecureError(message) DPL_MACRO_FOR_LOGGING(message, SecureError) +#ifdef BUILD_TYPE_DEBUG + #define LogDebug(message) DPL_MACRO_FOR_LOGGING(message, Debug) + #define LogInfo(message) DPL_MACRO_FOR_LOGGING(message, Info) + #define LogWarning(message) DPL_MACRO_FOR_LOGGING(message, Warning) + #define LogPedantic(message) DPL_MACRO_FOR_LOGGING(message, Pedantic) + #define LogSecureDebug(message) DPL_MACRO_FOR_LOGGING(message, SecureDebug) + #define LogSecureInfo(message) DPL_MACRO_FOR_LOGGING(message, SecureInfo) + #define LogSecureWarning(message) DPL_MACRO_FOR_LOGGING(message, SecureWarning) +#else + #define LogDebug(message) DPL_MACRO_DUMMY_LOGGING(message, Debug) + #define LogInfo(message) DPL_MACRO_DUMMY_LOGGING(message, Info) + #define LogWarning(message) DPL_MACRO_DUMMY_LOGGING(message, Warning) + #define LogPedantic(message) DPL_MACRO_DUMMY_LOGGING(message, Pedantic) + #define LogSecureDebug(message) DPL_MACRO_DUMMY_LOGGING(message, SecureDebug) + #define LogSecureInfo(message) DPL_MACRO_DUMMY_LOGGING(message, SecureInfo) + #define LogSecureWarning(message) DPL_MACRO_DUMMY_LOGGING(message, SecureWarning) +#endif // BUILD_TYPE_DEBUG + #endif // SECURITYSERVER_LOG_H diff --git a/src/server2/dpl/log/src/log.cpp b/src/server2/dpl/log/src/log.cpp index 13330b8..5903e4c 100644 --- a/src/server2/dpl/log/src/log.cpp +++ b/src/server2/dpl/log/src/log.cpp @@ -31,10 +31,12 @@ namespace SecurityServer { namespace Log { namespace // anonymous { +#ifdef BUILD_TYPE_DEBUG const char *OLD_STYLE_LOGS_ENV_NAME = "DPL_USE_OLD_STYLE_LOGS"; const char *OLD_STYLE_PEDANTIC_LOGS_ENV_NAME = "DPL_USE_OLD_STYLE_PEDANTIC_LOGS"; const char *OLD_STYLE_LOGS_MASK_ENV_NAME = "DPL_USE_OLD_STYLE_LOGS_MASK"; +#endif // BUILD_TYPE_DEBUG const char *SECURITY_SERVER_LOG_OFF = "DPL_LOG_OFF"; } // namespace anonymous @@ -48,6 +50,7 @@ LogSystem::LogSystem() : m_oldStyleProvider(NULL), m_isLoggingEnabled(!getenv(SECURITY_SERVER_LOG_OFF)) { +#ifdef BUILD_TYPE_DEBUG bool oldStyleLogs = false; bool oldStyleDebugLogs = true; bool oldStyleInfoLogs = true; @@ -120,6 +123,10 @@ LogSystem::LogSystem() : m_dlogProvider = new DLOGLogProvider(); AddProvider(m_dlogProvider); } +#else // BUILD_TYPE_DEBUG + m_dlogProvider = new DLOGLogProvider(); + AddProvider(m_dlogProvider); +#endif // BUILD_TYPE_DEBUG } LogSystem::~LogSystem()