|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Object
|
+--org.apache.log4j.AppenderSkeleton
|
+--org.apache.log4j.WriterAppender
WriterAppender appends log events to a Writer or an
OutputStream depending on the user's choice.
WriterAppender は、ユーザの選択により、Writer または OutputStream にログイベントを追加します。
| フィールドの概要 | |
static String |
IMMEDIATE_FLUSH_OPTION
推奨されていません。 We now use JavaBeans introspection to configure components. Options strings are no longer needed. 私たちは、コンポーネントを設定するために、現時点では、JavaBeansのイントロスペクションを利用します。 オプション文字列は、今後必要なくなります。 |
protected boolean |
immediateFlush
Immediate flush means that the underlying writer or output stream will be flushed at the end of each append operation. |
protected QuietWriter |
qw
This is the quietWriter where we will write
to.
|
| クラス org.apache.log4j.AppenderSkeleton から継承したフィールド |
closed, errorHandler, headFilter, layout, name, tailFilter, threshold, THRESHOLD_OPTION |
| コンストラクタの概要 | |
WriterAppender()
This default constructor does nothing. |
|
WriterAppender(Layout layout,
OutputStream os)
Instantiate a WriterAppender and set the output destination to a new OutputStreamWriter initialized with os
as its OutputStream.
|
|
WriterAppender(Layout layout,
Writer writer)
Instantiate a WriterAppender and set the output destination to writer.
|
|
| メソッドの概要 | |
void |
activateOptions()
Does nothing. |
void |
append(LoggingEvent event)
This method is called by the AppenderSkeleton.doAppend(org.apache.log4j.spi.LoggingEvent)
method.
|
protected boolean |
checkEntryConditions()
This method determines if there is a sense in attempting to append. |
void |
close()
Close this appender instance. |
protected void |
closeWriter()
Close the underlying Writer.
|
boolean |
getImmediateFlush()
Returns value of the ImmediateFlush option. |
String[] |
getOptionStrings()
推奨されていません。 We now use JavaBeans introspection to configure components. Options strings are no longer needed. 私たちは、コンポーネントを設定するために、現時点では、JavaBeansのイントロスペクションを使います。 オプション文字列は、今後必要なくなります。 |
boolean |
requiresLayout()
The WriterAppender requires a layout. |
protected void |
reset()
Clear internal references to the writer and other variables. |
void |
setErrorHandler(ErrorHandler eh)
Set the ErrorHandler for this FileAppender and also the
underlying QuietWriter if any.
|
void |
setImmediateFlush(boolean value)
If the ImmediateFlush option is set to true, the appender will flush at the end of each
write. |
void |
setOption(String key,
String value)
Set option to value.
|
void |
setWriter(Writer writer)
Sets the Writer where the log output will go. |
protected void |
subAppend(LoggingEvent event)
Actual writing occurs here. |
protected void |
writeFooter()
Write a footer as produced by the embedded layout's Layout.getFooter() method.
|
protected void |
writeHeader()
Write a header as produced by the embedded layout's Layout.getHeader() method.
|
| クラス org.apache.log4j.AppenderSkeleton から継承したメソッド |
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setLayout, setName, setThreshold |
| クラス java.lang.Object から継承したメソッド |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| フィールドの詳細 |
public static final String IMMEDIATE_FLUSH_OPTION
私たちは、コンポーネントを設定するために、現時点では、JavaBeansのイントロスペクションを利用します。 オプション文字列は、今後必要なくなります。
各追加オペレーションの最後で、出力ストリームをすぐにフラッシュしたい場合のオプションに指定する時に使う文字列定数です。
Note that all option keys are case sensitive.
全てのオプションキーは、大文字と小文字の区別をするのに気をつけてください。
protected boolean immediateFlush
immediateFlush is set to
false, then there is a good chance that the last few
logs events are not actually written to persistent media if and
when the application crashes.
早急のフラッシュとは、生成されたライターまたは出力ストリームが各対かオペレーションの最後でフラッシュするということを意味しています。
早急なフラッシュは、遅いですが、各追加要求が実際に書き出されたことを保証します。
immediateFlushがfalseに設定されている場合、アプリケーションがクラッシュした時、最後の残りのログイベントが実際には、永続性を保つメディアへの書き込みがされないというよい面があります。
The immediateFlush variable is set to
true by default.
デフォルトでは、immediateFlush変数は、trueに設定されています。
protected QuietWriter qw
quietWriter where we will write
to.
これは、私たちが書き込む quietWriter です。
| コンストラクタの詳細 |
public WriterAppender()
このデフォルトのコンストラクタは、何も行いません。
public WriterAppender(Layout layout,
OutputStream os)
OutputStreamWriter initialized with os
as its OutputStream.
WriterAppender をインスタンス化し、OutputStream としての os を使って新しく初期化される OutputStream を出力先として設定します。
public WriterAppender(Layout layout,
Writer writer)
writer.
WriterAppenderをインスタンス化し、writer を出力先として設定します。
The writer must have been previously opened by
the user.
writer は、ユーザにより使う前にオープンされている必要があります。
| メソッドの詳細 |
public void setImmediateFlush(boolean value)
true, the appender will flush at the end of each
write. This is the default behavior. If the option is set to
false, then the underlying stream can defer writing
to physical medium to a later time.
もし、immediateFlush オプションが true に設定されている場合、アペンダは、各書き込みの最後でフラッシュします。
もし、オプションが false に設定されている場合、その時は、生成されたストリームは、物理的なメディアへの書き込みを後にのばします。
Avoiding the flush operation at the end of each append results in a performance gain of 10 to 20 percent. However, there is safety tradeoff involved in skipping flushing. Indeed, when flushing is skipped, then it is likely that the last few log events will not be recorded on disk when the application exits. This is a high price to pay even for a 20% performance gain.
各追加の最後でフラッシュ処理をしないことで、10から20パーセントパフォーマンスが上昇するという結果をもたらします。 しかし、安全なトレードオフは、フラッシングをスキップすることでおこります。 実際、フラッシュがスキップされると、アプリケーションが生きている時でも、最後の残りのログイベントがディスクに記録されないということがありえます。 これは、20%のパフォーマンス上昇と引換に払う高い代償ともいえます。
public boolean getImmediateFlush()
ImmediateFlush オプションの値を返します。
public void activateOptions()
何もしません。
AppenderSkeleton 内の activateOptionspublic void append(LoggingEvent event)
AppenderSkeleton.doAppend(org.apache.log4j.spi.LoggingEvent)
method.
このメソッドは、AppenderSkeleton.doAppend(org.apache.log4j.spi.LoggingEvent) メソッドにより呼ばれます。
If the output stream exists and is writable then write a log
statement to the output stream. Otherwise, write a single warning
message to System.err.
もし、出力ストリームが存在し、書き込みが可能であれば、出力ストリームにログステートメントを書き込みます。
そうでなければ、System.err に単独の警告メッセージを書き込みます。
The format of the output will depend on this appender's layout.
出力のフォーマットは、このアペンダのレイアウトにしたがいます。
AppenderSkeleton 内の appendprotected boolean checkEntryConditions()
It checks whether there is a set output target and also if
there is a set layout. If these checks fail, then the boolean
value false is returned.
セットした出力のターゲットが存在するか、また、セットしたレイアウトが存在するかをチェックします。
もしこれらのチェックが失敗した場合、論理値 false が返されます。
public void close()
このアペンダのインスタンスをクローズします。 生成されているストリームまたはライタもクローズします。
Closed appenders cannot be reused.
クローズされたアペンダは、再利用できません。
setWriter(java.io.Writer)protected void closeWriter()
Writer.
生成された、Writer をクローズします。
public String[] getOptionStrings()
私たちは、コンポーネントを設定するために、現時点では、JavaBeansのイントロスペクションを使います。 オプション文字列は、今後必要なくなります。
このコンポーネントのオプション名を返します。
AppenderSkeleton 内の getOptionStringspublic void setErrorHandler(ErrorHandler eh)
ErrorHandler for this FileAppender and also the
underlying QuietWriter if any.
FileAppenderが要求する ErrorHandler と あれば 生成された QuietWriter を設定します。
AppenderSkeleton 内の setErrorHandler
public void setOption(String key,
String value)
setOption method.
汎用的な、setOption メソッドを使う代わりに、オプションに関しては、直接セッタメソッドを使います。
OptionHandler の記述: 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()が呼ばれる時にだけ有効になります。
AppenderSkeleton 内の setOptionpublic void setWriter(Writer writer)
Sets the Writer where the log output will go. The specified Writer must be opened by the user and be writable.
ログの出力が行われる場合のライタを設定します。 その指定されたライタは、ユーザによりオープンされている必要があり、書き込み可能でなくては、なりません。
The java.io.Writer will be closed when the
appender instance is closed.
java.io.Writer は、アペンダのインスタンスがクローズした時にクローズされます。
WARNING: Logging to an unopened Writer will fail.
注意: オープンされていないライタへのロギング処理は、失敗するでしょう。
Writer - An already opened Writer.
Writer すでにオープンされたライタ
protected void subAppend(LoggingEvent event)
実際の書き込みは、ここで行われます。
Most subclasses of WriterAppender will need to
override this method.
ほとんどの WriterAppender のサブクラスは、このメソッドをオーバーライドする必要があります。
public boolean requiresLayout()
true.
WriterAppender は、レイアウトを要求します。
従って、このメソッドは、true を返します。
protected void reset()
ライタと他の変数たちへの内部参照をクリアします。
Subclasses can override this method for an alternate closing behavior.
サブクラスは、相互のクローズの振る舞いを行うために、このメソッドをオーバーライドします。
protected void writeFooter()
Layout.getFooter() method.
組み込まれたレイアウトの Layout.getHeader() メソッドにより作成されるようなフッタを書き込みます。
protected void writeHeader()
Layout.getHeader() method.
組み込まれたレイアウトの Layout.getHeader() メソッドにより作成されるようなヘッダを書き込みます。
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||