Open yairshemer1 opened 1 year ago
Hi @yairshemer1,
Hydra's logging facilities integrate with the python standard library's logging
module. Since loguru doesn't use the standard library's logging
as a backend and instead implements its own logging framework, it makes sense that the loguru logs are not showing up in hydra's log files.
If you want to set up loguru to append to the same log file as hydra does, it might be possible to inspect the hydra config to figure out the name the current active log file (see https://hydra.cc/docs/configure_hydra/intro/#top-level-hydra-settings for how to inspect the job_logging
and hydra_logging
variables in the hydra config). You would then configure loguru to output to that file.
Hey @Jasha10 This works fine as expected. Thanks for the response and suggested solution.
For others who find this thread, see also suggestion at https://github.com/facebookresearch/hydra/issues/2735#issuecomment-1774523324
It might be nice to have a dedicated plugin for hydra and loguru. I'm using a solution like that in 2735 currently, and as I just posted there it doesn't super reliably work within libraries, so more may be needed. Would a dedicated plugin be helpful to other folks?
🚀 Feature Request
Started to use loguru, noticing the logger's output is not included in hydra logging file. Was wondering if this is possible, or does it already exist and I have missed it.
Motivation
The ability to use loguru and hydra.
Pitch
The only alternative for me is to go back to the native python logger, which is something I'd rather not do. I would like the hydra to also capture the loguru's output through a possible handler, or a definition within the config file.
Additional context
-