org.apache.log4j.net
クラス SMTPAppender

java.lang.Object
  |
  +--org.apache.log4j.AppenderSkeleton
        |
        +--org.apache.log4j.net.SMTPAppender
すべての実装インタフェース:
Appender, OptionHandler

public class SMTPAppender
extends AppenderSkeleton

Send an e-mail when a specific logging event occurs, typically on errors or fatal errors.

指定したロギングイベントが、一般的には、エラーまたは致命的エラー上で発生した時、電子メールを送信します。

The number of logging events delivered in this e-mail depend on the value of BufferSize option. The SMTPAppender keeps only the last BufferSize logging events in its cyclic buffer. This keeps memory requirements at a reasonable level while still delivering useful application context.

この電子メールに出力されるロギングイベントの数は、BufferSize オプションの値により決まります。 SMTPAppender は、循環バッファ内に最終的な BufferSizeのロギングイベントを保持します。 これにより、有効なアプリケーションのコンテキストを書き込む間、納得のいくレベルでメモリを要求し続けます。

導入されたバージョン:
1.0
作成者:
Ceki Gülcü

フィールドの概要
static String BUFFER_SIZE_OPTION
          推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant will be removed in the near term.

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

protected  CyclicBuffer cb
           
protected  TriggeringEventEvaluator evaluator
           
static String EVALUATOR_CLASS_OPTION
          推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant will be removed in the near term.

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

protected  javax.mail.Message msg
           
static String SMTP_HOST_OPTION
          推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant will be removed in the near term.

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

 
クラス org.apache.log4j.AppenderSkeleton から継承したフィールド
closed, errorHandler, headFilter, layout, name, tailFilter, threshold, THRESHOLD_OPTION
 
コンストラクタの概要
SMTPAppender()
          The default constructor will instantiate the appender with a TriggeringEventEvaluator that will trigger on events with priority ERROR or higher.
SMTPAppender(TriggeringEventEvaluator evaluator)
          Use evaluator passed as parameter as the TriggeringEventEvaluator for this SMTPAppender.
 
メソッドの概要
 void activateOptions()
          Activate the specified options, such as the smtp host, the recipient, from, etc.
 void append(LoggingEvent event)
          Perform SMTPAppender specific appending actions, mainly adding the event to a cyclic buffer and checking if the event triggers an e-mail to be sent.
protected  boolean checkEntryConditions()
          This method determines if there is a sense in attempting to append.
 void close()
          Release any resources allocated within the appender such as file handles, network connections, etc.
 int getBufferSize()
          Returns value of the BufferSize option.
 String getEvaluatorClass()
          Returns value of the EvaluatorClass option.
 String getFrom()
          Returns value of the From option.
 boolean getLocationInfo()
          Returns value of the LocationInfo option.
 String[] getOptionStrings()
          推奨されていません。 We now use JavaBeans introspection to configure components. Options strings are no longer needed.

今日、私たちは、コンポーネントの設定には、JavaBeansのイントロスペクションを使用します。 オプション文字列は、もう必要ありません。

 String getSMTPHost()
          Returns value of the SMTPHost option.
 String getSubject()
          Returns value of the Subject option.
 String getTo()
          Returns value of the To option.
 boolean requiresLayout()
          The SMTPAppender requires a layout.
protected  void sendBuffer()
          Send the contents of the cyclic buffer as an e-mail message.
 void setBufferSize(int bufferSize)
          The BufferSize option takes a positive integer representing the maximum number of logging events to collect in a cyclic buffer.
 void setEvaluatorClass(String value)
          The EvaluatorClass option takes a string value representing the name of the class implementing the TriggeringEventEvaluator interface.
 void setFrom(String from)
          The From option takes a string value which should be a e-mail address of the sender.
 void setLocationInfo(boolean locationInfo)
          The LocationInfo option takes a boolean value.
 void setOption(String option, String value)
          Set option to value.
 void setSMTPHost(String smtpHost)
          The SMTPHost option takes a string value which should be a the host name of the SMTP server that will send the e-mail message.
 void setSubject(String subject)
          The Subject option takes a string value which should be a the subject of the e-mail message.
 void setTo(String to)
          The To option takes a string value which should be a comma separated list of e-mail address of the recipients.
 
クラス org.apache.log4j.AppenderSkeleton から継承したメソッド
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
 
クラス java.lang.Object から継承したメソッド
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

cb

protected CyclicBuffer cb

msg

protected javax.mail.Message msg

TO_OPTION

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

