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
Common libraries for [Stackify Monolog handler](https://github.com/stackify/stackify-log-monolog) and [Stackify log4php appender](https://github.com/stackify/stackify-log-log4php).
7
-
This package also includes a standalone [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) compatible logger that can be used without third-party libraries.
Install the latest version with `composer require stackify/logger`
24
19
25
-
There are three different transport options that can be configured to send data to Stackify. Below will show how to implement the different transport options.
20
+
### Installation with Linux Agent
21
+
22
+
This is the suggested installation option, offering the best
23
+
logging performance.
24
+
25
+
```php
26
+
use Stackify\Log\Standalone\Logger;
27
+
28
+
$logger = new Logger('application_name', 'environment_name');
29
+
```
30
+
31
+
### Installation without Linux Agent
26
32
27
-
### ExecTransport
28
-
ExecTransport does not require a Stackify agent to be installed because it sends data directly to Stackify services. It collects log entries in batches, calls curl using the ```exec``` function, and sends data to the background immediately [```exec('curl ... &')```]. This will affect the performance of your application minimally, but it requires permissions to call ```exec``` inside the PHP script and it may cause silent data loss in the event of any network issues. This transport method does not work on Windows. To configure ExecTransport you need to pass the environment name and API key (license key):
33
+
This option does not require the Stackify Agent to be installed because it sends data directly to Stackify services. It collects log entries in batches, calls curl using the ```exec``` function, and sends data to the background immediately [```exec('curl ... &')```]. This will affect the performance of your application minimally, but it requires permissions to call ```exec``` inside the PHP script and it may cause silent data loss in the event of any network issues. This transport method does not work on Windows. To configure ExecTransport you need to pass the environment name and API key (license key):
29
34
30
35
```php
31
36
use Stackify\Log\Transport\ExecTransport;
@@ -37,9 +42,8 @@ $logger = new Logger('application_name', 'environment_name', $transport);
37
42
38
43
#### Optional Settings
39
44
40
-
41
45
**Proxy**
42
-
- ExecTransport supports data delivery through proxy. Specify proxy using [libcurl format](http://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html): <[protocol://][user:password@]proxyhost[:port]>
46
+
- ExecTransport supports data delivery through proxy. Specify proxy using [libcurl format](http://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html): `<[protocol://][user:password@]proxyhost[:port]>`
43
47
```php
44
48
$transport = new ExecTransport($apiKey, ['proxy' => 'https://55.88.22.11:3128']);
45
49
```
@@ -58,55 +62,8 @@ system environment variables; do not enable if sensitive information such as pas
58
62
$logger = new Logger('application_name', 'environment_name', $transport, true);
59
63
```
60
64
61
-
62
-
### CurlTransport
63
-
CurlTransport does not require a Stackify agent to be installed and it also sends data directly to Stackify services. It collects log entries in a single batch and sends data using native [PHP cURL](http://php.net/manual/en/book.curl.php) functions. This way is a blocking one, so it should not be used on production environments. To configure CurlTransport you need to pass environment name and API key (license key):
64
-
```php
65
-
use Stackify\Log\Transport\CurlTransport;
66
-
use Stackify\Log\Standalone\Logger;
67
-
68
-
$transport = new CurlTransport('api_key');
69
-
$logger = new Logger('application_name', 'environment_name', $transport);
70
-
```
71
-
72
-
#### Optional Settings
73
-
74
-
**Proxy**
75
-
- CurlTransport supports data delivery through proxy. Specify proxy using [libcurl format](http://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html): <[protocol://][user:password@]proxyhost[:port]>
76
-
```php
77
-
$transport = new CurlTransport($apiKey, ['proxy' => 'https://55.88.22.11:3128']);
78
-
```
79
-
80
-
**Log Server Environment Variables**
81
-
- Server environment variables can be added to error log message metadata. **Note:** This will log all
82
-
system environment variables; do not enable if sensitive information such as passwords or keys are stored this way.
83
-
84
-
```php
85
-
$logger = new Logger('application_name', 'environment_name', $transport, true);
86
-
```
87
-
88
-
### AgentTransport
89
-
90
-
AgentTransport does not require additional configuration in your PHP code because all data is passed to the [Stackify agent](http://support.stackify.com/hc/en-us/articles/205419575). The agent must be installed on the same machine. Local TCP socket on port 10515 is used, so performance of your application is affected minimally.
91
-
```php
92
-
use Stackify\Log\Standalone\Logger;
93
-
94
-
$logger = new Logger('application_name', 'environment_name');
95
-
```
96
-
97
-
You will need to enable the TCP listener by checking the "PHP App Logs (Agent Log Collector)" in the server settings page in Stackify. See [Log Collectors Page](http://support.stackify.com/hc/en-us/articles/204719709) for more details.
98
-
99
-
#### Optional Settings
100
-
101
-
**Log Server Environment Variables**
102
-
- Server environment variables can be added to error log message metadata. **Note:** This will log all
103
-
system environment variables; do not enable if sensitive information such as passwords or keys are stored this way.
104
-
105
-
```php
106
-
$logger = new Logger('application_name', 'environment_name', null, true);
107
-
```
108
-
109
-
## Troubleshooting
65
+
66
+
#### Troubleshooting
110
67
111
68
If transport does not work, try looking into ```vendor\stackify\logger\src\Stackify\debug\log.log``` file (if it is available for writing). Errors are also written to global PHP [error_log](http://php.net/manual/en/errorfunc.configuration.php#ini.error-log).
112
69
Note that ExecTransport does not produce any errors at all, but you can switch it to debug mode:
0 commit comments