Download the PHP package m6web/log-bridge-bundle without Composer
On this page you can find all versions of the php package m6web/log-bridge-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package log-bridge-bundle
LogBridgeBundle 
Symfony Bundle to log Request/Response with Monolog.
NOTE: The actual version of this bundle support Symfony >= 4.4
.
If you need support for older versions, please use ~7.0
release.
Features
- semantic configuration
- sf2 event dispatcher integration
- log request filter
Install
With composer
Add to your AppKernel
Usage
Routes support multiples formats :
By default, level
is info
You can declare all the options you want.
By default, only response_body
and post_parameters
is supported by the DefaultFormatter
Status support multiples formats :
Instead of add can be use !
to exclude status
By default, this bundle use a builtin logger with monolog support m6web_log_bridge.logger
You can override this configuration by writing your own logger who must implements Psr\Log\LoggerInterface
:
Acme\DemoBundle\Logger\logger
must be implement Psr\Log\LoggerInterface
Define your Provider from format log content
It is advisable to extend default provider M6Web\Bundle\LogBridgeBundle\Formatter\DefaultFormatter
default definition from service provider :
From override :
or simply override this parameter :
Log contents example
Request
------------------------
content-type :
content-length :
host : domain.tld
x-real-ip : *********
x-forwarded-for : *********
x-forwarded-proto : http
x-forwarded-port : 80
remote-user : u_glinel
connection : close
cache-control : max-age=0
authorization : Basic ************
accept : text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
user-agent : Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/127.0.0.1 Chrome/127.0.0.1 Safari/537.36
accept-encoding : gzip,deflate,sdch
accept-language : fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
cookie : PHPSESSID=************
php-auth-user : u_glinel
x-php-ob-level : 1
------------------------
Response
------------------------
HTTP 1.0 200
Age: 2
Etag:
Vary:
Cache-Control: no-cache
Content-Type: application/json
Date: dd mm yyyy hh:ii:ss GMT
------------------------
Response body
------------------------
Here response content
Logging exceptions
The bundle allow detailed logging of exceptions. This is ensured by the use of exception.log
in the configuration.
This switch allows the bundle to register a listener which will save any received exception and passed it within the request under the defined attribute.
If you use the default formatter, change it using the configuration. The bundle provides another formatter implementation able to log exceptions.
If you prefer to use your own formatter, you will be able to read exceptions directly from the request under the attribute specified in m6_web_log_bridge.exception.request_attribute
.
Tests
You can run the unit tests with the following command:
All versions of log-bridge-bundle with dependencies
symfony/config Version ^4.4|^5.0|^6.0
symfony/yaml Version ^4.4|^5.0|^6.0
symfony/routing Version ^4.4|^5.0|^6.0
symfony/expression-language Version ^4.4|^5.0|^6.0
symfony/security-core Version ^4.4|^5.0|^6.0
symfony/dependency-injection Version ^4.4|^5.0|^6.0
symfony/http-kernel Version ^4.4|^5.0|^6.0