org.apache.commons.logging
インタフェース Log

既知の実装クラスの一覧:
Jdk14Logger, Log4JCategoryLog, Log4JLogger, LogKitLogger, NoOpLog, SimpleLog

public interface Log

ログ処理の API を抽象化したシンプルなログ処理のインタフェースです。 このインタフェースを実装したクラスには、 LogFactory によって正しくインスタンス化を行えるようにするために、このログの「名前」を表す単独の String を引数として持つコンストラクタがなければなりません。

A simple logging interface abstracting logging APIs. In order to be instantiated successfully by {@link LogFactory}, classes that implement this interface must have a constructor that takes a single String parameter representing the "name" of this Log.

Log で使用される6つのログレベルは(順番に)以下のようになります。

The six logging levels used by Log are (in order):
  1. trace (最も軽微)
  2. debug
  3. info
  4. warn
  5. error
  6. fatal (最も重大)
  1. trace (the least serious)
  2. debug
  3. info
  4. warn
  5. error
  6. fatal (the most serious)
これらのログレベルと内部で使用されるログシステムの概念とのマッピングは 各(ログシステム毎の)実装に依存します。 しかしながら各実装ではこの順序通りに動作することを保証する必要があります。
The mapping of these log levels to the concepts used by the underlying logging system is implementation dependent. The implemention should ensure, though, that this ordering behaves as expected.

パフォーマンスはログ処理においてよく問題となる事柄です。 適宜プロパティを調べることによって、(ログに出力する情報の生成といった) 重い処理の部分を避けることができます。

[訳注: 文字列の生成や連結の事を指しているようです]
Performance is often a logging concern. By examining the appropriate property, a component can avoid expensive operations (producing information to be logged).

例えば、

For example,
    if (log.isDebugEnabled()) {
        ... (theResult を作成する)何か重い処理を実施 ...
        log.debug(theResult);
    }
 
    if (log.isDebugEnabled()) {
        ... do something expensive ...
        log.debug(theResult);
    }
 

内部で使用されるログシステムの設定は、そのシステムがどんなメカニズムをサポートしていたとしても、一般的に Logging API の外部で行われます。

Configuration of the underlying logging system will generally be done external to the Logging APIs, through whatever mechanism is supported by that system.

バージョン:
$Id: Log.java,v 1.3 2004/04/08 12:22:29 hioki Exp $
作成者:
Scott Sanders, Rod Waldhoff
翻訳者:
日置 聡
校正者:
高橋 達男
翻訳状況:
校了

メソッドの概要
 void debug(Object message)
           debug ログレベルでメッセージをログ出力します。
 void debug(Object message, Throwable t)
           debug レベルでエラーをログ出力します。
 void error(Object message)
           error レベルでメッセージをログ出力します。
 void error(Object message, Throwable t)
           error レベルでエラーをログ出力します。
 void fatal(Object message)
           fatal レベルでメッセージをログ出力します。
 void fatal(Object message, Throwable t)
           fatal レベルでエラーをログ出力します。
 void info(Object message)
           info レベルでメッセージをログ出力します。
 void info(Object message, Throwable t)
           info レベルでエラーをログ出力します。
 boolean isDebugEnabled()
           debug レベルのログ処理が現在有効かどうかチェックします。
 boolean isErrorEnabled()
           error レベルのログ処理が現在有効かどうかチェックします。
 boolean isFatalEnabled()
           fatal レベルのログ処理が現在有効かどうかチェックします。
 boolean isInfoEnabled()
           info レベルのログ処理が現在有効かどうかチェックします。
 boolean isTraceEnabled()
           trace レベルのログ処理が現在有効かどうかチェックします。
 boolean isWarnEnabled()
           warning レベルのログ処理が現在有効かどうかチェックします。
 void trace(Object message)
           trace レベルでメッセージをログ出力します。
 void trace(Object message, Throwable t)
           trace レベルでエラーをログ出力します。
 void warn(Object message)
           warn レベルでメッセージをログ出力します。
 void warn(Object message, Throwable t)
           warn レベルでエラーをログ出力します。
 

メソッドの詳細

