http4s / blaze

Blazing fast NIO microframework and Http Parser
Apache License 2.0
350 stars 63 forks source link

`BlazeServerBuilder` doesn't respect metered logger #670

Open mr-git opened 5 years ago

mr-git commented 5 years ago

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 commented 5 years ago

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

rossabaker commented 5 years ago

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.

mr-git commented 5 years ago

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

rossabaker commented 5 years ago

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?

ChristopherDavenport commented 5 years ago

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

mr-git commented 5 years ago

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 :)

rossabaker commented 3 years ago

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.