Fork me on GitHub
#aws
<
2021-07-05
>
onetom11:07:48

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?

onetom11:07:39

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.

onetom11:07:54

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 ( "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.

onetom12:07:22

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.

onetom12:07:18

(It's really painful, because these warnings often totally obscure the useful output...)

onetom21:07:10

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 layer

onetom21:07:46

I 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

onetom03:07:45

actually, this is the line needed in logging.properties, for suppressing the warnings about the "`profile `" prefix:

com.amazonaws.auth.profile.internal.BasicProfileConfigLoader.level=SEVERE

onetom06:07:19

managed to suppress the jetty related log message too. took this advice: https://stackoverflow.com/a/53064639/263983 and added "-Dorg.eclipse.jetty.util.log.announce=false" to the :jvm-opts too.

drewverlee17:07:49

@U086D6TBN thanks for sharing, i was curious how to fix that message myself.

👍 4
onetom03:07:23

where would be a good place to put all this info, so more cognitect.aws.api and datomic cloud users can benefit from it?

drewverlee07:07:59

The datomic forum maybe? Someone official would say least see it there and meet help redirect. Also it's persistent

👍 3