Im trying to add a class of log formatter to the faust logging_config
but getting an error with not mush exlained:
CANNOT SETUP LOGGING: ValueError("Unable to configure formatter 'exp_formatter'") from File "det_to_events/main.py", line 246, in <module>
app.main()
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/faust/app/base.py", line 761, in main
cli(app=self)
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/faust/cli/base.py", line 539, in _inner
cmd()
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/faust/cli/base.py", line 620, in __call__
self.run_using_worker(*args, **kwargs)
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/faust/cli/base.py", line 630, in run_using_worker
raise worker.execute_from_commandline()
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/mode/worker.py", line 279, in execute_from_commandline
self.loop.run_until_complete(self._starting_fut)
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/nest_asyncio.py", line 84, in run_until_complete
self._run_once()
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/nest_asyncio.py", line 120, in _run_once
handle._run()
File "/opt/homebrew/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/nest_asyncio.py", line 196, in step
step_orig(task, exc)
File "/opt/homebrew/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/tasks.py", line 280, in __step
result = coro.send(None)
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/mode/services.py", line 800, in start
await self._default_start()
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/mode/services.py", line 807, in _default_start
await self._actually_start()
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/mode/services.py", line 815, in _actually_start
await self.on_first_start()
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/faust/worker.py", line 334, in on_first_start
await self.default_on_first_start()
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/mode/worker.py", line 178, in default_on_first_start
self._setup_logging()
File "/Users/matany/Library/Caches/pypoetry/virtualenvs/det-to-events-S0HiGbUI-py3.8/lib/python3.8/site-packages/mode/worker.py", line 201, in _setup_logging
traceback.print_stack(file=self.stderr)
my code:
from my_package_path import MyLogger
my_config = {
'version': 1,
"disable_existing_loggers": False,
'formatters': {
"exp_formatter": {"()": 'path.to.my.formatter', "format": "EXPERIMENTAL log formatter - %(name)s - %(levelname)s - %(message)s"},
},
'handlers': {
'root_logger_handler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': "exp_formatter"
}
},
'loggers': {
'': {
'level': 'INFO',
'handlers': ['root_logger_handler']
},
}
}
This configuration is added to Faust
logging_config and later i call app.main()
, where i get the error.
I can also tell that when im trying to serialize the configuration using json.dumps(my_config)
im getting an error saying that the object is not serlizable, so it might be connected as well.
Help would be appreciated!