For the complete documentation index, see llms.txt. This page is also available as Markdown.

AppLogger

The app-logger plugin accepts log messages over RPC. Level-based methods use the app logger channel. The log() method writes directly to RoadRunner's standard error.

Configuration

Configure the app channel in the logs section to select the output format and minimum level:

.rr.yaml
rpc:
  listen: tcp://127.0.0.1:6001

logs:
  channels:
    app:
      mode: production
      level: info

This example emits JSON records at info level or higher and filters out debug. These settings do not control raw log calls.

See Logger for formats, levels, and output destinations. Level-based methods use the logger's asynchronous output queue.

PHP client

The RoadRunner app-logger plugin comes with a convenient PHP package that simplifies the process of integrating the plugin with your PHP application.

Installation

To get started, you can install the package via Composer using the following command:

Usage

After the installation, you can create an instance of the RoadRunner\Logger\Logger class, which will allow you to use the available class methods.

Here is an example:

See RPC connections for connection setup.

Available methods

  • debug(string): void: Sends a debug log message to the server

  • error(string): void: Sends an error log message to the server

  • info(string): void: Sends an info log message to the server

  • warning(string): void: Sends a warning log message to the server

  • log(string): void: Sends a log message directly to the STDERR of the server

Raw Output

The raw RPC methods app.Log and app.LogWithContext write directly to standard error. They bypass logger levels, formats, output settings, and the asynchronous queue. These calls wait for the write to complete. The logger's raw mode uses its configured level, destinations, and asynchronous queue.

With app-logger v6, app.Log appends LF (\n) only when the message does not already end with LF. app.LogWithContext uses the same rule when there are no attributes. V5 wrote these messages without adding a line ending. Update consumers that depended on concatenated messages without line endings.

With attributes, app.LogWithContext writes the message, a space, comma-separated key:value pairs, and LF. It preserves newlines inside the message. Send the raw RPC message without a trailing newline if you need the attributes on the same line.

API

RPC API

The string methods accept a message and a boolean reply placeholder. Call them by their registered RPC names:

Method
Output

app.Error

Error-level record through the app logger.

app.Info

Info-level record through the app logger.

app.Warning

Warning-level record through the app logger.

app.Debug

Debug-level record through the app logger.

app.Log

Raw standard error output.

Each method also has a WithContext variant, such as app.InfoWithContext. These methods accept LogEntry and a Response placeholder from github.com/roadrunner-server/api-go/v6/applogger/v1. The entry carries the message and LogAttrs key/value pairs.

The plugin's Go RPC receiver is no longer exported as app.RPC. Custom containers obtain it through Plugin.RPC(); PHP RPC method names are unchanged.

Last updated