org.apache.log4j
クラス Category

java.lang.Object
  |
  +--org.apache.log4j.Category
すべての実装インタフェース:
AppenderAttachable
直系の既知のサブクラス:
AppServerCategory, MyCategory, RootCategory, XCategory

public class Category
extends Object
implements AppenderAttachable

This is the central class in the log4j package. One of the distintive features of log4j are hierarchical categories and their evaluation.

このクラスは、log4jパッケージ内の中心的なクラスです。 log4jの示唆的特徴の一つは、階層的なカテゴリとそれらの評価です。

See the user manual for an introduction on this class.

このクラスの導入については、ユーザマニュアルを参照してください。

作成者:
Ceki Gülcü, Anders Kristensen

フィールドの概要
protected  boolean additive
          Additivity is set to true by default, that is children inherit the appenders of their ancestors by default.
static String DEFAULT_CONFIGURATION_FILE
          This string constant is set to log4j.properties the name of the file that will be searched by default in classpath.
static String DEFAULT_CONFIGURATION_KEY
          This string constant is set to log4j.configuration.
static String DEFAULT_INIT_OVERRIDE_KEY
          Setting the system property log4j.defaultInitOverride to "true" or any other value than "false" will skip default configuration process.
static Hierarchy defaultHierarchy
          The hierarchy where categories are attached to by default.
protected  Hierarchy hierarchy
           
protected  String name
          The name of this category.
protected  Category parent
          The parent of this category.
protected  Priority priority
          The assigned priority of this category.
protected  ResourceBundle resourceBundle
           
 
コンストラクタの概要
protected Category(String name)
          This constructor created a new Category instance and sets its name.
 
メソッドの概要
 void addAppender(Appender newAppender)
          Add newAppender to the list of appenders of this Category instance.
 void assert(boolean assertion, String msg)
          If assertion parameter is false, then logs msg as an error statement.
 void callAppenders(LoggingEvent event)
          Call the appenders in the hierrachy starting at this.
 void debug(Object message)
          Log a message object with the DEBUG priority.
 void debug(Object message, Throwable t)
          Log a message object with the DEBUG priority including the stack trace of the Throwable t passed as parameter.
 void error(Object message)
          Log a message object with the ERROR priority.
 void error(Object message, Throwable t)
          Log a message object with the ERROR priority including the stack trace of the Throwable t passed as parameter.
static Category exists(String name)
          If the named category exists (in the default hierarchy) then it returns a reference to the category, otherwise it returns null.
 void fatal(Object message)
          Log a message object with the FATAL priority.
 void fatal(Object message, Throwable t)
          Log a message object with the FATAL priority including the stack trace of the Throwable t passed as parameter.
protected  void forcedLog(String fqcn, Priority priority, Object message, Throwable t)
          This method creates a new logging event and logs the event without further checks.
 boolean getAdditivity()
          Get the additivity flag for this Category instance.
 Enumeration getAllAppenders()
          Get the appenders contained in this category as an Enumeration.
 Appender getAppender(String name)
          Look for the appender named as name.
 Priority getChainedPriority()
          Starting from this category, search the category hierarchy for a non-null priority and return it.
static Enumeration getCurrentCategories()
          Returns all the currently defined categories in the default hierarchy as an Enumeration.
static Hierarchy getDefaultHierarchy()
          Return the default Hierarchy instance.
 Hierarchy getHierarchy()
          Return the the Hierarchy where this Category instance is attached.
static Category getInstance(Class clazz)
          Shorthand for getInstance(clazz.getName()).
static Category getInstance(String name)
          Retrieve a category with named as the name parameter.
static Category getInstance(String name, CategoryFactory factory)
          Like getInstance(String) except that the type of category instantiated depends on the type returned by the CategoryFactory.makeNewCategoryInstance(java.lang.String) method of the factory parameter.
 String getName()
          Return the category name.
 Priority getPriority()
          Returns the assigned Priority, if any, for this Category.
 ResourceBundle getResourceBundle()
          Return the inherited ResourceBundle for this category.
protected  String getResourceBundleString(String key)
          Returns the string resource coresponding to key in this category's inherited resource bundle.
