How do you disable log messages?

Hi Guys!

I’m writing a console application in Python and I’ve been trying to disable the log messages that mxnet throws when loading a model in the beginning. I’ve tried everything but no matter what they all seem to have no effect. Any help appreciated!

Example of log message:

[22:39:38] C:\Jenkins\workspace\mxnet-tag\mxnet\src\nnvm\legacy_json_util.cc:209: Loading symbol saved by previous version v0.8.0. Attempting to upgrade...
[22:39:38] C:\Jenkins\workspace\mxnet-tag\mxnet\src\nnvm\legacy_json_util.cc:217: Symbol successfully upgraded!

Things I’ve tried:

warnings.filterwarnings('ignore')
logging.getLogger('mxnet').setLevel(logging.CRITICAL)

I’ve also a tried a combination of these and other suppressions but nothing works.

Thanks for the help!

Can you try adding this line at the start of your code:
logging.basicConfig(level=logging.DEBUG)

Thank you for the suggestion! I just tried it but it did not seem to have any effect.
For reference here is the code for my main python file:


logging.basicConfig(level=logging.DEBUG)


import mxnet as mx
import mtcnn_detector
#logging.getLogger('mxnet').setLevel(logging.CRITICAL)

if __name__ == '__main__':
    det = mtcnn_detector.MtcnnDetector(model_folder='model', minsize=50,
                                       ctx=mx.cpu(0),
                                       num_worker=4,
                                       accurate_landmark=False)

I also tried the line that is commented but that didn’t help either.

Thank you for the suggestion! I just tried it but it does not seem to have any effect as before.

For reference here is the main python file that I’m running:

import logging

logging.basicConfig(level=logging.DEBUG)


import mxnet as mx
import mtcnn_detector
#logging.getLogger('mxnet').setLevel(logging.CRITICAL)

if __name__ == '__main__':
    det = mtcnn_detector.MtcnnDetector(model_folder='model', minsize=50,
                                       ctx=mx.cpu(0),
                                       num_worker=4,
                                       accurate_landmark=False)

I also tried the line that is commented but that didn’t help either.