Skip to content
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

[improve][broker] Add class name and line number output to the log. #22300

Closed
wants to merge 1 commit into from

Conversation

hanmz
Copy link
Contributor

@hanmz hanmz commented Mar 19, 2024

Motivation

The current log file does not output the class name and line number. In some cases, it is difficult to quickly locate specific lines of code based on the log content.

Before optimization, we could only see the name of the logger, but we didn’t know which line of log output was of which class.
The log example is as follows:
image

After optimization, we print out the class name and line number, so we can quickly locate the specific line of code.
The log example is as follows:
image

Modifications

Add java class file name and line number output to the log.
"%d{ISO8601_OFFSET_DATE_TIME_HHMM} [%t] %-5level %logger{36} **(%F:%L)** - %msg%n"

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Mar 19, 2024
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need the line number, please make this change to your own local version of the logging configuration files.

We turned off the location information also for tests in #22251 because of performance reasons.

The overhead is explain in https://logging.apache.org/log4j/2.x/manual/layouts.html#location-information

@lhotari
Copy link
Member

lhotari commented Mar 19, 2024

I'll close this since this would cause a performance issue. Please check the previous comment for details and a workaround.

@lhotari lhotari closed this Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants