New submission from Inada Naoki <songofaca...@gmail.com>: See cgi.initlog(): https://github.com/python/cpython/blob/b2a91e0c9ee18b50cc86b21211c2258520a9f5d0/Lib/cgi.py#L82
``` logfp = open(logfile, "a") ``` This feature is not documented but can be used like this. ``` import cgi cgi.logfile="myapp.log" cgi.log("こんにちは") ``` I want to change log file encoding to UTF-8. Although this is backward incompatible change, it unlikely break user application because it just change the logfile encoding. UTF-8 is safer than locale encoding because UTF-8 supports all valid Unicode strings. ---------- components: Library (Lib) messages: 390120 nosy: methane priority: normal severity: normal status: open title: cgi.log() uses default encoding versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43711> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com