简体   繁体   中英

How can i log stdout and stderr outputs using fb-hydra?

I am trying to log stdout and stderr into a file.

I found custom.yaml file in the facebookresearch/hydra github.

# @package _group_
version: 1
formatters:
  simple:
    format: '[%(levelname)s] - %(message)s'
handlers:
  console:
    class: logging.StreamHandler
    formatter: simple
    stream: ext://sys.stdout
root:
  handlers: [console]

disable_existing_loggers: False

I figured that I am able to create a custom job_logging config file and log stderr by editing the file as below

stream: ext://sys.stderr

However, I want to log stderr and stdout at the same time.

I am having a hard time figuring it out.. Does anyone know how I can do it by changing the config file?

Hydra is forwarding your config (as a primitive dictionary) to logging.config.dictConfig . This is more of question about that API than about Hydra.

Do you know how to do this via logging.config.dictConfig without Hydra?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM