|
| WebLogic Server 6.0 Code Examples, BEA Systems, Inc. |
Package examples.i18n.logging
Simple Message Catalog Example
See:
Description
Class Summary |
I18nLog |
This example shows how to use the internationalized (I18n) logging interfaces. |
Package examples.i18n.logging Description
Simple Message Catalog Example
This example demonstrates how to use the internationalization interfaces to build and view a simple message catalog for different locales using the Message Editor graphical user interface (GUI).
- Build the example
- Configure the example
- Run the example
You must build the example before you can use the internationalization interfaces to access a simple message catalog. This example uses the simple message catalog I18nSimple.xml.
- Set up your development shell, as described in Setting up your environment for building and running the examples.
- Run build.sh(UNIX) or build.cmd(Windows).
These scripts process the I18nLog.xml catalog, and produce the logging class examples.i18n.logging.I18nLogLogger. This class contains static methods for logging messages to the WebLogic Server error log.
By default, a passed throwable logs a stack trace along with the method. Messages can optionally be defined to not log a stack trace. The logger methods return the message ID for applications that want to do more than just log these messages.
The message ID is used to obtain the message attributes. The L10nLookup object provides access to the catalogs via Localizer classes. Localizers provide the access to individual messages. Each log message catalog has two Localizers:
- General message information
- Detailed attributes
You will need to get the L10nLookup properties and use them to get the message Localizers. The basic localizer lcl returns a default value of false, and the detail localizer lclDetail returns a default value of true.
Use the Message Editor to load the simple message catalog that you have built and configured, and display the log message catalog information.
To start the Message Editor:
classTextFormatter
Switch back and forth between the locales (English and French are provided for this example) to see how the messages change that are written to the client log.
The basic Localizer provides access to the following catalog information:
- Version
- L10n Package - package for catalog data
- I18n Package - package for Logger methods
- Subsystem - catalog subsystem
- Severity
- debug (128)
- info (64)
- warning (32)
- error (8)
- Message Body - the message text
- Stack option - whether or not to log a stack trace
In addition to the basic information described above, the detail Localizer provides additional information, including cause and action for the message.