-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Profiler] could not access logs in tests #33384
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
Comments
I think the best way for you to access the logs in functional tests is not using the profiler, but to add the Monolog test handler in your test env: # config/packages/test/monolog.yaml
monolog:
handlers:
[...]
# Test handler allows to perform assertions on logs:
test:
type: test
level: debug
process_psr_3_messages: false
channels: ["!event", "!doctrine"] Declaring an alias to the service: # config/packages/test/monolog.yaml
services:
Monolog\Handler\TestHandler:
public: true # to be accessible from tests
alias: monolog.handler.test you could easily access it in tests from the client container, and use its assertions methods. |
hey there @ogizanagi! Thank you for your answer! I'll try this approach as soon as possible and I'll let you know :) |
Hey, thanks for your report! |
Hello? This issue is about to be closed if nobody replies. |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
For people passing by, the solution provided by @ogizanagi works years later with Symfony 7.1. I successfully integrated it. |
Symfony version(s) affected: 4.3.4 (upgrading from 4.2.5)
Description
#30339
This PR disabled the debug logger in
cli
. During the execution of my functional tests with PHPUnit I cannot access the logs contained in the profiler's logger collectorthese lines gathered also the logs made by a GuzzleHttp client instance (I can dump the log messages).
I need to check those logs in order to be sure that the GuzzleClient makes the right requests needed by my application.
How can I access those logs? Is there another way to do that?
Thank you in advance! 😄
The text was updated successfully, but these errors were encountered: