• Showing Page History #80334

Show page source of OutputLog_Interaction #80342

[[PageNavi(NavigationList)]]

=== ログ出力時の処理の流れ(概念的なもの) ===
 ここでは、[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html log4cpp::Category]クラスの[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#a763caceab3981c2e06811c29655b361b log]メソッド(あるいは優先度ごとに用意されたメソッド、すなわち、[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#aafa1ca0c9d57f9f87eae8628e89c5950 debug]、[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#ad218a5e279fc9b15a076bf62503f37b4 info]、[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#a5a4ba8063d108e275affa4aca5aec4ef notice]、[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#a9c372f41858234fe5ab0cfe94cfdb94a warn]、[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#a90d7771a3113219532878f1fea554afe error]、[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#acf854aca1676ede517914bf5185fc36d crit]、[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#aca8a704d6397ac3a4300966a6142460c alert]、[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#a3663faf2ad6873c3da8cdfef5780277a emerg]、[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#a249d46ce876a4af55a25226255e626fa fatal])を呼んだときにどのような流れで実際にログ出力が行われるかを説明します。

[[Thumb(outputLog_interaction.jpg, size=large, caption=図1 ログ出力時の処理の流れ)]]

 図1はログ出力時の処理の流れをUML2.0のシーケンス図で表記したものです。[[BR]]
細かい部分は省いています。実際には、Category::log()が呼ばれると、
 [http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#a763caceab3981c2e06811c29655b361b Category::log()][[BR]]
 →引数で渡された優先度のログがCategoryが出力対象としているかチェック[[BR]]
 →[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#a2020a52bc0abfa16f6c2f879791ca4ef Category::_logUnconditionally()]を呼び出し[[BR]]
  →[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#a77265549183a4f2fc9ecea8da5aec8b4 Category::_logUnconditionally2()]を呼び出し[[BR]]
   →[http://log4cpp-jp.sourceforge.jp/api/structlog4cpp_1_1LoggingEvent.html LoggingEvent]を生成[[BR]]
   →[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Category.html#ac07af8f9e1f8342dce0a437c6ad9764f Category::callAppenders()]を呼び出し[[BR]]
    →Category::_appenderSetMutexをロック(図1のcritical複合フラグメントの部分)[[BR]]
    →Categoryが持つ全appenderに対して[http://log4cpp-jp.sourceforge.jp/api/classlog4cpp_1_1Appender.html#ad867da8a98bfee7e7aa9ade86044a1d6 doAppend()]を呼び出し[[BR]]
    →additivityがtrue(かつ、親カテゴリがある(今のカテゴリがルートカテゴリではない))の場合、親のCategoryに対しcallAppenders()を呼び出し

という感じなのですが、図1ではさすがにここまで記述していません。

[[PageNavi(NavigationList)]]