Logging¶
When running DeepReg, there are two types of printed messages:
DeepReg messages, which are entirely controlled by DeepReg code.
TensorFlow messages, which are automatically printed by TensorFlow during certain workflows.
Therefore, we use two independent environment variables to control these two types of messages. The log level controls which types of log messages would be printed. Further details are explained below.
DeepReg logging¶
DeepReg uses the
Python module ``logging` <https://docs.python.org/3/library/logging.html>`_ to log the
messages. The log level is controlled by the environment variable DEEPREG_LOG_LEVEL
.
The levels are given in the table below. The default level is “2”.
To adjust the logging level, there are two options. Take the training as example,
You can first define the environment variable, then run the job.
export DEEPREG_LOG_LEVEL=1 deepreg_train --gpu "" --config_path config/unpaired_labeled_ddf.yaml --exp_name test
Alternatively, you can define the environment variable while running the job.
DEEPREG_LOG_LEVEL=1 deepreg_train --gpu "" --config_path config/unpaired_labeled_ddf.yaml --exp_name test
DEEPREG_LOG_LEVEL |
Behavior |
---|---|
“0” |
Log all messages, equivalent to |
“1” |
Log all messages, equivalent to |
“2” |
Log all messages except DEBUG, equivalent to |
“3” |
Log all messages except DEBUG and INFO, equivalent to |
“4” |
Log all messages except DEBUG, INFO, and WARNING, equivalent to |
“5” |
Log all messages except DEBUG, INFO, WARNING, and ERROR, equivalent to |
TensorFlow logging¶
With TensorFlow 2.3, its log level is controlled by the environment variable
TF_CPP_MIN_LOG_LEVEL
. The levels are given in the table below. The default level is
“2”.
To adjust the logging level, there are two options. Take the training as example,
You can first define the environment variable, then run the job.
export TF_CPP_MIN_LOG_LEVEL=1 deepreg_train --gpu "" --config_path config/unpaired_labeled_ddf.yaml --exp_name test
Alternatively, you can define the environment variable while running the job.
TF_CPP_MIN_LOG_LEVEL=1 deepreg_train --gpu "" --config_path config/unpaired_labeled_ddf.yaml --exp_name test
TF_CPP_MIN_LOG_LEVEL |
Behavior |
---|---|
“0” |
Log all messages. |
“1” |
Log all messages except INFO. |
“2” |
Log all messages except INFO and WARNING. (default) |
“3” |
Log all messages except INFO, WARNING, and ERROR. |