Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7792af6

Browse files
author
github-actions
committed
Merge 3.11 into 3.10
1 parentd6ed50c commit7792af6

File tree

1 file changed

+74
-17
lines changed

1 file changed

+74
-17
lines changed

‎howto/logging-cookbook.po

Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -277,18 +277,27 @@ msgid ""
277277
"filter_maker`` in the filter configuration. You will need to change that if "
278278
"you define it in a different module."
279279
msgstr""
280+
"この関数は引数として与えられた文字列をログレベルの数値に変換し、ログレコード"
281+
"内のログレベルが指定されたレベル以下の場合に ``True`` を返す関数を返します。"
282+
"この例では ``filter_maker`` をコマンドラインから実行するテストスクリプト "
283+
"``main.py`` で関数が定義されているため、フィルター設定上のモジュール名は "
284+
"``__main__`` になります。そのためフィルター設定の中では ``__main__."
285+
"filter_maker`` となります。異なるモジュールで関数を定義した場合、この部分を変"
286+
"更する必要があります。"
280287

281288
#:../../howto/logging-cookbook.rst:383
282289
msgid"With the filter added, we can run ``main.py``, which in full is:"
283290
msgstr""
291+
"フィルターを追加した ``main.py`` の全体像は以下のようになり、これで実行できる"
292+
"状態になりました:"
284293

285294
#:../../howto/logging-cookbook.rst:453
286295
msgid"And after running it like this:"
287-
msgstr""
296+
msgstr"これを以下のように実行します:"
288297

289298
#:../../howto/logging-cookbook.rst:459
290299
msgid"We can see the results are as expected:"
291-
msgstr""
300+
msgstr"すると期待通りの結果を得ることができます:"
292301

293302
#:../../howto/logging-cookbook.rst:485
294303
msgid"Configuration server example"
@@ -409,6 +418,14 @@ msgid ""
409418
"application, to use the above approach for logging, so that any blocking "
410419
"code runs only in the ``QueueListener`` thread."
411420
msgstr""
421+
"上述の議論は特に同期コードにについてのものではなく、むしろ遅いロギングハンド"
422+
"ラについてでしたが、非同期コードやネットワーク、あるいはファイルハンドラから"
423+
"のロギングでさえも (イベントループをブロックしてしまう) 問題につながる可能性"
424+
"があることには注意すべきでしょう。これはいくつかのロギングが :mod:`asyncio` "
425+
"内部で行われることが理由です。何らかの非同期コードがアプリケーションの中で使"
426+
"われている場合、ロギングには上記のアプローチを使っていかなるブロッキングコー"
427+
"ドも ``QueueListener`` スレッド内だけで実行されるようにしておくことが最も良い"
428+
"でしょう。"
412429

413430
#:../../howto/logging-cookbook.rst:615
414431
msgid""
@@ -477,7 +494,7 @@ msgstr ""
477494

478495
#:../../howto/logging-cookbook.rst:766
479496
msgid"Running a logging socket listener in production"
480-
msgstr""
497+
msgstr"作成中のロギングソケットのリスナーを実行する"
481498

482499
#:../../howto/logging-cookbook.rst:770
483500
msgid""
@@ -486,78 +503,87 @@ msgid ""
486503
"Gist <socket-listener-gist_>`__ which provides the bare-bones files to run "
487504
"the above functionality using Supervisor. It consists of the following files:"
488505
msgstr""
506+
"作成中のロギングリスナーを実行するためには、 `Supervisor <http://supervisord."
507+
"org/>`_ のようなプロセス管理ツールを使う必要があるかもしれません。 `こちらの "
508+
"Gist <socket-listener-gist_>`__ は Supervisor を使って上記の機能を実行するた"
509+
"めの必要最低限のファイルを提供しています。以下のファイルが必要になります:"
489510

490511
#:../../howto/logging-cookbook.rst:777
491512
msgid"File"
492-
msgstr""
513+
msgstr"ファイル"
493514

494515
#:../../howto/logging-cookbook.rst:777
495516
msgid"Purpose"
496517
msgstr"目的"
497518

498519
#:../../howto/logging-cookbook.rst:779
499520
msgid":file:`prepare.sh`"
500-
msgstr""
521+
msgstr":file:`prepare.sh`"
501522

