Dragon2fly/logger_tt

How to inherit hydra default logging parameters?

Opened this issue · 3 comments

Hi!
I love so much how this package deals with multiprocessing
I want to keep my current log settings like in facebookresearch/hydra since I adopted all logs to that format in my project.

I think about solution when setup_logging is used in main where hydra main config is available

Thank you.

Hi @SolomidHero,

As you may already know, copy a log_config.yaml, modify it, and then pass it to setup_logging will override logger-tt's default behavior. So just change the log format at line 8 or 11 to something like '[%(asctime)s][%(name)s][%(levelname)s] - %(message)s' as your need.

Have a good day.

Thak you very much!
I will try and answer back!

But can I set this format param using cfg.hydra.formatters.format in the code?
It seems that it is not enough. What params I am able to define from default hydra config?
hydra/conf/hydra/job_logging/default.yaml

formatters:
  simple:
    format: '[%(asctime)s][%(name)s][%(levelname)s] - %(message)s'
handlers:
  console:
    class: logging.StreamHandler
    formatter: simple
    stream: ext://sys.stdout
  file:
    class: logging.FileHandler
    formatter: simple
    # absolute file path
    filename: ${hydra.runtime.output_dir}/${hydra.job.name}.log
root:
  level: INFO
  handlers: [console, file]

disable_existing_loggers: false

Yes, you can.

Both libs use the standard logging module under the hood, so they share the same config file.
You can read more about the config file here

Except for the filename part in your config example, it may not be in a standard.

If you need more help, please be more specific about what have you tried, give an example of the real result, and your expectation.

Have a good day