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

Check JUL log entry params on null. #1990

Merged
merged 2 commits into from Aug 8, 2023
Merged

Check JUL log entry params on null. #1990

merged 2 commits into from Aug 8, 2023

Conversation

Caparow
Copy link
Contributor

@Caparow Caparow commented Aug 8, 2023

No description provided.

@@ -42,25 +42,27 @@ class LogstageJulLogger(router: LogRouter) extends java.util.logging.Handler wit

@inline private[this] def mkEntry(record: LogRecord): Log.Entry = {

val id = Log.LoggerId(record.getLoggerName)
val loggerName = if (record.getLoggerName == null) "unknown" else record.getLoggerName
Copy link
Member

Choose a reason for hiding this comment

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

Option(record.getLoggerName) match ...

} else {
record.getParameters.toSeq ++ Seq(record.getThrown)
}
val params = if (record.getParameters == null) Seq.empty else record.getParameters.toSeq
Copy link
Member

Choose a reason for hiding this comment

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

The same, Option().getOrElse()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pshirshov I've thought about this but decided that it's a better solution for performance. If you insist I can change null checks to options.

@pshirshov pshirshov merged commit 837069d into develop Aug 8, 2023
31 checks passed
@pshirshov pshirshov deleted the jul-adapter-npe-fix branch August 8, 2023 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants