0

[编辑于 6 月 19 日] 问题不是关于日志的内容,而是为什么日志没有出现在我的 symfony 分析器中

我的 symfony 分析器没有显示任何错误日志,但我的 php 内置服务器似乎捕获了它们并将它们显示在我的终端中。

要运行我的内置 Web 服务器,我使用以下命令:php bin/console server:run没有额外参数

我的终端中的输出类似于:

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]: /

当我检查我的 symfony 分析器时,我得到了这个空屏幕: Symfony 分析器

我记得很久以前,我在终端中运行了一个命令来更改详细程度,但不幸的是我不记得是哪一个来恢复它。我认为这就是终端显示日志信息而不是我的 symfony 分析器的原因

有人可以帮助我吗?

4

2 回答 2

0

好吧,我只是想念独白(composer require symfony/monolog-bundle

通过这样做,我的终端只显示:

[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

我的日志在我的 symfony 分析器中正常显示

于 2019-06-19T09:58:35.827 回答
0

终端的输出中没有显示错误。它表明身份验证失败,它不会让您的 HTTP 请求通过安全组件。这就是您收到 HTTP 响应的原因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

您的应用程序安全配置存在问题,不允许任何请求通过。这就是为什么 Symfony 分析器是空的以及为什么您无法访问该网站的原因。虽然这不是Exception可以抛出的。根据您的特定配置和发送的请求,这只是必需的行为。

此外,对命令(参数)详细程度的任何更改-v[vv]都不是永久性的,并且仅在该特定命令的运行期间相关。

于 2019-06-19T08:22:09.027 回答