org.apache.log4j
クラス TTCCLayout

java.lang.Object
  |
  +--org.apache.log4j.Layout
        |
        +--org.apache.log4j.helpers.DateLayout
              |
              +--org.apache.log4j.TTCCLayout
すべての実装インタフェース:
OptionHandler

public class TTCCLayout
extends DateLayout

TTCC layout format consists of time, thread, category and nested diagnostic context information, hence the name.

TTCCレイアウトのフォーマットは、時間とスレッド、カテゴリとネスト化診断コンテキスト情報、そして名前から成り立っています。

Each of the four fields can be individually enabled or disabled. The time format depends on the DateFormat used.

4つのフィールドはそれぞれ、独自で許可、不許可を設定できます。 時間のフォーマットは、利用されるDateFormatに依存します。

Here is an example TTCCLayout output with the RelativeTimeDateFormat.

ここでの例は、RelativeTimeDateFormatを使ってTTCCLayoutの出力を行います。

176 [main] INFO  org.apache.log4j.examples.Sort - Populating an array of 2 elements in reverse order.
225 [main] INFO  org.apache.log4j.examples.SortAlgo - Entered the sort method.
262 [main] DEBUG org.apache.log4j.examples.SortAlgo.OUTER i=1 - Outer loop.
276 [main] DEBUG org.apache.log4j.examples.SortAlgo.SWAP i=1 j=0 - Swapping intArray[0] = 1 and intArray[1] = 0
290 [main] DEBUG org.apache.log4j.examples.SortAlgo.OUTER i=0 - Outer loop.
304 [main] INFO  org.apache.log4j.examples.SortAlgo.DUMP - Dump of interger array:
317 [main] INFO  org.apache.log4j.examples.SortAlgo.DUMP - Element [0] = 0
331 [main] INFO  org.apache.log4j.examples.SortAlgo.DUMP - Element [1] = 1
343 [main] INFO  org.apache.log4j.examples.Sort - The next log statement should be an error message.
346 [main] ERROR org.apache.log4j.examples.SortAlgo.DUMP - Tried to dump an uninitialized array.
at org.apache.log4j.examples.SortAlgo.dump(SortAlgo.java:58)
at org.apache.log4j.examples.Sort.main(Sort.java:64)
467 [main] INFO  org.apache.log4j.examples.Sort - Exiting main method.

The first field is the number of milliseconds elapsed since the start of the program. The second field is the thread outputting the log statement. The third field is the priority, the fourth field is the category to which the statement belongs.

最初のフィールドは、プログラムが開始してからの経過時間を表すミリ秒の番号です。 2番目のフィールドは、ログステートメントを出力するスレッドです。 3番目のフィールドは、優先度、そして、4番目のフィールドは、ステートメントが属する カテゴリとなります。

The fifth field (just before the '-') is the nested diagnostic context. Note the nested diagnostic context may be empty as in the first two statements. The text after the '-' is the message of the statement.

5番目のフィールド(ちょうど'-'の前)は、ネスト化診断コンテキストです。 ネスト化診断コンテキストは最初の2つのステートメントように空である可能性が あることを念頭においてください。 '-'の後のテキストは、ステートメントのメッセージです。

WARNING Do not use the same TTCCLayout instance from within different appenders. The TTCCLayout is not thread safe when used in his way. However, it is perfectly safe to use a TTCCLayout instance from just one appender.

警告 異なるアペンダ間で同じTTCCLayoutのインスタンスを使わないようにしてください。 TTCCLayoutは、自分自身で使われている時スレッドセーフではありません。 しかし、まさに一つのアペンダからTTCCLayoutのインスタンスを使うのは、全く安全です。

PatternLayout offers a much more flexible alternative.

PatternLayoutは、最も融通の利く選択肢を与えてくれます。

作成者:
Ceki Gülcü, Heinz Richter

フィールドの概要
protected  StringBuffer buf
           
static String CATEGORY_PREFIXING_OPTION
          推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

今日、オプションは、JavaBeansのパラダイムを使って処理されます。 この定数は、今後必要なくなり、近いうちに削除される予定です。

static String CONTEXT_PRINTING_OPTION
          推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

今日、オプションは、JavaBeansのパラダイムを使って処理されます。 この定数は、今後必要なくなり、近いうちに削除される予定です。

static String THREAD_PRINTING_OPTION
          推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

今日、オプションは、JavaBeansのパラダイムを使って処理されます。 この定数は、今後必要なくなり、近いうちに削除される予定です。

 
クラス org.apache.log4j.helpers.DateLayout から継承したフィールド
date, DATE_FORMAT_OPTION, dateFormat, NULL_DATE_FORMAT, pos, RELATIVE_TIME_DATE_FORMAT, TIMEZONE_OPTION
 
クラス org.apache.log4j.Layout から継承したフィールド
LINE_SEP, LINE_SEP_LEN
 
コンストラクタの概要
TTCCLayout()
          Instantiate a TTCCLayout object with RelativeTimeDateFormat as the date formatter in the local time zone.
TTCCLayout(String dateFormatType)
          Instantiate a TTCCLayout object using the local time zone.
 
メソッドの概要
 String format(LoggingEvent event)
          In addition to the priority of the statement and message, the returned byte array includes time, thread, category and NDC information.
 boolean getCategoryPrefixing()
          Returns value of the CategoryPrefixing option.
 boolean getContextPrinting()
          Returns value of the ContextPrinting option.
 String[] getOptionStrings()
          Return list of strings that the OptionHandler instance recognizes.
 boolean getThreadPrinting()
          Returns value of the ThreadPrinting option.
 boolean ignoresThrowable()
          The TTCCLayout does not handle the throwable contained within LoggingEvents.
 void setCategoryPrefixing(boolean categoryPrefixing)
          The CategoryPrefixing option specifies whether Category name is part of log output or not.
 void setContextPrinting(boolean contextPrinting)
          The ContextPrinting option specifies log output will include the nested context information belonging to the current thread.
 void setOption(String key, String value)
          Set option to value.
 void setThreadPrinting(boolean threadPrinting)
          The ThreadPrinting option specifies whether the name of the current thread is part of log output or not.
 
クラス org.apache.log4j.helpers.DateLayout から継承したメソッド
activateOptions, dateFormat, getDateFormat, getTimeZone, setDateFormat, setDateFormat, setDateFormat, setTimeZone
 
クラス org.apache.log4j.Layout から継承したメソッド
getContentType, getFooter, getHeader
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

THREAD_PRINTING_OPTION

public static final String THREAD_PRINTING_OPTION
推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

今日、オプションは、JavaBeansのパラダイムを使って処理されます。 この定数は、今後必要なくなり、近いうちに削除される予定です。


CATEGORY_PREFIXING_OPTION

public static final String CATEGORY_PREFIXING_OPTION
推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

今日、オプションは、JavaBeansのパラダイムを使って処理されます。 この定数は、今後必要なくなり、近いうちに削除される予定です。


CONTEXT_PRINTING_OPTION

public static final String CONTEXT_PRINTING_OPTION
推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

今日、オプションは、JavaBeansのパラダイムを使って処理されます。 この定数は、今後必要なくなり、近いうちに削除される予定です。


buf

protected final StringBuffer buf
コンストラクタの詳細

TTCCLayout

public TTCCLayout()
Instantiate a TTCCLayout object with RelativeTimeDateFormat as the date formatter in the local time zone.

ローカルタイムゾーンで日付フォーマッタとして RelativeTimeDateFormatを 使って、TTCCLayoutオブジェクトを生成します。

導入されたバージョン:
0.7.5

TTCCLayout

public TTCCLayout(String dateFormatType)
Instantiate a TTCCLayout object using the local time zone. The DateFormat used will depend on the dateFormatType.