502523
#:../../howto/logging-cookbook.rst:779
503524
msgid"A Bash script to prepare the environment for testing"
504-
msgstr""
525+
msgstr"試験用の環境を準備する Bash スクリプト"
505526

506527
#:../../howto/logging-cookbook.rst:782
507528
msgid":file:`supervisor.conf`"
508-
msgstr""
529+
msgstr":file:`supervisor.conf`"
509530

510531
#:../../howto/logging-cookbook.rst:782
511532
msgid""
512533
"The Supervisor configuration file, which has entries for the listener and a "
513534
"multi-process web application"
514535
msgstr""
536+
"リスナーとマルチプロセスの web アプリケーションのための設定を含む Supervisor "
537+
"の設定ファイル"
515538

516539
#:../../howto/logging-cookbook.rst:786
517540
msgid":file:`ensure_app.sh`"
518-
msgstr""
541+
msgstr":file:`ensure_app.sh`"
519542

520543
#:../../howto/logging-cookbook.rst:786
521544
msgid""
522545
"A Bash script to ensure that Supervisor is running with the above "
523546
"configuration"
524547
msgstr""
548+
"Supervisor が上記の設定で実行されていることを保証するための Bash スクリプト"
525549

526550
#:../../howto/logging-cookbook.rst:789
527551
msgid":file:`log_listener.py`"
528-
msgstr""
552+
msgstr":file:`log_listener.py`"
529553

530554
#:../../howto/logging-cookbook.rst:789
531555
msgid""
532556
"The socket listener program which receives log events and records them to a "
533557
"file"
534-
msgstr""
558+
msgstr"ログイベントを受信してファイルに記録するソケットリスナープログラム"
535559

536560
#:../../howto/logging-cookbook.rst:792
537561
msgid":file:`main.py`"
538-
msgstr""
562+
msgstr":file:`main.py`"
539563

540564
#:../../howto/logging-cookbook.rst:792
541565
msgid""
542566
"A simple web application which performs logging via a socket connected to "
543567
"the listener"
544568
msgstr""
569+
"リスナーに接続されたソケットを通じてロギングを実行する簡単な web アプリケー"
570+
"ション"
545571

546572
#:../../howto/logging-cookbook.rst:795
547573
msgid":file:`webapp.json`"
548-
msgstr""
574+
msgstr":file:`webapp.json`"
549575

550576
#:../../howto/logging-cookbook.rst:795
551577
msgid"A JSON configuration file for the web application"
552-
msgstr""
578+
msgstr"web アプリケーションのための JSON 設定ファイル"
553579

554580
#:../../howto/logging-cookbook.rst:797
555581
msgid":file:`client.py`"
556-
msgstr""
582+
msgstr":file:`client.py`"
557583

558584
#:../../howto/logging-cookbook.rst:797
559585
msgid"A Python script to exercise the web application"
560-
msgstr""
586+
msgstr"web アプリケーションを起動するための Python スクリプト"
561587

562588
#:../../howto/logging-cookbook.rst:800
563589
msgid""
@@ -567,20 +593,28 @@ msgid ""
567593
"same log file without conflicting with one another --- they all go through "
568594
"the socket listener."
569595
msgstr""
596+
"この web アプリケーションは、リクエストを処理する複数のワーカープロセスを起動"
597+
"する web アプリケーションサーバーである `Gunicorn <https://gunicorn.org/>`_ "
598+
"を使っています。ここに例として挙げた設定は、複数のワーカーがいかにして互いに"
599+
"衝突することなく同じログファイルに書き込みを行うことができるかを示しています "
600+
"--- ワーカーは全てソケットリスナーを通じてログを書き込むのです。"
570601

571602
#:../../howto/logging-cookbook.rst:805
572603
msgid"To test these files, do the following in a POSIX environment:"
573604
msgstr""
605+
"これらのファイルを試すためには、 POSIX 環境において以下を行なってください:"
574606

575607
#:../../howto/logging-cookbook.rst:807
576608
msgid""
577609
"Download `the Gist <socket-listener-gist_>`__ as a ZIP archive using the :"
578610
"guilabel:`Download ZIP` button."
579611
msgstr""
612+
":guilabel:`Download ZIP` ボタンを押して `Gist <socket-listener-gist_>`__ を "
613+
"ZIP アーカイブとしてダウンロードしてください。"
580614

