Refactor log system
[platform/core/security/cert-svc.git] / vcore / src / dpl / db / src / sql_connection.cpp
index 9da8266..fa238cd 100644 (file)
@@ -26,6 +26,7 @@
 #include <memory>
 #include <dpl/noncopyable.h>
 #include <dpl/assert.h>
+#include <dpl/log/log.h>
 #include <unistd.h>
 #include <cstdio>
 #include <cstdarg>
@@ -52,7 +53,7 @@ class ScopedNotifyAll :
             return;
         }
 
-        VcoreLogD("Notifying after successful synchronize");
+        LogDebug("Notifying after successful synchronize");
         m_synchronizationObject->NotifyAll();
     }
 };
@@ -74,14 +75,14 @@ SqlConnection::DataCommand::DataCommand(SqlConnection *connection,
                                      &m_stmt, NULL);
 
         if (ret == SQLITE_OK) {
-            VcoreLogD("Data command prepared successfuly");
+            LogDebug("Data command prepared successfuly");
             break;
         } else if (ret == SQLITE_BUSY) {
-            VcoreLogD("Collision occurred while preparing SQL command");
+            LogDebug("Collision occurred while preparing SQL command");
 
             // Synchronize if synchronization object is available
             if (connection->m_synchronizationObject) {
-                VcoreLogD("Performing synchronization");
+                LogDebug("Performing synchronization");
                 connection->m_synchronizationObject->Synchronize();
                 continue;
             }
@@ -92,14 +93,14 @@ SqlConnection::DataCommand::DataCommand(SqlConnection *connection,
         // Fatal error
         const char *error = sqlite3_errmsg(m_masterConnection->m_connection);
 
-        VcoreLogD("SQL prepare data command failed");
-        VcoreLogD("    Statement: %s", buffer);
-        VcoreLogD("    Error: %s", error);
+        LogDebug("SQL prepare data command failed");
+        LogDebug("    Statement : " << buffer);
+        LogDebug("    Error     : " << error);
 
         ThrowMsg(Exception::SyntaxError, error);
     }
 
-    VcoreLogD("Prepared data command: %s", buffer);
+    LogDebug("Prepared data command : " << buffer);
 
     // Increment stored data command count
     ++m_masterConnection->m_dataCommandsCount;
@@ -107,10 +108,10 @@ SqlConnection::DataCommand::DataCommand(SqlConnection *connection,
 
 SqlConnection::DataCommand::~DataCommand()
 {
-    VcoreLogD("SQL data command finalizing");
+    LogDebug("SQL data command finalizing");
 
     if (sqlite3_finalize(m_stmt) != SQLITE_OK) {
-        VcoreLogD("Failed to finalize data command");
+        LogDebug("Failed to finalize data command");
     }
 
     // Decrement stored data command count
@@ -123,8 +124,8 @@ void SqlConnection::DataCommand::CheckBindResult(int result)
         const char *error = sqlite3_errmsg(
                 m_masterConnection->m_connection);
 
-        VcoreLogD("Failed to bind SQL statement parameter");
-        VcoreLogD("    Error: %s", error);
+        LogDebug("Failed to bind SQL statement parameter");
+        LogDebug("    Error : " << error);
 
         ThrowMsg(Exception::SyntaxError, error);
     }
@@ -134,7 +135,7 @@ void SqlConnection::DataCommand::BindNull(
     SqlConnection::ArgumentIndex position)
 {
     CheckBindResult(sqlite3_bind_null(m_stmt, position));
-    VcoreLogD("SQL data command bind null: [%i]", position);
+    LogDebug("SQL data command bind null: [" << position << "]");
 }
 
 void SqlConnection::DataCommand::BindInteger(
@@ -142,7 +143,7 @@ void SqlConnection::DataCommand::BindInteger(
     int value)
 {
     CheckBindResult(sqlite3_bind_int(m_stmt, position, value));
-    VcoreLogD("SQL data command bind integer: [%i] -> %i", position, value);
+    LogDebug("SQL data command bind integer: [" << position << "] -> " << value);
 }
 
 void SqlConnection::DataCommand::BindInt8(
@@ -151,7 +152,7 @@ void SqlConnection::DataCommand::BindInt8(
 {
     CheckBindResult(sqlite3_bind_int(m_stmt, position,
                                      static_cast<int>(value)));
-    VcoreLogD("SQL data command bind int8: [%i] -> %i", position, value);
+    LogDebug("SQL data command bind int8: [" << position << "] -> " << value);
 }
 
 void SqlConnection::DataCommand::BindInt16(
@@ -160,8 +161,7 @@ void SqlConnection::DataCommand::BindInt16(
 {
     CheckBindResult(sqlite3_bind_int(m_stmt, position,
                                      static_cast<int>(value)));
-    VcoreLogD("SQL data command bind int16: [%i] -> %i", position, value);
-}
+    LogDebug("SQL data command bind int16: [" << position << "] -> " << value);}
 
 void SqlConnection::DataCommand::BindInt32(
     SqlConnection::ArgumentIndex position,
@@ -169,7 +169,7 @@ void SqlConnection::DataCommand::BindInt32(
 {
     CheckBindResult(sqlite3_bind_int(m_stmt, position,
                                      static_cast<int>(value)));
-    VcoreLogD("SQL data command bind int32: [%i] -> %i", position, value);
+    LogDebug("SQL data command bind int32: [" << position << "] -> " << value);
 }
 
 void SqlConnection::DataCommand::BindInt64(
@@ -178,7 +178,7 @@ void SqlConnection::DataCommand::BindInt64(
 {
     CheckBindResult(sqlite3_bind_int64(m_stmt, position,
                                        static_cast<sqlite3_int64>(value)));
-    VcoreLogD("SQL data command bind int64: [%i] -> %lli", position, value);
+    LogDebug("SQL data command bind int64: [" << position << "] -> " << value);
 }
 
 void SqlConnection::DataCommand::BindFloat(
@@ -187,7 +187,7 @@ void SqlConnection::DataCommand::BindFloat(
 {
     CheckBindResult(sqlite3_bind_double(m_stmt, position,
                                         static_cast<double>(value)));
-    VcoreLogD("SQL data command bind float: [%i] -> %f", position, value);
+    LogDebug("SQL data command bind float: [" << position << "] -> " << value);
 }
 
 void SqlConnection::DataCommand::BindDouble(
@@ -195,7 +195,7 @@ void SqlConnection::DataCommand::BindDouble(
     double value)
 {
     CheckBindResult(sqlite3_bind_double(m_stmt, position, value));
-    VcoreLogD("SQL data command bind double: [%i] -> %f", position, value);
+    LogDebug("SQL data command bind double: [" << position << "] -> " << value);
 }
 
 void SqlConnection::DataCommand::BindString(
@@ -212,7 +212,7 @@ void SqlConnection::DataCommand::BindString(
                                       value, strlen(value),
                                       SQLITE_TRANSIENT));
 
-    VcoreLogD("SQL data command bind string: [%i] -> %s", position, value);
+    LogDebug("SQL data command bind string: [" << position << "] -> " << value);
 }
 
 void SqlConnection::DataCommand::BindString(
@@ -320,17 +320,17 @@ bool SqlConnection::DataCommand::Step()
         int ret = sqlite3_step(m_stmt);
 
         if (ret == SQLITE_ROW) {
-            VcoreLogD("SQL data command step ROW");
+            LogDebug("SQL data command step ROW");
             return true;
         } else if (ret == SQLITE_DONE) {
-            VcoreLogD("SQL data command step DONE");
+            LogDebug("SQL data command step DONE");
             return false;
         } else if (ret == SQLITE_BUSY) {
-            VcoreLogD("Collision occurred while executing SQL command");
+            LogDebug("Collision occurred while executing SQL command");
 
             // Synchronize if synchronization object is available
             if (m_masterConnection->m_synchronizationObject) {
-                VcoreLogD("Performing synchronization");
+                LogDebug("Performing synchronization");
 
                 m_masterConnection->
                     m_synchronizationObject->Synchronize();
@@ -344,8 +344,8 @@ bool SqlConnection::DataCommand::Step()
         // Fatal error
         const char *error = sqlite3_errmsg(m_masterConnection->m_connection);
 
-        VcoreLogD("SQL step data command failed");
-        VcoreLogD("    Error: %s", error);
+        LogDebug("SQL step data command failed");
+        LogDebug("    Error : " << error);
 
         ThrowMsg(Exception::InternalError, error);
     }
@@ -363,7 +363,7 @@ void SqlConnection::DataCommand::Reset()
      */
     sqlite3_reset(m_stmt);
 
-    VcoreLogD("SQL data command reset");
+    LogDebug("SQL data command reset");
 }
 
 void SqlConnection::DataCommand::CheckColumnIndex(
@@ -377,7 +377,7 @@ void SqlConnection::DataCommand::CheckColumnIndex(
 bool SqlConnection::DataCommand::IsColumnNull(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column type: [%i]", column);
+    LogDebug("SQL data command get column type: [" << column << "]");
     CheckColumnIndex(column);
     return sqlite3_column_type(m_stmt, column) == SQLITE_NULL;
 }
@@ -385,83 +385,83 @@ bool SqlConnection::DataCommand::IsColumnNull(
 int SqlConnection::DataCommand::GetColumnInteger(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column integer: [%i]", column);
+    LogDebug("SQL data command get column integer: [" << column << "]");
     CheckColumnIndex(column);
     int value = sqlite3_column_int(m_stmt, column);
-    VcoreLogD("    Value: %i", value);
+    LogDebug("    Value : " << value);
     return value;
 }
 
 int8_t SqlConnection::DataCommand::GetColumnInt8(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column int8: [%i]", column);
+    LogDebug("SQL data command get column int8: [" << column << "]");
     CheckColumnIndex(column);
     int8_t value = static_cast<int8_t>(sqlite3_column_int(m_stmt, column));
-    VcoreLogD("    Value: %i", value);
+    LogDebug("    Value : " << value);
     return value;
 }
 
 int16_t SqlConnection::DataCommand::GetColumnInt16(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column int16: [%i]", column);
+    LgDebug("SQL data command get column int16: [" << column << "]");
     CheckColumnIndex(column);
     int16_t value = static_cast<int16_t>(sqlite3_column_int(m_stmt, column));
-    VcoreLogD("    Value: %i", value);
+    LogDebug("    Value : " << value);
     return value;
 }
 
 int32_t SqlConnection::DataCommand::GetColumnInt32(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column int32: [%i]", column);
+    LogDebug("SQL data command get column int32: [" << column << "]");
     CheckColumnIndex(column);
     int32_t value = static_cast<int32_t>(sqlite3_column_int(m_stmt, column));
-    VcoreLogD("    Value: %i", value);
+    LogDebug("    Value : " << value);
     return value;
 }
 
 int64_t SqlConnection::DataCommand::GetColumnInt64(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column int64: [%i]", column);
+    LogDebug("SQL data command get column int64: [" << column << "]");
     CheckColumnIndex(column);
     int64_t value = static_cast<int64_t>(sqlite3_column_int64(m_stmt, column));
-    VcoreLogD("    Value: %lli", value);
+    LogDebug("    Value : " << value);
     return value;
 }
 
 float SqlConnection::DataCommand::GetColumnFloat(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column float: [%i]", column);
+    LogDebug("SQL data command get column float: [" << column << "]");
     CheckColumnIndex(column);
     float value = static_cast<float>(sqlite3_column_double(m_stmt, column));
-    VcoreLogD("    Value: %f", value);
+    LogDebug("    Value : " << value);
     return value;
 }
 
 double SqlConnection::DataCommand::GetColumnDouble(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column double: [%i]", column);
+    LogDebug("SQL data command get column double: [" << column << "]");
     CheckColumnIndex(column);
     double value = sqlite3_column_double(m_stmt, column);
-    VcoreLogD("    Value: %f", value);
+    LogDebug("    Value : " << value);
     return value;
 }
 
 std::string SqlConnection::DataCommand::GetColumnString(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column string: [%i]", column);
+    LogDebug("SQL data command get column string: [" << column << "]");
     CheckColumnIndex(column);
 
     const char *value = reinterpret_cast<const char *>(
             sqlite3_column_text(m_stmt, column));
 
-    VcoreLogD("    Value: %s", value);
+    LogDebug("    Value : " << value);
 
     if (value == NULL) {
         return std::string();
@@ -473,105 +473,105 @@ std::string SqlConnection::DataCommand::GetColumnString(
 boost::optional<int> SqlConnection::DataCommand::GetColumnOptionalInteger(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column optional integer: [%i]", column);
+    LogDebug("SQL data command get column optional integer: [" << column << "]");
     CheckColumnIndex(column);
     if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL) {
         return boost::optional<int>();
     }
     int value = sqlite3_column_int(m_stmt, column);
-    VcoreLogD("    Value: %i", value);
+    LogDebug("    Value : " << value);
     return boost::optional<int>(value);
 }
 
 boost::optional<int8_t> SqlConnection::DataCommand::GetColumnOptionalInt8(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column optional int8: [%i]", column);
+    LogDebug("SQL data command get column optional int8: [" << column << "]");
     CheckColumnIndex(column);
     if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL) {
         return boost::optional<int8_t>();
     }
     int8_t value = static_cast<int8_t>(sqlite3_column_int(m_stmt, column));
-    VcoreLogD("    Value: %i", value);
+    LogDebug("    Value: " << value);
     return boost::optional<int8_t>(value);
 }
 
 boost::optional<int16_t> SqlConnection::DataCommand::GetColumnOptionalInt16(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column optional int16: [%i]", column);
+    LogDebug("SQL data command get column optional int16: [" << column << "]");
     CheckColumnIndex(column);
     if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL) {
         return boost::optional<int16_t>();
     }
     int16_t value = static_cast<int16_t>(sqlite3_column_int(m_stmt, column));
-    VcoreLogD("    Value: %i", value);
+    LogDebug("    Value : " << value);
     return boost::optional<int16_t>(value);
 }
 
 boost::optional<int32_t> SqlConnection::DataCommand::GetColumnOptionalInt32(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column optional int32: [%i]", column);
+    LogDebug("SQL data command get column optional int32: [" << column << "]");
     CheckColumnIndex(column);
     if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL) {
         return boost::optional<int32_t>();
     }
     int32_t value = static_cast<int32_t>(sqlite3_column_int(m_stmt, column));
-    VcoreLogD("    Value: %i", value);
+    LogDebug("    Value : " << value);
     return boost::optional<int32_t>(value);
 }
 
 boost::optional<int64_t> SqlConnection::DataCommand::GetColumnOptionalInt64(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column optional int64: [%i]", column);
+    LogDebug("SQL data command get column optional int64: [" << column << "]");
     CheckColumnIndex(column);
     if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL) {
         return boost::optional<int64_t>();
     }
     int64_t value = static_cast<int64_t>(sqlite3_column_int64(m_stmt, column));
-    VcoreLogD("    Value: %lli", value);
+    LogDebug("    Value : " << value);
     return boost::optional<int64_t>(value);
 }
 
 boost::optional<float> SqlConnection::DataCommand::GetColumnOptionalFloat(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column optional float: [%i]", column);
+    LogDebug("SQL data command get column optional float: [" << column << "]");
     CheckColumnIndex(column);
     if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL) {
         return boost::optional<float>();
     }
     float value = static_cast<float>(sqlite3_column_double(m_stmt, column));
-    VcoreLogD("    Value: %f", value);
+    LogDebug("    Value : " << value);
     return boost::optional<float>(value);
 }
 
 boost::optional<double> SqlConnection::DataCommand::GetColumnOptionalDouble(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column optional double: [%i]", column);
+    LogDebug("SQL data command get column optional double: [" << column << "]");
     CheckColumnIndex(column);
     if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL) {
         return boost::optional<double>();
     }
     double value = sqlite3_column_double(m_stmt, column);
-    VcoreLogD("    Value: %f", value);
+    LogDebug("    Value : " << value);
     return boost::optional<double>(value);
 }
 
 boost::optional<String> SqlConnection::DataCommand::GetColumnOptionalString(
     SqlConnection::ColumnIndex column)
 {
-    VcoreLogD("SQL data command get column optional string: [%i]", column);
+    LogDebug("SQL data command get column optional string: [" << column << "]");
     CheckColumnIndex(column);
     if (sqlite3_column_type(m_stmt, column) == SQLITE_NULL) {
         return boost::optional<String>();
     }
     const char *value = reinterpret_cast<const char *>(
             sqlite3_column_text(m_stmt, column));
-    VcoreLogD("    Value: %s", value);
+    LogDebug("    Value : " << value);
     String s = FromUTF8String(value);
     return boost::optional<String>(s);
 }
@@ -581,10 +581,10 @@ void SqlConnection::Connect(const std::string &address,
                             Flag::Option flag)
 {
     if (m_connection != NULL) {
-        VcoreLogD("Already connected.");
+        LogDebug("Already connected.");
         return;
     }
-    VcoreLogD("Connecting to DB: %s...", address.c_str());
+    LogDebug("Connecting to DB: " << address << "...");
 
     // Connect to database
     int result;
@@ -596,7 +596,7 @@ void SqlConnection::Connect(const std::string &address,
                 NULL);
 
         m_usingLucene = true;
-        VcoreLogD("Lucene index enabled");
+        LogDebug("Lucene index enabled");
     } else {
         result = sqlite3_open_v2(
                 address.c_str(),
@@ -605,13 +605,13 @@ void SqlConnection::Connect(const std::string &address,
                 NULL);
 
         m_usingLucene = false;
-        VcoreLogD("Lucene index disabled");
+        LogDebug("Lucene index disabled");
     }
 
     if (result == SQLITE_OK) {
-        VcoreLogD("Connected to DB");
+        LogDebug("Connected to DB");
     } else {
-        VcoreLogD("Failed to connect to DB!");
+        LogDebug("Failed to connect to DB!");
         ThrowMsg(Exception::ConnectionBroken, address);
     }
 
@@ -622,11 +622,11 @@ void SqlConnection::Connect(const std::string &address,
 void SqlConnection::Disconnect()
 {
     if (m_connection == NULL) {
-        VcoreLogD("Already disconnected.");
+        LogDebug("Already disconnected.");
         return;
     }
 
-    VcoreLogD("Disconnecting from DB...");
+    LogDebug("Disconnecting from DB...");
 
     // All stored data commands must be deleted before disconnect
     AssertMsg(m_dataCommandsCount == 0,
@@ -643,20 +643,20 @@ void SqlConnection::Disconnect()
 
     if (result != SQLITE_OK) {
         const char *error = sqlite3_errmsg(m_connection);
-        VcoreLogD("SQL close failed");
-        VcoreLogD("    Error: %s", error);
+        LogDebug("SQL close failed");
+        LogDebug("    Error : " << error);
         Throw(Exception::InternalError);
     }
 
     m_connection = NULL;
 
-    VcoreLogD("Disconnected from DB");
+    LogDebug("Disconnected from DB");
 }
 
 bool SqlConnection::CheckTableExist(const char *tableName)
 {
     if (m_connection == NULL) {
-        VcoreLogD("Cannot execute command. Not connected to DB!");
+        LogDebug("Cannot execute command. Not connected to DB!");
         return false;
     }
 
@@ -666,7 +666,7 @@ bool SqlConnection::CheckTableExist(const char *tableName)
     command->BindString(1, tableName);
 
     if (!command->Step()) {
-        VcoreLogD("No matching records in table");
+        LogDebug("No matching records in table");
         return false;
     }
 
@@ -682,19 +682,19 @@ SqlConnection::SqlConnection(const std::string &address,
     m_dataCommandsCount(0),
     m_synchronizationObject(synchronizationObject)
 {
-    VcoreLogD("Opening database connection to: %s", address.c_str());
+    LogDebug("Opening database connection to : " << address);
 
     // Connect to DB
     SqlConnection::Connect(address, flag, option);
 
     if (!m_synchronizationObject) {
-        VcoreLogD("No synchronization object defined");
+        LogDebug("No synchronization object defined");
     }
 }
 
 SqlConnection::~SqlConnection()
 {
-    VcoreLogD("Closing database connection");
+    LogDebug("Closing database connection");
 
     // Disconnect from DB
     Try
@@ -703,19 +703,19 @@ SqlConnection::~SqlConnection()
     }
     Catch(Exception::Base)
     {
-        VcoreLogD("Failed to disconnect from database");
+        LogDebug("Failed to disconnect from database");
     }
 }
 
 void SqlConnection::ExecCommand(const char *format, ...)
 {
     if (m_connection == NULL) {
-        VcoreLogD("Cannot execute command. Not connected to DB!");
+        LogDebug("Cannot execute command. Not connected to DB!");
         return;
     }
 
     if (format == NULL) {
-        VcoreLogD("Null query!");
+        LogDebug("Null query!");
         ThrowMsg(Exception::SyntaxError, "Null statement");
     }
 
@@ -733,11 +733,11 @@ void SqlConnection::ExecCommand(const char *format, ...)
     std::unique_ptr<char[],free_deleter> buffer(rawBuffer);
 
     if (!buffer) {
-        VcoreLogD("Failed to allocate statement string");
+        LogDebug("Failed to allocate statement string");
         return;
     }
 
-    VcoreLogD("Executing SQL command: %s", buffer.get());
+    LogDebug("Executing SQL command : " << buffer.get());
 
     // Notify all after potentially synchronized database connection access
     ScopedNotifyAll notifyAll(m_synchronizationObject.get());
@@ -764,11 +764,11 @@ void SqlConnection::ExecCommand(const char *format, ...)
         }
 
         if (ret == SQLITE_BUSY) {
-            VcoreLogD("Collision occurred while executing SQL command");
+            LogDebug("Collision occurred while executing SQL command");
 
             // Synchronize if synchronization object is available
             if (m_synchronizationObject) {
-                VcoreLogD("Performing synchronization");
+                LogDebug("Performing synchronization");
                 m_synchronizationObject->Synchronize();
                 continue;
             }
@@ -777,7 +777,7 @@ void SqlConnection::ExecCommand(const char *format, ...)
         }
 
         // Fatal error
-        VcoreLogD("Failed to execute SQL command. Error: %s", errorMsg.c_str());
+        LogDebug("Failed to execute SQL command. Error : " << errorMsg);
         ThrowMsg(Exception::SyntaxError, errorMsg);
     }
 }
@@ -787,7 +787,7 @@ SqlConnection::DataCommandAutoPtr SqlConnection::PrepareDataCommand(
     ...)
 {
     if (m_connection == NULL) {
-        VcoreLogD("Cannot execute data command. Not connected to DB!");
+        LogDebug("Cannot execute data command. Not connected to DB!");
         return DataCommandAutoPtr();
     }
 
@@ -805,11 +805,11 @@ SqlConnection::DataCommandAutoPtr SqlConnection::PrepareDataCommand(
     std::unique_ptr<char[],free_deleter> buffer(rawBuffer);
 
     if (!buffer) {
-        VcoreLogD("Failed to allocate statement string");
+        LogDebug("Failed to allocate statement string");
         return DataCommandAutoPtr();
     }
 
-    VcoreLogD("Executing SQL data command: %s", buffer.get());
+    LogDebug("Executing SQL data command : " << buffer.get());
 
     return DataCommandAutoPtr(new DataCommand(this, buffer.get()));
 }
@@ -851,7 +851,7 @@ int SqlConnection::db_util_open_with_options(const char *pszFilePath, sqlite3 **
     int mode;
 
     if((pszFilePath == NULL) || (ppDB == NULL)) {
-            VcoreLogW("sqlite3 handle null error");
+            LogWarning("sqlite3 handle null error");
             return SQLITE_ERROR;
     }
 
@@ -859,7 +859,7 @@ int SqlConnection::db_util_open_with_options(const char *pszFilePath, sqlite3 **
 
     if((geteuid() != 0) && (access(pszFilePath, mode))) {
             if(errno == EACCES) {
-                    VcoreLogD("file access permission error");
+                    LogDebug("file access permission error");
                     return SQLITE_PERM;
             }
     }
@@ -867,7 +867,7 @@ int SqlConnection::db_util_open_with_options(const char *pszFilePath, sqlite3 **
     /* Open DB */
     int rc = sqlite3_open_v2(pszFilePath, ppDB, flags, zVfs);
     if (SQLITE_OK != rc) {
-            VcoreLogE("sqlite3_open_v2 error(%d)",rc);
+            LogError("sqlite3_open_v2 error(" << rc << ")");
             return rc;
     }
 
@@ -884,7 +884,7 @@ int SqlConnection::db_util_close(sqlite3 *pDB)
     /* Close DB */
     int rc = sqlite3_close(pDB);
     if (SQLITE_OK != rc) {
-            VcoreLogW("Fail to change journal mode: %s\n", pszErrorMsg);
+            LogWarning("Fail to change journal mode : " << pszErrorMsg);
             sqlite3_free(pszErrorMsg);
             return rc;
     }