How to set up logging level in Tensorlayer and Tensorflow

less than 1 minute read

In python logger, there are 5 logging levels: {50: 'FATAL', 40: 'ERROR', 30: 'WARN', 20: 'INFO', 10: 'DEBUG'}. The logger only prints logs that are higher than the default logging level. By default, the logging level in both tensorlayer and tensorflow is WARN. This posts changes the logging level into INFO.

Tensorlayer

print(tl.logging._level_names)
print(tl.logging.get_verbosity())
tl.logging.set_verbosity(tl.logging.INFO)

Tensorflow

print(tf.logging._level_names)
print(tf.logging.get_verbosity())
tf.logging.set_verbosity(tf.logging.INFO)