blaze icon indicating copy to clipboard operation
blaze copied to clipboard

`BlazeServerBuilder` doesn't respect metered logger

Open mr-git opened this issue 5 years ago • 7 comments

Currently, BlazeServerBuilder has line statically defined logger (https://github.com/http4s/http4s/blob/2dba53fd4bcd8711f7db093e445ed5854f319afa/blaze-server/src/main/scala/org/http4s/server/blaze/BlazeServerBuilder.scala#L97). It limits our ability to us metered logger.

Would it make sense to provide extra def withLogger(logger: Logger[F]) function would allow us to provide metered logger?

mr-git avatar May 28 '19 18:05 mr-git

https://gitter.im/http4s/http4s?at=5ced612b6366992a9438c309

mr-git avatar May 28 '19 18:05 mr-git

I think that might also be achievable by an appender, but I'm not opposed to a configurable logger if that's deemed a better way.

rossabaker avatar May 28 '19 18:05 rossabaker

"By an appender" - how? I am not sure, that I follow your idea

mr-git avatar May 28 '19 20:05 mr-git

Maybe a Filter is a better choice than an appender. A Filter would let you count events and respond accordingly. Is that your use case?

rossabaker avatar May 29 '19 03:05 rossabaker

I believe something along the lines of whats capable with epimetheus-log4cats perhaps.

ChristopherDavenport avatar May 29 '19 13:05 ChristopherDavenport

we use epimetheus-log4cats and we added metrics like:

logger <- LogModifier.selfAwareStructured(registry, Slf4jLogger.getLogger[IO])

but I noticed, that logs from server are not accounted for :)

mr-git avatar May 29 '19 14:05 mr-git

The logger in Blaze is log4s, so I'm not sure what the log4cats solution achieves. I guess we can still add this, but I'm still not understanding what can't be accomplished through logback facilities.

rossabaker avatar Apr 06 '21 04:04 rossabaker