org.apache.commons.logging.impl
クラス SimpleLog

java.lang.Object
  拡張org.apache.commons.logging.impl.SimpleLog
すべての実装インタフェース:
Log

public class SimpleLog
extends Object
implements Log

ロガーの定義に関係なく、有効化されたすべてのログメッセージを System.err に送るシンプルな Log (インターフェイス)の実装です。 このロガーの振る舞いを設定するために、以下のシステムプロパティがサポートされます:

Simple implementation of Log that sends all enabled log messages, for all defined loggers, to System.err. The following system properties are supported to configure the behavior of this logger:

上記システムプロパティを探す際に、この実装は "simplelog.properties" という名称のクラスローダリソースもチェックし、(存在すれば)すべての合致する定義をインクルードします。

In addition to looking for system properties with the names specified above, this implementation also checks for a class loader resource named "simplelog.properties", and includes any matching definitions from this resource (if it exists).

バージョン:
$Id: SimpleLog.java,v 1.4 2004/04/08 13:11:17 hioki Exp $
作成者:
Scott Sanders, Rod Waldhoff, Robert Burrell Donkin
翻訳者:
日置 聡
校正者:
芦沢 嘉典
翻訳状況:
校了

フィールドの概要
protected  int currentLogLevel
          現在のログレベル。
protected static DateFormat dateFormatter
          使用される日時のフォーマット。
static int LOG_LEVEL_ALL
          全てのログレベルを有効に。
static int LOG_LEVEL_DEBUG
          "デバッグ"レベルのログ処理。
static int LOG_LEVEL_ERROR
          "エラー"レベルのログ処理。
static int LOG_LEVEL_FATAL
          "致命的"レベルのログ処理。
static int LOG_LEVEL_INFO
          "情報"レベルのログ処理。
static int LOG_LEVEL_OFF
          全てのログレベルを無効に。
static int LOG_LEVEL_TRACE
          "トレース"レベルのログ処理。
static int LOG_LEVEL_WARN
          "警告"レベルのログ処理。
protected  String logName
          このシンプルログインスタンスの名称。
private  String prefix
           
protected static boolean showDateTime
          ログメッセージ内に現在の日時を含めるかどうか。
protected static boolean showLogName
          ログメッセージ内にインスタンス名を含めるかどうか。
protected static boolean showShortName
          ログメッセージ内にロガーの省略名(最後の部分)を含めるかどうか。
protected static Properties simpleLogProps
          simplelog.properties リソースファイルからロードされた Properties。
protected static String systemPrefix
          Simple で使用される全てのシステムプロパティはこの名称から始まります。
 
コンストラクタの概要
SimpleLog(String name)
          指定された名称でシンプルログインスタンスを生成します。
 
メソッドの概要
 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 ログレベルでエラーをログ出力します。
private static boolean getBooleanProperty(String name, boolean dephault)
           
private static ClassLoader getContextClassLoader()
          スレッドコンテキストクラスローダが利用できる場合には、それを返します。
 int getLevel()
           ログ処理のレベルを取得します。
private static InputStream getResourceAsStream(String name)
           
private static String getStringProperty(String name)
           
private static String getStringProperty(String name, String dephault)
           
 void info(Object message)
           info ログレベルでメッセージをログ出力します。
 void info(Object message, Throwable t)
           info ログレベルでエラーをログ出力します。
 boolean isDebugEnabled()
           debug メッセージが現在有効かどうかをチェックします。
 boolean isErrorEnabled()
           error メッセージが現在有効かどうかをチェックします。
 boolean isFatalEnabled()
           fatal メッセージが現在有効かどうかをチェックします。
 boolean isInfoEnabled()
           info メッセージが現在有効かどうかをチェックします。
protected  boolean isLevelEnabled(int logLevel)
          指定されたログレベルが現在有効かどうかチェックします。
 boolean isTraceEnabled()
           trace メッセージが現在有効かどうかをチェックします。
 boolean isWarnEnabled()
           warn メッセージが現在有効かどうかをチェックします。
protected  void log(int type, Object message, Throwable t)
           実際のログ処理を実施します。
 void setLevel(int currentLogLevel)
          ログ処理のレベルを設定します。
 void trace(Object message)
           trace ログレベルでメッセージをログ出力します。
 void trace(Object message, Throwable t)
           trace ログレベルでエラーをログ出力します。
 void warn(Object message)
           warn ログレベルでメッセージをログ出力します。
 void warn(Object message, Throwable t)
           warn ログレベルでエラーをログ出力します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

systemPrefix

