Chapter 1, “Monitoring Techniques”

This example shows how to configure the log4j.properties file.

StepsConfiguring Log4j

  1. Use a text editor to create a log4j.properties file.

    # Set root category priority to INFO and its only appender to CONSOLE.
    #log4j.rootCategory=FATAL, CONSOLE
    log4j.rootCategory=DEBUG, LOGFILE
    
    # Set the enterprise logger category to FATAL and its only appender to CONSOLE.
    # log4j.logger.org.apache.axis.enterprise=DEBUG, LOGFILE
    
    # CONSOLE is set to be a ConsoleAppender using a PatternLayout.
    log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
    log4j.appender.CONSOLE.Threshold=DEBUG
    log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
    log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n
    
    # LOGFILE is set to be a File appender using a PatternLayout.
    log4j.appender.LOGFILE=org.apache.log4j.FileAppender
    log4j.appender.LOGFILE.File=<install_directory>/axisserver.log
    log4j.appender.LOGFILE.Append=true
    log4j.appender.LOGFILE.Threshold=DEBUG
    log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
    log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
    
  2. Put the log4j.properties file into $EAServer_Home/lib.

  3. Change to $EAServer_Home/bin and execute:

    run-server -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
    
  4. Write a class named “Hello”:

    package sayhello;
    
    public class Hello {
    public String hello() {
          return "hello";
        }
    }
    
  5. Use Sybase Web Services Toolkit to deploy this class as a Web service and generate a client.

  6. Run Hello_ServiceTestClient.java.

  7. Find the log file in <install_directory>\aixsserver.log and view the contents which should look similar to:

    953  [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  -
    loadBundle: Ignoring MissingResourceException: Can't find bundle for
    base name org.apache.axis.resource, locale zh_CN
    953  [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  -
    Created org.apache.axis.i18n.resource, linked to parent null
    953  [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  -
    getBundle(org.apache.axis,org.apache.axis.utils,resource,null,...)
    953  [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  -
    loadBundle: Ignoring MissingResourceException: Can't find bundle for
    base name org.apache.axis.utils.resource, locale zh_CN
    953  [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  -
    loadBundle: Ignoring MissingResourceException: Can't find bundle for
    base name org.apache.axis.resource, locale zh_CN
    953  [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  - Root
    package not found, cross link to org.apache.axis.i18n.resource
    953  [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  - Root
    package not found, cross link to org.apache.axis.i18n.resource
    953  [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  -
    org.apache.axis.i18n.resource::handleGetObject(engineFactory)
    1047 [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  -
    org.apache.axis.i18n.resource::handleGetObject(attachEnabled)
    1063 [main] DEBUG org.apache.axis.i18n.ProjectResourceBundle  -
    org.apache.axis.i18n.resource::handleGetObject(oddDigits00)