mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

Logging in Mxnet, with different level (verbose, warning, error)

Open dmidge8 opened this issue 8 years ago • 8 comments

Hi,

As pointed out in this forum thread, https://discuss.mxnet.io/t/how-to-enable-logginig-for-c-api/1273/5 and https://discuss.mxnet.io/t/debug-mxnet-network-in-c/1274, there is a strong need felt to be able to log information and failed checks in MXNet. It is mainly useful when using the C++ API, because there are no other feedback than the one you get when there is an error and than you need to dive deep in the code to finally get what went wrong. (For example, that the expected input shape of the symbol is not consistent to the one that has been gotten).

Moreover, a consistent way to get the logging information would be great. Meaning, one that doesn't need to modify environment variables and so on, would be appreciated. It would then be possible to have several level of logging, according on what is common in most of the projects out there, including "verbose, debug, info, warning, error". Also, depending on the level of information gathered, having all the log output in file would be appreciated.

Thanks!

dmidge8 avatar Jul 04 '18 18:07 dmidge8

I think you can already get streams like LOG(severity) where severity can be FATAL, ERROR, WARNING, INFO. https://github.com/dmlc/dmlc-core/blob/649be18a8c55c48517861d67158a45dec54992ee/include/dmlc/logging.h#L162-L166

szha avatar Jul 04 '18 19:07 szha

Indeed. But when you use a compiled version of MXNet and you try to figure what is going wrong with it, you may want to toggle with several version of severity.

There, for now, every time you want to use the C++, since you don't have lot of feedback, you either have the choice of compiling the whole MXNet library with no log and then wonder what went wrong, or try to log everything and potentially being invaded by a lot of feedback that is thrown directly in the CLI.

A more interactive way to choose the level of information received would be a better solution. And if the checks where to embed some kind of logging, mainly when it fails, it would be better. And if all the logging where centralized and not disperse in the environment variable, I would even enjoy that more!

dmidge8 avatar Jul 04 '18 21:07 dmidge8

@dmidge8 one option for managing logs when they're all enabled would be to use a log viewer like glogg.

safrooze avatar Jan 23 '19 23:01 safrooze

Any updates? Trying to remove

[16:09:01] src/nnvm/legacy_json_util.cc:209: Loading symbol saved by previous version v1.3.0. Attempting to upgrade...
[16:09:01] src/nnvm/legacy_json_util.cc:217: Symbol successfully upgraded!
[16:09:01] src/executor/graph_executor.cc:1984: Subgraph backend MKLDNN is activated.

from console output

Elijas avatar Apr 02 '20 06:04 Elijas

You could set MXNET_SUBGRAPH_VERBOSE to 0 and these message will be muted. However, I think we should change the code to make default to 0 (currently is 1). It'll be a good first issue for new mxnet developers.

apeforest avatar Apr 02 '20 06:04 apeforest

You could set MXNET_SUBGRAPH_VERBOSE to 0 and these message will be muted.

@apeforest Thank you for a quick reply! It worked for graph_executor.cc, however, these still appear and I need to hide them:

[16:09:01] src/nnvm/legacy_json_util.cc:209: Loading symbol saved by previous version v1.3.0. Attempting to upgrade...
[16:09:01] src/nnvm/legacy_json_util.cc:217: Symbol successfully upgraded!

Could you tell me the other environment variable?

Elijas avatar Apr 03 '20 10:04 Elijas

There is no variable to disable that. And it's logged using INFO level.

apeforest avatar Apr 03 '20 13:04 apeforest

requires https://github.com/dmlc/dmlc-core/issues/623

szha avatar Jul 29 '20 22:07 szha