581615
#:../../howto/logging-cookbook.rst:810
582616
msgid"Unzip the above files from the archive into a scratch directory."
583-
msgstr""
617+
msgstr"アーカイブファイルをスクラッチディレクトリに展開してください。"
584618

585619
#:../../howto/logging-cookbook.rst:812
586620
msgid""
@@ -589,18 +623,27 @@ msgid ""
589623
"files, and a :file:`venv` subdirectory to contain a virtual environment into "
590624
"which ``bottle``, ``gunicorn`` and ``supervisor`` are installed."
591625
msgstr""
626+
"準備のために、スクラッチディレクトリにおいて ``bash prepare.sh`` を実行してく"
627+
"ださい。これにより Supervisor 関連のファイルおよびログファイルのための :file:"
628+
"`run` サブディレクトリ、および ``bottle``, ``gunicorn`` そして "
629+
"``supervisor`` がインストールされる仮想環境を含む :file:`venv` サブディレクト"
630+
"リが生成されます。"
592631

593632
#:../../howto/logging-cookbook.rst:817
594633
msgid""
595634
"Run ``bash ensure_app.sh`` to ensure that Supervisor is running with the "
596635
"above configuration."
597636
msgstr""
637+
"``bash ensure_app.sh`` を実行して Supervisor が上記の設定で実行されていること"
638+
"を確認してください。"
598639

599640
#:../../howto/logging-cookbook.rst:820
600641
msgid""
601642
"Run ``venv/bin/python client.py`` to exercise the web application, which "
602643
"will lead to records being written to the log."
603644
msgstr""
645+
"``venv/bin/python client.py`` を実行して web アプリケーションを起動してくださ"
646+
"い。これによりログにレコードが書き込まれるはずです。"
604647

605648
#:../../howto/logging-cookbook.rst:823
606649
msgid""
@@ -609,18 +652,26 @@ msgid ""
609652
"won't be in any particular order, since they have been handled concurrently "
610653
"by different worker processes in a non-deterministic way."
611654
msgstr""
655+
":file:`run` サブディレクトリにあるログファイルを調べてください。最新のログ"
656+
"は、パターン :file:`app.log*` に一致する名前のファイルにあるはずです。ログは"
657+
"異なるワーカープロセスによって非決定論的な形で並行に処理されるため、特定の決"
658+
"まった順番にはなりません。"
612659

613660
#:../../howto/logging-cookbook.rst:828
614661
msgid""
615662
"You can shut down the listener and the web application by running ``venv/bin/"
616663
"supervisorctl -c supervisor.conf shutdown``."
617664
msgstr""
665+
"リスナーと web アプリケーションは ``venv/bin/supervisorctl -c supervisor."
666+
"conf shutdown`` を実行することでシャットダウンできます。"
618667

619668
#:../../howto/logging-cookbook.rst:831
620669
msgid""
621670
"You may need to tweak the configuration files in the unlikely event that the "
622671
"configured ports clash with something else in your test environment."
623672
msgstr""
673+
"ありそうもないことですが、テスト環境で設定したポートが別の設定と衝突してし"
674+
"まった場合、設定ファイルを修正する必要があるかもしれません。"
624675

625676
#:../../howto/logging-cookbook.rst:837
626677
msgid"Adding contextual information to your logging output"
@@ -802,7 +853,7 @@ msgstr "実行すると、以下のようになります:"
802853

803854
#:../../howto/logging-cookbook.rst:996
804855
msgid"Use of ``contextvars``"
805-
msgstr""
856+
msgstr"``contextvars`` の利用"
806857

807858
#:../../howto/logging-cookbook.rst:998
808859
msgid""
@@ -813,6 +864,12 @@ msgid ""
813864
"logs can populated with contextual information such as, for example, request "
814865
"attributes handled by web applications."
815866
msgstr""
867+
"Python 3.7 以降、 :mod:`contextvars` モジュールは :mod:`threading` と :mod:"
868+
"`asyncio` の両方の処理上のニーズを満たすコンテキストローカルな変数を提供して"
869+
"います。このタイプの変数はスレッドローカルな変数に適しています。以下の例は、"
870+
"マルチスレッド環境において、 いかにして web アプリケーションによって処理され"
871+
"るリクエスト属性のような処理の文脈上の情報とともにログを投入できるかを示しま"
872+
"す。"
816873

817874
#:../../howto/logging-cookbook.rst:1004
818875
msgid""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp