Comments (5)
thanks - i tested out the changes from with #12198 and my problems are solved
from twisted.
I forked the codebase and put in the small change and everything seems OK for my use case though I'm too concerned about unforeseen side effects and unclear on how to test etc. to open a PR.
from twisted.
Hi,
Thanks for the report.
I would say that the call should be just logFile.write(line)
Then, the logFile
should do its magic to make sure the line is stored into the expected encoding.
And just open the log in text mode here
twisted/src/twisted/web/http.py
Lines 3304 to 3309 in c465c46
logFile._encoding
is a private API
Don't worry to much about breaking things.
If you send a PR with good test coverate and for changes which pass on the existing tests, the PR should be good to merge.
As a side note, I don't know why the Twisted HTTP is not using the standard logging infrastructure, and instead uses a custom file.
I am using the server in production, but I have just overwritten the factory not to handle the logs in a separate file.
Thanks again!
from twisted.
Whew. OK, there are a couple of mixed-up issues here.
HTTPFactory
really needs to delegate some of its logging responsibilities to a dedicated object, which can implement structured logging methods.NSLog
is capable of outputting structured information, and it's a bit sad it has to log everything with"@"
as its format string. In HTTP/3 you still need to log requests, but the server is not going to be a "Factory" at all.- why is the log file being opened in binary mode when we are encoding everything we are writing to it?
from twisted.
- why does
log
silently discard its logs?
from twisted.
Related Issues (20)
- Deprecate defer.inlineCallbacks and defer.deferredGenerator in favour of coros HOT 1
- Disordered HTTP pipeline response in twisted.web, again HOT 1
- Purge `bytes == str` and `bytes != str` type checks
- Example imap4client.py has Python 2 code (`raw_input`, and Python 2 shebang)
- Use Incremental 24.7.0
- Add some more HTTP server benchmarks
- Clean up GitHub actions warnings
- Update pre-commit hooks HOT 4
- Methods in IMAP4Server class throws exception when copy fails or there is no mailbox HOT 1
- HTML injection in HTTP redirect body
- [trial] builtins.RuntimeError: no running event loop with --reactor=asyncio HOT 3
- Update CodeCov and CodSpeed Github actions
- Release 24.7.0 HOT 21
- t.conch.ssh test failures with openssh-9.8 HOT 3
- `test_http11_server_chunked_response` benchmark is flaky HOT 1
- twisted.internet.address raises a DeprecationWarning for attrs `safe` argument HOT 2
- Regression since 2024.3.0: CopiedFailure relies on parents being settable
- Enforce minimum dependency testing environment
- Speed up chained Deferreds
- Implement benchmark for callLater and reactor.runUntilCurrent(), and speed them up
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twisted.