Remove easylogging and replace by GLog (#22979)

Signed-off-by: Enwei Jiao <enwei.jiao@zilliz.com>
This commit is contained in:
Enwei Jiao 2023-03-27 18:22:02 +08:00 committed by GitHub
parent 14a07fdae8
commit ef57ba3bac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 39 additions and 8615 deletions

View File

@ -1,25 +0,0 @@
* GLOBAL:
FORMAT = "%datetime | %level | %logger | %msg"
FILENAME = "/var/lib/milvus/logs/milvus-%datetime{%y-%M-%d-%H:%m}-easylog.log"
ENABLED = true
TO_FILE = false
TO_STANDARD_OUTPUT = true
SUBSECOND_PRECISION = 3
PERFORMANCE_TRACKING = false
MAX_LOG_FILE_SIZE = 209715200 ## Throw log files away after 200MB
* INFO:
ENABLED = true
* TRACE:
ENABLED = true
* DEBUG:
ENABLED = true
* WARNING:
ENABLED = true
* ERROR:
ENABLED = true
* FATAL:
ENABLED = true
* VERBOSE:
FORMAT = "%datetime{%d/%M/%y} | %level-%vlevel | %msg"
TO_FILE = false
TO_STANDARD_OUTPUT = true

View File

@ -8,6 +8,7 @@ class MilvusConan(ConanFile):
"rocksdb/6.29.5",
"boost/1.81.0",
"onetbb/2021.7.0",
"nlohmann_json/3.11.2",
"zstd/1.5.2",
"lz4/1.9.4",
"snappy/1.1.9",
@ -51,6 +52,7 @@ class MilvusConan(ConanFile):
"aws-sdk-cpp:transfer": False,
"gtest:build_gmock": False,
"boost:without_locale": False,
"glog:with_gflags": False,
}
def configure(self):

View File

@ -18,7 +18,7 @@
#include "ConfigKnowhere.h"
#include "exceptions/EasyAssert.h"
#include "easyloggingpp/easylogging++.h"
#include "glog/logging.h"
#include "log/Log.h"
#include "knowhere/comp/thread_pool.h"
#include "knowhere/comp/knowhere_config.h"
@ -35,21 +35,7 @@ KnowhereInitImpl(const char* conf_file) {
knowhere::KnowhereConfig::SetLogHandler();
knowhere::KnowhereConfig::SetStatisticsLevel(0);
knowhere::KnowhereConfig::ShowVersion();
#ifdef EMBEDDED_MILVUS
// always disable all logs for embedded milvus.
el::Configurations el_conf;
el_conf.setGlobally(el::ConfigurationType::Enabled, "false");
el::Loggers::reconfigureAllLoggers(el_conf);
#else
if (conf_file != nullptr) {
el::Configurations el_conf(conf_file);
el::Loggers::reconfigureAllLoggers(el_conf);
LOG_SERVER_DEBUG_ << "Config easylogging with yaml file: "
<< conf_file;
}
LOG_SERVER_DEBUG_ << "Knowhere init successfully";
#endif
google::InitGoogleLogging("milvus");
};
std::call_once(init_knowhere_once_, init);

View File

@ -57,7 +57,7 @@ VectorMemNMIndex::Load(const BinarySet& binary_set, const Config& config) {
VectorMemIndex::Load(binary_set, config);
if (binary_set.Contains(RAW_DATA)) {
std::call_once(raw_data_loaded_, [&]() {
LOG_SEGCORE_INFO_C << "NM index load raw data done!";
LOG_SEGCORE_INFO_ << "NM index load raw data done!";
});
}
}

View File

