This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-23
Channels
- # announcements (5)
- # babashka (22)
- # beginners (240)
- # calva (51)
- # clj-commons (1)
- # cljsrn (9)
- # clojars (12)
- # clojure (81)
- # clojure-australia (2)
- # clojure-europe (40)
- # clojure-france (10)
- # clojure-italy (1)
- # clojure-nl (2)
- # clojure-uk (37)
- # clojurescript (59)
- # clojureverse-ops (2)
- # copenhagen-clojurians (1)
- # cursive (9)
- # datomic (18)
- # emacs (12)
- # fulcro (24)
- # graalvm (48)
- # hyperfiddle (5)
- # introduce-yourself (1)
- # jackdaw (1)
- # jobs (2)
- # juxt (8)
- # lsp (25)
- # malli (8)
- # missionary (1)
- # music (3)
- # off-topic (32)
- # polylith (16)
- # quil (4)
- # re-frame (52)
- # reitit (5)
- # reveal (3)
- # rewrite-clj (26)
- # rum (1)
- # sci (1)
- # shadow-cljs (14)
- # sql (2)
- # tools-build (40)
- # tools-deps (14)
- # vrac (2)
- # xtdb (63)
Let me know about libraries you want to use with graalvm https://twitter.com/fierycoddev/status/1441098133555998726?s=21
@U01RXDR9F4M This is the time you can take the list of libraries you're using and post them all 😄
com.cognitect.aws/*
io.pedestal/pedestal.log {:mvn/version "0.5.9"}
ch.qos.logback/logback-classic {:mvn/version "1.2.5"}
com.fasterxml.woodstox/woodstox-core {:mvn/version "6.2.6"}
com.jcraft/jsch {:mvn/version "0.1.55"}
clj-http/clj-http {:mvn/version "3.12.3"}
org.apache.cxf/cxf-core {:mvn/version "3.4.4"}
io.xapix/paos {:mvn/version "0.2.5"}
Most of my lambdas are on HL 0.2.3.
The first 4 entries I’ve configured to run on HL 0.5.0 with the dev
graalvm which currently uses the 21.3.x line and forces build-time config.
"--initialize-at-build-time=com.fasterxml.jackson,org.eclipse.jetty,ch.qos.logback,javax.xml.namespace.QName,org.slf4j.LoggerFactory,org.slf4j.impl.StaticLoggerBinder,com.ctc.wstx,javax.xml.stream.FactoryFinder,io.opentracing.util.GlobalTracer,com.sun.org.apache.xerces.internal,javax.xml.parsers.FactoryFinder,com.sun.xml.internal.stream.util.ThreadLocalBufferAllocator,jdk.xml.internal.JdkXmlUtils"
The latter 5 (woodstox and onwards) all gave me pain with getting native build to run correctly and needed careful native/agent code to coax the right build
to get pedestal logging to build at all on graalvm, I had to disable metrics recording using the follow parameter to graalvm
;; Disable JMX metrics in Pedestal logging (GraalVM build fails, plus JMX metrics are not useful in Lambda)
"-Dio.pedestal.log.defaultMetricsRecorder=nil"
Thanks. This is already a lot to be patched 😄
No worries, and thank you for this!
an exhaustive list of all my current dependencies is as follows:
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.2"}
ch.qos.logback/logback-classic {:mvn/version "1.2.5"}
clj-http/clj-http {:mvn/version "3.12.3", :exclusions [commons-logging/commons-logging]}
com.cognitect.aws/api {:mvn/version "0.8.515"}
com.cognitect.aws/dynamodb {:mvn/version "810.2.801.0"}
com.cognitect.aws/endpoints {:mvn/version "1.1.12.65"}
com.cognitect.aws/s3 {:mvn/version "814.2.978.0"}
com.cognitect.aws/sqs {:mvn/version "811.2.958.0"}
com.cognitect.aws/ssm {:mvn/version "814.2.977.0"}
com.deepbeginnings/eximia {:mvn/version "0.1.3"}
com.fasterxml.woodstox/woodstox-core {:mvn/version "6.2.6"}
com.jcraft/jsch {:mvn/version "0.1.55"}
com.rpl/specter {:mvn/version "1.1.3"}
district0x/graphql-query {:mvn/version "1.0.6"}
io.pedestal/pedestal.log {:mvn/version "0.5.9"}
io.xapix/paos {:mvn/version "0.2.5", :exclusions [commons-logging/commons-logging, log4j/log4j]}
lock-key/lock-key {:mvn/version "1.5.0"}
metosin/jsonista {:mvn/version "0.3.4"}}
net.cgrand/xforms {:mvn/version "0.19.2"}
net.totakke/clj-iso3166 {:mvn/version "0.2.0"}
org.apache.cxf/cxf-core {:mvn/version "3.4.4"}
org.slf4j/jcl-over-slf4j {:mvn/version "1.7.32"} ;; to bridge commons-logging to logback
phrase/phrase {:mvn/version "0.3-alpha4"}
tick/tick {:mvn/version "0.4.32"}
tolitius/xml-in {:mvn/version "0.1.1"}
uk.co.lucasweb/aws-v4-signer-java {:mvn/version "1.3"}
Which one is the most important @U01RXDR9F4M
the first list I posted is in order of importance to me
clj-easy currently adds cognitect
to the Clojure namespaces supplied to the build time parameter, but I had to also add org.eclipse.jetty
to the build time list to prevent those scary runtime stack traces we went though last week
yep, we can fix this by making a clj-easy config for it in https://github.com/clj-easy/graal-config
@U01RXDR9F4M whas is necessary for pedestal log to work? Build is successful, but I'm not seeing any logs
Oh it probably requires slf4j implementation
Forgotten how good logging in java is 😄
Pure love for the idea of "let's do a facade for everything guys, ok?" 😂
Yeah. Got it working
@U01RXDR9F4M how to trigger this metrics recorder?
not sure how to explicitly trigger the metrics recorder, as far as I’m aware, it’s just “there” and initialises by default
to that end, it would be triggered by using the logger, I guess
What facade do you using for loggin?
pedestal -> slf4j then using logback for the logger implementation
pop the above in your resources
another way to break graalvm build is to specify config scanning in logback.xml. I’ll post an example in a sec
<configuration scan="true" scanPeriod="5 seconds"> <!-- scan is handy for REPL sessions, but fatal to GraalVM native builds :-) -->
The following deps and the logback.xml
file in resources should be enough to get you logging.
io.pedestal/pedestal.log {:mvn/version "0.5.9"}
ch.qos.logback/logback-classic {:mvn/version "1.2.5"}
in your Clojure code:
(:require
[io.pedestal.log :as log])
(log/error :in 'my-fn :message "this is a message")
(sorry if that’s teaching granny to suck eggs)
Out of curiosity why are you not using slf4j simple?
I mean of course i will provide patchem for all of those but still im genuinely curious
if these deps all worked (which I haven’t tried, will do so in a few weeks) Clerk should be runnable in native image
org.clojure/java.classpath {:mvn/version "1.0.0"}
org.clojure/tools.analyzer.jvm {:mvn/version "1.1.0"}
org.clojure/tools.deps.alpha {:mvn/version "0.11.905"}
weavejester/dependency {:mvn/version "0.2.1"}
funcool/datoteka {:mvn/version "1.0.0"}
com.nextjournal/beholder {:mvn/version "1.0.0"}
mvxcvi/multihash {:mvn/version "2.0.3"}
lambdaisland/uri {:mvn/version "1.4.70"}
arrowic/arrowic {:mvn/version "0.1.1"}
rewrite-clj/rewrite-clj {:mvn/version "0.6.1"}
funcool/datoteka
I plan to replace with babashka.fs
> Out of curiosity why are you not using slf4j simple?
Just familiarity with Logback.
I’ll try SimpleLogger
as it’s probably more lightweight. For instance, it would do away with a load of XML references.
@U01RXDR9F4M simpleogger is easy to bake with Graal. Just include simple logger in initialize-at-build-time
@UJ1339K2B what are the exact build time parameters you’re using for SimpleLogger? It took the following for a simple lambda with only a log statement to work:
"--initialize-at-build-time=com.fasterxml.jackson,javax.xml.parsers.FactoryFinder,com.sun.org.apache.xerces.internal,jdk.xml.internal.JdkXmlUtils"
Strangely, the native compilation didn’t ask specifically for org.slf4j.impl.SimpleLogger
, which I was expecting based on your comment.
sam local invoke
successfully showed log outputps - I’m using the dev
graalvm image
Args=--initialize-at-build-time=org.slf4j.LoggerFactory \
--initialize-at-build-time=org.slf4j.impl.StaticLoggerBinder \
--initialize-at-build-time=org.slf4j.impl.SimpleLogger
@U5H74UNSF How clerk works? Isn't it dynamically loads arbitrary classes at run time?
@UJ1339K2B I take it that’s without pedestal logging?
But it works with pedestal logging
Although don't know how to trigger metrics
https://github.com/clj-easy/graal-config/tree/master/config/org.slf4j/slf4j-simple
I’ll see if I can send a repro, but it won’t be until tomorrow
You mean for metrics? 😄