Git Product home page Git Product logo

error_report2_client's Introduction

Error Report 2 (Client)

An error reporting service for SPFW. Clients send error and exception logs to an API.

Requirements

  • SPFW >=2.0.0 (since ER2 Client 2.1.x) and
  • PHP >=7.4.

If you are using SPFW 1.x.x check out ER2 Client Version 2.0.x.

Installation

  • Include this git-project as submodule in your modules-directory,
  • add ErrorReport2Client as Error-Exception-handler to your config.

Example:

cd src/modules
git submodule add URL_TO_REPOSITORY

Update

When ER2 is included as git submodule, update the submodule. Future updates may change configuration options. We try to keep ER2 backward compatible as much as reasonable. Please read the release notes carefully for each release!

ER2 uses semantic versioning. Breaking changes can be expected at major releases.

Configuration

Required configuration

The constructor requires two arguments:

  • The api-server URI (full path) and
  • the API token.

API token must be generated in advanced on the server side.

Example: $config->addErrorExceptionAction(new \ErrorReport2\ErrorReport2Client('https://localhost/er2_listener', '9318560345'), -1);

Optional configuration

Application identifier

If you are logging more than one service on the serverside, it is recommended to set up a service identifier. This can be done by adding the service identifier as the third argument to the constructor.

Example: new ErrorReport2Client('https://localhost/er2_listener', '9318560345', 'My wonderful web app');

Limit Logged Data

By default, all data is sent to the API. There are good reasons to limit the transmitted data, e.g. for security reasons.

Restrict Request Parameter

Request parameter contain all get- and post-variables of a request. This can contain login form data, such as passwords. These information should not be logged. ER2 must be properly configured to minimize critical data for the transmission.

Examples:

$er2->blockCookieParameter('login_cookie');
$er2->blockGetParameter('session_id');
$er2->blockPostParameter('password');
$er2->blockSessionParameter('session_token');
Disable Certain Data Categories

While it is important to log error and exception details, it can be wished to stop logging other information than that. Following data categories can be disabled:

  • Environment variables (like $_SERVER),
  • database queries,
  • cookies,
  • session ($_SESSION),
  • get- ($_GET) and
  • post variables ($_POST).
$er2->disableTransmittingCookies();
$er2->disableTransmittingDatabaseQueries();
$er2->disableTransmittingEnvironmentVariables();
$er2->disableTransmittingGetParameter();
$er2->disableTransmittingPostParameter();
$er2->disableTransmittingSessionVariables();

Server Request Timeout

If server API does not respond, ER2 will continue trying to reach the server. PHP's default request timeout is 60 seconds. This blocks clients from continuing, e.g. displaying the user a proper error page. To limit the waiting time for the user, a shorter timeout than PHP's default timeout is recommended. ER2 limits requests to 5 seconds by default.

This example reduces the timeout to 3 seconds:

$er2->setTimeout(3);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.