@ -19,7 +19,7 @@
#include <string>
#include <sys/types.h>
#include <unistd.h>
#include "easyloggingpp/easylogging++.h"
#include "glog/logging.h"
// namespace milvus {
@ -40,33 +40,6 @@
#define VAR_THREAD_START_TIMESTAMP (get_thread_start_timestamp())
#define VAR_COMMAND_TAG (context->command_tag())
// Use this macro whenever possible
// Depends variables: context Context
#define MLOG(level, module, error_code) \
LOG(level) << " | " << VAR_REQUEST_ID << " | " << #level << " | " \
<< VAR_COLLECTION_NAME << " | " << VAR_CLIENT_ID << " | " \
<< VAR_CLIENT_TAG << " | " << VAR_CLIENT_IPPORT << " | " \
<< VAR_THREAD_ID << " | " << VAR_THREAD_START_TIMESTAMP \
<< " | " << VAR_COMMAND_TAG << " | " << #module << " | " \
<< error_code << " | "
// Use in some background process only
#define MLOG_(level, module, error_code) \
LOG(level) << " | " \
<< "" \
<< " | " << #level << " | " \
<< "" \
<< " | " \
<< "" \
<< " | " \
<< "" \
<< " | " \
<< "" \
<< " | " << VAR_THREAD_ID << " | " \
<< VAR_THREAD_START_TIMESTAMP << " | " \
<< "" \
<< " | " << #module << " | " << error_code << " | "
/////////////////////////////////////////////////////////////////////////////////////////////////
#define SEGCORE_MODULE_NAME "SEGCORE"
#define SEGCORE_MODULE_CLASS_FUNCTION \
@ -81,15 +54,8 @@
__FUNCTION__, \
GetThreadName().c_str())
#define LOG_SEGCORE_TRACE_C LOG(TRACE) << SEGCORE_MODULE_CLASS_FUNCTION
#define LOG_SEGCORE_DEBUG_C LOG(DEBUG) << SEGCORE_MODULE_CLASS_FUNCTION
#define LOG_SEGCORE_INFO_C LOG(INFO) << SEGCORE_MODULE_CLASS_FUNCTION
#define LOG_SEGCORE_WARNING_C LOG(WARNING) << SEGCORE_MODULE_CLASS_FUNCTION
#define LOG_SEGCORE_ERROR_C LOG(ERROR) << SEGCORE_MODULE_CLASS_FUNCTION
#define LOG_SEGCORE_FATAL_C LOG(FATAL) << SEGCORE_MODULE_CLASS_FUNCTION
#define LOG_SEGCORE_TRACE_ LOG(TRACE) << SEGCORE_MODULE_FUNCTION
#define LOG_SEGCORE_DEBUG_ LOG(DEBUG) << SEGCORE_MODULE_FUNCTION
#define LOG_SEGCORE_TRACE_ DLOG(INFO) << SEGCORE_MODULE_FUNCTION
#define LOG_SEGCORE_DEBUG_ DLOG(INFO) << SEGCORE_MODULE_FUNCTION
#define LOG_SEGCORE_INFO_ LOG(INFO) << SEGCORE_MODULE_FUNCTION
#define LOG_SEGCORE_WARNING_ LOG(WARNING) << SEGCORE_MODULE_FUNCTION
#define LOG_SEGCORE_ERROR_ LOG(ERROR) << SEGCORE_MODULE_FUNCTION
@ -109,15 +75,8 @@
__FUNCTION__, \
GetThreadName().c_str())
#define LOG_SERVER_TRACE_C LOG(TRACE) << SERVER_MODULE_CLASS_FUNCTION
#define LOG_SERVER_DEBUG_C LOG(DEBUG) << SERVER_MODULE_CLASS_FUNCTION
#define LOG_SERVER_INFO_C LOG(INFO) << SERVER_MODULE_CLASS_FUNCTION
#define LOG_SERVER_WARNING_C LOG(WARNING) << SERVER_MODULE_CLASS_FUNCTION
#define LOG_SERVER_ERROR_C LOG(ERROR) << SERVER_MODULE_CLASS_FUNCTION
#define LOG_SERVER_FATAL_C LOG(FATAL) << SERVER_MODULE_CLASS_FUNCTION
#define LOG_SERVER_TRACE_ LOG(TRACE) << SERVER_MODULE_FUNCTION
#define LOG_SERVER_DEBUG_ LOG(DEBUG) << SERVER_MODULE_FUNCTION
#define LOG_SERVER_TRACE_ DLOG(INFO) << SERVER_MODULE_FUNCTION
#define LOG_SERVER_DEBUG_ DLOG(INFO) << SERVER_MODULE_FUNCTION
#define LOG_SERVER_INFO_ LOG(INFO) << SERVER_MODULE_FUNCTION
#define LOG_SERVER_WARNING_ LOG(WARNING) << SERVER_MODULE_FUNCTION
#define LOG_SERVER_ERROR_ LOG(ERROR) << SERVER_MODULE_FUNCTION

View File

@ -21,7 +21,6 @@
#include "TimestampIndex.h"
#include "common/Schema.h"
#include "easyloggingpp/easylogging++.h"
#include "segcore/AckResponder.h"
#include "segcore/ConcurrentVector.h"
#include "segcore/Record.h"