A string constant used in naming the To field of outgoing e-mail output file. Current value of this string constant is To.

送信する電子メールの出力ファイルのToフィールドを指定する時に使用される文字列定数です。 この文字列定数の現在の値は、Toです。

Note that all option keys are case sensitive.

全てのオプションキーは、大文字と小文字をすることに気をつけてください。


FROM_OPTION

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

A string constant used in naming the From field of outgoing e-mail output file. Current value of this string constant is From.

送信する電子メールの出力ファイルのFromフィールドを指定する時に使用される文字列定数です。 この文字列定数の現在の値は、Fromです。

Note that all option keys are case sensitive.

全てのオプションキーは、大文字と小文字をすることに気をつけてください。


SUBJECT_OPTION

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

A string constant used in naming the Subject field of outgoing e-mail output file. Current value of this string constant is Subject.

送信する電子メールの出力ファイルのSubjectフィールドを指定する時に使用される文字列定数です。 この文字列定数の現在の値は、Subjectです。

Note that all option keys are case sensitive.

全てのオプションキーは、大文字と小文字をすることに気をつけてください。


SMTP_HOST_OPTION

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

A string constant used in naming the SMTP host that will be contacted to send the e-mail. Current value of this string constant is SMTPHost.

電子メールを送信するために接続されるSMTPホストを指定する時に使用される文字列定数です。 この文字列定数の現在の値は、SMTPHostです。

Note that all option keys are case sensitive.

全てのオプションキーは、大文字と小文字をすることに気をつけてください。


BUFFER_SIZE_OPTION

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

A string constant used in naming the cyclic buffer size option. Current value of this string constant is BufferSize.

循環バッファのサイズオプションを指定する時に使用される文字列定数です。 この文字列の現在の値は、BufferSizeです。

Note that all option keys are case sensitive.

全てのオプションキーは、大文字と小文字をすることに気をつけてください。


EVALUATOR_CLASS_OPTION

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

A string constant used in naming the class of the TriggeringEventEvaluator that this SMTPApepdner wll use. Current value of this string constant is EvaluatorClass.

この SMTPAppender が使用する TriggeringEventEvaluator のクラスを指定する時に使用される文字列定数です。 この文字列定数の現在の値は、EvaluatorClassです。

Note that all option keys are case sensitive.

全てのオプションキーは、大文字と小文字をすることに気をつけてください。


LOCATION_INFO_OPTION

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

今日、オプションは、JavaBeansパラダイムを使用して処理されます。 この定数は、近いうちに削除されるでしょう。

A string constant used in naming the option for setting the the location information flag. Current value of this string constant is LocationInfo.

位置情報フラグを設定するためのオプションを指定する時に使用される文字列定数です。 この文字列定数の現在の値は、LocationInfoです。

Note that all option keys are case sensitive.

全てのオプションキーは、大文字と小文字をすることに気をつけてください。


evaluator

protected TriggeringEventEvaluator evaluator
コンストラクタの詳細

SMTPAppender

public SMTPAppender()
The default constructor will instantiate the appender with a TriggeringEventEvaluator that will trigger on events with priority ERROR or higher.

デフォルトのコンストラクタは、ERRORまたはそれ以上の優先度をもつイベントでトリガーとなるように TriggeringEventEvaluator を使ってアペンダを生成します。


SMTPAppender

public SMTPAppender(TriggeringEventEvaluator evaluator)
Use evaluator passed as parameter as the TriggeringEventEvaluator for this SMTPAppender.

このSMTPAppenderに対する TriggeringEventEvaluator のように、パラメタとして渡された evaluator を使用します。

メソッドの詳細

getOptionStrings

public String[] getOptionStrings()
推奨されていません。 We now use JavaBeans introspection to configure components. Options strings are no longer needed.

今日、私たちは、コンポーネントの設定には、JavaBeansのイントロスペクションを使用します。 オプション文字列は、もう必要ありません。

Retuns the option names for this component in addition in addition to the options of its super class AppenderSkeleton.

親クラス AppenderSkeleton のオプションに追加するための、このコンポーネントに関するオプション名を返します。

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

activateOptions

public void activateOptions()
Activate the specified options, such as the smtp host, the recipient, from, etc.

smtpホストや、宛先、差出人などのような指定したオプションを有効にします。

オーバーライド:
クラス AppenderSkeleton 内の activateOptions

append

public void append(LoggingEvent event)
Perform SMTPAppender specific appending actions, mainly adding the event to a cyclic buffer and checking if the event triggers an e-mail to be sent.

