You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| skywalking_agent.properties_report_period_factor | The agent sends the instance properties to the backend every heartbeat_period * properties_report_period_factor seconds. | 10 |
22
22
| skywalking_agent.enable_zend_observer | Whether to use `zend observer` instead of `zend_execute_ex` to hook the functions, this feature is only available for PHP8+. | Off |
23
-
| skywalking_agent.reporter_type | Reporter type, optional values are `grpc`, `kafka` and `standalone`. | grpc |
23
+
| skywalking_agent.reporter_type | Reporter type, optional values are `grpc`, `kafka` and `standalone`. | grpc |
24
24
| skywalking_agent.kafka_bootstrap_servers | A list of host/port pairs to use for connect to the Kafka cluster. Only available when `reporter_type` is `kafka`. ||
25
25
| skywalking_agent.kafka_producer_config | Configure Kafka Producer configuration in JSON format `{"key": "value}`. Only available when `reporter_type` is `kafka`. | {} |
26
26
| skywalking_agent.inject_context | Whether to enable automatic injection of skywalking context variables (such as `SW_TRACE_ID`). For `php-fpm` mode, it will be injected into the `$_SERVER` variable. For `swoole` mode, it will be injected into the `$request->server` variable. | Off |
27
-
| skywalking_agent.instance_name | Instance name. You can set `${HOSTNAME}`, refer to [Example #1](https://www.php.net/manual/en/install.fpm.configuration.php)||
27
+
| skywalking_agent.instance_name | Instance name. You can set `${HOSTNAME}`, refer to [Example #1](https://www.php.net/manual/en/install.fpm.configuration.php)||
28
28
| skywalking_agent.standalone_socket_path | Unix domain socket file path of standalone skywalking php worker. Only available when `reporter_type` is `standalone`. ||
29
+
| skywalking_agent.psr_logging_level | The log level reported to SkyWalking, based on PSR-3, one of `Off`, `Debug`, `Info`, Notice`, Warning`, Error`, Critical`, Alert`, Emergency`. | Off |
In `skywalking-php`, the log level configuration is managed using the `skywalking_agent.psr_logging_level` directive in your `php.ini` file. This configuration defines the minimum log level that will be reported to SkyWalking. The log levels are based on PSR-3 standards and allow you to control the verbosity of the logs sent to SkyWalking.
6
+
7
+
## Configuration
8
+
9
+
You can set the `skywalking_agent.psr_logging_level` in your `php.ini` file:
10
+
11
+
```ini
12
+
skywalking_agent.psr_logging_level = Info
13
+
```
14
+
15
+
The possible values for this configuration are:
16
+
17
+
-`Off`: No logs will be reported to SkyWalking.
18
+
-`Debug`: Logs with the level "Debug" or higher will be reported.
19
+
-`Info`: Logs with the level "Info" or higher will be reported.
20
+
-`Notice`: Logs with the level "Notice" or higher will be reported.
21
+
-`Warning`: Logs with the level "Warning" or higher will be reported.
22
+
-`Error`: Logs with the level "Error" or higher will be reported.
23
+
-`Critical`: Logs with the level "Critical" or higher will be reported.
24
+
-`Alert`: Logs with the level "Alert" or higher will be reported.
25
+
-`Emergency`: Logs with the level "Emergency" or higher will be reported.
26
+
27
+
### Default Value
28
+
29
+
The default value for `skywalking_agent.psr_logging_level` is set to `Off`, which means no log will be reported to SkyWalking unless specified otherwise.
30
+
31
+
## How It Works
32
+
33
+
The `skywalking_agent.psr_logging_level` setting works by hooking into any PHP `LoggerInterface` implementation that follows the PSR-3 standard. The agent listens for log events and compares the log level with the configured value.
34
+
35
+
- If the log level is **greater than or equal to** the specified `skywalking_agent.psr_logging_level`, the log is reported to SkyWalking.
36
+
- Logs with a level **lower than** the configured value will be ignored and not sent to SkyWalking.
37
+
38
+
This approach ensures that only relevant logs (those that meet or exceed the configured severity level) are sent to SkyWalking, minimizing noise and focusing on more critical events.
39
+
40
+
## Example Usage
41
+
42
+
To report logs of level `Warning` and higher to SkyWalking, you would set the configuration as follows:
43
+
44
+
```ini
45
+
skywalking_agent.psr_logging_level = Warning
46
+
```
47
+
48
+
With this setting, logs at the levels `Warning`, `Error`, `Critical`, `Alert`, and `Emergency` will be sent to SkyWalking, while logs at the `Debug`, `Info`, and `Notice` levels will be ignored.
49
+
50
+
## Conclusion
51
+
52
+
The `skywalking_agent.psr_logging_level` configuration gives you fine-grained control over the logging behavior of your SkyWalking PHP agent. Adjusting the log level allows you to ensure that only the most important logs are captured, optimizing your monitoring and debugging workflows.
0 commit comments