ローカルのタイムゾーンを使ってTTCCLayoutオブジェクトのインスタンスを 生成します。使用されるDateFormatは、dateFormatTypeに 依存します。

This constructor just calls the DateLayout.setDateFormat(java.lang.String) method.

このコンストラクタはまさに DateLayout.setDateFormat(java.lang.String)メソッドを呼び出します。

メソッドの詳細

getOptionStrings

public String[] getOptionStrings()
推奨されていません。 Use the setter method for the option directly instead of the generic setOption method.

一般的な setOptionメソッドを使う代わりに、直接オプションの ためのセッタメソッドを使います。

インタフェース OptionHandler の記述:
Return list of strings that the OptionHandler instance recognizes.

OptionHandlerインスタンスが認識する文字列のリストを返します。

オーバーライド:
クラス DateLayout 内の getOptionStrings

setOption

public void setOption(String key,
                      String value)
推奨されていません。 Use the setter method for the option directly instead of the generic setOption method.

一般的な setOptionメソッドを使う代わりに、直接オプションの ためのセッタメソッドを使います。

インタフェース OptionHandler の記述:
Set option to value.

オプション に設定します。

The handling of each option depends on the OptionHandler instance. Some options may become active immediately whereas other may be activated only when OptionHandler.activateOptions() is called.

各オプションの処理は、OptionHandlerのインスタンスに依存します。 いくつかのオプションは、直ぐに有効になりますが、その他は OptionHandler.activateOptions()が呼ばれる時にだけ有効になります。

オーバーライド:
クラス DateLayout 内の setOption

setThreadPrinting

public void setThreadPrinting(boolean threadPrinting)
The ThreadPrinting option specifies whether the name of the current thread is part of log output or not. This is true by default.

ThreadPrintingオプションは、現在のスレッド名名がログ出力の 一部分かそうでないかを指定します。これは、デフォルトで true です。


getThreadPrinting

public boolean getThreadPrinting()
Returns value of the ThreadPrinting option.

ThreadPrintingオプションの値を返します。


setCategoryPrefixing

public void setCategoryPrefixing(boolean categoryPrefixing)
The CategoryPrefixing option specifies whether Category name is part of log output or not. This is true by default.

CategoryPrefixingオプションは、Category名がログ出力の 一部分かそうでないかを指定します。これは、デフォルトで true です。


getCategoryPrefixing

public boolean getCategoryPrefixing()
Returns value of the CategoryPrefixing option.

CategoryPrefixingオプションの値を返します。


setContextPrinting

public void setContextPrinting(boolean contextPrinting)
The ContextPrinting option specifies log output will include the nested context information belonging to the current thread. This is true by default.

ContextPrintingオプションは、ログの出力が現在のスレッドに 属するネスト化診断コンテキストを含むかどうかを指定します。 これは、デフォルトで true です。


getContextPrinting

public boolean getContextPrinting()
Returns value of the ContextPrinting option.

ContextPrintingオプションの値を返します。


format

public String format(LoggingEvent event)
In addition to the priority of the statement and message, the returned byte array includes time, thread, category and NDC information.

ステートメントとメッセージの優先度に追加して、返されるバイトの配列には、 時間とスレッド、カテゴリそして情報が含まれます。

Time, thread, category and diagnostic context are printed depending on options.

時間とスレッド、カテゴリそして診断コンテキストは、オプションに依存し、 出力されます。

オーバーライド:
クラス Layout 内の format
パラメータ:
category -

category

priority -

priority

message -

message


ignoresThrowable

public boolean ignoresThrowable()
The TTCCLayout does not handle the throwable contained within LoggingEvents. Thus, it returns true.

TTCCLayoutは、LoggingEvents内に含まれるthrowableを 処理しません。したがって、trueを返します。

オーバーライド:
クラス Layout 内の ignoresThrowable
導入されたバージョン:
version 0.8.4


Please notify me about new log4j releases.