8899# Meng Du <[email protected] >, 20191010# MuSheng Chen <[email protected] >, 201911- 1211# Freesand Leo <[email protected] >, 201912+ 1313#
1414#, fuzzy
1515msgid ""
@@ -18,7 +18,7 @@ msgstr ""
1818"Report-Msgid-Bugs-To : \n "
1919"POT-Creation-Date : 2019-01-01 10:14+0900\n "
2020"PO-Revision-Date : 2017-02-16 17:45+0000\n "
21- "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2019\n "
21+ "Last-Translator : 非法操作 <ultrahe@gmail .com>, 2019\n "
2222"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2323"MIME-Version : 1.0\n "
2424"Content-Type : text/plain; charset=UTF-8\n "
@@ -450,14 +450,17 @@ msgid ""
450450" same format string can be used to get similar output to that shown above. "
451451"Here's an example script::"
452452msgstr ""
453+ "例如,在一个web应用程序中,正在处理的请求(或者至少是请求的一部分),可以存储在一个线程本地(:class:`threading.local`) "
454+ "变量中,然后从``Filter``中去访问。请求中的信息,如IP地址和用户名将被存储在``LogRecord``中,使用上例``LoggerAdapter``中的"
455+ " 'ip' 和 'user' 属性名。在这种情况下,可以使用相同的格式化字符串来得到上例中类似的输出结果。这是一段示例代码::"
453456
454457#: ../../howto/logging-cookbook.rst:688
455458msgid "which, when run, produces something like:"
456- msgstr ""
459+ msgstr "在运行时,产生如下内容: "
457460
458461#: ../../howto/logging-cookbook.rst:709
459462msgid "Logging to a single file from multiple processes"
460- msgstr ""
463+ msgstr "从多个进程记录至单个文件 "
461464
462465#: ../../howto/logging-cookbook.rst:711
463466msgid ""
@@ -474,6 +477,8 @@ msgid ""
474477" and includes a working socket receiver which can be used as a starting "
475478"point for you to adapt in your own applications."
476479msgstr ""
480+ "尽管logging是线程安全的,将单个进程中的多个线程日志记录至单个文件也是支持的,但通过多个进程记录至单个文件却是不支持的,因为在Python中没有标准的方案在多个进程中去序列化数据至一个文件。如果你需要将多个进程记录至单个文件,有一个方案是让所有的进程都记录日志至:class:`~handlers.SocketHandler`,然后用一个单独的实现了套接字服务器的进程一边从套接字中读取一遍记录至日志文件。(如果你愿意,也可以在一个现有进程的单独线程中执行此工作)文档:ref:`This"
481+ " section 1`中有更详细的介绍并包括一个可以运行的套接字接收器,可以作为基础去适配你自己的程序。"
477482
478483#: ../../howto/logging-cookbook.rst:724
479484msgid ""
@@ -486,6 +491,9 @@ msgid ""
486491":mod:`multiprocessing` module does not provide working lock functionality on"
487492" all platforms (see https://bugs.python.org/issue3770)."
488493msgstr ""
494+ "如果你使用的是最近一些版本的Python包含了:mod:`multiprocessing`模块的,你也可以使用:class:`~multiprocessing.Lock`写自己的处理程序让其从多个进程中按顺序记录至文件。现有的"
495+ " :class:`FileHandler` 和它的子类目前没有使用:mod:`multiprocessing` "
496+ ",尽管将来可能会这样做。请注意目前:mod:`multiprocessing`模块并非在所有平台上提供锁的功能(查阅https://bugs.python.org/issue3770)。"
489497
490498#: ../../howto/logging-cookbook.rst:735
491499msgid ""
0 commit comments