Show / Hide Table of Contents

    Logging Commands

    Out of the box Petabridge.Cmd.Host supports a number of logging commands that you can use immediately for working with your Akka.NET applications.

    Available Commands

    Command Name Description
    log write Writes a log at the specified log level to the Akka.NET host's log file.
    log peek Peeks at the event log and allows the client to view up to N past events logged on the Petabridge.Cmd.Host.
    log tail Starts a live tail of the log events produced by the server in real-time as they occur. Can be canceled with a Control + C instruction to the pbm client.

    log write

    Any logs written to the Petabridge.Cmd.Host using this method will appear in any loggers that are defined on the server, given that the host is configured to support the loglevel used by this command. I.E. if the server has akka.loglevel = INFO defined in its HOCON, any log messages written with this method using -l debug will not appear in the log.

    log write takes the following arguments:

    Argument Name Switches Mandatory? Allow Multiple? Is Flag? Description
    loglevel -l or -L no no no The loglevel at which the message will be written. Valid values are 'debug', 'info', 'warning', and 'error'. Defaults to 'debug' if left blank.
    message -m or -M yes no no The message to be written to the log.

    Examples

    Writing a debug message into the log file.

    pbm [host@port] log write -m "restarting this node" -l debug
    

    log peek

    The Petabridge.Cmd.Host configures the server to only memorize the 50 most recent logs by default. All memorized logs will be recorded from the point in time in which the Petabridge.Cmd.Host was started, irregardless of whether or not any clients have connected to it. To view those logs, you can use the log peek command.

    log peek takes the following arguments:

    Argument Name Switches Mandatory? Allow Multiple? Is Flag? Description
    loglevel -l or -L no no no The loglevel at which the message will be written. Valid values are 'debug', 'info', 'warning', and 'error'. Defaults to 'debug' if left blank.
    count -n or -N no no no The maximum number of logs to be retrieved from the server. Defaults to 1.

    Examples

    View the 30 most recent INFO messages:

    pbm [host:port] log peek -n 30 -l info
    

    log tail

    log tail is a streaming command and cannot be interrupted without explicitly terminating the pbm client. This is especially useful if you want to be able to pipe the logged data to a local file or any other type of shell output when running the client in "single shot" mode.

    log tail takes the following arguments:

    Argument Name Switches Mandatory? Allow Multiple? Is Flag? Description
    loglevel -l or -L no no no The loglevel at which the message will be written. Valid values are 'debug', 'info', 'warning', and 'error'. Defaults to 'debug' if left blank.

    Examples

    Tail all INFO logs:

    pbm [host:port] log tail -l info
    
    Back to top Generated by DocFX