Thespian
Thespian copied to clipboard
logging can fail with pickling errors for log contents
running into issues with the logging subsystem, and wanted to see what may be going on / what options one may have:
as background, one of my library dependencies is logging something that cannot be serialized (getting a pickle error), causing an exception in the logging stack and breaking my system. I am using the multiprocTCPBase system (on Linux) and setting ActorSystem::logDefs per the documentation. to avoid this, I can set ActorSystem::logDefs to None, but then getting no logs at all which is also sad
Is there a way to ask the actor system to not meddle with the logging system at all? looking at the code in multiprocCommon I could not see one
one thing that could help is to be able to filter out specific loggers. in this case, the issue comes from the websocket library that has this logger setup:
if logger is None:
logger = logging.getLogger("websockets.protocol")
self.logger: LoggerLike = logging.LoggerAdapter(logger, {"websocket": self})
having self containing attributes that cannot be serialized. this is all out of my control as it is a transitive dependency,
if it is possible to filter these log events from the actor system forwarding via config (leg level, filters etc) that could help solve such problems
Ouch. First, this is clearly an issue Thespian should be able to deal with without crashing the logger. I've renamed this issue to capture that.
There's no filtering like you suggested, although that may be something I could figure out to add in the future along with fixing this issue.
For the immediate term, I believe commenting out these lines will stop the log forwarding (i.e. "meddling with the logging system") and allow you to get something mostly working: https://github.com/kquick/Thespian/blob/master/thespian/system/multiprocCommon.py#L651-L655