static Category getRoot()
          Return the root of the default category hierrachy.
 void info(Object message)
          Log a message object with the INFO priority.
 void info(Object message, Throwable t)
          Log a message object with the INFO priority including the stack trace of the Throwable t passed as parameter.
 boolean isDebugEnabled()
          Check whether this category is enabled for the DEBUG priority.
 boolean isEnabledFor(Priority priority)
          Check whether this category is enabled for a given Priority passed as parameter.
 boolean isInfoEnabled()
          Check whether this category is enabled for the info priority.
 void l7dlog(Priority priority, String key, Object[] params, Throwable t)
          Log a localized and parameterized message.
 void l7dlog(Priority priority, String key, Throwable t)
          Log a localized message.
 void log(Priority priority, Object message)
          This generic form is intended to be used by wrappers.
 void log(Priority priority, Object message, Throwable t)
          This generic form is intended to be used by wrappers.
 void log(String callerFQCN, Priority priority, Object message, Throwable t)
          This is the most generic printing method.
 void removeAllAppenders()
          Remove all previously added appenders from this Category instance.
 void removeAppender(Appender appender)
          Remove the appender passed as parameter form the list of appenders.
 void removeAppender(String name)
          Remove the appender with the name passed as parameter form the list of appenders.
 void setAdditivity(boolean additive)
          Set the additivity flag for this Category instance.
 void setPriority(Priority priority)
          Set the priority of this Category.
 void setResourceBundle(ResourceBundle bundle)
          Set the resource bundle to be used with localized logging methods l7dlog(Priority,String,Throwable) and l7dlog(Priority,String,Object[],Throwable).
static void shutdown()
          Calling this method will safely close and remove all appenders in all the categories including root contained in the default hierachy.
 void warn(Object message)
          Log a message object with the WARN priority.
 void warn(Object message, Throwable t)
          Log a message with the WARN priority including the stack trace of the Throwable t passed as parameter.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

defaultHierarchy

public static final Hierarchy defaultHierarchy
The hierarchy where categories are attached to by default.

デフォルトでは、カテゴリがアタッチされている階層


DEFAULT_CONFIGURATION_FILE

public static final String DEFAULT_CONFIGURATION_FILE
This string constant is set to log4j.properties the name of the file that will be searched by default in classpath. If the file can be found, then it is fed to the PropertyConfigurator.

この文字列定数は、デフォルトでクラスパス上で検索されるファイル名 log4j.propertiesを設定しています。 もしファイルが見つからなかった場合、PropertyConfiguratorへフィードバックします。

See also DEFAULT_CONFIGURATION_KEY for a more general alternative.

さらに一般的な選択に関しては、DEFAULT_CONFIGURATION_KEYを参照してください。

See also the full description of default intialization procedure.

デフォルトの初期化の手続きの完全な説明を参照してください。

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

DEFAULT_CONFIGURATION_KEY

public static final String DEFAULT_CONFIGURATION_KEY
This string constant is set to log4j.configuration.

この文字列定数は、log4j.configuration に設定されています。

It corresponds to name of a system property that, if set, specifies the name of the resource containing the properties file or URL with which log4j should configure itself. See OptionConverter.selectAndConfigure(java.net.URL, org.apache.log4j.Hierarchy) for more detailed information on the processing of this option.

もし、設定されていれば、プロパティファイルまたは、log4jが自分で設定するときに使うURLを含むリソース名を指定するシステムプロパティ名に一致します。 このオプションの操作上のさらに詳しい情報は、OptionConverter.selectAndConfigure(java.net.URL, org.apache.log4j.Hierarchy)を参照してください。

Setting the log4j.configuration system property overrides the default search for the file log4j.properties.

log4j.configuration をシステムプロパティに設定すると、ファイル log4j.propertiesのデフォルト検索をオーバーライドします。

Note that all property keys are case sensitive.

全てのプロパティキーは、大文字と小文字の区別をするのに気をつけてください。。

See also the full description of default intialization procedure.

デフォルトの初期化の手続きの完全な説明を参照してください。

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

DEFAULT_INIT_OVERRIDE_KEY

public static final String DEFAULT_INIT_OVERRIDE_KEY
Setting the system property log4j.defaultInitOverride to "true" or any other value than "false" will skip default configuration process.

システムプロパティ log4j.defaultInitOverrideを"true"または、デフォルトの設定動作をスキップさせる"false"以外の値を設定します。

The current value of the DEFAULT_INIT_OVERRIDE_KEY string constant is log4j.defaultInitOverride.

この文字列定数 DEFAULT_INIT_OVERRIDE_KEYの現在の値は、log4j.defaultInitOverrideです。

See also the full description of default intialization procedure.

デフォルトの初期化の手続きの完全な説明を参照してください。

Note that all property keys are case sensitive.

