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

Seeing info level logs with minimum-level set to Warn #814

Open
mdegat01 opened this issue Jul 7, 2022 · 3 comments
Open

Seeing info level logs with minimum-level set to Warn #814

mdegat01 opened this issue Jul 7, 2022 · 3 comments

Comments

@mdegat01
Copy link

mdegat01 commented Jul 7, 2022

In my sharry config logging is set up like this:

  # Configures logging
  logging {
    # The format for the log messages. Can be one of:
    # Json, Logfmt, Fancy or Plain
    format = "Fancy"

    # The minimum level to log. From lowest to highest:
    # Trace, Debug, Info, Warn, Error
    minimum-level = "Warn"
  }

As you can see, I have set it to Warn level and there are no overrides for specific loggers. However I still see info level logs on startup:

2022.07.07 14:20:33:0001 [io-comp...] [INFO ] sharry.restserver.Main.run:55 -
Map(Ident(filesystem) -> FileSystem(false,/data/sharry/files), Ident(minio) -> S3(enabled=false, endpoint=http://localhost:9000, bucket=sharry, accessKey=username, secretKey=***), Ident(database) -> DefaultDatabase(true))

2022.07.07 14:20:33:0002 [io-comp...] [INFO ] sharry.restserver.Main.run:62 - Alias-Member feature enabled: true
2022.07.07 14:20:35:0000 [io-comp...] [INFO ] org.flywaydb.core.internal.license.VersionPrinter - Flyway Community Edition 8.5.13 by Redgate
...

I wondered if perhaps this was because the default config listed overrides for these particular loggers. So as a test I tried adding this to my config and restarting:

    levels = {
      "sharry" = "Warn"
      "org.flywaydb" = "Warn"
      "binny" = "Warn"
      "org.http4s" = "Warn"
    }

That fixed the issue. After that I saw exactly one info level log, this one:

2022.07.07 14:22:14:776 io-compute-5 INFO sharry.restserver.Main.run:23
    Using given config file: /etc/sharry/sharry.conf

I assume that's because it has not processed the config yet and determined the minimum level.

I can adjust my config to account for this. But I think the default config should not include overrides for particular loggers. I get why it shows that on the website as an example but I think those should be commented out in the actual config.

@mdegat01
Copy link
Author

mdegat01 commented Jul 7, 2022

I may be totally off base about the default config thing. I was going to fix it but I don't actually see a default config file in this repo that looks like the one on the website. In that case I'm not sure what's happening but I was definitely seeing info level logs before adding those overrides and not afterwards.

@mdegat01
Copy link
Author

mdegat01 commented Jul 7, 2022

I fixed it locally by adding this:

    levels = {
      "sharry" = ${sharry.restserver.logging.minimum-level}
      "org.flywaydb" = ${sharry.restserver.logging.minimum-level}
      "binny" = ${sharry.restserver.logging.minimum-level}
      "org.http4s" = ${sharry.restserver.logging.minimum-level}
    }

This makes the minimum level universal as I was expecting. If there is a default config file somewhere shared between runtime and the website perhaps that could be an option. Let's you document that option with a functional example that doesn't change runtime behavior for those loggers.

@eikek
Copy link
Owner

eikek commented Jul 8, 2022

Hi @mdegat01 - I think you are completely right here. The default config is here: https://github.com/eikek/sharry/blob/master/modules/restserver/src/main/resources/reference.conf - This is exactly the same file you see on the website.

You are also right about the initial line - then the config has not been applied as it is just reading the file.

It's ok to me to remove the default overrides - they are there to have the same logging as before the change with overriding loggers (it was always conigured like this). And it's a mix of loggers that can be useful in case of error. But I can understand the confusion. I can comment it out and then all who want to have this must change their config. So there may be disagreement on the other side 😄

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

No branches or pull requests

2 participants