WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

Package examples.i18n.logging.startup

This package demonstrates how a startup class uses WebLogic i18n to log your own application's info and error messages to the server log.

See:
          Description

Interface Summary
UserSMessagesStartup The remote interface is implemented by UserSMessagesStartupImpl.
 

Class Summary
UserSMessagesStartClient UserSMessagesStartClient is used to exercise UserSMessagesStartupImpl which runs on the server.
UserSMessagesStartupImpl UserSMessagesStartupImpl is a simple startup class which shows how to use WebLogic i18n to log your own application's info and error messages to the server log.
 

Package examples.i18n.logging.startup Description

This package demonstrates how a startup class uses WebLogic i18n to log your own application's info and error messages to the server log.

UserSMessagesStartClient is used to exercise UserSMessagesStartupImpl which runs on the server.

UserSMessagesStartupImpl is a simple startup class which shows how to use WebLogic i18n to log your own application's info and error messages to the server log. There is a similar example showing how to do the same thing from a servlet instead of a startup class.

After running the example once, change your host computer's locale from "English" to "German" or "French" and reboot the WebLogic server. Run the example again and note that the example's log messages are displayed in either "German" or "French" depending upon your settings.

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

  1. Build the example
  2. Configure the server
  3. 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 correct locations in your WebLogic Server distribution.

Configure the Server

    Configure the server

    1. Start the server with the examples configuration.
    2. Bring up the Administration Console in your browser.
    3. Click to expand the Deployments node in the left-hand pane.
    4. Click to expand the Startup & Shutdown node in the left-hand pane.
    5. Click Create a new Startup Class.
    6. Enter UserSMessagesStartup in the Name field.
    7. Enter examples.i18n.logging.startup.UserSMessagesStartupImpl in the ClassName field.
    8. Click Create.
    9. Select the Targets tab in the right-hand pane to display the Available and Chosen targets.
    10. Enable the UserSMessagesStartup startup class on the examplesServer.
    11. Click to expand the Servers node in the left-hand pane.
    12. Click on the examplesServer node in the left-hand pane.
    13. Select the Logging tab in the right-hand pane.
    14. Click General tab to display Stdout severity threshold field.
    15. Pull down the drop down box to set the value of Stdout severity threshold to Info.

    Run the example

    1. Restart the WebLogic Server with the examples configuration.

    2. Execute the following command in your development shell: java examples.i18n.logging.startup.UserSMessagesStartClient host port where:
      host
      Host name of the WebLogic Server
      port
      Port where the WebLogic Server is listening for connections

    3. You should receive output similar to this in your WL_HOME/weblogic700/samples/server/config/examples/examplesServer/examplesServer.log file:
      
        This message displays a number as currency: $17.00.
        This message displays the string "WXYZ". There were 5 previous calls to the logger method for this message.
        This message displays the string "QRSTUV". There was one previous call to the logger method for this message. 
        This message displays the string "ABCD". There were no previous calls to the logger method for this message. 
        This is not really an error, the example has finished normally. 
        

    4. After you finish reviewing the log messages, Shut down the server. Change the locale of the server's computer to French or German (in Windows, from Control Panel -> Regional Settings).

    5. Repeat Steps 1 to 3 as described in Run the example to see the output in French or German.


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

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