im getting 5 of these log messages from the cognitect aws-api:
Jul 05, 2021 7:22:53 PM com.amazonaws.auth.profile.internal.BasicProfileConfigLoader loadProfiles
WARNING: Your profile name includes a 'profile ' prefix. This is considered part of the profile name in the Java SDK, so you will need to include this prefix in your profile name when you reference this profile from your Java code.
how can i disable them?after these messages, i also see another log message on the stderr:
2021-07-05 19:22:54.723:INFO::nREPL-session-c95f0d6e-f1cc-472d-85b4-dcd1d1820ae8: Logging initialized @109640ms to org.eclipse.jetty.util.log.StdErrLog
so it seems this jetty logger is starting after the amazon libs has already sent some logs.according to https://docs.huihoo.com/jetty/the-definitive-reference/configuring-logging.html , i should be able to just do something like clj -J-Dcom.amazonaws.auth.profile.internal.LEVEL=OFF
to suppress these messages, but that didn't work.
i also tried to put a jetty-logging.properties
on my classpath, but interestingly enough (<http://clojure.java.io/resource|clojure.java.io/resource> "jetty-logging.properties")
just returns nil
.
im working on a minimal repro case now, but if anyone has some pointers to some examples, it would be great.
We are using awscli v2, so we can use single sign on. For that we need to have section names in ~/.aws/config
to be prefixed with "profile<space>" and that triggers these warnings.
(It's really painful, because these warnings often totally obscure the useful output...)
After reading the docs of a bunch of logging related libs, this is what worked for me finally:
1. create a logging.properties
file at the same directory level as the deps.edn
file. NOT in src/
or whatever dir, which is on the classpath! example content:
handlers=java.util.logging.ConsoleHandler
.level=INFO
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] [%4$-7s] %3$s: %5$s%6$s%n
cognitect.aws.credentials.level=WARNING
2. reference this file via :jvm-opts
in deps.edn
. eg, here is a map-entry from the :aliases
:
:aliases
{:dev
{:extra-paths ["dev"]
:jvm-opts ["-Dclojure.tools.logging.factory=clojure.tools.logging.impl/jul-factory"
"-Djava.util.logging.config.file=logging.properties"]}
}
and also wire up the jul
(`java.util.logging`) to the clojure.tools.logging
abstraction layerI still see a log message, which has a different format, than the one I specified, and I can't suppress it:
(def s3 (aws.api/client {:api :s3}))
2021-07-06 05:28:44.781:INFO::nREPL-session-2b108885-7ed5-4894-bedd-6077fd6b02c0: Logging initialized @12704ms to org.eclipse.jetty.util.log.StdErrLog