protected static final String systemPrefix
Simple で使用される全てのシステムプロパティはこの名称から始まります。
All system properties used by Simple start with this

関連項目:
定数フィールド値

simpleLogProps

protected static final Properties simpleLogProps
simplelog.properties リソースファイルからロードされた Properties。
Properties loaded from simplelog.properties


showLogName

protected static boolean showLogName
ログメッセージ内にインスタンス名を含めるかどうか。
Include the instance name in the log message?


showShortName

protected static boolean showShortName
ログメッセージ内にロガーの省略名(最後の部分)を含めるかどうか。 デフォルトは true - false にしてしまった場合にはメッセージの洪水の中で 誰がどのメッセージを送ったのかを見失ってしまうでしょう。
Include the short name ( last component ) of the logger in the log message. Default to true - otherwise we'll be lost in a flood of messages without knowing who sends them.


showDateTime

protected static boolean showDateTime
ログメッセージ内に現在の日時を含めるかどうか。
Include the current time in the log message


dateFormatter

protected static DateFormat dateFormatter
使用される日時のフォーマット。
Used to format times


LOG_LEVEL_TRACE

public static final int LOG_LEVEL_TRACE
"トレース"レベルのログ処理。
"Trace" level logging.

関連項目:
定数フィールド値

LOG_LEVEL_DEBUG

public static final int LOG_LEVEL_DEBUG
"デバッグ"レベルのログ処理。
"Debug" level logging.

関連項目:
定数フィールド値

LOG_LEVEL_INFO

public static final int LOG_LEVEL_INFO
"情報"レベルのログ処理。
"Info" level logging.

関連項目:
定数フィールド値

LOG_LEVEL_WARN

public static final int LOG_LEVEL_WARN
"警告"レベルのログ処理。
"Warn" level logging.

関連項目:
定数フィールド値

LOG_LEVEL_ERROR

public static final int LOG_LEVEL_ERROR
"エラー"レベルのログ処理。
"Error" level logging.

関連項目:
定数フィールド値

LOG_LEVEL_FATAL

public static final int LOG_LEVEL_FATAL
"致命的"レベルのログ処理。
"Fatal" level logging.

関連項目:
定数フィールド値

LOG_LEVEL_ALL

public static final int LOG_LEVEL_ALL
全てのログレベルを有効に。
Enable all logging levels

関連項目:
定数フィールド値

LOG_LEVEL_OFF

public static final int LOG_LEVEL_OFF
全てのログレベルを無効に。
Enable no logging levels

関連項目:
定数フィールド値

logName

protected String logName
このシンプルログインスタンスの名称。
The name of this simple log instance


currentLogLevel

protected int currentLogLevel
現在のログレベル。
The current log level


prefix

private String prefix
コンストラクタの詳細

SimpleLog

public SimpleLog(String name)
指定された名称でシンプルログインスタンスを生成します。
Construct a simple log with given name.

パラメータ:
name - log name
ログの名称
メソッドの詳細

getStringProperty

private static String getStringProperty(String name)

getStringProperty

private static String getStringProperty(String name,
                                        String dephault)

getBooleanProperty

private static boolean getBooleanProperty(String name,
                                          boolean dephault)

setLevel

public void setLevel(int currentLogLevel)

ログ処理のレベルを設定します。

Set logging level.

パラメータ:
currentLogLevel - 新しいログ処理のレベル
level new logging level

getLevel

public int getLevel()

ログ処理のレベルを取得します。

Get logging level.


log

protected void log(int type,
                   Object message,
                   Throwable t)

実際のログ処理を実施します。 このメソッドはメッセージを組み立てて、 System.err に出力します。

Do the actual logging. This method assembles the message and then prints to System.err.


isLevelEnabled

protected boolean isLevelEnabled(int logLevel)
指定されたログレベルが現在有効かどうかチェックします。
Is the given log level currently enabled?

パラメータ:
logLevel - 有効かどうか確認するログレベル
is this level enabled?

debug

public final void debug(Object message)

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

Log a message with debug log level.

定義:
インタフェース Log 内の debug
パラメータ:
message - このメッセージをログします
log this message

debug

public final void debug(Object message,
                        Throwable t)

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

Log an error with debug log level.

定義:
インタフェース Log 内の debug
パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

trace

public final void trace(Object message)

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

Log a message with trace log level.

定義:
インタフェース Log 内の trace
パラメータ:
message - このメッセージをログ出力します
log this message

trace

public final void trace(Object message,
                        Throwable t)

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

Log an error with trace log level.

定義:
インタフェース Log 内の trace
パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

