Writing to the console logger

I would like to know what’s the best way to write to the console logger.

Currently, running my script produces an output log that looks like this:

[2021-02-09 11:58:55,266][lightning][INFO] - GPU available: True, used: True
[2021-02-09 11:58:55,266][lightning][INFO] - TPU available: None, using: 0 TPU cores
[2021-02-09 11:58:55,267][lightning][INFO] - LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0,1,2,3]
[2021-02-09 11:59:32,130][lightning][INFO] -

This is followed by a ModelSummary whose configuration depends on the weights_summary argument passed into Trainer . Model checkpointing information is also appended to the log as training goes along.

Metric logging is handled separately by a TensorBoardLogger.

What I would like to do is append something to the console log file above at some point during training.

Thanks!

try:

import logging
loger = logging.getLogger('lightning')
loger.info(...)
loger.debug(...)
1 Like

Thanks very much for your reply @goku .One final question, any idea how to specify the path for the output log file?

maybe this can help: How to write to a file, using the logging Python module? - Stack Overflow