GithubHelp home page GithubHelp logo

Comments (5)

michelcrypt4d4mus avatar michelcrypt4d4mus commented on September 26, 2024 2

thanks - i tested out the changes from with #12198 and my problems are solved

from twisted.

michelcrypt4d4mus avatar michelcrypt4d4mus commented on September 26, 2024

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.

adiroiban avatar adiroiban commented on September 26, 2024

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

def _openLogFile(self, path):
"""
Override in subclasses, e.g. to use L{twisted.python.logfile}.
"""
f = open(path, "ab", 1)
return f


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.

glyph avatar glyph commented on September 26, 2024

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.

glyph avatar glyph commented on September 26, 2024
  • why does log silently discard its logs?

from twisted.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.