'How to avoid terminal to catch error instead of Symfony profiler

[edited on 19th june] The question is not regarding the content of the logs, but why logs doesn't not appear in my symfony profiler

My symfony profiler doesn't display any error log but my php built-in-server seems to catch them and display them in my terminal.

To run my built-in web server, i'm using the following command: php bin/console server:run with no extra parameters

the output in my terminal is something like:

2019-06-19T07:23:21+00:00 [info] Matched route "overblog_graphql_endpoint".
2019-06-19T07:23:21+00:00 [debug] Checking for guard authentication credentials.
2019-06-19T07:23:21+00:00 [debug] Checking support on guard authenticator.
2019-06-19T07:23:21+00:00 [debug] Calling getCredentials() on guard authenticator.
2019-06-19T07:23:21+00:00 [info] Guard authentication failed.
2019-06-19T07:23:21+00:00 [debug] The "Lexik\Bundle\JWTAuthenticationBundle\Security\Guard\JWTTokenAuthenticator" authenticator set the response. Any later authenticator will not be called
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ValidateRequestListener::onKernelRequest".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.request" to listener "Overblog\GraphQLBundle\EventListener\ClassLoaderListener::load".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\SessionListener::onKernelRequest".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\ResolveControllerNameSubscriber::onKernelRequest".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener::onKernelRequest".
2019-06-19T07:23:21+00:00 [debug] Listener "Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener::onKernelRequest" stopped propagation of the event "kernel.request".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ResponseListener::onKernelResponse".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelResponse".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.response" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelResponse".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.response" to listener "Symfony\Component\Security\Http\RememberMe\ResponseListener::onKernelResponse".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelResponse".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.response" to listener "Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener::onKernelResponse".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\SessionListener::onKernelResponse".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\StreamedResponseListener::onKernelResponse".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.finish_request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelFinishRequest".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.finish_request" to listener "Symfony\Component\HttpKernel\EventListener\SessionListener::onFinishRequest".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.finish_request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelFinishRequest".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.finish_request" to listener "Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener::onKernelFinishRequest".
2019-06-19T07:23:21+00:00 [debug] Notified event "kernel.terminate" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelTerminate".
[Wed Jun 19 09:23:21 2019] 127.0.0.1:60635 [401]: /

When I check my symfony profiler, i got this empty screen: Symfony Profiler
(source: i.ibb.co)

I remember long time ago, I run a command in my terminal to change the verbosity, but I'm unfortunately unable to remember which one was it to revert it. And I think this is the reason why the terminal is displaying the log info instead of my symfony profiler

Is there someone who can help me ?



Solution 1:[1]

There is no error shown in your output from terminal. It states that authentication failed and it won't let your HTTP request pass security component. That's why you are getting HTTP response 401 Unauthorized.

2019-06-19T07:23:21+00:00 [info] Guard authentication failed.
2019-06-19T07:23:21+00:00 [debug] The "Lexik\Bundle\JWTAuthenticationBundle\Security\Guard\JWTTokenAuthenticator" authenticator set the response. Any later authenticator will not be called

You have issue in your application security config which is not letting any request through. That's why Symfony profiler is empty and why you cannot reach the website. Though this is not an Exception which could be thrown. It's simply required behavior based on your particular config and sent request.

Also any change to verbosity of the command (parameter -v[vv]) is not permanent and is relevant only during the run of that particular command.

Solution 2:[2]

ok, i was just missing monolog (composer require symfony/monolog-bundle)

By doing so, my terminal only show this:

[Wed Jun 19 11:56:26 2019] 127.0.0.1:53057 [200]: /graphiql
[Wed Jun 19 11:56:27 2019] 127.0.0.1:53058 [200]: /
[Wed Jun 19 11:56:28 2019] 127.0.0.1:53059 [200]: /_wdt/ddb809
[Wed Jun 19 11:56:30 2019] 127.0.0.1:53062 [200]: /graphiql
[Wed Jun 19 11:56:30 2019] 127.0.0.1:53063 [200]: /
[Wed Jun 19 11:56:30 2019] 127.0.0.1:53065 [200]: /_wdt/4f2a47
[Wed Jun 19 11:56:33 2019] 127.0.0.1:53068 [200]: /
[Wed Jun 19 11:56:42 2019] 127.0.0.1:53074 [200]: /_profiler/ea688f
[Wed Jun 19 11:56:43 2019] 127.0.0.1:53075 [200]: /_profiler/ea688f?panel=logger

and my logs are appearing normally in my symfony profiler

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ludo
Solution 2 Simon B