AppLogger
Last updated
Was this helpful?
Last updated
Was this helpful?
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.
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 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.
The RoadRunner app-logger
plugin comes with a convenient PHP package that simplifies the process of integrating the plugin with your PHP application.
To get started, you can install the package via Composer using the following command:
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:
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
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.
Method sends an error
log message with the specified message to the RoadRunner server.
Method sends an info
log message with the specified message to the RoadRunner server.
Method sends a warning
log message with the specified message to the RoadRunner server.
Method sends a debug
log message with the specified message to the RoadRunner server.
Method sends a log message with the specified message directly to the STDERR
of the RoadRunner server.
You can refer to the documentation page to learn more about creating the RPC connection.