dmlc-core icon indicating copy to clipboard operation
dmlc-core copied to clipboard

[Feature] Logging level support

Open szha opened this issue 4 years ago • 4 comments

Since dmlc-core logging is providing logging capability to several projects, it would be great to have the capability of setting logging levels which will improve the user experience in these projects.

https://github.com/apache/incubator-mxnet/issues/16666 https://github.com/apache/incubator-mxnet/issues/10492

The implementation should allow changing the logging level at runtime, and for disabled logging levels, the invocation should incur as little overhead as possible.

szha avatar Jun 08 '20 18:06 szha

@trivialfis This is a good time to port dmlc/xgboost#3982 to dmlc-core. I'd like to give it a try.

hcho3 avatar Jun 11 '20 07:06 hcho3

Not sure about that. I have a similar logging utility for my own use with some additional features like signal handling (printing a backtrace when segfault). But the more I use logging, the more I like about Python's logging module. If you want to create a new c++ logging library, I suggest we can look into that direction a little bit.

trivialfis avatar Jun 11 '20 09:06 trivialfis

I agree that Python logging is nice. However, we need need logging in the C++ layer. Also, there is a large body of existing code using LOG(INFO). That's why I'm inclined to port dmlc/xgboost#3982 to dmlc-core.

If you want to create a new c++ logging library, I suggest we can look into that direction a little bit.

Do you see a clear design flaw in dmlc/xgboost#3982?

hcho3 avatar Jun 11 '20 09:06 hcho3

@hcho3

Do you see a clear design flaw in dmlc/xgboost#3982?

Not yet, maybe no support for user defined verbosity level?

we need need logging in the C++ layer.

Yup, I meant we can implement something similar to python logging in c++. We can use shared pointer for holding child logger, define a similar logger manager etc. I haven't found any existing implementation online. But I believe it's possible.

lso, there is a large body of existing code using LOG(INFO). That's why I'm inclined to port dmlc/xgboost#3982 to dmlc-core.

Sure, that won't be a problem. But since dmlc-core is a common brick for other libraries. Giving it some more thought would be great.

trivialfis avatar Jun 11 '20 09:06 trivialfis