全てのプロパティキーは、大文字と小文字の区別をするのに気をつけてください。

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

name

protected String name
The name of this category.

カテゴリ名を表します。


priority

protected volatile Priority priority
The assigned priority of this category. The priority variable need not be assined a value in which case it is inherited form the hierarchy. 割り当てられたこのカテゴリの優先度を表します。 priorityは、階層から継承されるとどんなケースでも変数を割り当てられる必要はありません。

parent

protected volatile Category parent
The parent of this category. All categories have at least one ancestor which is the root category.

このカテゴリの親です。 すべてのカテゴリには、最低一つは、ルートカテゴリの祖先があります。


resourceBundle

protected ResourceBundle resourceBundle

hierarchy

protected Hierarchy hierarchy

additive

protected boolean additive
Additivity is set to true by default, that is children inherit the appenders of their ancestors by default. If this variable is set to false then the appenders found in the ancestors of this category are not used. However, the children of this category will inherit its appenders, unless the children have their additivity flag set to false too. See the user manual for more details.

additivityはデフォルトでtrueに設定されています。 それは、デフォルトで子が祖先のアペンダを継承すること表します。 もし、この値がfalseい設定されている場合、カテゴリの祖先内で見つかったアペンダは使われません。 しかし、子にもfalseを設定したadditivityフラグがない場合、このカテゴリの子は、アペンダを継承します。 さらに詳細は、ユーザマニュアルを参照してください。

コンストラクタの詳細

Category

protected Category(String name)
This constructor created a new Category instance and sets its name.

このコンストラクタは、Categoryインスタンスを作成し、その名前を設定します。

It is intended to be used by sub-classes only. You should not create categories directly.

それは、サブクラスだけに使われることを意図しています。 あなたは、直接カテゴリを作成してはいけません。

パラメータ:
name - The name of the category.

name カテゴリ名

メソッドの詳細

addAppender

public void addAppender(Appender newAppender)
Add newAppender to the list of appenders of this Category instance.

このCategoryのインスタンスのリストにnewAppenderを追加します。

If newAppender is already in the list of appenders, then it won't be added again.

もし、newAppenderがすでにアペンダのリスト内にあれば、再度追加されることは、ありません。

定義:
インタフェース AppenderAttachable 内の addAppender

assert

public void assert(boolean assertion,
                   String msg)
If assertion parameter is false, then logs msg as an error statement.

assertionパラメタがfalseの場合、エラーステートメントしてmsgをログに出力します。

パラメータ:
assertion -

assertion

msg - The message to print if assertion is false.

msg assertionがfalseの場合、出力されるメッセージ

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

callAppenders

public void callAppenders(LoggingEvent event)
Call the appenders in the hierrachy starting at this. If no appenders could be found, emit a warning.

ここで始まる階層内のアペンダを呼び出します。

This method calls all the appenders inherited from the hierarchy circumventing any evaluation of whether to log or not to log the particular log request.

このメソッドは、特定のログ要求に対しログに出力するかどうかという評価を見つけ出す階層から継承した全てのアペンダを呼び出します。

パラメータ:
LoggingEvent - the event to log.

loggingEvent ログに出力するイベント


debug

public void debug(Object message)
Log a message object with the DEBUG priority.

DEBUG優先度を使ってメッセージオブジェクトをログ出力します。

This method first checks if this category is DEBUG enabled by comparing the priority of this category with the DEBUG priority. If this category is DEBUG enabled, then it converts the message object (passed as parameter) to a string by invoking the appropriate ObjectRenderer. It then proceeds to call all the registered appenders in this category and also higher in the hierarchy depending on the value of the additivity flag.

このメソッドは、DEBUG優先度を使ってこのカテゴリの優先度と比較することによりこのカテゴリが DEBUGを利用できるかどうかを最初にチェックします。 もし、このカテゴリがDEBUGを利用できる場合、妥当な ObjectRendererを起動することによりパラメタとして渡されたメッセージオブジェクトを文字列に変換します。 それは、カテゴリ内の全ての登録されたアペンダであり、また、additivityフラグの値に依存する階層内でより上位のアペンダを呼び出そうとします。

WARNING Note that passing a Throwable to this method will print the name of the Throwable but no stack trace. To print a stack trace use the debug(Object, Throwable) form instead. 警告 このメソッドへ Throwableを投げると、Throwableの名前を出力するが、スタックトレースは出力しないことを念頭においてください。 スタックトレースを出力するには、代わりとして、debug(Object, Throwable)フォームを使ってください。