View File

@ -33,27 +33,27 @@
#include "storage/FieldDataFactory.h"
#define FILEMANAGER_TRY try {
#define FILEMANAGER_CATCH \
} \
catch (LocalChunkManagerException & e) { \
LOG_SEGCORE_ERROR_C << "LocalChunkManagerException:" << e.what(); \
return false; \
} \
catch (MinioException & e) { \
LOG_SEGCORE_ERROR_C << "milvus::storage::MinioException:" << e.what(); \
return false; \
} \
catch (DiskANNFileManagerException & e) { \
LOG_SEGCORE_ERROR_C << "milvus::storage::DiskANNFileManagerException:" \
<< e.what(); \
return false; \
} \
catch (ArrowException & e) { \
LOG_SEGCORE_ERROR_C << "milvus::storage::ArrowException:" << e.what(); \
return false; \
} \
catch (std::exception & e) { \
LOG_SEGCORE_ERROR_C << "Exception:" << e.what(); \
#define FILEMANAGER_CATCH \
} \
catch (LocalChunkManagerException & e) { \
LOG_SEGCORE_ERROR_ << "LocalChunkManagerException:" << e.what(); \
return false; \
} \
catch (MinioException & e) { \
LOG_SEGCORE_ERROR_ << "milvus::storage::MinioException:" << e.what(); \
return false; \
} \
catch (DiskANNFileManagerException & e) { \
LOG_SEGCORE_ERROR_ << "milvus::storage::DiskANNFileManagerException:" \
<< e.what(); \
return false; \
} \
catch (ArrowException & e) { \
LOG_SEGCORE_ERROR_ << "milvus::storage::ArrowException:" << e.what(); \
return false; \
} \
catch (std::exception & e) { \
LOG_SEGCORE_ERROR_ << "Exception:" << e.what(); \
return false;
#define FILEMANAGER_END }
@ -113,7 +113,7 @@ DiskFileManagerImpl::AddFile(const std::string& file) noexcept {
auto& pool = ThreadPool::GetInstance();
FILEMANAGER_TRY
if (!local_chunk_manager.Exist(file)) {
LOG_SEGCORE_ERROR_C << "local file: " << file << " does not exist ";
LOG_SEGCORE_ERROR_ << "local file: " << file << " does not exist ";
return false;
}

View File

@ -187,10 +187,10 @@ MinioChunkManager::MinioChunkManager(const StorageConfig& storage_config)
// CreateBucket(storage_config.bucket_name);
// }
LOG_SEGCORE_INFO_C << "init MinioChunkManager with parameter[endpoint: '"
<< storage_config.address << "', default_bucket_name:'"
<< storage_config.bucket_name << "', use_secure:'"
<< std::boolalpha << storage_config.useSSL << "']";
LOG_SEGCORE_INFO_ << "init MinioChunkManager with parameter[endpoint: '"
<< storage_config.address << "', default_bucket_name:'"
<< storage_config.bucket_name << "', use_secure:'"
<< std::boolalpha << storage_config.useSSL << "']";
}
MinioChunkManager::~MinioChunkManager() {

View File

@ -35,7 +35,7 @@ class ThreadPool {
public:
explicit ThreadPool(const int thread_core_coefficient) : shutdown_(false) {
auto thread_num = cpu_num * thread_core_coefficient;
LOG_SEGCORE_INFO_C << "Thread pool's worker num:" << thread_num;
LOG_SEGCORE_INFO_ << "Thread pool's worker num:" << thread_num;
threads_ = std::vector<std::thread>(thread_num);
Init();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
# or implied. See the License for the specific language governing permissions and limitations under the License.
#-------------------------------------------------------------------------------
set( KNOWHERE_VERSION v2.1.0 )
set( KNOWHERE_VERSION main )
message(STATUS "Building knowhere-${KNOWHERE_SOURCE_VER} from source")
message(STATUS ${CMAKE_BUILD_TYPE})

View File

@ -12,14 +12,9 @@
#include <gtest/gtest.h>
#include "common/SystemProperty.h"
#ifndef MILVUS_TEST_SEGCORE_YAML_PATH
#error MILVUS_TEST_SEGCORE_YAML_PATH is not defined
#define MILVUS_TEST_SEGCORE_YAML_PATH ""
#endif
int
main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
}