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).

  1. Build the example
  2. Configure the example
  3. Run the example

Build 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.

  1. Set up your development shell, as described in Setting up your environment for building and running the examples.
  2. 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.

Configure the example

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:

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.

Run the example

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:

In addition to the basic information described above, the detail Localizer provides additional information, including cause and action for the message.


Documentation is available at
http://e-docs.bea.com/wls/docs60

Copyright © 2000 BEA Systems, Inc. All Rights Reserved.