パラメータ:
message - the message object to log.

message ログに出力するメッセージ


debug

public void debug(Object message,
                  Throwable t)
Log a message object with the DEBUG priority including the stack trace of the Throwable t passed as parameter.

パラメタで渡される Throwable t のスタックとレースを含め、DEBUG優先度を使って、メッセージオブジェクトをログに出力します。

See debug(Object) form for more detailed information.

さらに詳しい情報に関しては、debug(Object)を参照してください。

パラメータ:
message - the message object to log.

message ログに出力するメッセージオブジェクト

t - the exception to log, including its stack trace.

t ログに出力するスタックトレースを含む例外


error

public void error(Object message)
Log a message object with the ERROR priority.

ERROR優先度を使ってメッセージオブジェクトをログ出力します。

This method first checks if this category is ERROR enabled by comparing the priority of this category with ERROR priority. If this category is ERROR enabled, then it converts the message object passed as parameter to a string by invoking the appropriate ObjectRenderer. It proceeds to call all the registered appenders in this category and also higher in the hierarchy depending on the value of the additivity flag.

このメソッドは、ERROR優先度を使ってこのカテゴリの優先度と比較することによりこのカテゴリが ERRORを利用できるかどうかを最初にチェックします。 もし、このカテゴリがERRORを利用できる場合、妥当な ObjectRendererを起動することによりパラメタとして渡されたメッセージオブジェクトを文字列に変換します。 それは、カテゴリ内の全ての登録されたアペンダであり、また、additivityフラグの値に依存する階層内でより上位のアペンダを呼び出そうとします。

WARNING Note that passing a Throwable to this method will print the name of the Throwable but no stack trace. To print a stack trace use the error(Object, Throwable) form instead. 警告 このメソッドへ Throwableを投げると、Throwableの名前を出力するが、スタックトレースは出力しないことを念頭においてください。 スタックトレースを出力するには、代わりとして、error(Object, Throwable)フォームを使ってください。

パラメータ:
message - the message object to log

message ログに出力するメッセージ


error

public void error(Object message,
                  Throwable t)
Log a message object with the ERROR priority including the stack trace of the Throwable t passed as parameter.

パラメタで渡される Throwable t のスタックとレースを含め、ERROR優先度を使って、メッセージオブジェクトをログに出力します。

See error(Object) form for more detailed information.

さらに詳しい情報に関しては、error(Object)を参照してください。

パラメータ:
message - the message object to log.

message ログに出力するメッセージオブジェクト

t - the exception to log, including its stack trace.

t ログに出力するスタックトレースを含む例外


exists

public static Category exists(String name)
If the named category exists (in the default hierarchy) then it returns a reference to the category, otherwise it returns null.

もし、(デフォルト階層内に)名前で指定されたカテゴリが存在する場合、カテゴリの参照を返します。 そうでない場合は、nullを返します。

Contributed by Ciaran Treanor - ciaran@xelector.com

Ciaran Treanor氏により寄付されました。ciaran@xelector.com


fatal

public void fatal(Object message)
Log a message object with the FATAL priority.

FATAL優先度を使ってメッセージオブジェクトをログ出力します。

This method first checks if this category is FATAL enabled by comparing the priority of this category with FATAL priority. If the category is FATAL enabled, then it converts the message object passed as parameter to a string by invoking the appropriate ObjectRenderer. It proceeds to call all the registered appenders in this category and also higher in the hierarchy depending on the value of the additivity flag.

このメソッドは、FATAL優先度を使ってこのカテゴリの優先度と比較することによりこのカテゴリが FATALを利用できるかどうかを最初にチェックします。 もし、このカテゴリがFATALを利用できる場合、妥当な ObjectRendererを起動することによりパラメタとして渡されたメッセージオブジェクトを文字列に変換します。 それは、カテゴリ内の全ての登録されたアペンダであり、また、additivityフラグの値に依存する階層内でより上位のアペンダを呼び出そうとします。

WARNING Note that passing a Throwable to this method will print the name of the Throwable but no stack trace. To print a stack trace use the fatal(Object, Throwable) form instead. 警告 このメソッドへ Throwableを投げると、Throwableの名前を出力するが、スタックトレースは出力しないことを念頭においてください。 スタックトレースを出力するには、代わりとして、fatal(Object, Throwable)フォームを使ってください。

パラメータ:
message - the message object to log

message ログに出力するメッセージ


fatal

public void fatal(Object message,
                  Throwable t)
Log a message object with the FATAL priority including the stack trace of the Throwable t passed as parameter.

パラメタで渡される Throwable t のスタックとレースを含め、FATAL優先度を使って、メッセージオブジェクトをログに出力します。

See fatal(Object) for more detailed information.

さらに詳しい情報に関しては、fatal(Object)を参照してください。

パラメータ:
message - the message object to log.

message ログに出力するメッセージオブジェクト

t - the exception to log, including its stack trace.

t ログに出力するスタックトレースを含む例外


forcedLog

protected void forcedLog(String fqcn,
                         Priority priority,
                         Object message,
                         Throwable t)
This method creates a new logging event and logs the event without further checks.

このメソッドは、新しいロギングイベントを作り、それほどのチェックなしでイベントをログに出力します。


getAdditivity

public boolean getAdditivity()
Get the additivity flag for this Category instance.

このCategoryインスタンスに関するadditivityフラグを取得します。


getAllAppenders

public Enumeration getAllAppenders()
Get the appenders contained in this category as an Enumeration. If no appenders can be found, then a NullEnumeration is returned.

このカテゴリ内に含まれるアペンダをEnumerationとして取得します。 もし、アペンダが見つからなかった場合、NullEnumerationが返されます。

定義:
インタフェース AppenderAttachable 内の getAllAppenders
戻り値:
Enumeration An enumeration of the appenders in this category.

Enumeration このカテゴリ内にある列挙です。


getAppender

public Appender getAppender(String name)
Look for the appender named as name.

nameとして指定されたアペンダを探します。

Return the appender with that name if in the list. Return null otherwise.

もしリスト内にあればその名前を使っているアペンダを返します。 そうでない場合は、nullを返します。

定義:
インタフェース AppenderAttachable 内の getAppender

getChainedPriority

public Priority getChainedPriority()
Starting from this category, search the category hierarchy for a non-null priority and return it. Otherwise, return the priority of the root category.

このカテゴリから始め、nullでない優先度をもつカテゴリ階層を検索し、それを返します。 そうでない場合、ルートカテゴリの優先度を返します。

The Category class is designed so that this method executes as quickly as possible.

Categoryクラスは、できるだけ早くこのメソッドが実行されるように設計されています。


getCurrentCategories

public static Enumeration getCurrentCategories()
Returns all the currently defined categories in the default hierarchy as an Enumeration.

デフォルトの階層内で現在定義されているすべてのカテゴリをEnumerationとして取り出します。

The root category is not included in the returned Enumeration.

ルートカテゴリは、返されるEnumeration内には、含まれません


getDefaultHierarchy

public static Hierarchy getDefaultHierarchy()
Return the default Hierarchy instance.

デフォルトのHierarchyインスタンスを返します。

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

getHierarchy

public Hierarchy getHierarchy()
Return the the Hierarchy where this Category instance is attached.

このCategoryインスタンスがアタッチされている場合Hierarchyを返します。

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

getInstance

public static Category getInstance(String name)
Retrieve a category with named as the name parameter. If the named category already exists, then the existing instance will be reutrned. Otherwise, a new instance is created.

nameパラメタとして指定された名前を使ってカテゴリを取り出します。 もし、名前で指定されたカテゴリがすでに存在する場合、存在するインスタンスが返されます。そうでなければ、新しいインスタンスが生成されます。

By default, categories do not have a set priority but inherit it from the hierarchy. This is one of the central features of log4j.

デフォルトでは、カテゴリには、優先度のセットはなく、階層から優先度を継承します。 これは、log4jの主要な特徴の一つです。

パラメータ:
name - The name of the category to retrieve.

name 取り出すカテゴリ名


getInstance

public static Category getInstance(Class clazz)
Shorthand for getInstance(clazz.getName()).

getInstance(clazz.getName())の簡略形です。

パラメータ:
clazz - The name of clazz will be used as the name of the category to retrieve. See getInstance(String) for more detailed information.

clazz clazz名は、取り出すためのカテゴリ名として使われます。 さらに詳しい情報は、getInstance(String)を参照してください。

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

getInstance

public static Category getInstance(String name,
                                   CategoryFactory factory)
Like getInstance(String) except that the type of category instantiated depends on the type returned by the CategoryFactory.makeNewCategoryInstance(java.lang.String) method of the factory parameter.

インスタンス化されたカテゴリのタイプが、factoryパラメタのCategoryFactory.makeNewCategoryInstance(java.lang.String)メソッドにより返されたタイプに依存するということ以外getInstance(String)と同じです。

This method is intended to be used by sub-classes.

このメソッドは、サブクラスで使われることを意図しています。

パラメータ:
name - The name of the category to retrieve.

name 取り出すカテゴリ名

factory - A CategoryFactory implementation that will actually create a new Instance.

factory 実際に新しいインスタンスを作るCategoryFactoryの実装

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

getName

public final String getName()
Return the category name.

カテゴリ名を返します。


getPriority

public final Priority getPriority()
Returns the assigned Priority, if any, for this Category.

このカテゴリに関して、もしあれば、割り当てられたPriorityを返します。

戻り値:
Priority - the assigned Priority, can be null.

Priority - 割り当てられたPriority、nullのはずです。


getRoot

public static final Category getRoot()
Return the root of the default category hierrachy.

デフォルトのカテゴリ階層のルートを返します。

The root category is always instantiated and available. It's name is "root".

ルートカテゴリは、大抵インスタンスかされて、利用できます。 その名前は、"root"です。

Nevertheless, calling Category.getInstance("root") does not retrieve the root category but a category just under root named "root".

Category.getInstance("root")を呼び出しても、"root"と命名されたルートのちょうどしたのカテゴリを取り出しますが、ルートカテゴリ自体は、取り出しません。


getResourceBundle

public ResourceBundle getResourceBundle()
Return the inherited ResourceBundle for this category.

このカテゴリに関する 継承されたResourceBundleを返します。

This method walks the hierarchy to find the appropriate resource bundle. It will return the resource bundle attached to the closest ancestor of this category, much like the way priorities are searched. In case there is no bundle in the hierarchy then null is returned.

このメソッドは、妥当なリソースバンドルを探すために階層を渡り歩きます。 優先度が検索される方法のように、カテゴリのもっとも密接した祖先にアタッチされたリソースバンドルを返します。 階層内でバンドルがない場合、nullが返されます。

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

getResourceBundleString

protected String getResourceBundleString(String key)
Returns the string resource coresponding to key in this category's inherited resource bundle. See also getResourceBundle().

このカテゴリの継承されたリソースバンドル内のkeyに一致する文字列リソースを返します。

If the resource cannot be found, then an error message will be logged complaining about the missing resource.

もし、リソースが見つからなかった場合、errorメッセージが見つからなかったリソースについての理由をログに出力されます。


info

public void info(Object message)
Log a message object with the INFO priority.

INFO優先度を使ってメッセージオブジェクトをログ出力します。

This method first checks if this category is INFO enabled by comparing the priority of this category with INFO priority. If the category is INFO enabled, then it converts the message object passed as parameter to a string by invoking the appropriate ObjectRenderer. It proceeds to call all the registered appenders in this category and also higher in the hierarchy depending on the value of the additivity flag.

このメソッドは、INFO優先度を使ってこのカテゴリの優先度と比較することによりこのカテゴリが WARNを利用できるかどうかを最初にチェックします。 もし、このカテゴリがINFOを利用できる場合、妥当な ObjectRendererを起動することによりパラメタとして渡されたメッセージオブジェクトを文字列に変換します。 それは、カテゴリ内の全ての登録されたアペンダであり、また、additivityフラグの値に依存する階層内でより上位のアペンダを呼び出そうとします。

WARNING Note that passing a Throwable to this method will print the name of the Throwable but no stack trace. To print a stack trace use the info(Object, Throwable) form instead. 警告 このメソッドへ Throwableを投げると、Throwableの名前を出力するが、スタックトレースは出力しないことを念頭においてください。 スタックトレースを出力するには、代わりとして、info(Object, Throwable)フォームを使ってください。

パラメータ:
message - the message object to log

message ログに出力するメッセージ


info

public void info(Object message,
                 Throwable t)
Log a message object with the INFO priority including the stack trace of the Throwable t passed as parameter.

パラメタで渡される Throwable t のスタックとレースを含め、INFO優先度を使って、メッセージオブジェクトをログに出力します。

See info(Object) for more detailed information.

さらに詳しい情報は、info(Object)を参照してください。

パラメータ:
message - the message object to log.

message ログに出力するメッセージオブジェクト

t - the exception to log, including its stack trace.

t ログに出力する、スタックトレースを含めた例外


isDebugEnabled

public boolean isDebugEnabled()
Check whether this category is enabled for the DEBUG priority.

このカテゴリがDEBUG優先度を利用できるかをチェックします。

This function is intended to lessen the computational cost of disabled log debug statements.

この機能は、利用不可能なログデバッグステートメントのコンピュータ上のコストを低減することを意図しています。

For some cat Category object, when you write,

いくつかの cat カテゴリオブジェクトに関して、あなたが記述する時、

      cat.debug("This is entry number: " + i );
  

You incur the cost constructing the message, concatenatiion in this case, regardless of whether the message is logged or not.

メッセージがログに出力されるかされないかを気にしないような、ここのケースでは、連結したメッセージを構築する犠牲を払います。

If you are worried about speed, then you should write

もし、速度を気にかけないというのであれば、あなたは次のように記述すべきです。

 	 if(cat.isDebugEnabled()) { 
 	   cat.debug("This is entry number: " + i );
 	 }
  

This way you will not incur the cost of parameter construction if debugging is disabled for cat. On the other hand, if the cat is debug enabled, you will incur the cost of evaluating whether the category is debug enabled twice. Once in isDebugEnabled and once in the debug. This is an insignificant overhead since evaluating a category takes about 1%% of the time it takes to actually log.

このように、もし、デバッグがcatで利用できない場合、パラメタの構成のコストを負うことはありません。 一方では、もし、catがデバッグ可能な場合、あなたは、カテゴリがデバッグできるかどうか2回評価されるという犠牲を払うことでしょう。 isDebugEnabledで1回、debugで1回。 カテゴリを評価するのに、実際にログへ出力する時間の1%くらいかかりますが、これはちょっとしたオーバーヘッドになります。

戻り値:
boolean - true if this category is debug enabled, false otherwise.

isEnabledFor

public boolean isEnabledFor(Priority priority)
Check whether this category is enabled for a given Priority passed as parameter.

このカテゴリがパラメタで渡された特定の Priorityを利用できるかどうかをチェックします。

See also isDebugEnabled().

isDebugEnabled()を参照してください。

戻り値:
boolean True if this category is enabled for priority.

isInfoEnabled

public boolean isInfoEnabled()
Check whether this category is enabled for the info priority. See also isDebugEnabled().

このカテゴリが、infoの優先度を利用できるかどうかをチェックします。

戻り値:
boolean - true if this category is enabled for priority info, false otherwise.

論理値 - もし、このカテゴリが優先度 info に関して利用可能であれば trueを、そうでない場合は、false


l7dlog

public void l7dlog(Priority priority,
                   String key,
                   Throwable t)
Log a localized message. The user supplied parameter key is replaced by its localized version from the resource bundle.

ローカライズされたメッセージをログに出力します。 ユーザの提供したパラメタkeyはリソースバンドルからローカライズされたバージョンにより置き換えられます。

導入されたバージョン:
0.8.4
関連項目:
setResourceBundle(java.util.ResourceBundle)

l7dlog

public void l7dlog(Priority priority,
                   String key,
                   Object[] params,
                   Throwable t)
Log a localized and parameterized message. First, the user supplied key is searched in the resource bundle. Next, the resulting pattern is formatted using MessageFormat.format(String,Object[]) method with the user supplied object array params.

ローカライズ、パラメタライズされたメッセージをログに出力します。 まず最初に、ユーザが提供したkeyがリソースバンドル内で検索されます。 次に、結果のパターンは、ユーザが提供したオブジェクトの配列 paramsを使うMessageFormat.format(String,Object[])を使ってフォーマットされます。

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

log

public void log(Priority priority,
                Object message,
                Throwable t)
This generic form is intended to be used by wrappers.

この一般的なフォームは、ラッパによって使われることを意図しています。


log

public void log(Priority priority,
                Object message)
This generic form is intended to be used by wrappers.

この一般的なフォームは、ラッパによって使われることを意図しています。


log

public void log(String callerFQCN,
                Priority priority,
                Object message,
                Throwable t)
This is the most generic printing method. It is intended to be invoked by wrapper classes.

これは、もっとも一般的なプリントメソッドです。 ラッパクラスにより起動されることを意図しています。

パラメータ:
callerFQCN - The wrapper class' fully qualified class name.

callerFQCN ラッパクラスの完全修飾クラス名

priority - The priority of the logging request.

priority ロギング要求の優先度

message - The message of the logging request.

message ロギング要求のメッセージ

t - The throwable of the logging request, may be null.

param ロギング要求のthrowable、nullかもしれません


removeAllAppenders

public void removeAllAppenders()
Remove all previously added appenders from this Category instance.

このカテゴリから前に追加された全てのアペンダを削除します。

This is useful when re-reading configuration information.

これは、設定情報を再読み込みする際に役立ちます。

定義:
インタフェース AppenderAttachable 内の removeAllAppenders

removeAppender

public void removeAppender(Appender appender)
Remove the appender passed as parameter form the list of appenders.

アペンダのリストからパラメタで渡されたアペンダを削除します。

定義:
インタフェース AppenderAttachable 内の removeAppender
導入されたバージョン:
0.8.2

removeAppender

public void removeAppender(String name)
Remove the appender with the name passed as parameter form the list of appenders.

パラメタで渡された名前を使ってアペンダのリストからアペンダを削除します。

定義:
インタフェース AppenderAttachable 内の removeAppender
導入されたバージョン:
0.8.2

setAdditivity

public void setAdditivity(boolean additive)
Set the additivity flag for this Category instance.

このCategoryのインスタンスに関するadditivityフラグを設定します。

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

setPriority

public void setPriority(Priority priority)
Set the priority of this Category.

このカテゴリの優先度を設定します。

Null values are admitted.

null値は、認められています。


setResourceBundle

public void setResourceBundle(ResourceBundle bundle)
Set the resource bundle to be used with localized logging methods l7dlog(Priority,String,Throwable) and l7dlog(Priority,String,Object[],Throwable).

ローカライズされた ロギングメソッド l7dlog(Priority,String,Throwable)l7dlog(Priority,String,Object[],Throwable)と一緒に使われるリソースバンドルを設定します。

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

shutdown

public static void shutdown()
Calling this method will safely close and remove all appenders in all the categories including root contained in the default hierachy.

このメソッドを呼ぶと、安全ににクローズし、デフォルトの階層内にあるルートを含むすべてのカテゴリ内のアペンダを削除します。

Some appenders such as SocketAppender and AsyncAppender need to be closed before the application exists. Otherwise, pending logging events might be lost.

SocketAppenderAsyncAppenderのようないくつかのアペンダは、アプリケーションが終了する前にクローズされる必要があります。 しかし、宙ぶらりのロギングイベントは、失われるでしょう。

The shutdown method is careful to close nested appenders before closing regular appenders. This is allows configurations where a regular appender is attached to a category and again to a nested appender.

shutdownメソッドは、通常アペンダをクローズする前にネストしたアペンダをクローズするよう配慮されています。

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

warn

public void warn(Object message)
Log a message object with the WARN priority.

WARN優先度を使ってメッセージオブジェクトをログに出力します。

This method first checks if this category is WARN enabled by comparing the priority of this category with WARN priority. If the category is WARN enabled, then it converts the message object passed as parameter to a string by invoking the appropriate ObjectRenderer. It proceeds to call all the registered appenders in this category and also higher in the hieararchy depending on the value of the additivity flag.

このメソッドは、WARN優先度を使ってこのカテゴリの優先度と比較することによりこのカテゴリが WARNを利用できるかどうかを最初にチェックします。 もし、このカテゴリがWARNを利用できる場合、妥当な ObjectRendererを起動することによりパラメタとして渡されたメッセージオブジェクトを文字列に変換します。 それは、カテゴリ内の全ての登録されたアペンダであり、また、additivityフラグの値に依存する階層内でより上位のアペンダを呼び出そうとします。

WARNING Note that passing a Throwable to this method will print the name of the Throwable but no stack trace. To print a stack trace use the warn(Object, Throwable) form instead.

警告 このメソッドへ Throwableを投げると、Throwableの名前を出力するが、スタックトレースは出力しないことを念頭においてください。 スタックトレースを出力するには、代わりとして、warn(Object, Throwable)フォームを使ってください。

パラメータ:
message - the message object to log.

message ログに出力するメッセージオブジェクト


warn

public void warn(Object message,
                 Throwable t)
Log a message with the WARN priority including the stack trace of the Throwable t passed as parameter.

パラメータとして渡される Throwable tのスタックとレースに含まれる WARN優先度を使ってメッセージをログに出力します。

See warn(Object) for more detailed information.

さらに詳しい情報は、warn(Object)を参照してください。

パラメータ:
message - the message object to log.

message ログに出力するためのメッセージオブジェクト

t - the exception to log, including its stack trace.

t ログに出力するための例外でスタックトレースを含みます。



Please notify me about new log4j releases.