Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WebProfilerBundle] Display again the number of occurrences of log messages#45198

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
javiereguiluz wants to merge1 commit intosymfony:6.1fromjaviereguiluz:fix_45183

Conversation

@javiereguiluz
Copy link
Member

QA
Branch?6.1
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#45183
LicenseMIT
Doc PR-

It looks like this:

log-occurrences

@javiereguiluz
Copy link
MemberAuthor

As@SVillette pointed out to me via Symfony Slack, the current profiler before this PR already displayed the "log counter":

image (1)

So, the real problem might be that the log counter of LoggerProfiler doesn't work.

@SVillette also mentioned that doing the following change inLoggerDataCollector::getProcessedLogs() solve the problem for them:

$logs[] = [  ...'errorCounter' =>isset($rawLogData['errorCounter']) ?$rawLogData['errorCounter']->getValue() :1,'errorCount' =>$rawLog['errorCount'] ??1,// The line I added to make it worked  ...];

I need help to know how to move forward with this. Thanks!

SVillette and UlrichHP reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

This could qualify as a bug fix IMHO.
About the count, "15" looks like it's correct to me.

@SVillette
Copy link
Contributor

Hi@nicolas-grekas, I will clarify a little about what has been done.

The issue is not about global count ("15") but the count per log ("5 times").
Symfony 5.4 added a new methodLoggerDataCollector::getProcessedLogs() that introducederrorCounter when processing a single log, but the template (Collector/logger.html.twig at line 241) only displaylog.errorCount which is never defined.

publicfunctiongetProcessedLogs(){...$logs[] = [...'errorCounter' =>isset($rawLogData['errorCounter']) ?$rawLogData['errorCounter']->getValue() :1,    ];...return$this->processedLogs =$logs;}
{%macro render_log_message(category,log_index,log) %}...    {%iflog.errorCountisdefinedandlog.errorCount>1 %}         <spanclass="log-num-occurrences">{{log.errorCount }} times</span>    {%endif %}...{%endmacro %}

" the current profiler before this PR already displayed the "log counter""

To reformulate what@javiereguiluz said, the template was already displaying the right information but theLoggerDataCollector does not pass theerrorCount when getting the processed logs.

From what I debugged$rawLogData['errorCounter'] is not defined and soerrorCounter value is always 1. I cannot affirm this is always the case.

So that's why I just modifiederrorCounter byerrorCount in theLoggerDataCollector. In addition,$rawLogData does not contain neithererrorCounter norerrorCount so I just used$rawLog['errorCount'].

$logs[] = ['errorCount' =>$rawLog['errorCount'] ??1,];

I hope my explanation are clear, I can open a PR if you consider it is a bug fix.

@SVillette
Copy link
Contributor

Finally, I want to add that a global search onerrorCounter only displayLoggerDataCollector::getProcessedLogs() andLoggerDataCollector::testCollectFromDeprecationsLog(). I don't see any other usages.

@javiereguiluz
Copy link
MemberAuthor

Closing in favor of a better fix in#45302. Thanks!

fabpot added a commit that referenced this pull requestFeb 4, 2022
…ot displayed in WebProfilerBundle (SVillette)This PR was merged into the 5.4 branch.Discussion----------[HttpKernel][WebProfilerBundle] Fixed error count by log not displayed in WebProfilerBundle| Q             | A| ------------- | ---| Branch?       | 5.4| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Tickets       |Fix#45183| License       | MIT| Doc PR        | -This PR is the following of#45198. Refer to this PR for details.![image](https://user-images.githubusercontent.com/17042730/152384024-64ffecb3-d895-450b-a994-fe3d54582680.png)Commits-------5e1a2cb [HttpKernel] Fixed error count by log not displayed in WebProfilerBundle
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

6.1

Development

Successfully merging this pull request may close these issues.

[Profiler] Logs > Deprecations tab doesn't show how often a single deprecation is triggered

4 participants

@javiereguiluz@nicolas-grekas@SVillette@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp