Hi, I'd like to use a custom logging formatter wit...
# troubleshooting
p
Hi, I'd like to use a custom logging formatter with Meltano. Is it possible to specify in the
logging.yml
a callable formatter that has been defined in a local python file? I'm not succeeding in doing so and have tried several different paths for the custom formatter. E.g i have a callable
factory
defined in a file
config_loader.py
which is in the same dir as the `logging.yml`:
Copy code
version: 1
disable_existing_loggers: false

formatters:
  default:
    format: "%(message)s"
  custom:
   (): .config_loader.factory

handlers:
  console:
    class: logging.StreamHandler
    level: INFO
    formatter: custom
    stream: "<ext://sys.stderr>"

root:
  level: INFO
  propagate: yes
  handlers: [console]
e
According to the logging docs:
This is signalled by an absolute import path to the factory being made available under the special key
'()'
.
That means relative imports are not supported:
Copy code
formatters:
  default:
    format: "%(message)s"
  custom:
   (): config_loader.factory
Also, you have to make your module available to the Python interpreter. You can do that with the
PYTHONPATH
variable. If
config_loader.py
and
logging.yml
are at the project root:
Copy code
PYTYHONPATH=. meltano ...