+

Search Tips   |   Advanced Search

BinaryLog command options

Use the binaryLog command to view or copy the contents of a binary logging repository, or list the available server process instances in the repository. The binaryLog command is equivalent to the logViewer command in the profile bin directory of the full profile application server.

The binary log and trace facility writes to a repository in a binary format. We can view, query and filter the repository using the binaryLog command. The binaryLog command provides options for quickly converting repository contents into a text file in various formats, such as basic and advanced formats. The command also provides options to make getting the data we need from the logs easier; for example, allowing you to filter what log records we want by level, logger name, or date and time.


Syntax

Syntax:

The value of options is different based on the value of action.


Parameters

The following actions are available for the binaryLog command:

view

Read a repository, optionally filter it, and create a version that users can read.

Syntax:

    binaryLog view {serverName | repositoryPath} [options]

serverName

Name of a Liberty server with a repository to read from.

repositoryPath

Path to a repository to read from. This is typically the directory containing both the logdata and tracedata directories.

If neither a serverName nor a repositoryPath is specified on the command line, the task is performed against the default server instance, defaultServer.

Filter options:

All filters are optional. When multiple filters are used, they are logically ANDed together.

  • --minDate=value

    Filter based on minimum record creation date. Specify value as either a date (for example --minDate="2/20/13") or a date and time (for example --minDate="2/20/13 16:47:21:445 EST").

  • --maxDate=value

    Filter based on maximum record creation date. Specify value as either a date (for example --maxDate="2/20/13") or a date and time (for example --maxDate="2/20/13 16:47:21:445 EST").

  • --minLevel=value

    Filter based on minimum level. Value must be one of FINEST | FINER | FINE | DETAIL | CONFIG | INFO | AUDIT | WARNING | SEVERE | FATAL.

  • --maxLevel=value

    Filter based on maximum level. Value must be one of the following: FINEST | FINER | FINE | DETAIL | CONFIG | INFO | AUDIT | WARNING | SEVERE | FATAL.

  • --includeLogger=value[,value]*

    Include records with specified logger name. Value may include * or ? as a wildcard.

  • --includeMessage=value

    Filter based on message name. Value may include * or ? as a wildcard.

  • --includeThread=value

    Include records with specified thread id. Values must be in hexadecimal (for example, --includeThread=2a).

  • --includeExtension=name=value[,name=value]*

    Include records with specified extension name and value. Value may include * or ? as a wildcard. To include a comma in the value, use "\,"

  • --includeInstance=value

    Include records from the specified server instance. Value must either be "latest" or be a valid instance ID. Run this command using the listInstances action to see a list of valid instance IDs.

Monitor option:

--monitor

Continuously monitor the repository and output new content as it is generated.

Output options:

  • --format={basic | advanced | CBE-1.0.1}

    Specify the output format to use. "basic" is the default format.

  • --encoding=value

    Specify the character encoding to use for output.

copy

Read a repository, optionally filter it, and write the contents to a new repository.

Syntax:

    binaryLog copy {serverName | repositoryPath} targetPath [options]

serverName

Name of a Liberty server with a repository to read from.

repositoryPath

Path to a repository to read from. This is typically the directory containing the logdata and tracedata directories.

targetPath

Path at which to create a new repository. The targetPath must be specified.

Either serverName or repositoryPath must be specified, as well as the targetPath.

Filter options:

All filters are optional. When multiple filters are used, they are logically ANDed together.

  • --minDate=value

    Filter based on minimum record creation date. Value must be specified as either a date (for example --minDate="2/20/13") or a date and time (for example --minDate="2/20/13 16:52:32:808 EST").

  • --maxDate=value

    Filter based on maximum record creation date. Value must be specified as either a date (for example --maxDate="2/20/13") or a date and time (for example --maxDate="2/20/13 16:52:32:808 EST").

  • --minLevel=value

    Filter based on minimum level. Value must be one of the following: FINEST | FINER | FINE | DETAIL | CONFIG | INFO | AUDIT | WARNING | SEVERE | FATAL.

  • --maxLevel=value

    Filter based on maximum level. Value must be one of the following: FINEST | FINER | FINE | DETAIL | CONFIG | INFO | AUDIT | WARNING | SEVERE | FATAL.

  • --includeLogger=value[,value]*

    Include records with specified logger name. Value may include * or ? as a wildcard.

  • --excludeLogger=value[,value]*

    Exclude records with specified logger name. Value may include * or ? as a wildcard.

  • --includeMessage=value

    Filter based on message name. Value may include * or ? as a wildcard.

  • --includeThread=value

    Include records with specified thread id. Values must be in hexadecimal (for example, --includeThread=2a).

  • --includeExtension=name=value[,name=value]*

    Include records with specified extension name and value. Value may include * or ? as a wildcard. To include a comma in the value, use "\,"

  • --includeInstance=value

    Include records from the specified server instance. Value must either be "latest" or be a valid instance ID. Run this command using the listInstances action to see a list of valid instance IDs.

listInstances

List the IDs of server instances in the repository. A server instance is the collection of all log/trace records written from the time a server is started until it is stopped. Server instance IDs can be used with the --includeInstance option of the binaryLog view action.

Syntax:

    binaryLog listInstances {serverName | repositoryPath}

serverName

Name of a Liberty server with a repository to read from.

repositoryPath

Path to a repository to read from. This is typically the directory containing the logdata and tracedata directories.

If serverName or repositoryPath are not specified on the command line, the task is performed against the default server instance, defaultServer.

Be aware of binaryLog filtering optimizations. The binaryLog tool is able to filter log and trace data most efficiently when used with the following filter options:

  • --minDate
  • --maxDate
  • --includeThread
  • --minLevel
  • --maxLevel

Example usage

See the following examples of binaryLog commands.

  • Display all events in the defaultServer repository between July 19th, 2013 and August 2nd, 2013.

      binaryLog view --minDate=07/19/13 --maxDate=08/02/13

  • Display new events from server myServer, whose specified level is WARNING or higher, using the advanced format as the server writes them to the log repository.

      binaryLog view myServer --monitor --minLevel=WARNING --format=advanced

  • Write log messages from a repository at /apps/server1/logs; include only those that were written to the error stream of a specific repository.

      binaryLog view /apps/server1/logs --includeLogger=SystemErr

  • View events from the defaultServer repository that occurred before September 14th, 2012 4:28 PM eastern daylight time.

      binaryLog view --maxDate="09/14/12 16:28:00:000 EDT"

  • Write events from the defaultServer repository containing a 'thread' extension with value 'Default Executor-thread-4'

      binaryLog view --includeExtension=thread="Default Executor-thread-4" --format=advanced

  • View the list of server instances in the defaultServer repository:
    binaryLog listInstances 
    
    Using D:\wlp\usr\servers\defaultServer\logs as repository directory.
    
    Instance ID                  Start Date
    1358809441761                1/21/13 18:04:01:761 EST
    1358864476191                1/22/13 9:21:16:191 EST
    1358869523192                1/22/13 10:45:23:192 EST
    1358871281166                1/22/13 11:14:41:166 EST
    1358879829000                1/22/13 13:37:09:000 EST
    1358892222067                1/22/13 17:03:42:067 EST

  • View events from the defaultServer using one of the instance IDs from the previous example:

      binaryLog view --includeInstance=1358871281166

  • Copy events from the defaultServer, whose specified level is WARNING or higher, from the latest server instance to a new repository at d:\toSupport directory.

      binaryLog copy defaultServer d:\toSupport --minLevel=warning --includeInstance=latest


Parent topic: Binary logging