PHPackages                             oh/form-error-log-bundle - 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. oh/form-error-log-bundle

ActiveSymfony-bundle[Logging &amp; Monitoring](/categories/logging)

oh/form-error-log-bundle
========================

Log form errors

47.6k5[1 PRs](https://github.com/ollieLtd/OhFormErrorLogBundle/pulls)PHP

Since Apr 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ollieLtd/OhFormErrorLogBundle)[ Packagist](https://packagist.org/packages/oh/form-error-log-bundle)[ RSS](/packages/oh-form-error-log-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

OhFormErrorLogBundle
====================

[](#ohformerrorlogbundle)

Log form errors.

Functional testing your forms is all well and good, but how do you know your users are using it correctly? This plugin can log the errors your users are making so that you can spot any usability problems.

WARNING: If the error is on the whole form this bundle tries to json\_encode your bound entity. If it can't be json\_encoded it will try to serialize before finally logging the whole \_POST request for the form. THIS IS A SECURITY RISK IF USED ON FORMS CONTAINING SENSITIVE DATA, LIKE PASSWORDS OR CREDIT CARD INFORMATION. If this is the case, you should implement the Serializeable or JsonSerializable (PHP 5.4) interfaces on your bound objects to block out the sensitive data.

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

[](#installation)

This bundle is alpha stability due to the lack of testing on different form types. Your composer.json needs to reflect that by setting the minimum-stability to "alpha" or "dev"

```
"minimum-stability": "alpha"

```

Install this bundle as usual by adding to composer.json:

```
"oh/form-error-log-bundle": "dev-master"

```

Register the bundle in `app/AppKernel.php`:

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Oh\FormErrorLogBundle\OhFormErrorLogBundle(),
    );
}

```

Set up
------

[](#set-up)

There are 2 logging methods provided. One uses your normal logger (Monolog) and the other logs into a database

Method 1: Monolog
-----------------

[](#method-1-monolog)

You will need to create a new channel in your monolog settings called 'formerror'

```
#app/config/config_prod.yml
monolog:
	handlers:
		main:
			type:         fingers_crossed
			action_level: error
			handler:      nested
		nested:
			type:  stream
			path:  %kernel.logs_dir%/%kernel.environment%.log
			level: debug
		formerror:
			type:  stream
			path:  %kernel.logs_dir%/form-error-%kernel.environment%.log
			channels: formerror

```

Method 2: Database
------------------

[](#method-2-database)

This uses Doctrine. You should create your own Entity which implements FormErrorLogEntityInterface

```