isDebugEnabled

public boolean isDebugEnabled()

debug レベルのログ処理が現在有効かどうかチェックします。

Is debug logging currently enabled?

ログレベルが debug 以上の場合に(String の連結のような) 重い処理を行わないようにこのメソッドを呼んで(チェックして)ください。

Call this method to prevent having to perform expensive operations (for example, String concatination) when the log level is more than debug.


isErrorEnabled

public boolean isErrorEnabled()

error レベルのログ処理が現在有効かどうかチェックします。

Is error logging currently enabled?

ログレベルが error 以上の場合に(String の連結のような) 重い処理を行わないようにこのメソッドを呼んで(チェックして)ください。

Call this method to prevent having to perform expensive operations (for example, String concatination) when the log level is more than error.


isFatalEnabled

public boolean isFatalEnabled()

fatal レベルのログ処理が現在有効かどうかチェックします。

Is fatal logging currently enabled?

ログレベルが fatal 以上の場合に(String の連結のような) 重い処理を行わないようにこのメソッドを呼んで(チェックして)ください。

Call this method to prevent having to perform expensive operations (for example, String concatination) when the log level is more than fatal.


isInfoEnabled

public boolean isInfoEnabled()

info レベルのログ処理が現在有効かどうかチェックします。

Is info logging currently enabled?

ログレベルが info 以上の場合に(String の連結のような) 重い処理を行わないようにこのメソッドを呼んで(チェックして)ください。

Call this method to prevent having to perform expensive operations (for example, String concatination) when the log level is more than info.


isTraceEnabled

public boolean isTraceEnabled()

trace レベルのログ処理が現在有効かどうかチェックします。

Is trace logging currently enabled?

ログレベルが trace 以上の場合に(String の連結のような) 重い処理を行わないようにこのメソッドを呼んで(チェックして)ください。

Call this method to prevent having to perform expensive operations (for example, String concatination) when the log level is more than trace.


isWarnEnabled

public boolean isWarnEnabled()

warning レベルのログ処理が現在有効かどうかチェックします。

Is warning logging currently enabled?

ログレベルが warning 以上の場合に(String の連結のような) 重い処理を行わないようにこのメソッドを呼んで(チェックして)ください。

Call this method to prevent having to perform expensive operations (for example, String concatination) when the log level is more than warning.


trace

public void trace(Object message)

trace レベルでメッセージをログ出力します。

Log a message with trace log level.

パラメータ:
message - このメッセージをログ出力します
log this message

trace

public void trace(Object message,
                  Throwable t)

trace レベルでエラーをログ出力します。

Log an error with trace log level.

パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

debug

public void debug(Object message)

debug ログレベルでメッセージをログ出力します。

Log a message with debug log level.

パラメータ:
message - このメッセージをログします
log this message

debug

public void debug(Object message,
                  Throwable t)

debug レベルでエラーをログ出力します。

Log an error with debug log level.

パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

info

public void info(Object message)

info レベルでメッセージをログ出力します。

Log a message with info log level.

パラメータ:
message - このメッセージをログ出力します
log this message

info

public void info(Object message,
                 Throwable t)

info レベルでエラーをログ出力します。

Log an error with info log level.

パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

warn

public void warn(Object message)

warn レベルでメッセージをログ出力します。

Log a message with warn log level.

パラメータ:
message - このメッセージをログ出力します
log this message

warn

public void warn(Object message,
                 Throwable t)

warn レベルでエラーをログ出力します。

Log an error with warn log level.

パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

error

public void error(Object message)

error レベルでメッセージをログ出力します。

Log a message with error log level.

パラメータ:
message - このメッセージをログ出力します
log this message

error

public void error(Object message,
                  Throwable t)

error レベルでエラーをログ出力します。

Log an error with error log level.

パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

fatal

public void fatal(Object message)

fatal レベルでメッセージをログ出力します。

Log a message with fatal log level.

パラメータ:
message - このメッセージをログ出力します
log this message

fatal

public void fatal(Object message,
                  Throwable t)

fatal レベルでエラーをログ出力します。

Log an error with fatal log level.

パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation