-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make logging code self-contained #13785
Conversation
Rewrite logging code to use python's builting QueueListener, effectively moving the logging process into a thread of the Frigate app. Also, wrap this behaviour in a easy-to-use context manager to encourage some consistency.
✅ Deploy Preview for frigate-docs canceled.
|
We definitely prefer contributions over issues. We have had several large PRs opened in the past that haven't been merged because there was context that the author wasn't aware of. I definitely encourage you to communicate your plans prior to investing a lot of effort as we are moving relatively fast. A series of smaller PRs like this are preferred. We are all on the Home Assistant discord. blakeblackshear |
The logging implementation here was based on the recommended approach for multiprocessing logging in the Python docs. https://docs.python.org/3/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes I'm guessing you are suggesting we switch to the variant where the logging is a thread of the main process. I'm curious what problem you are solving by doing this? We have quite a few things happening in the main thread when users have a large number of cameras. |
Oh; I didn't realize that was in the cookbook. Still, I find that particular implementation rather dubious. Mainly in the cleanup department. The main point of the PR is the I could move
|
Oh, I forgot to run mypy. Let me fix that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR re-introduces an issue that was fixed already which is that the onvif package forcefully introduces its own log handler which will repeat all logs without the formatting applied. This is why the
if root.hasHandlers():
root.handlers.clear()
is there. This can't be controlled from the onvif package
Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
When testing inside the dev container the main process does not stop cleanly, it has to be killed |
I couldn't figure out how you're running it inside the dev container, so I'm just doing |
the main python process that runs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, everything looks to be working correctly now
I don't thing this is due to my changes. This seems to happen when |
QueueListener
, effectively moving the logging process into a thread of the Frigate app.@NickM-27 @hawkeye217 @blakeblackshear Sorry for pinging randomly, but I'm seeing my other PR (#13765) get forgotten, so I'm assuming it got buried by the dependabot noise.
TL;DR: Whom should I annoy to get things merged? Maintaining multiple branches gets old, fast. Unless you prefer huge, unreviewable, PRs.
I'm planning to deploy frigate in my own nvr, but I have quite a few fixes I want to contribute to get it working the way I want to. I figured you'd prefer contributions to me nagging you via issues.
Next is probably faster shutdown, assuming I don't get side tracked.
I'm also planning to improve the webui, to get it into a state where I can use that as a birdseye view with a simple web client. Is there somewhere I can reach you directly (matrix/discord/irc/pigeon)?