{"id":31915464,"url":"https://github.com/stackify/stackify-log-log4php","last_synced_at":"2025-10-13T19:47:27.157Z","repository":{"id":23201887,"uuid":"26558572","full_name":"stackify/stackify-log-log4php","owner":"stackify","description":null,"archived":false,"fork":false,"pushed_at":"2023-08-11T15:01:04.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-07-23T12:08:54.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-12T22:09:30.000Z","updated_at":"2021-11-24T16:53:44.000Z","dependencies_parsed_at":"2022-08-05T21:00:28.576Z","dependency_job_id":null,"html_url":"https://github.com/stackify/stackify-log-log4php","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/stackify/stackify-log-log4php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-log-log4php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-log-log4php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-log-log4php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-log-log4php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackify","download_url":"https://codeload.github.com/stackify/stackify-log-log4php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-log-log4php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016839,"owners_count":26085889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T19:47:25.281Z","updated_at":"2025-10-13T19:47:27.147Z","avatar_url":"https://github.com/stackify.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PHP version](https://badge.fury.io/ph/stackify%2Flog4php.svg)](http://badge.fury.io/ph/stackify%2Flog4php)\n\n# Stackify log4php Appender\n\nApache log4php appender for sending log messages and exceptions to Stackify.\nApache log4php \u003e= 2.2.0 is supported.\n\n* **Errors and Logs Overview:** http://support.stackify.com/errors-and-logs-overview/\n* **Sign Up for a Trial:** http://www.stackify.com/sign-up/\n\n## Installation\n\nInstall the latest version with `composer require stackify/log4php`\n\n### Installation with Linux Agent\n\nThis is the suggested installation option, offering the best logging performance.\n\n```xml\n\u003croot\u003e\n    ...\n    \u003cappender_ref ref=\"stackifyAppender\" /\u003e\n\u003c/root\u003e\n\n\u003cappender name=\"stackifyAppender\" class=\"\\Stackify\\Log\\Log4php\\Appender\"\u003e\n    \u003cparam name=\"appName\" value=\"application_name\" /\u003e\n    \u003cparam name=\"environmentName\" value=\"environment_name\" /\u003e\n\u003c/appender\u003e\n```\n\n#### Optional Configuration\n\n**Log Server Environment Variables**\n- Server environment variables can be added to error log message metadata. **Note:** This will log all \nsystem environment variables; do not enable if sensitive information such as passwords or keys are stored this way.\n\n ```xml\n\u003cparam name=\"logServerVariables\" value=\"true\" /\u003e\n```\n\n### Installation without Linux Agent\n\nThis option 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 ... \u0026')```]. 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):\n\n```xml\n\u003croot\u003e\n    ...\n    \u003cappender_ref ref=\"stackifyAppender\" /\u003e\n\u003c/root\u003e\n\n\u003cappender name=\"stackifyAppender\" class=\"\\Stackify\\Log\\Log4php\\Appender\"\u003e\n    \u003cparam name=\"appName\" value=\"application_name\" /\u003e\n    \u003cparam name=\"environmentName\" value=\"environment_name\" /\u003e\n    \u003cparam name=\"mode\" value=\"exec\" /\u003e\n    \u003cparam name=\"apiKey\" value=\"api_key\" /\u003e\n\u003c/appender\u003e\n```\n\n#### Optional Configuration\n\n**Proxy**\n- ExecTransport supports data delivery through proxy. Specify proxy using [libcurl format](http://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html): \u003c[protocol://][user:password@]proxyhost[:port]\u003e\n```xml\n\u003cparam name=\"proxy\" value=\"https://55.88.22.11:3128\" /\u003e\n```\n\n**Curl path**\n- It can be useful to specify ```curl``` destination path for ExecTransport. This option is set to 'curl' by default.\n```xml\n\u003cparam name=\"curlPath\" value=\"/usr/bin/curl\" /\u003e\n```\n \n## Notes\n\nTo get more error details pass Exception objects to the logger if available:\n```php\ntry {\n    $db-\u003econnect();\ncatch (DbException $ex) {\n    $logger-\u003eerror('DB is not available', $ex);\n}\n```\n\nAll data added to the [MDC](https://logging.apache.org/log4php/apidocs/class-LoggerMDC.html) or [NDC](https://logging.apache.org/log4php/apidocs/class-LoggerNDC.html) will automatically be captured and attached to your log message. This information will be available as JSON data and will be searchable within Stackify.\n\n## Troubleshooting\nIf 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).\nNote that ExecTransport does not produce any errors at all, but you can switch it to debug mode:\n```php\n\u003cparam name=\"debug\" value=\"1\" /\u003e\n```\n\n## Additional Configuration\nFor additional configurations, you can set on the XML or the PHP File Configuration. Reference for the additional options are located on the stackify logger repository [Stackify PHP Logger - Configuration Settings](stackify/stackify-api-php#configuration-settings)\n\n### XML Configuration\n- The string should be a JSON String and HTML Encoded (will improve this eventually.)\n```php\n// Sample PHP Config\n$config = array(\n    'Debug' =\u003e true,\n    'DebugLogPath' =\u003e '/path/to/log.log'\n);\n// 1. Converting PHP array to JSON String\n// - String: {\"Debug\":true,\"DebugLogPath\":\"/path/to/log.log\"}\n$jsonString = json_encode($config);\n// 2. XML Encode the JSON String\n//   - ' is replaced with \u0026apos;\n//   - \" is replaced with \u0026quot;\n//   - \u0026 is replaced with \u0026amp;\n//   - \u003c is replaced with \u0026lt;\n//   - \u003e is replaced with \u0026gt;\n// - Encoded String: {\u0026quot;Debug\u0026quot;:true,\u0026quot;DebugLogPath\u0026quot;:\u0026quot;/path/to/log.log\u0026quot;}\n// - Note: In case the string has new line (\"\\n\") or a carriage return (\"\\r\") character, you still need to escape it\n//   - \\n should be replaced with \u0026#10; or \u0026#xA;\n//   - \\r should be replaced with \u0026#13; or \u0026#xD;\n// - Reference: https://stackoverflow.com/a/29924176/14542233\n$xmlEncode = htmlspecialchars($jsonString, ENT_XML1 | ENT_QUOTES, 'UTF-8');\n\n// 3. Add it as a value on XML Configuration\n\u003cparam name=\"config\" value=\"{\u0026quot;Debug\u0026quot;:true,\u0026quot;DebugLogPath\u0026quot;:\u0026quot;/path/to/log.log\u0026quot;}\" /\u003e\n```\n\n### PHP Configuration\n- If using the PHP configuration, basically add the `config` attribute on the `params` under the Stackify Appender settings\n```php\n\u003c?php\nreturn array(\n    'rootLogger' =\u003e array(\n        'appenders' =\u003e array('stackifyAppender'),\n    ),\n    'appenders' =\u003e array(\n        'stackifyAppender' =\u003e array(\n            'class' =\u003e '\\Stackify\\Log\\Log4php\\Appender',\n            'params' =\u003e array(\n                'appName' =\u003e 'application-name',\n                'environmentName' =\u003e 'environment-name',\n                // Additional configuration\n                'config' =\u003e array(\n                    'Debug' =\u003e true,\n                    'DebugLogPath' =\u003e 'logConfig.log'\n                )\n            )\n        )\n```\n\n## License\n\nCopyright 2019 Stackify, LLC.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackify%2Fstackify-log-log4php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackify%2Fstackify-log-log4php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackify%2Fstackify-log-log4php/lists"}