WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

examples.i18n.logging
Class I18nLog

java.lang.Object
  |
  +--examples.i18n.logging.I18nLog

public class I18nLog
extends java.lang.Object

This example shows how to use the internationalized (I18n) logging interface to access a simple message catalog. The methods and arguments are defined in the I18nLog.xml catalog. This example uses the simple message catalog I18nSimple.xml.

The following section describes how to build and run the examples:

  1. Build the example
  2. Run the example

Build the example

  1. Set up your development shell as described in Setting up your environment.

    We provide a build script for you to build the example, called build.xml.

  2. Run the build script using the following Java ant command:
           
    prompt> ant
  3. The script builds the example and places the files in the samples\examples\i18n\logging directory of your WebLogic Server installation.

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.

Run the example

  1. Execute the following command in your development shell:
    prompt> java examples.i18n.logging.I18nLog

  2. After you finish reviewing the messages, change the locale of the server's computer to French (in Windows, change the locale from the Control Panel -> Regional Settings) to see how the messages change that are written to the client log.

  3. Use the Message Editor to load the simple message catalog that you have built and configured, and display the log message catalog information.

  4. Start the Message Editor:
    java weblogic.il8ntools.gui.MessageEditor

  5. The basic Localizer provides access to the following catalog information:

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

In addition to the basic information described above, the detail Localizer provides additional information, including cause and action for the message. Copyright (c) 2000-2002 by BEA Systems, Inc. All Rights Reserved.


Constructor Summary
I18nLog()
           
 
Method Summary
static void main(java.lang.String[] argv)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

I18nLog

public I18nLog()
Method Detail

main

public static void main(java.lang.String[] argv)

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

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