Symfony2 Profiler: save more entries

By default, the Symfony2 profiler saves only the last few requests (I don’t know how many of them are between 25 and 40). I think the list deletes seniors after a cup of minutes.

I would like to do a long profiling and measuring some data. Can I set a maximum profiling value? Or maybe store all the data in my (MongoDB) database? (I am currently using Symfony 2.2)

Update . I found that clearing the cache also clears the profiler data, so I think the key problem here is to save the profiler data somewhere else.

+4
source share
1 answer

Mark this one out.

You can override the default profiler.storage , which is defined here .

You can either define your own class (implementing ProfilerStorageInterface ), or use one of the provided implementations (check here for the entire list).

For example, if you want to use MongoDbProfilerStorage , you can override this service as follows:

 <service id="profiler.storage" class="Symfony\Component\HttpKernel\Profiler\MongoDbProfilerStorage" public="false"> <argument>mongodb://[USER: PWD@ ]HOST/DATABASE/COLLECTION</argument> <argument></argument> <argument></argument> <argument>86400</argument> </service> 

This way, you do not delete profiler data every time you clear the cache.

+2
source

Source: https://habr.com/ru/post/1500184/


All Articles