org.apache.log4j
クラス Hierarchy

java.lang.Object
  |
  +--org.apache.log4j.Hierarchy

public class Hierarchy
extends Object

This class is specialized in retrieving categories by name and also maintaining the category hierarchy.

このクラスは、名前によるカテゴリの取り出しとカテゴリ階層の維持に特化しています。

The casual user should not have to deal with this class directly. In fact, up until version 0.9.0, this class had default package access. However, if you are in an environment where multiple applications run in the same VM, then read on.

一般のユーザは、直接このクラスを処理することはありません。 本当のところ、0.9.0にバージョンがアップして、デフォルトのパッケージアクセスができるようになりました。 しかし、もし、あなたが、複数のアプリケーションが同じVM上で稼動するような環境下にいる場合、その時読んでください。

The structure of the category hierarchy is maintained by the getInstance(java.lang.String) method. The hierarchy is such that children link to their parent but parents do not have any pointers to their children. Moreover, categories can be instantiated in any order, in particular descendant before ancestor.

カテゴリ階層の構造は、getInstance(java.lang.String)メソッドにより維持されます。 階層は、子が親にリンクしているが、親はその子へのポインタを持っていないような構造になっています。 その上、カテゴリは、祖先の前に子孫が来るような特別な場合を除き、どんな順番でもインスタンス化できます。

In case a descendant is created before a particular ancestor, then it creates a provision node for the ancestor and adds itself to the provision node. Other descendants of the same ancestor add themselves to the previously created provision node.

子孫が特定の祖先の前に作られる場合、子孫は、祖先の規定ノードに作成され、自分自身を規定ノードに追加します。 他の祖先をもつ子孫は、前に作成された規定ノードに自分自身を追加します。

See the code below for further details.

さらに詳しくは、以下のコードを参照してください。

作成者:
Ceki Gülcü

コンストラクタの概要
Hierarchy(Category root)
          Create a new Category hierarchy.
 
メソッドの概要
 void addRenderer(Class classToRender, ObjectRenderer or)
          Add an object renderer for a specific class.
 void clear()
          This call will clear all category definitions from the internal hashtable.
 void disable(Priority p)
          Disable all logging requests of priority equal to or below the priority parameter p, for all categories in this hierarchy.
 void disable(String priorityStr)
          Similar to disable(Priority) except that the priority argument is given as a String.
 void disableAll()
          Disable all logging requests regardless of category and priority.
 void disableDebug()
          Disable all logging requests of priority DEBUG regardless of category.
 void disableInfo()
          Disable all logging requests of priority INFO and below regardless of category.
 void enableAll()
          Undoes the effect of calling any of disable(java.lang.String), disableAll(), disableDebug() and disableInfo() methods.
 Category exists(String name)
          Check if the named category exists in the hierarchy.
 Enumeration getCurrentCategories()
          Returns all the currently defined categories in this hierarchy as an Enumeration.
 Category getInstance(String name)
          Return a new category instance named as the first parameter using the default factory.
 Category getInstance(String name, CategoryFactory factory)
          Return a new category instance named as the first parameter using factory.
 RendererMap getRendererMap()
          Get the renderer map for this hierarchy.
 Category getRoot()
          Get the root of this hierarchy.
 boolean isDisabled(int level)
           
 void overrideAsNeeded(String override)
          Override the shipped code flag if the override parameter is not null.
 void resetConfiguration()
          Reset all values contained in this hierarchy instance to their default.
 void setCategoryFactory(CategoryFactory factory)
          Set the default CategoryFactory instance.
 void setDisableOverride(String override)
          Set the disable override value given a string.
 void shutdown()
          Shutting down a hierarchy will safely close and remove all appenders in all categories including the root category.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

Hierarchy

public Hierarchy(Category root)
Create a new Category hierarchy.

新規にカテゴリーの階層を作成します。

パラメータ:
root - The root of the new hierarchy.

新しい階層のルートです。

メソッドの詳細

addRenderer

public void addRenderer(Class classToRender,
                        ObjectRenderer or)
Add an object renderer for a specific class.

設定するクラスに関するオブジェクトレンダラーを追加します。


clear

public void clear()
This call will clear all category definitions from the internal hashtable. Invoking this method will irrevocably mess up the category hierarchy.

この呼び出しによりすべてのカテゴリーの定義は内部のハッシュテーブルからクリアされます。このメソッドを起動するとカテゴリーの階層はなくなり、もとへ戻せなくなります。

You should really know what you are doing before invoking this method.

このメソッドを起動する前に本当に行ってよいか確認する必要があります。

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

exists

public Category exists(String name)
Check if the named category exists in the hierarchy. If so return its reference, otherwise returns null.

階層内に指定されたカテゴリーが存在するかどうかをチェックします。 もし存在すればその参照を返します。そうでなければ、nullを返します。

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

検索するためのカテゴリー名


disable

public void disable(String priorityStr)
Similar to disable(Priority) except that the priority argument is given as a String.

引数の優先度が文字列でしていされる以外、disable(Priority) と同じです。


disable

public void disable(Priority p)
Disable all logging requests of priority equal to or below the priority parameter p, for all categories in this hierarchy. Logging requests of higher priority then p remain unaffected.

この階層内にある すべての カテゴリーに対してパラメータの優先度 p と等価もしくはより低いすべての優先度のロギング要求を拒否します。

Nevertheless, if the BasicConfigurator.DISABLE_OVERRIDE_KEY system property is set to "true" or any value other than "false", then logging requests are evaluated as usual, i.e. according to the Basic Selection Rule.

それでも、もし BasicConfigurator.DISABLE_OVERRIDE_KEY システムプロパティが "true" または "false" 以外の値に設定されている場合、Basic Selection Rule によれば、たいていの場合、ロギング要求は評価されます。

The "disable" family of methods are there for speed. They allow printing methods such as debug, info, etc. to return immediately after an integer comparison without walking the category hierarchy. In most modern computers an integer comparison is measured in nanoseconds where as a category walk is measured in units of microseconds.

速度にかんしては、メソッドの "disable" の集合があります。 それらにより、debug、info などのような出力メソッドは、カテゴリー階層を渡り歩かず整数値比較を行った後すぐに返ることができます。 ほとんどの近代のコンピュータでは、整数値比較はカテゴリーの移動がマイクロ秒単位で計測されるようにナノ秒で計測されます。

Other configurators define alternate ways of overriding the disable override flag. See PropertyConfigurator and DOMConfigurator.

他の設定は上書き禁止フラグをオーバーライドする2つの方法を定義しています。 PropertyConfiguratorDOMConfigurator を参照してください。

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

disableAll

public void disableAll()
Disable all logging requests regardless of category and priority. This method is equivalent to calling disable(java.lang.String) with the argument Priority.FATAL, the highest possible priority.

カテゴリーと優先度に関係なくロギング要求を拒否します。 このメソッドはもっとも高い優先度の引数 Priority.FATAL を使って disable(java.lang.String) を呼び出すのに等しくなります。

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

disableDebug

public void disableDebug()
Disable all logging requests of priority DEBUG regardless of category. Invoking this method is equivalent to calling disable(java.lang.String) with the argument Priority.DEBUG.

カテゴリーに関係なく優先度 DEBUG のすべてのロギング要求を拒否します。 このメソッドを起動するのは、引数 Priority.DEBUG を使って disable(java.lang.String) を呼び出すのに等しくなります。

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

disableInfo

public void disableInfo()
Disable all logging requests of priority INFO and below regardless of category. Note that DEBUG messages are also disabled.

カテゴリーに関係なく優先度 INFO とそれより低い優先度のすべてのロギング要求を拒否します。

Invoking this method is equivalent to calling disable(Priority) with the argument Priority.INFO.

このメソッドを起動するのは引数 Priority.INFO を使って disable(Priority) を呼び出すのに等しくなります。

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

enableAll

public void enableAll()
Undoes the effect of calling any of disable(java.lang.String), disableAll(), disableDebug() and disableInfo() methods. More precisely, invoking this method sets the Category class internal variable called disable to its default "off" value.

disable(java.lang.String) と、disableAll()disableDebug()disableInfo() メソッドを呼び出した時の効果を無効にします。 もっと正確には、このメソッドを起動するとカテゴリークラスに初期値 "off" 値をとるdisable と呼ばれる内部変数を設定します。

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

overrideAsNeeded

public void overrideAsNeeded(String override)
Override the shipped code flag if the override parameter is not null.

override パラメーターが null 出ない場合、送られたコードフラグを上書きします。

If override is null then there is nothing to do. Otherwise, set Category.shippedCode to false if override has a value other than "false".

override が null の場合は、なにも処理は行いません。 そうでない時、override が "false" 以外の値の場合、Category.shippedCode に false を設定します。


getInstance

public Category getInstance(String name)
Return a new category instance named as the first parameter using the default factory.

デフォルトのファクトリを使うために最初のパラメーターとして指定された新規のカテゴリーのインスタンスを返します。

If a category of that name already exists, then it will be returned. Otherwise, a new category will be instantiated and then linked with its existing ancestors as well as children.

もし、指定した名前をもつカテゴリーがすでに存在している場合、そのカテゴリーが返されます。 そうでない時は、新規のカテゴリーのインスタンスが作成され、子と同様に存在する子孫にリンクされます。

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

取得するためのカテゴリーの名前


getInstance

public Category getInstance(String name,
                            CategoryFactory factory)
Return a new category instance named as the first parameter using factory.

factory を使うために最初のパラメーターとして指定された新規のカテゴリーを返します。

If a category of that name already exists, then it will be returned. Otherwise, a new category will be instantiated by the factory parameter and linked with its existing ancestors as well as children.

もし指定されたカテゴリーの名前が既に存在している場合は、そのカテゴリーを返します。 そうでない時は、factory パラメーターにより新規のカテゴリーが作成され、子と同様に存在する子孫にリンクされます。

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

取得するためのカテゴリーの名前

factory - The factory that will make the new category instance.

新規のカテゴリーのインスタンスを作成するためのファクトリー


getCurrentCategories

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

この階層内で現時点で定義されているすべてのカテゴリーを Enumeration として返します。

The root category is not included in the returned Enumeration.

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


isDisabled

public boolean isDisabled(int level)

getRendererMap

public RendererMap getRendererMap()
Get the renderer map for this hierarchy.

getRoot

public Category getRoot()
Get the root of this hierarchy.

この階層のルートを取得します。

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

resetConfiguration

public void resetConfiguration()
Reset all values contained in this hierarchy instance to their default. This removes all appenders from all categories, sets the priority of all non-root categories to null, sets their additivity flag to true and sets the priority of the root category to DEBUG. Moreover, message disabling is set its default "off" value.

この階層のインスタンス内に含まれるすべての値をそれらの初期値にリセットします。 これにより、すべてのカテゴリーからすべてのアペンダーを削除し、すべてのルートでないカテゴリーの優先度を null に設定し、それらの追加フラグを true に設定し、そしてルートカテゴリーの優先度を DEBUG に設定します。 その上、メッセージ出力の可否は、デフォルトの "off" 値に設定されます。

Existing categories are not removed. They are just reset.

存在するカテゴリーは削除されず、そのままリセットされるだけです。

This method should be used sparingly and with care as it will block all logging until it is completed.

このメソッドは補助的に使用する必要があり、完了するまですべてのロギングをブロックすることに注意してください。

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

setCategoryFactory

public void setCategoryFactory(CategoryFactory factory)
Set the default CategoryFactory instance.

デフォルトの CategoryFactory のインスタンスを設定します。

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

setDisableOverride

public void setDisableOverride(String override)
Set the disable override value given a string.

文字列として与えられた上書き禁止フラグの値を設定します。

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

shutdown

public void shutdown()
Shutting down a hierarchy will safely close and remove all appenders in all categories including the root category.

階層の機能を停止するとルートカテゴリーを含むすべてのカテゴリー内にあるアペンダーを 安全に クローズし、削除します。

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


Please notify me about new log4j releases.