- Index

< Previous |  | Next >

# Managing Logging at Runtime

StreamBase provides mechanisms to manage logging while a fragment is running in a node, using the logging target of the epadmin command.

## Determine Engine Name

StreamBase logging management commands affect running engines, not nodes or fragments. Your running fragment in its node might be configured to run with more than one engine.

For this reason, you must determine the engine name or names you want to target with a logging command. First, determine the node's Administration Port:

    epadmin servicename=A.X display node

Next, determine the engine name in the Name line resulting from the next command.

    epadmin servicename=A.X display engine

For a node running on a remote machine, you may need to use the hostname and adminport parameters, and/or the username and password parameters.

    epadmin servicename=A.X adminport=2643 hostname=server.example.com display engine
    epadmin servicename=A.X username=guest password=guest display engine

The Name near the top of the results shows the engine name for the specified node.

    Name = engine_name

## Display Logging

To see all of the logging configurations for all subsystems in the running node, run this command:

    epadmin adminport=6575 display logging enginename=engine_name

This shows results like this example:

    Engine Name = engine_name
    Logger Name = ROOT
    Log Level = INFO

    Engine Name = engine_name
    Logger Name = com.sun.jersey
    Log Level = WARN

    Engine Name = engine_name
    Logger Name = com.tibco.ep.dtm.audit
    Log Level = INFO
    ...

You can reduce the display to a particular logger:

    epadmin adminport=6575 display logging enginename=engine_name loggername=ROOT

## Set Logging

You can use the set logging command to change log levels of a particular logger in a running engine:

    epadmin adminport=6575 set logging enginename=engine_name loggername=ROOT level=DEBUG

Without the `enginename` parameter, this command sets a new log level for all running engines.

Instead of setting just the log level, you can upload a new logging configuration file:

    epadmin adminport=6575 set logging enginename=engine_name configuration=new-logging.xml

Add the format=groovy parameter to upload a new configuration file that uses Groovy. The default format is XML.

Changes made with set logging are not persistent, and are reset to the fragment's or application's default level on engine or node restart.

## Reset Logging

Use the reset logging command to reset logging changes made by the set command.

    epadmin adminport=6575 reset logging

Add an enginename= parameter to restrict the command to a particular engine. Add the loggername= command to restrict the command to a particular logger on an engine.

## Export Logging

Use the export logging command to retrieve the current logging configuration. Add the enginename= parameter to restrict the command to a particular engine:

    epadmin adminport=6575 export logging enginename=engine_name

Redirect this command's output to a file to preserve the logging configuration.

## Tail Logging

Use the tail logging command to read all new messages in an engine's log stream. This command blocks until it is interrupted, or count messages are read. This command can be executed against engines that are not in the started state. When the engine is started, any new log messages are displayed.

    tail logging

Add the enginename= parameter to restrict the command to a particular logger on an engine. If not specified, the tail logging command will tail log streams on all engines.

    tail logging --enginename=engine_name

Add the count= parameter to restrict the total number of log messages to read. The command terminates after this number of log messages is read. If not provided, the command continues to read until interrupted.

    tail logging --enginename=engine_name --count=100
    tail logging --count=100