Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(log): adjust log level and macro names #1200

Merged
merged 4 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/aio/disk_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ void disk_engine::process_write(aio_task *aio, uint64_t sz)
void disk_engine::complete_io(aio_task *aio, error_code err, uint64_t bytes)
{
if (err != ERR_OK) {
dinfo("disk operation failure with code %s, err = %s, aio_task_id = %016" PRIx64,
aio->spec().name.c_str(),
err.to_string(),
aio->id());
LOG_DEBUG("disk operation failure with code %s, err = %s, aio_task_id = %016" PRIx64,
aio->spec().name.c_str(),
err.to_string(),
aio->id());
}

// batching
Expand Down
6 changes: 3 additions & 3 deletions src/aio/native_linux_aio_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dsn_handle_t native_linux_aio_provider::open(const char *file_name, int flag, in
{
dsn_handle_t fh = (dsn_handle_t)(uintptr_t)::open(file_name, flag, pmode);
if (fh == DSN_INVALID_FILE_HANDLE) {
derror("create file failed, err = %s", strerror(errno));
LOG_ERROR("create file failed, err = %s", strerror(errno));
}
return fh;
}
Expand All @@ -56,7 +56,7 @@ error_code native_linux_aio_provider::close(dsn_handle_t fh)
if (fh == DSN_INVALID_FILE_HANDLE || ::close((int)(uintptr_t)(fh)) == 0) {
return ERR_OK;
} else {
derror("close file failed, err = %s", strerror(errno));
LOG_ERROR("close file failed, err = %s", strerror(errno));
return ERR_FILE_OPERATION_FAILED;
}
}
Expand All @@ -66,7 +66,7 @@ error_code native_linux_aio_provider::flush(dsn_handle_t fh)
if (fh == DSN_INVALID_FILE_HANDLE || ::fsync((int)(uintptr_t)(fh)) == 0) {
return ERR_OK;
} else {
derror("flush file failed, err = %s", strerror(errno));
LOG_ERROR("flush file failed, err = %s", strerror(errno));
return ERR_FILE_OPERATION_FAILED;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/aio/test/aio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ TEST(core, operation_failed)

t = ::dsn::file::read(fp2, buffer, 512, 100, LPC_AIO_TEST, nullptr, io_callback, 0);
t->wait();
ddebug("error code: %s", err->to_string());
LOG_INFO("error code: %s", err->to_string());
file::close(fp);
file::close(fp2);
fail::teardown();
Expand Down
2 changes: 1 addition & 1 deletion src/block_service/block_service_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ block_service_manager::block_service_manager()

block_service_manager::~block_service_manager()
{
ddebug("close block service manager.");
LOG_INFO("close block service manager.");
zauto_write_lock l(_fs_lock);
_fs_map.clear();
}
Expand Down
98 changes: 49 additions & 49 deletions src/block_service/fds/fds_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,26 +160,26 @@ error_code fds_service::initialize(const std::vector<std::string> &args)
#define FDS_EXCEPTION_HANDLE(ERR_REFERENCE, OPERATION, INPUT_PARAMETER) \
catch (const Poco::TimeoutException &ex) \
{ \
derror("fds %s timeout: parameter(%s), code(%d), msg(%s)", \
OPERATION, \
INPUT_PARAMETER, \
ex.code(), \
ex.message().c_str()); \
LOG_ERROR("fds %s timeout: parameter(%s), code(%d), msg(%s)", \
OPERATION, \
INPUT_PARAMETER, \
ex.code(), \
ex.message().c_str()); \
ERR_REFERENCE = ERR_TIMEOUT; \
} \
catch (const Poco::Exception &ex) \
{ \
derror("fds %s get poco exception: parameter(%s), code(%d), msg(%s), what(%s)", \
OPERATION, \
INPUT_PARAMETER, \
ex.code(), \
ex.message().c_str(), \
ex.what()); \
LOG_ERROR("fds %s get poco exception: parameter(%s), code(%d), msg(%s), what(%s)", \
OPERATION, \
INPUT_PARAMETER, \
ex.code(), \
ex.message().c_str(), \
ex.what()); \
ERR_REFERENCE = ERR_FS_INTERNAL; \
} \
catch (...) \
{ \
derror("fds %s get unknown exception: parameter(%s)", OPERATION, INPUT_PARAMETER); \
LOG_ERROR("fds %s get unknown exception: parameter(%s)", OPERATION, INPUT_PARAMETER); \
ERR_REFERENCE = ERR_FS_INTERNAL; \
}

Expand Down Expand Up @@ -232,10 +232,10 @@ dsn::task_ptr fds_service::list_dir(const ls_request &req,
}
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
derror("fds listObjects failed: parameter(%s), code(%d), msg(%s)",
req.dir_name.c_str(),
ex.code(),
ex.what());
LOG_ERROR("fds listObjects failed: parameter(%s), code(%d), msg(%s)",
req.dir_name.c_str(),
ex.code(),
ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "listObject", req.dir_name.c_str())
Expand All @@ -244,19 +244,19 @@ dsn::task_ptr fds_service::list_dir(const ls_request &req,
try {
if (_client->doesObjectExist(_bucket_name,
utils::path_to_fds(req.dir_name, false))) {
derror("fds list_dir failed: path not dir, parameter(%s)",
req.dir_name.c_str());
LOG_ERROR("fds list_dir failed: path not dir, parameter(%s)",
req.dir_name.c_str());
resp.err = ERR_INVALID_PARAMETERS;
} else {
derror("fds list_dir failed: path not found, parameter(%s)",
req.dir_name.c_str());
LOG_ERROR("fds list_dir failed: path not found, parameter(%s)",
req.dir_name.c_str());
resp.err = ERR_OBJECT_NOT_FOUND;
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
derror("fds doesObjectExist failed: parameter(%s), code(%d), msg(%s)",
req.dir_name.c_str(),
ex.code(),
ex.what());
LOG_ERROR("fds doesObjectExist failed: parameter(%s), code(%d), msg(%s)",
req.dir_name.c_str(),
ex.code(),
ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "doesObjectExist", req.dir_name.c_str())
Expand Down Expand Up @@ -332,24 +332,24 @@ dsn::task_ptr fds_service::remove_path(const remove_path_request &req,
if (req.recursive) {
should_remove_path = true;
} else {
derror("fds remove_path failed: dir not empty, parameter(%s)",
req.path.c_str());
LOG_ERROR("fds remove_path failed: dir not empty, parameter(%s)",
req.path.c_str());
resp.err = ERR_DIR_NOT_EMPTY;
}
} else {
if (_client->doesObjectExist(_bucket_name, utils::path_to_fds(req.path, false))) {
should_remove_path = true;
} else {
derror("fds remove_path failed: path not found, parameter(%s)",
req.path.c_str());
LOG_ERROR("fds remove_path failed: path not found, parameter(%s)",
req.path.c_str());
resp.err = ERR_OBJECT_NOT_FOUND;
}
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
derror("fds remove_path failed: parameter(%s), code(%d), msg(%s)",
req.path.c_str(),
ex.code(),
ex.what());
LOG_ERROR("fds remove_path failed: parameter(%s), code(%d), msg(%s)",
req.path.c_str(),
ex.code(),
ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "remove_path", req.path.c_str());
Expand All @@ -361,16 +361,16 @@ dsn::task_ptr fds_service::remove_path(const remove_path_request &req,
if (deleting->countFailedObjects() <= 0) {
resp.err = ERR_OK;
} else {
derror("fds remove_path failed: countFailedObjects = %d, parameter(%s)",
deleting->countFailedObjects(),
req.path.c_str());
LOG_ERROR("fds remove_path failed: countFailedObjects = %d, parameter(%s)",
deleting->countFailedObjects(),
req.path.c_str());
resp.err = ERR_FS_INTERNAL;
}
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
derror("fds remove_path failed: parameter(%s), code(%d), msg(%s)",
req.path.c_str(),
ex.code(),
ex.what());
LOG_ERROR("fds remove_path failed: parameter(%s), code(%d), msg(%s)",
req.path.c_str(),
ex.code(),
ex.what());
resp.err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(resp.err, "remove_path", req.path.c_str());
Expand Down Expand Up @@ -499,15 +499,15 @@ error_code fds_file_object::get_content(uint64_t pos,
_fds_path,
pos + transfered_bytes,
length - transfered_bytes);
dinfo("get object from fds succeed, remote_file(%s)", _fds_path.c_str());
LOG_DEBUG("get object from fds succeed, remote_file(%s)", _fds_path.c_str());
std::istream &is = obj->objectContent();
transfered_bytes += utils::copy_stream(is, os, PIECE_SIZE);
err = ERR_OK;
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
derror("fds getObject error: remote_file(%s), code(%d), msg(%s)",
file_name().c_str(),
ex.code(),
ex.what());
LOG_ERROR("fds getObject error: remote_file(%s), code(%d), msg(%s)",
file_name().c_str(),
ex.code(),
ex.what());
if (ex.code() == Poco::Net::HTTPResponse::HTTP_NOT_FOUND) {
_has_meta_synced = true;
_md5sum = "";
Expand Down Expand Up @@ -548,10 +548,10 @@ error_code fds_file_object::put_content(/*in-out*/ std::istream &is,
try {
c->putObject(_service->get_bucket_name(), _fds_path, is, galaxy::fds::FDSObjectMetadata());
} catch (const galaxy::fds::GalaxyFDSClientException &ex) {
derror("fds putObject error: remote_file(%s), code(%d), msg(%s)",
file_name().c_str(),
ex.code(),
ex.what());
LOG_ERROR("fds putObject error: remote_file(%s), code(%d), msg(%s)",
file_name().c_str(),
ex.code(),
ex.what());
err = ERR_FS_INTERNAL;
}
FDS_EXCEPTION_HANDLE(err, "putObject", file_name().c_str())
Expand All @@ -560,7 +560,7 @@ error_code fds_file_object::put_content(/*in-out*/ std::istream &is,
return err;
}

ddebug("start to synchronize meta data after successfully wrote data to fds");
LOG_INFO("start to synchronize meta data after successfully wrote data to fds");
err = get_file_meta();
if (err == ERR_OK) {
transfered_bytes = _size;
Expand Down
4 changes: 2 additions & 2 deletions src/block_service/hdfs/hdfs_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void hdfs_service::close()
// This method should be carefully called.
// Calls to hdfsDisconnect() by individual threads would terminate
// all other connections handed out via hdfsConnect() to the same URI.
ddebug("Try to disconnect hdfs.");
LOG_INFO("Try to disconnect hdfs.");
int result = hdfsDisconnect(_fs);
if (result == -1) {
derror_f("Fail to disconnect from the hdfs file system, error: {}.",
Expand Down Expand Up @@ -335,7 +335,7 @@ error_code hdfs_file_object::write_data_in_batches(const char *data,
return ERR_FS_INTERNAL;
}

ddebug("start to synchronize meta data after successfully wrote data to hdfs");
LOG_INFO("start to synchronize meta data after successfully wrote data to hdfs");
return get_file_meta();
}

Expand Down
Loading