info

public final void info(Object message)

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

Log a message with info log level.

定義:
インタフェース Log 内の info
パラメータ:
message - このメッセージをログ出力します
log this message

info

public final void info(Object message,
                       Throwable t)

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

Log an error with info log level.

定義:
インタフェース Log 内の info
パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

warn

public final void warn(Object message)

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

Log a message with warn log level.

定義:
インタフェース Log 内の warn
パラメータ:
message - このメッセージをログ出力します
log this message

warn

public final void warn(Object message,
                       Throwable t)

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

Log an error with warn log level.

定義:
インタフェース Log 内の warn
パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

error

public final void error(Object message)

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

Log a message with error log level.

定義:
インタフェース Log 内の error
パラメータ:
message - このメッセージをログ出力します
log this message

error

public final void error(Object message,
                        Throwable t)

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

Log an error with error log level.

定義:
インタフェース Log 内の error
パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

fatal

public final void fatal(Object message)

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

Log a message with fatal log level.

定義:
インタフェース Log 内の fatal
パラメータ:
message - このメッセージをログ出力します
log this message

fatal

public final void fatal(Object message,
                        Throwable t)

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

Log an error with fatal log level.

定義:
インタフェース Log 内の fatal
パラメータ:
message - このメッセージをログ出力します
log this message
t - この原因(となった例外)をログ出力します
log this cause

isDebugEnabled

public final boolean isDebugEnabled()

debug メッセージが現在有効かどうかをチェックします。

Are debug messages currently enabled?

このメソッドにて事前にチェックすることによりロガーのメッセージが無効な場合に String の連結のような不要な重い処理を避けることができます。

This allows expensive operations such as String concatenation to be avoided when the message will be ignored by the logger.

定義:
インタフェース Log 内の isDebugEnabled

isErrorEnabled

public final boolean isErrorEnabled()

error メッセージが現在有効かどうかをチェックします。

Are error messages currently enabled?

このメソッドにて事前にチェックすることによりロガーのメッセージが無効な場合に String の連結のような不要な重い処理を避けることができます。

This allows expensive operations such as String concatenation to be avoided when the message will be ignored by the logger.

定義:
インタフェース Log 内の isErrorEnabled

isFatalEnabled

public final boolean isFatalEnabled()

fatal メッセージが現在有効かどうかをチェックします。

Are fatal messages currently enabled?

このメソッドにて事前にチェックすることによりロガーのメッセージが無効な場合に String の連結のような不要な重い処理を避けることができます。

This allows expensive operations such as String concatenation to be avoided when the message will be ignored by the logger.

定義:
インタフェース Log 内の isFatalEnabled

isInfoEnabled

public final boolean isInfoEnabled()

info メッセージが現在有効かどうかをチェックします。

Are info messages currently enabled?

このメソッドにて事前にチェックすることによりロガーのメッセージが無効な場合に String の連結のような不要な重い処理を避けることができます。

This allows expensive operations such as String concatenation to be avoided when the message will be ignored by the logger.

定義:
インタフェース Log 内の isInfoEnabled

isTraceEnabled

public final boolean isTraceEnabled()

trace メッセージが現在有効かどうかをチェックします。

Are trace messages currently enabled?

このメソッドにて事前にチェックすることによりロガーのメッセージが無効な場合に String の連結のような不要な重い処理を避けることができます。

This allows expensive operations such as String concatenation to be avoided when the message will be ignored by the logger.

定義:
インタフェース Log 内の isTraceEnabled

isWarnEnabled

public final boolean isWarnEnabled()

warn メッセージが現在有効かどうかをチェックします。

Are warn messages currently enabled?

このメソッドにて事前にチェックすることによりロガーのメッセージが無効な場合に String の連結のような不要な重い処理を避けることができます。

This allows expensive operations such as String concatenation to be avoided when the message will be ignored by the logger.

定義:
インタフェース Log 内の isWarnEnabled

getContextClassLoader

private static ClassLoader getContextClassLoader()
スレッドコンテキストクラスローダが利用できる場合には、それを返します。 利用できない場合には null を返します。 スレッドコンテキストクラスローダはJDK 1.2 以降で、セキュリティ条件が満たされている場合 利用可能です。
Return the thread context class loader if available. Otherwise return null. The thread context class loader is available for JDK 1.2 or later, if certain security conditions are met.

例外:
LogConfigurationException - 適切なクラスローダを認識できなかった場合。
if a suitable class loader cannot be identified.

getResourceAsStream

private static InputStream getResourceAsStream(String name)


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