-
Notifications
You must be signed in to change notification settings - Fork 0
Replace spdlogs with Arrow Internal Logging
#104
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
Conversation
|
Closing PR as I found some issues. Will reopen when it is ready for review |
|
Raised apache#47608 for the issues I was running into |
|
|
||
| #include <functional> | ||
| #include <memory> | ||
| #include <string> | ||
| #include "arrow/util/logging.h" | ||
|
|
||
| #include <spdlog/fmt/fmt.h> | ||
|
|
||
| // The logger using spdlog is deprecated and will be replaced. | ||
| // TODO: mirgate logging to use Arrow's internal logging system | ||
|
|
||
| #define __LAZY_LOG(LEVEL, ...) \ | ||
| do { \ | ||
| driver::odbcabstraction::Logger* logger = \ | ||
| driver::odbcabstraction::Logger::GetInstance(); \ | ||
| if (logger) { \ | ||
| logger->log(driver::odbcabstraction::LogLevel::LogLevel_##LEVEL, \ | ||
| [&]() { return fmt::format(__VA_ARGS__); }); \ | ||
| } \ | ||
| } while (0) | ||
| #define __LAZY_LOG(LEVEL, ...) ARROW_LOG(LEVEL) << __VA_ARGS__; | ||
| #define LOG_DEBUG(...) __LAZY_LOG(DEBUG, __VA_ARGS__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the main code change for this PR. This is where logging is switched to Arrow
|
Let me rework on the Arrow logging usage |
7a8324f to
966fbe4
Compare
It is up to Arrow community to enable GLOG on Windows
966fbe4 to
79fa39b
Compare
Resolves errors of kernel function already registered
We can work + test on log file support on macOS/Linux phase
cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/logger.h
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main file to review
* `GetModulePath` can be used to fetch the co-located TLS file
| : false; | ||
| if (!log_enabled.get()) { | ||
| return; | ||
| } | ||
| void FlightSqlDriver::RegisterComputeKernels() { | ||
| auto registry = arrow::compute::GetFunctionRegistry(); | ||
|
|
||
| auto log_path_iterator = propertyMap.find(std::string(SPDLogger::LOG_PATH)); | ||
| auto log_path = log_path_iterator != propertyMap.end() ? log_path_iterator->second : ""; | ||
| if (log_path.empty()) { | ||
| return; | ||
| // strptime is one of the required compute functions | ||
| auto strptime_func = registry->GetFunction("strptime"); | ||
| if (!strptime_func.ok()) { | ||
| // Register Kernel functions to library | ||
| ThrowIfNotOK(arrow::compute::Initialize()); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function resolves the kernel registry issue
spdlogsand use Arrow's internal logs instead. The PR is based on commit: dbt-labs/flightsql-odbc@65554dfSee this file for documentation for enable logging: cpp/src/arrow/flight/sql/odbc/README
Log file path is not supported, because Arrow code disables GLOG on Windows (MSVC) as
Plasma using glog is not fully tested on windows.I found this reason from apache@7104d64