[Log] new spdlog tool for ray#10967
Conversation
|
I test both glog and spdlog: spdlog : log file name pattern LogPerfTest_45421.log ( It can be modifed as same as glog) Only one difference is glog will produce log messages in both console(stdout) and log, but spdlog we define currently just flush them in log file. |
|
Can you add some details about the motivation in the description? |
|
So, does it mean spdlog is 10 times faster than glog in your workload? Also, why don't we do this |
|
Can you also push the benchmarking code to this PR? |
It is LogPerfTest in src/ray/util/logging_test.cc. |
~ 5200ms when I remove stderr verbose of glog. (Just change |
|
@rkooo567 I have pushed benchmark target commit. You may execute And |
|
@ashione Can you remove WIP when it is ready? |
0f546ca to
3d45577
Compare
I remove |
|
@ashione Please avoid rebasing/modifying commit history in a pull request. It's hard to find out what's changed since the last review. |
kfstorm
left a comment
There was a problem hiding this comment.
Could you paste an example output of RAY_CHECK?
src/ray/util/logging.cc
Outdated
| inline void Flush() { | ||
| auto logger = get_logger(); | ||
| if (loglevel_ == static_cast<int>(spdlog::level::critical)) { | ||
| stream() << "\n" << ray::GetCallTrace(); |
There was a problem hiding this comment.
Why we need this line? I think GLOG will fetch the stack trace for us once std::abort() is invoked.
There was a problem hiding this comment.
Could you paste an example output of
RAY_CHECK?
Stacktraces will be exactly produced twice with InstallFailureSignalHandler, but nothing will be catched we do not call GetCallTrace manually without InstallFailureSignalHandler for glog.
|
I always use the merge master command and never had any trouble (and it is okay to do this because the commit history doesn't matter anyway. All of commits are merged into one by Github when merged). |
I can't find |
It's shown by return value of command line. |
|
FYI, I tested with an The only difference from the glog solution is that there are many duplicated |
|
@kfstorm please don’t merge it yet. I will review it tmrw |
|
@rkooo567 Don't worry. I'm not going to merge this PR without your approval. |
| public: | ||
| explicit SpdLogMessage(const char *file, int line, int loglevel) : loglevel_(loglevel) { | ||
| stream() << ConstBasename(file) << ":" << line << ": "; | ||
| } |
There was a problem hiding this comment.
auto-gen by clang-format
src/ray/util/logging.cc
Outdated
| if (!logger) { | ||
| logger = spdlog::get("stderr"); | ||
| } | ||
| // If no default logger we just emit all log informations to stderr. |
There was a problem hiding this comment.
When's the time we don't have a default logger? Can you comment it?
src/ray/util/logging.cc
Outdated
| loglevel_ == static_cast<int>(spdlog::level::critical)) { | ||
| stream() << "\n*** StackTrace Information ***\n" << ray::GetCallTrace(); | ||
| } | ||
| logger->log(static_cast<spdlog::level::level_enum>(loglevel_), "{}", str_.str()); |
There was a problem hiding this comment.
| logger->log(static_cast<spdlog::level::level_enum>(loglevel_), "{}", str_.str()); | |
| logger->log(static_cast<spdlog::level::level_enum>(loglevel_), /*fmt*/ "{}", str_.str()); | |
| ```? |
There was a problem hiding this comment.
Not sure if it is the correct argument. Can you specify what this argument means?
src/ray/util/logging_test.cc
Outdated
| #include "ray/util/logging.h" | ||
|
|
||
| #include <chrono> | ||
| #include <csignal> |
There was a problem hiding this comment.
Why is it added when we commented out all tests here?
| exit(0); | ||
| } | ||
|
|
||
| TEST(PrintLogTest, RayCheckAbortTest) { |
There was a problem hiding this comment.
I add it only for testing manually because process will abort and exit if signal catched.
| #endif | ||
| } | ||
|
|
||
| void WriteFailureMessage(const char *data, int size) { |
src/ray/util/logging.cc
Outdated
| spdlog::rotating_logger_mt("ray_log_sink", | ||
| dir_ends_with_slash + app_name_without_path + "_" + | ||
| std::to_string(pid) + ".log", | ||
| 1 << 29, 10); |
There was a problem hiding this comment.
Can we make this part configurable?
There was a problem hiding this comment.
I'll extract theses parameters from env vars.
Can we make this part configurable?
|
@rkooo567 Could you go over it again? I found failures are related to python travis tests. |
|
@ashione Can you merge the latest master? It seems like all serve tests are failing, but I think it was same for the master. But I'd like to make sure if that's the case. |
|
Remove the tag (@author-action-required) once you merge the latest master (and passes all builds) |
|
@rkooo567 I have no idea about why //python/ray/tune:test_experiment_analysis failed in TUNE_TESTING? Is it known-issue in master. |
|
@ashione I think there were some failures on master. This must've been resolved now. Can you try merging the master one more time? |
It's done and looks all green. |
|
Windows CI failure seems unrelated. |
|
Windows tests seem to have weird test failures that I've never seen. Rerunning the job now... |
|
@kfstorm The test failure indeed seems unrelated, but I've never seen this error in any CI builds. So let me re-run it just in case! |
|
@rkooo567 Sure. Thank you. |
Motiviation:
Why are these changes needed?
A new log tool for users.
Related issue number
#10493
spdlog V.S. glog : https://docs.google.com/document/d/1pEXTLOhTFu5-va14Wj-tGoJD9tt_M_-JRMtxqd1JCyI
Checks
scripts/format.shto lint the changes in this PR.