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

Kyo logging works at the Error level only #1049

Closed
halansary opened this issue Jan 23, 2025 · 4 comments
Closed

Kyo logging works at the Error level only #1049

halansary opened this issue Jan 23, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@halansary
Copy link

halansary commented Jan 23, 2025

I am trying Kyo for the first time and may be doing something wrong here, but my expectation is that this should work (given my config) for all log levels except "debug":

object App extends KyoApp:
  run:

    for 
      _ <- Log.debug("debugging")
      _ <- Log.info("informing")
      _ <- Log.warn("warning")
      _ <- Log.error("erroring")
    yield ()

end App

Only the Log.error works despite that my logback level is set to "info", and the following is printed:

18:53:34.303 [kyo-scheduler-worker-2] ERROR kyo.logs -- [App.scala:16:33] erroring

Here is the complete config:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration>

<configuration>
  <import class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"/>
  <import class="ch.qos.logback.core.ConsoleAppender"/>

  <appender name="STDOUT" class="ConsoleAppender">
    <encoder class="PatternLayoutEncoder">
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%kvp- %msg%n</pattern>
    </encoder>
  </appender>

  <root level="info">
    <appender-ref ref="STDOUT"/>
  </root>
</configuration>

It seems to me that this piece of code in kyo.internatl.LogPlatformSpecific:

val level =
                if logger.isErrorEnabled() then Level.error
                else if logger.isWarnEnabled() then Level.warn
                else if logger.isInfoEnabled() then Level.info
                else if logger.isDebugEnabled() then Level.debug
                else Level.trace

... will always mean that the intended log level is error, because error is always isEnabled for all other levels (providing that i understand the isErrorEnabled function correctly).

@hearnadam hearnadam added the bug Something isn't working label Jan 23, 2025
@hearnadam
Copy link
Collaborator

This was a bug fixed in #1046. @fwbrasil perhaps we should cut a release?

@halansary you can try out the snapshot build. It should be: 0.16.1+39-96217015-SNAPSHOT I believe.

@fwbrasil
Copy link
Collaborator

Sounds good. I can make a release later today.

@fwbrasil
Copy link
Collaborator

Released: https://github.com/getkyo/kyo/releases/tag/v0.16.2

@halansary please let us know if you still see issues

@halansary
Copy link
Author

@fwbrasil it works great now, thanks. And thank you so much for this amazing project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants