この付録では、msgcat.dtd
スキーマの要素について説明します。
詳細については、次を参照してください。
Oracle CEPでは、ローカライズ可能なログ・メッセージの定義に使用する、多数のメッセージ・カタログ要素が提供されます。
この項では、次のメッセージ・カタログの例を示します。
例G-3 ログ・メッセージ・カタログ
<?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls90/dtd/msgcat.dtd"> <message_catalog l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" version="1.0" baseid="600000" endid="600100"> <logmessage messageid="600001" severity="warning" method="logNoAuthorization(String arg0, java.util.Date arg1,int arg2)"> <messagebody> Could not open file, {0} on {1,date} after {2,number} attempts. </messagebody> <messagedetail> The configuration for this application will be defaulted to factory settings. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable. </messagedetail> <cause> The user is not authorized to use custom configurations. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable.The attempt has been logged to the security log. </cause> <action> The user needs to gain approriate authorization or learn to live with the default settings. </action> </logmessage> </message_catalog>
例G-4 シンプル・テキスト・カタログ
<?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls90/dtd/msgcat.dtd"> <message_catalog> l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" version="1.0"> <message messageid="FileMenuTitle"> <messagebody> File </messagebody> </message> </message_catalog>
表G-1では、message_catalog
要素の属性を示します。
表G-1 message_catalog要素の属性
属性 | 説明 | データ型 | 必須? |
---|---|---|---|
|
このカタログのLoggerクラスを含むJavaパッケージ。クラスの名前はカタログ・ファイルの名前に基づいて付けられます。たとえば、カタログの名前が 構文: 標準のJavaパッケージ構文。 例: デフォルト: |
|
いいえ。 |
|
カタログ用に生成したLogLocalizerプロパティを含むJavaパッケージ。たとえば、カタログの名前が
構文: 標準のJavaパッケージ構文。 例: デフォルト: |
|
いいえ。 |
|
このカタログと関連付けられているサブシステムを識別する頭字語。サブシステムの名前はサーバー・ログに含まれ、メッセージの分離を目的として使用されます。 例: |
|
はい。 |
|
使用される 使用方法: 構文: 例: |
|
はい。 |
|
このカタログで使用される最低のメッセージIDを指定します。構文: 1から6桁。例: 有効な値:
|
|
いいえ。 |
|
このカタログで使用される最高のメッセージIDを指定します。 構文: 1桁から6桁の数値。 例: 有効な値:
|
|
いいえ。 |
|
Loggableオブジェクトを返す追加メソッドを生成するかどうかを示します。 例: 有効な値:
デフォルト: |
|
|
|
ログに記録されるときにメッセージIDの先頭に追加する <[prefix-]id> ここで、 たとえば、プレフィックスが 構文: 任意の 例: 有効な値:
|
|
いいえ。 |
|
カタログの内容を説明する省略可能な属性。 例: |
|
いいえ。 |
次の例は、ログ・メッセージ・カタログ・ファイル内のmessage_catalog
要素の使用方法を示します。
<?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls90/dtd/msgcat.dtd"> <message_catalog l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" version="1.0" baseid="600000" endid="600100"> <logmessage messageid="600001" severity="warning" method="logNoAuthorization(String arg0, java.util.Date arg1,int arg2)"> <messagebody> Could not open file, {0} on {1,date} after {2,number} attempts. </messagebody> <messagedetail> The configuration for this application will be defaulted to factory settings. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable. </messagedetail> <cause> The user is not authorized to use custom configurations. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable.The attempt has been logged to the security log. </cause> <action> The user needs to gain approriate authorization or learn to live with the default settings. </action> </logmessage> </message_catalog>
表G-6ではlogmessage
コンポーネント構成要素の属性が一覧表示されています。
表G-2 logmessage要素の属性
属性 | 説明 | データ型 | 必須? |
---|---|---|---|
|
このログ・メッセージのユニークな識別子。識別子は、すべてのカタログにわたりユニークである必要があります。値は、 使用方法: 値は、 構文: 1桁から6桁の数値。 例: |
|
はい。 |
|
このメッセージの修正管理に使用される日付と時刻のスタンプ。日付は、カタログで動作するユーティリティによって提供されます。 使用方法: 日付はカタログで動作するユーティリティによって提供されます。 構文: |
|
いいえ。 |
|
ログ・メッセージの重大度を示します。ユーザー定義カタログでは、 有効な値:
例: |
|
はい。 |
|
このメッセージをログに記録するためのメソッド・シグネチャ。 構文は標準のJavaメソッド・シグネチャから修飾子、セミコロン、および拡張子を除いたもの。引数の型にはJavaプリミティブまたはJavaクラスを使用できます。クラスは 引数には有効であればどのような名前でも指定できますが、 |
|
はい。 |
|
生成するメソッドのタイプを指定します。メソッドは次のとおりです。
有効な値:
デフォルト: |
|
いいえ。 |
|
Throwableの引数としてスタック・トレースを生成するかどうかを示します。値が 有効な値:
デフォルト: |
|
いいえ。 |
|
メッセージが廃止されているかどうかを示します。廃止されたメッセージとは、前のリリースで使用されていたが、今は古くなり、現在のバージョンでは使用されないメッセージ。廃止されたメッセージは、クラスまたはリソースの生成で使用しません。 有効な値:
デフォルト: |
|
いいえ。 |
次の例は、ログ・メッセージ・カタログ・ファイル内のlogmessage
要素の使用方法を示します。
<?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls90/dtd/msgcat.dtd"> <message_catalog l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" version="1.0" baseid="600000" endid="600100"> <logmessage messageid="600001" severity="warning" method="logNoAuthorization(String arg0, java.util.Date arg1,int arg2)"> <messagebody> Could not open file, {0} on {1,date} after {2,number} attempts. </messagebody> <messagedetail> The configuration for this application will be defaulted to factory settings. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable. </messagedetail> <cause> The user is not authorized to use custom configurations. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable.The attempt has been logged to the security log. </cause> <action> The user needs to gain approriate authorization or learn to live with the default settings. </action> </logmessage> </message_catalog>
表G-3では、message
要素の属性を示します。
表G-3 message要素の属性
属性 | 説明 | データ型 | 必須? |
---|---|---|---|
|
このログ・メッセージの、英数字文字列での一意の識別子。このカタログでのみ、一意である必要があります。 |
|
はい。 |
|
このメッセージの修正管理に使用される日付と時刻のスタンプ。日付は、カタログで動作するユーティリティによって提供されます。 使用方法: 日付はカタログで動作するユーティリティによって提供されます。 構文: |
|
いいえ。 |
|
このメッセージをフォーマットするためのメソッド・シグネチャ。 構文は標準のJavaメソッド・シグネチャから戻り値の型、修飾子、セミコロン、および拡張子を除いたものです。戻り値の型は常に 各引数について、次に説明する 例: この例は、次のように public String getNoAuthorization(String filename, java.util.Date creDate) |
|
いいえ。 |
|
メッセージが廃止されているかどうかを示します。廃止されたメッセージとは、前のリリースで使用されていたが、今は古くなり、現在のバージョンでは使用されないメッセージ。廃止されたメッセージは、クラスまたはリソースの生成で使用しません。 有効な値:
デフォルト: |
|
いいえ。 |
次の例は、ログ・メッセージ・カタログ・ファイル内のmessage
要素の使用方法を示します。
<?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls90/dtd/msgcat.dtd"> <message_catalog> l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" version="1.0"> <message messageid="FileMenuTitle"> <messagebody> File </messagebody> </message> </message_catalog>
messagebody要素では、0から10のプレースホルダー{n}
を使用できます。プレースホルダーは、ログ・メッセージがローカライズされるときに適切な引数で置き換えられます。
最後の引数がThrowableまたはサブクラスでない場合、メッセージ本文には、対応するメソッド属性にリストされたすべての引数に対するプレースホルダーを含める必要があります。
一重引用符は、java.text.MessageFormat
によって特別に解析されるため、使用は慎重に行います。メッセージ引数に引用符を付けた方がよい場合は、(G.5.3項「例」のように)二重引用符を使用します。メッセージが1つ以上のプレースホルダーを持つ場合、一重引用符が正しく表示されるようにするには(たとえば、アポストロフィとして)、もう1つ一重引用符を付ける必要があります。
構文: String
次の例は、ログ・メッセージ・カタログ・ファイル内のmessagebody
要素の使用方法を説明します。
<?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls90/dtd/msgcat.dtd"> <message_catalog l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" version="1.0" baseid="600000" endid="600100"> <logmessage messageid="600001" severity="warning" method="logNoAuthorization(String arg0, java.util.Date arg1,int arg2)"> <messagebody> Could not open file, "{0}" on {1,date} after {2,number} attempts. </messagebody> <messagedetail> The configuration for this application will be defaulted to factory settings. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable. </messagedetail> <cause> The user is not authorized to use custom configurations. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable.The attempt has been logged to the security log. </cause> <action> The user needs to gain approriate authorization or learn to live with the default settings. </action> </logmessage> </message_catalog>
この要素を使用して、イベントの詳しい説明を定義します。この要素には、任意のプレースホルダーを含めることができます。
構文: String
次の例は、ログ・メッセージ・カタログ・ファイル内のmessagedetail
要素の使用方法を説明します。
<?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls90/dtd/msgcat.dtd"> <message_catalog l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" version="1.0" baseid="600000" endid="600100"> <logmessage messageid="600001" severity="warning" method="logNoAuthorization(String arg0, java.util.Date arg1,int arg2)"> <messagebody> Could not open file, {0} on {1,date} after {2,number} attempts. </messagebody> <messagedetail> The configuration for this application will be defaulted to factory settings. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable. </messagedetail> <cause> The user is not authorized to use custom configurations. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable.The attempt has been logged to the security log. </cause> <action> The user needs to gain approriate authorization or learn to live with the default settings. </action> </logmessage> </message_catalog>
この要素を使用して、イベントの主な原因を定義します。この要素には、任意のプレースホルダーを含めることができます。
構文: String
次の例は、ログ・メッセージ・カタログ・ファイル内のcause
要素の使用方法を説明します。
<?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls90/dtd/msgcat.dtd"> <message_catalog l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" version="1.0" baseid="600000" endid="600100"> <logmessage messageid="600001" severity="warning" method="logNoAuthorization(String arg0, java.util.Date arg1,int arg2)"> <messagebody> Could not open file, {0} on {1,date} after {2,number} attempts. </messagebody> <messagedetail> The configuration for this application will be defaulted to factory settings. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable. </messagedetail> <cause> The user is not authorized to use custom configurations. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable.The attempt has been logged to the security log. </cause> <action> The user needs to gain approriate authorization or learn to live with the default settings. </action> </logmessage> </message_catalog>
この要素を使用して、推奨の解決方法を定義します。この要素には、任意のプレースホルダーを含めることができます。
構文: String
次の図は、ログ・メッセージ・カタログ・ファイル内のaction
要素の使用方法を説明します。
<?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls90/dtd/msgcat.dtd"> <message_catalog l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" version="1.0" baseid="600000" endid="600100"> <logmessage messageid="600001" severity="warning" method="logNoAuthorization(String arg0, java.util.Date arg1,int arg2)"> <messagebody> Could not open file, {0} on {1,date} after {2,number} attempts. </messagebody> <messagedetail> The configuration for this application will be defaulted to factory settings. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable. </messagedetail> <cause> The user is not authorized to use custom configurations. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable.The attempt has been logged to the security log. </cause> <action> The user needs to gain approriate authorization or learn to live with the default settings. </action> </logmessage> </message_catalog>