Modifying the Logging Service Configuration

Overview of the Logging Service

The Logging Service enables applications to do the following:
  • send run-time messages to one or more output destinations, including consoles, files, and socket connections.
  • configure and control the format of information that is sent to a particular destination. Configuration can be performed through static configuration files or by invoking run-time methods that control logging output.
  • perform remote logging, which involves sending log messages that are generated in one Java virtual machine (JVM) to another JVM.
  • perform logging either by user session or by JVM.
For more information about the Logging Service, see com.sas.services.logging in the SAS Foundation Services class documentation at http://support.sas.com/rnd/javadoc/93.
When a service deployment is defined and deployed, a base logging configuration is used to determine the appropriate output destinations. However, you can use SAS Management Console Foundation Services Manager to modify the Logging Service configuration and configure additional logging contexts and output destinations. The Logging Service configuration consists of the following items:
contexts
specify the name and outputs for a specific logging context. In your application, you code the Logging Service to send information to a specific logging context. (The RootLoggingContext is used for any logging context that is not configured.) When naming the logging context, you can specify the logging context name as part of a naming hierarchy. In a naming hierarchy, the logging context names are separated by a period (for example, com.sas.services.event). If a call to a logging context named com.sas.services.event is made and there is no logging context for com.sas.services.event, then the Logging Service looks for a logging context of com.sas.services. If there is no logging context for com.sas.services, then com.sas is used. When you define a logging context, you associate outputs with the logging context in order to specify where to send logging messages for that particular logging context.
Note: To associate outputs with a logging context, you must first create the output definition.
outputs
specify an output destination for the logging messages. The Logging Service can send the log messages to a file, console, or socket.
renderers
specify a custom renderer that is used to format logging messages for a specific class. The custom renderer enables you to format logging output when you specify an object as the message parameter in a logging call.

Configure the Logging Service

To configure the Logging Service, perform the following steps:
  1. In the SAS Management Console navigation tree, locate and select the Logging Service that you want to modify. Right-click on the Logging Service and select Properties. The Logging Service Properties window appears.
  2. Select the Service Configuration tab and click Configuration. The Logging Service Configuration window appears.
  3. On the Outputs tab, click New to add an output, or select an output and click Edit to edit an output. Enter the following information:
    ID
    specifies the name or identifier for the output.
    Layout Pattern
    specifies how to format the log message. For details about specifying layout patterns, see Layout Formats .
    Async
    specifies whether asynchronous logging is activated.
    Type
    specifies the output type. Select one of the following:
    Console
    sends the logging output to the system console.
    File
    writes the logging output to a file.
    Socket
    sends the logging output to a network socket.
    ARM
    sends the logging output to an ARM appender.
    • If Console is selected, then the window contains these items:
      Target
      specifies the output destination. Valid values are System.out or System.err.
      ImmediateFlush
      specifies whether the contents of the log are sent out after each logging statement.
    • If File is selected, then the window contains these items:
      File
      specifies the file to use for output.
      ImmediateFlush
      specifies whether the contents of the log are sent out after each logging statement.
      Append
      specifies whether to append the logging output to the existing output in the file. If Append is not selected, then any existing data in the file will be overwritten.
      File Rollover
      specifies the type of rollover that is used for the log. Select one of the following:
      None
      specifies that file rollover is not used.
      Size
      specifies that the log file rolls over (starts a new file) when the file reaches a specific size. The Maximum Backup Index field specifies the number of backup files that are maintained. The Maximum File Size field specifies the maximum file size for the log file before rollover occurs.
      Frequency
      specifies that the log file rolls over (starts a new file) at a specific time interval. The Frequency Pattern field specifies the time pattern. For more information about frequency patterns, see the Foundation Services Manager Help.
    • If Socket is selected, the window contains these items:
      Host
      specifies the socket host (machine name).
      Port
      specifies the socket port number.
    • If ARM is selected, then the window does not contain any additional items.
    Click OK to return to the Logging Service Configuration window.
  4. On the Context tab, click New to add a context, or select a context and click Edit to edit a context. Enter the following information:
    Name
    specifies the name of the context.
    Priority
    specifies the priority level of the logging context. The priority levels are
    DEBUG
    displays the informational events that are most useful for debugging an application.
    INFO
    displays informational messages that highlight the progress of the application.
    WARN
    displays potentially harmful situations.
    ERROR
    displays error events that might allow the application to continue to run.
    FATAL
    displays very severe error events that will probably cause the application to terminate.
    Chained
    specifies whether the context is chained. Chaining designates that the log message is processed by both the current context and also by logging contexts higher in the logging context hierarchy.
    Outputs
    specifies the output destinations for the context. Move the outputs that you want to associate with this context from the Available pane to the Selected pane.
    Click OK to return to the Logging Service Configuration window.
  5. (Optional) Specify custom renderers for the Logging service. On the Renderers tab, click New to add a renderer, or select a renderer and click Edit to edit a renderer. Enter the following information:
    Rendered Class
    specifies the fully qualified name of a Java class that you want to associate with a custom renderer.
    Note: Any descendents of the rendered class will also be associated with the custom renderer, following the Java class hierarchy.
    Rendering Class
    specifies a Java class that implements com.sas.services.logging.RendererInterface. The rendering class is used to format the output for any logging calls where an object of the specified Rendered Class is passed in as the message parameter.
  6. (Optional) Specify consumers for the Logging service. On the Consumers tab, specify a Name for each consumer and then select which resources in the service configuration are consumed.
  7. Click OK to save the new Logging Service configuration to the metadata repository.