How to enable logginig for c++ API


#1

Hi, there

I’m trying to find error in my c++ application. There is some error while forward. I saw a lot of logging in mxnet, but in console appears only few messages.

My question is How to enable all levels of logging in mxnet with c++ API. How to redict logger to file or console? Is googleglog required?

Help, please. I’m tried to find failed CHECK’s manually. It’s slows down R&D critically.


Debug Mxnet network in C++
#2

Hi, Is there anyboby who can reply?? Or logging doesn’t work at all?


#3

As a starter, please try setting these env variable to 1:

MXNET_EXEC_VERBOSE_LOGGING
MXNET_MEM_PLAN_VERBOSE_LOGGING
MXNET_INFER_STORAGE_TYPE_VERBOSE_LOGGING
MXNET_VERBOSE_TUNING_INFO

@eric-haibin-lin do you know how else to get the logging info from dmlc/logging.h ?


#4

I don’t think there’s much logging in mxnet backend now. Log messages in CHECK’s are not logged unless the check fails. What exact err msg did you see?


#5

Thanks @ThomasDelteil, the environment variables are indeed a good thing to know. I could have roamed a while before discovering it.

Also, when I look in mxnet/3rdparty/dmlc-core/include/dmlc/base.h, there are a lot of defines such as DMLC_LOG_BEFORE_THROW. I guess we should set a couple of them to 1 also?


#6

@dmidge reviewing the content of that file it seems that we are already getting the maximum amount of logging.
DMLC_LOG_FATAL_THROW
DMLC_LOG_BEFORE_THROW
DMLC_LOG_STACK_TRACE
are already all set to 1.

I agree that a proper logging system with different verbosity level would be a beautiful addition to MXNet and greatly increase usability. Feel free to raise a feature request in the github repo.


#7

Hm, okay. I have only DMLC_LOG_FATAL_THROW enabled. DMLC_LOG_BEFORE_THROW is set to 0. And DMLC_LOG_STACK_TRACE seems to be enabled only for gcc for linux.

I’ll do a feature request in the github repo.


#8

Alright, I have submitted the github request there: https://github.com/apache/incubator-mxnet/issues/11557.