AppLogger
The RoadRunner server has a useful app-logger
plugin that allows users to send logs from their applications to the RoadRunner server using an RPC interface. This plugin is enabled by default and does not require any additional configurations. It can be used to observe all application and server logs in one place. This is especially useful when debugging and monitoring applications.
It will send raw messages to the RoadRunner STDERR
Configuration
The logs
section in the RoadRunner configuration file allows you to configure logging behavior for their application.
To interact with the RoadRunner app-logger plugin, you will need to have the RPC defined in the rpc configuration section. You can refer to the documentation page here to learn more about the configuration.
The level
key is used to specify the logging level for this channel. This means that only log messages with a severity level of info or higher will be sent to this channel.
Read more about logging in the Logging β Logger section.
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:
You can refer to the documentation page here to learn more about creating the RPC connection.
Available methods
debug(string): void
: Sends a debug log message to the servererror(string): void
: Sends an error log message to the serverinfo(string): void
: Sends an info log message to the serverwarning(string): void
: Sends a warning log message to the serverlog(string): void
: Sends a log message directly to theSTDERR
of the server
API
RPC API
RoadRunner provides an RPC API, which allows you to manage app-logger in your applications using remote procedure calls. The RPC API provides a set of methods that map to the available methods of the RoadRunner\Logger\Logger
class in PHP.
All methods accept a string
(which will be log message) as a first argument and a bool
placeholder for the second arg.
Error
Method sends an error
log message with the specified message to the RoadRunner server.
Info
Method sends an info
log message with the specified message to the RoadRunner server.
Warning
Method sends a warning
log message with the specified message to the RoadRunner server.
Debug
Method sends a debug
log message with the specified message to the RoadRunner server.
Log
Method sends a log message with the specified message directly to the STDERR
of the RoadRunner server.
Last updated