New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show stack trace of Doctrine query #30040
Comments
@iluuu1994 I agree that this would be great. However, it seems that Doctrine DBAL is not ready for this. Check doctrine/DoctrineBundle#722 (and duplicated issues like doctrine/DoctrineBundle#800). So, I must close this and I hope that one day this is fixed in Doctrine and leveraged in DoctrineBundle. Thanks. |
@javiereguiluz Thanks for investigating! Is this not an option? |
Sadly that's not an option. The Doctrine data collector used in DoctrineBridge is already using it. However, as you can see in its code (https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Logging/DebugStack.php) it doesn't log who/where the query was executed. That's why we don't have that info in the data collected by Symfony: |
Bummer. Anyway, thanks @javiereguiluz! |
Just to follow up, this was added in doctrine/DoctrineBundle#954 and will be released in version 1.11.0 of the Doctrine Bundle 👍 |
Hype! Thanks @ottaviano and @alcaeus! |
Hello @alcaeus, |
@mayro due to the performance impact (it increases memory usages of the collected queries), you need to opt-in in your DoctrineBundle config (see |
Thanks @stof i enable the profilning_collect_backtrace, I can now trace the steps but anyway it doesn't log where the query was executed... I'm using the Master/Slave connection and i need to know in which Database my query executed |
"in which connection of the Master/Slave" is not the same question than "where in the project", which is what a debug backtrace provides. |
@stof Thank you for clarifying that. so is there any way to know in which connection (Master or slave) the query was executed please ? |
Description
When a page executes too many queries it would be extremely useful to know where these queries are executed. Since these queries are generated by Doctrine it is very non-obvious where they are coming from.
Example
I would add another toggle "Show stack trace" that shows you exactly where the query was executed in your code.
The text was updated successfully, but these errors were encountered: