PHPackages                             stackify/logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. stackify/logger

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

stackify/logger
===============

Stackify logs and errors for PHP

2.0.0(2y ago)4280.1k↓32.7%102Apache-2.0PHPPHP &gt;= 7.1.0CI failing

Since Dec 29Pushed 1y ago13 watchersCompare

[ Source](https://github.com/stackify/stackify-api-php)[ Packagist](https://packagist.org/packages/stackify/logger)[ Docs](https://github.com/stackify/stackify-api-php)[ RSS](/packages/stackify-logger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (23)Used By (2)

[![PHP version](https://camo.githubusercontent.com/8bfa6ff4c8b36ab3da11e3a212e7318c5ea5afe2070ca22a1c28dd234633788f/68747470733a2f2f62616467652e667572792e696f2f70682f737461636b6966792532466c6f676765722e737667)](http://badge.fury.io/ph/stackify%2Flogger)

Stackify PHP Logger
===================

[](#stackify-php-logger)

Standalone Stackify PHP [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) Logger.

- **Errors and Logs Overview:**
- **Sign Up for a Trial:**

PHP Logging Framework Integrations
----------------------------------

[](#php-logging-framework-integrations)

- **Monolog** Handler:
- **log4php** Appender:

Installation
------------

[](#installation)

Install the latest version with `composer require stackify/logger`

### Requirements

[](#requirements)

- Stackify PHP Logger ^2.0 works with PHP 7.1 or above.
- Stackify PHP Logger ^1.0 works with PHP 5.3 or above.

### Installation with Linux Agent

[](#installation-with-linux-agent)

This is the suggested installation option, offering the best logging performance.

```
use Stackify\Log\Standalone\Logger;

$logger = new Logger('application_name', 'environment_name');
```

### Installation without Linux Agent

[](#installation-without-linux-agent)

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):

```
use Stackify\Log\Transport\ExecTransport;
use Stackify\Log\Standalone\Logger;

$transport = new ExecTransport('api_key');
$logger = new Logger('application_name', 'environment_name', $transport);
```

#### Optional Settings

[](#optional-settings)

**Proxy**

- ExecTransport supports data delivery through proxy. Specify proxy using [libcurl format](http://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html): ``

```
$transport = new ExecTransport($apiKey, ['proxy' => 'https://55.88.22.11:3128']);
```

**Curl path**

- It can be useful to specify `curl` destination path for ExecTransport. This option is set to 'curl' by default.

```
$transport = new ExecTransport($apiKey, ['curlPath' => '/usr/bin/curl']);
```

**Log Server Environment Variables**

- Server environment variables can be added to error log message metadata. **Note:** This will log all system environment variables; do not enable if sensitive information such as passwords or keys are stored this way.

```
$logger = new Logger('application_name', 'environment_name', $transport, true);
```

### **Configuration Settings**

[](#configuration-settings)

- This allow users to override default settings of the logger (Masking Request Variables, Session, Cookie or Updating connection properties to different Transports etc.)
- **Note** - By default capturing raw post data `(e.g. file_get_contents("php://input"))` and `$_POST` variables are `DISABLED` by default
    - To enable you can set the following options to `true`
    - `CapturePostVariables` - `Boolean` - Capture `$_POST` variables
    - `CaptureRawPostData` - `Boolean` - Capture `php://input` stream data `(e.g. file_get_contents("php://input"))````
        $config = array(
                'CapturePostVariables' => true,
                'CaptureRawPostData' => true,
                ...
        );
        ```
- **Note** - For the `Whitelist/Blackist` setting. Anything `falsy` (`null`, `false`, `array()` etc. - Refer to php [empty](https://www.php.net/manual/en/function.empty.php) function checking) will be considered as `Do Not Track` - No variable data will be processed.

#### Logger Level

[](#logger-level)

```
$config = array(
       'CaptureServerVariables' => false,
       'CaptureServerVariablesWhitelist' => '*',
       'CaptureServerVariablesBlacklist' => 'REMOTE_ADDR,SERVER_ADDR',
       ...
   );

$logger = new Logger('application_name', 'environment_name', $transport, true, $config);
```

#### Transport Level

[](#transport-level)

- This applies to all the transports `(ExecTransport, CurlTransport, AgentTransport, AgentSocketTransport)`

```
$config = array(
       'CaptureServerVariables' => false,
       'CaptureServerVariablesWhitelist' => '*',
       'CaptureServerVariablesBlacklist' => 'REMOTE_ADDR,SERVER_ADDR',
       ...
   );

$transport = new ExecTransport($apiKey, [
   'config' => $config
]);
```

### Available Options:

[](#available-options)

#### Server Variables

[](#server-variables)

- `CaptureServerVariables` - `Boolean` - Capture `$_SERVER` variables
- `CaptureServerVariablesWhitelist` - `Array` or `Comma-delimited string` - Whitelist `$_SERVER` attributes
- `CaptureServerVariablesBlacklist` - `Array` or `Comma-delimited string` - Mask `$_SERVER` attributes (e.g. `attribute => 'X-MASKED-X'`)

#### Get Variables

[](#get-variables)

- `CaptureGetVariables` - `Boolean` - Capture `$_GET` variables
- `CaptureGetVariablesWhitelist` - `Array` or `Comma-delimited string` - Whitelist `$_GET` attributes
- `CaptureGetVariablesBlacklist` - `Array` or `Comma-delimited string` - Mask `$_GET` attributes (e.g. `attribute => 'X-MASKED-X'`)

#### Post Variables

[](#post-variables)

- `CapturePostVariables` - `Boolean` - Capture `$_POST` variables
- `CapturePostVariablesWhitelist` - `Array` or `Comma-delimited string` - Whitelist `$_POST` attributes
- `CapturePostVariablesBlacklist` - `Array` or `Comma-delimited string` - Mask `$_POST` attributes (e.g. `attribute => 'X-MASKED-X'`)

#### Session Variables

[](#session-variables)

- `CaptureSessionVariables` - `Boolean` - Capture `$_SESSION` variables
- `CaptureSessionVariablesWhitelist` - `Array` or `Comma-delimited string` - Whitelist `$_SESSION` attributes
- `CaptureSessionVariablesBlacklist` - `Array` or `Comma-delimited string` - Mask `$_SESSION` attributes (e.g. `attribute => 'X-MASKED-X'`)

#### Error Headers

[](#error-headers)

- `CaptureErrorHeaders` - `Boolean` - Capture `HEADER` attributes available in `$_SERVER` variable
- `CaptureErrorHeadersWhitelist` - `Array` or `Comma-delimited string` - Whitelist `HEADER` attributes in `$_SERVER` variable
- `CaptureErrorHeadersBlacklist` - `Array` or `Comma-delimited string` - Mask `HEADER` attributes in `$_SERVER` variable (e.g. `attribute => 'X-MASKED-X'`)

#### Error Cookies

[](#error-cookies)

- `CaptureErrorCookies` - `Boolean` - Capture `$_COOKIE` variables
- `CaptureErrorCookiesWhitelist` - `Array` or `Comma-delimited string` - Whitelist `$_COOKIE` attributes
- `CaptureErrorCookiesBlacklist` - `Array` or `Comma-delimited string` - Mask `$_COOKIE` attributes

#### Capture Raw Post Data

[](#capture-raw-post-data)

- `CaptureRawPostData` - `Boolean` - Capture `php://input` stream data `(e.g. file_get_contents("php://input"))`

#### Debug Settings

[](#debug-settings)

- `Debug` - `Boolean` - Enable DEBUG in the logger
- `DebugLogPath` - `String` - A qualified path for the log file produced during debug or error

#### Agent Transport Settings

[](#agent-transport-settings)

- `Protocol` - `String` - Protocol can be `tcp` or `udp`
- `Host` - `String` - Server Hostname
- `Port` - `Numeric` - Port
- `SocketTimeoutConnect` - `Numeric` - Connection Request Timeout
- `SocketTimeoutWrite` - `Numeric` - Connection Write Timeout
- `SocketMaxConnectAttempts` - `Numeric` - Connection Attempts

#### Agent Socket Transport Settings

[](#agent-socket-transport-settings)

- `DomainSocketPath` - `String` - Stackify Agent unix socket path

#### API or Curl Exec Socket Transport Settings

[](#api-or-curl-exec-socket-transport-settings)

- `ApiBaseUrl` - `String` - Stackify API base url
- `ApiCallLogsEndpoint` - `String` - Stackify API Call Logs endpoint
- `ApiMaxTimeout` - `Numeric` - Stackify API Call Max Timeout
- `ApiVersionHeader` - `String` - Stackify API Version Header

#### Troubleshooting

[](#troubleshooting)

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). Note that ExecTransport does not produce any errors at all, but you can switch it to debug mode:

```
$transport = new ExecTransport($apiKey, ['debug' => true]);
```

You can set it also on the `Logger` level. Setting the `Debug` and `DebugLogPath`

```
$config = array(
        'DebugLogPath' => '/path/to/log.log',
        'Debug' => true
    );

$logger = new Logger('application_name', 'environment_name', $transport, true, $config);
```

### **Real User Monitoring (RUM)**

[](#real-user-monitoring-rum)

Real user monitoring injects a script tag containing the [RUM JS](https://stackify.com/retrace-real-user-monitoring/) that is responsible for capturing information about the http requests on the browser. This approach is manual and needs to be configured.

#### RUM - Setup

[](#rum---setup)

```
/** Requires composer **/
$applicationName = 'Your Application Name';
$environment = 'YourEnvironment';
$rumKey = 'YourRumKey';

\Stackify\Utils\Rum::getInstance()->setupConfiguration(
	$applicationName,
	$environment,
	$rumKey
);
```

#### RUM - Application

[](#rum---application)

```
DOCTYPE html>

	Title

...
```

License
-------

[](#license)

Copyright 2019 Stackify, LLC.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~162 days

Recently: every ~0 days

Total

22

Last Release

739d ago

Major Versions

1.x-dev → 2.0.02024-05-09

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

2.0.0PHP &gt;= 7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1adc413d81ba59c7407c85e4dd44d57b95d4c347307dcee6f326fcfd7d3a1bb?d=identicon)[homiedopie](/maintainers/homiedopie)

![](https://www.gravatar.com/avatar/7237e87c0bf2f79aa1f9a93bd8df54ce6be9f84d2c0d3c6a8e18c2399dca2580?d=identicon)[tlair-netreo](/maintainers/tlair-netreo)

---

Top Contributors

[![eric-martin](https://avatars.githubusercontent.com/u/4369260?v=4)](https://github.com/eric-martin "eric-martin (27 commits)")[![homiedopie](https://avatars.githubusercontent.com/u/6220402?v=4)](https://github.com/homiedopie "homiedopie (25 commits)")[![jmichaelis](https://avatars.githubusercontent.com/u/10456366?v=4)](https://github.com/jmichaelis "jmichaelis (9 commits)")[![darinhoward](https://avatars.githubusercontent.com/u/20421735?v=4)](https://github.com/darinhoward "darinhoward (5 commits)")[![dimitrytarasov](https://avatars.githubusercontent.com/u/9611704?v=4)](https://github.com/dimitrytarasov "dimitrytarasov (2 commits)")[![t-lair](https://avatars.githubusercontent.com/u/26470949?v=4)](https://github.com/t-lair "t-lair (2 commits)")[![femz12](https://avatars.githubusercontent.com/u/16762390?v=4)](https://github.com/femz12 "femz12 (1 commits)")[![aromka](https://avatars.githubusercontent.com/u/2651029?v=4)](https://github.com/aromka "aromka (1 commits)")[![rajesh-kumawat](https://avatars.githubusercontent.com/u/29918507?v=4)](https://github.com/rajesh-kumawat "rajesh-kumawat (1 commits)")

---

Tags

logpsr-3loggingmonologlog4phpstackify

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stackify-logger/health.svg)

```
[![Health](https://phpackages.com/badges/stackify-logger/health.svg)](https://phpackages.com/packages/stackify-logger)
```

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[inpsyde/wonolog

Monolog-based logging package for WordPress.

183617.9k7](/packages/inpsyde-wonolog)[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)[apix/log

Minimalist, thin and fast PSR-3 compliant (multi-bucket) logger.

511.0M18](/packages/apix-log)[elastic/ecs-logging

Format and enrich your log files in the elastic common schema

21907.5k1](/packages/elastic-ecs-logging)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