SMTPAppender の指定した追加アクションを実行します。 主に、循環バッファにイベントを追加し、そのイベントが電子メール送信のトリガーとなるかどうかをチェックします。

オーバーライド:
クラス AppenderSkeleton 内の append

checkEntryConditions

protected boolean checkEntryConditions()
This method determines if there is a sense in attempting to append.

このメソッドは、追加するのに相応しいかどうか決定する。

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 が返されます。


close

public void close()
インタフェース Appender の記述:
Release any resources allocated within the appender such as file handles, network connections, etc.

ファイルハンドルや、ネットワークのコネクションなどの、アペンダー内に位置づけられたリソースを開放します。

It is a programming error to append to a closed appender.

閉じたアペンダーに追加しようとするとプログラミングエラーになります。


getTo

public String getTo()
Returns value of the To option.

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


requiresLayout

public boolean requiresLayout()
The SMTPAppender requires a layout.

SMTPAPpender は、layout を要求します。


sendBuffer

protected void sendBuffer()
Send the contents of the cyclic buffer as an e-mail message.

電子メールのメッセージとして、循環バッファの内容を送信します。


getEvaluatorClass

public String getEvaluatorClass()
Returns value of the EvaluatorClass option.

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


getFrom

public String getFrom()
Returns value of the From option.

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


getSubject

public String getSubject()
Returns value of the Subject option.

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


setOption

public void setOption(String option,
                      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()が呼ばれる時にだけ有効になります。

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

setFrom

public void setFrom(String from)
The From option takes a string value which should be a e-mail address of the sender.

Fromオプションは、文字列値を取り、差出人の電子メールアドレスである必要があります。


setSubject

public void setSubject(String subject)
The Subject option takes a string value which should be a the subject of the e-mail message.

Subjectオプションは、文字列値をとり、電子メールメッセージの件名である必要があります。


setBufferSize

public void setBufferSize(int bufferSize)
The BufferSize option takes a positive integer representing the maximum number of logging events to collect in a cyclic buffer. When the BufferSize is reached, oldest events are deleted as new events are added to the buffer. By default the size of the cyclic buffer is 512 events. BufferSize オプションは、循環バッファに収集したロギングイベントの最大数を表す正の整数をとります。 BufferSize が最大値に到達した時は、新規イベントがバッファに追加されため、最も古いイベントは削除されます。 デフォルトで、循環バッファのサイズは、512イベントです。

setSMTPHost

public void setSMTPHost(String smtpHost)
The SMTPHost option takes a string value which should be a the host name of the SMTP server that will send the e-mail message.

SMTPHostオプションは、文字列値を取り、電子メールメッセージを送るSMTPサーバの名前である必要があります。


getSMTPHost

public String getSMTPHost()
Returns value of the SMTPHost option.

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


setTo

public void setTo(String to)
The To option takes a string value which should be a comma separated list of e-mail address of the recipients.

Toオプションは、文字列値をとり、宛先の電子メールアドレスのカンマ区切りのリストである必要があります。


getBufferSize

public int getBufferSize()
Returns value of the BufferSize option.

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


setEvaluatorClass

public void setEvaluatorClass(String value)
The EvaluatorClass option takes a string value representing the name of the class implementing the TriggeringEventEvaluator interface. A corresponding object will be instantiated and assigned as the triggering event evaluator for the SMTPAppender.

EvaluatorClassオプションは、TriggeringEventEvaluator インタフェースを実装しているクラス名を表す、文字列値をとります。 一致するオブジェクトがインスタンス化され、SMTPAppender のトリガーイベントの評価機構として割り当てられます。


setLocationInfo

public void setLocationInfo(boolean locationInfo)
The LocationInfo option takes a boolean value. By default, it is set to false which means there will be no effort to extract the location information related to the event. As a result, the layout that formats the events as they are sent out in an e-mail is likely to place the wrong location information (if present in the format).

LocationInfoオプションは、論理値をとります。 デフォルトでは、falseに設定され、そのイベントに関連する位置情報を抽出する動作を行わないことを意味します。 結果として、電子メール内に送出されるイベントをフォーマットするレイアウトは、(もし、フォーマット内に位置情報に関する記述があれば)間違った位置情報を出力するおそれがあります。

Location information extraction is comparatively very slow and should be avoided unless performance is not a concern.

位置情報を抽出するのは、比較にならないほど遅く、パフォーマンスを気にするようなら使用は避けるべきです。


getLocationInfo

public boolean getLocationInfo()
Returns value of the LocationInfo option.

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



Please notify me about new log4j releases.