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

LogAppender for java platform/system logger #493

Merged
merged 9 commits into from
Sep 11, 2022

Conversation

justcoon
Copy link
Contributor

similar to slf4j backend implementation

default behavior:

  • all annotations are placed at the beginning of log message
  • cause - LogAppender.appendCause - as throwable, Cause transformed into FiberFailure
  • logger name extracted from Trace, added JPL.loggerName zio LogAnnotation for custom logger name
  • updated documentation and examples

open questions:

  • slf4j and this jpl implementation got custom logger name aspect, should not we do common one?
  • by default both are appending all LogAnnotations-s, including logger name annotation, there is question if this annotation should not be excluded in default setup, because if logger name is extracted from Trace, there is not logger name annotation

related to #322 (from this ticket it is not clear if this was requirement for backend implementation like slf4j or it should be something similar to slf4j-bridge)

@justcoon justcoon requested a review from a team as a code owner August 18, 2022 20:29
@justcoon
Copy link
Contributor Author

NOTE:
CI setup needs to be updated, as java platform/system logger was introduced at JDK9

ZIO.logAnnotate(loggerNameKey, value)(zio)
}

def getLoggerName(default: String = "zio-jpl-logger"): Trace => String =
Copy link
Member

Choose a reason for hiding this comment

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

This should be hidden / made private.

): ZLayer[Any, Nothing, Unit] =
jpl(format, getLoggerName())

def jpl: ZLayer[Any, Nothing, Unit] =
Copy link
Member

Choose a reason for hiding this comment

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

This can be a val.

Copy link
Member

@jdegoes jdegoes left a comment

Choose a reason for hiding this comment

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

Just minor tweaks, and then good to merge!

@justcoon
Copy link
Contributor Author

@jdegoes - comments solved

@jdegoes jdegoes merged commit 16d7b47 into zio:master Sep 11, 2022
@justcoon justcoon deleted the java_system_logger branch February 15, 2023 19:30
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.

2 participants