This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-04
Channels
- # aleph (23)
- # announcements (1)
- # babashka (21)
- # beginners (70)
- # biff (3)
- # cider (8)
- # clj-kondo (45)
- # clj-yaml (9)
- # clojure (69)
- # clojure-europe (82)
- # clojure-nl (1)
- # clojure-norway (2)
- # clojurescript (34)
- # conjure (19)
- # core-typed (6)
- # cursive (2)
- # events (5)
- # fulcro (55)
- # honeysql (1)
- # integrant (18)
- # jobs (1)
- # lsp (124)
- # malli (10)
- # meander (1)
- # off-topic (26)
- # polylith (8)
- # reagent (7)
- # releases (1)
- # remote-jobs (1)
- # sci (2)
- # shadow-cljs (19)
- # squint (5)
- # vim (17)
- # xtdb (31)
When using next.jdbc, how can I remove this from being printed to the command line:
3850 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated
id like to only see what I print.
As you can see it's coming from your connection pool, not next.jdbc Have you checked how hikari's log levels can be configured?
Id like to stop it irrespective of where it comes from. How do I check the logs?
there are many different logging implementation in java so it's hard to help unless we know what you are using. Are you using logback ? You can setup level by prefix, so let's say your app is called "my_project" (so every namespace in your source file starts with "my_project.*", you could have a config like that:
default: off
overrides:
my_project: all
i don't think that's a good idea though, you might miss some pretty important messages, so it's better to configure the default to at least warn
Look in hikari and see it uses slf4j Then configure slf4j however it's configured for the proper logger name and set the desired logging level
Logging can be configured at the package/class and info level. Here's the https://github.com/brettwooldridge/HikariCP/blob/dev/src/main/java/com/zaxxer/hikari/HikariDataSource.java that is doing the logging. As suggested above, unless it is super noisy, I'd live with the log line, as you might end up turning off valuable logging info.
Hello. I'm trying to pretty print clojure data structure in Babashka so that namespaced keyword stays like :is.mad/wut
instead of #:is.mad{:wut}
In Clojure clj the following works (1)
(binding [*print-namespace-maps* false] (clojure.pprint/pprint {:is.mad/wut 42}))
{:is.mad/wut 42}
But in babashka REPL (https://github.com/babashka/babashka) the *print-namespace-maps*
binding doesn't seem to have effect (2)
(binding [*print-namespace-maps* false] (clojure.pprint/pprint {:is.mad/wut 42}))
#:is.mad{:wut 42}
Is there a way to achieve the 1st result with babashka?
Found these places in Clojure source that seemed relevant
https://github.com/clojure/clojure/blob/5ffe3833508495ca7c635d47ad7a1c8b820eab76/src/clj/clojure/pprint/dispatch.clj#L109
https://github.com/clojure/clojure/blob/5ffe3833508495ca7c635d47ad7a1c8b820eab76/src/clj/clojure/core_print.clj#L250This is a edge-case in bb which should be solved in the coming release: https://github.com/babashka/babashka/issues/1381
Wow, awesome man. That's fast. Someone's been practicing mind reading looks like 😄 I'll see on the weekend if I can do a pull request for it (unless someone takes it first). I've never contributed to babashka, so getting started may take a bit of time
The solution is to add the binding here: https://github.com/babashka/babashka/blob/7e77ab56338dd4fbbcc3b4ea462f2fe7173627f3/src/babashka/impl/pprint.clj#L100
Tests are here: https://github.com/babashka/babashka/blob/master/test/babashka/pprint_test.clj
@U04V15CAJ It’s a small change and I can create a PR right-away. One question, should we expose the var via sci
(copy it from sio
) or should we directly access sio/print-namespace-maps
from babashka.impl.pprint
?
We could add this line to sci.core#130
-
(def print-namespace-maps "SCI var that represents SCI's `clojure.core/*print-namespace-maps*`" sio/print-namespace-maps)
@U04V15CAJ I need some help with writing a proper test for this. I can see that there is a similar test in io_test.cljc
that uses println
, but I am unable to figure out a good way to test this new exposed var in sci.core
Would appreciate suggestions.
@U0505RKEL You can just write a test in core_test.clj
like this: (sci/binding [sci/print-namespace-maps ...] (sci/eval-string ...))
Is this an acceptable test for the presence of the dyn var?
(deftest print-namespace-maps-var-test
(is (= (sci/binding [sci/print-namespace-maps :test-val]
(sci/eval-string "*print-namespace-maps*"))
:test-val)))
I feel bringing in pprint
etc in core_test
may not be the best thing. Open to suggestions.
I added this test to pprint_test.clj
in sci
, but it’s failing -
(deftest print-namespace-maps-test
(is (= "{:x/a 1 :x/b 2}"
(str/trim
(sci/with-out-str
(sci/binding [sci/print-namespace-maps false] ;; was trying both to test
(sci/eval-string "
(require '[clojure.pprint :as pprint])
(binding [*print-namespace-maps* false]
(pprint/pprint {:x/a 1 :x/b 2}))
"
conf)))))))
(not (= "{:x/a 1 :x/b 2}" "#:x{:a 1, :b 2}"))
the dyn var setting is not getting picked up
This is the same issue that should be fixed in babashka. You should re-bind the clojure var to the value of the SCI var
I already have this in core.cljc
-
(def print-namespace-maps "SCI var that represents SCI's `clojure.core/*print-namespace-maps*`" sio/print-namespace-maps)
sio
is already capturing the var as core-dynamic-var
Do I need to do something additional for the tests?You can also go here for dev builds :) https://github.com/babashka/babashka-dev-builds
Why would evaling the Handler expression below result in a java.lang.RuntimeException
? My best guess is that the close expression doesn't know what the
(ns foo.cast
"Monitoring library."
(:require [centriq-web.env :as env])
(:import [java.util ArrayList Collection UUID]
[java.util.concurrent BlockingQueue LinkedBlockingQueue]))
(set! *warn-on-reflection* true)
(defprotocol HandlerImpl
(register* [_ type cb]
"Internal, do not call. Register callback for the given type.")
(enqueue* [_ data]
"Internal, do not call. Enqueue the given data to be dispatched to callbacks."))
(deftype Handler [^BlockingQueue q ^Thread t callbacks]
java.lang.AutoCloseable
(close [_]
(.put q q) ;; <---- this seems to be the issue.
(.join t))
HandlerImpl
(register* [_ type callback]
(swap! (get callbacks type) conj callback))
(enqueue* [_ data]
(.offer q (assoc data
:id (UUID/randomUUID)
:thread (.getName (Thread/currentThread))
:timestamp (System/currentTimeMillis)))))
full stack trace:
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling src/centriq_web/cast.clj at (18:5)
#:clojure.error{:phase :compile-syntax-check,
:line 18,
:column 5,
:source
"/home/drewverlee/Centriq/centriq-web/backend/src/centriq_web/cast.clj"}
Compiler.java: 6825 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 3893 clojure.lang.Compiler$InvokeExpr/parse
Compiler.java: 7126 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 3900 clojure.lang.Compiler$InvokeExpr/parse
Compiler.java: 7126 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 3900 clojure.lang.Compiler$InvokeExpr/parse
Compiler.java: 7126 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 6135 clojure.lang.Compiler$BodyExpr$Parser/parse
Compiler.java: 7124 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 7112 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 1020 clojure.lang.Compiler$HostExpr$Parser/parse
Compiler.java: 7124 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 7112 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 6135 clojure.lang.Compiler$BodyExpr$Parser/parse
Compiler.java: 8570 clojure.lang.Compiler$NewInstanceMethod/parse
Compiler.java: 8076 clojure.lang.Compiler$NewInstanceExpr/build
Compiler.java: 7952 clojure.lang.Compiler$NewInstanceExpr$DeftypeParser/parse
Compiler.java: 7124 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 6135 clojure.lang.Compiler$BodyExpr$Parser/parse
Compiler.java: 6453 clojure.lang.Compiler$LetExpr$Parser/parse
Compiler.java: 7124 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 7112 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 6137 clojure.lang.Compiler$BodyExpr$Parser/parse
Compiler.java: 6453 clojure.lang.Compiler$LetExpr$Parser/parse
Compiler.java: 7124 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 6137 clojure.lang.Compiler$BodyExpr$Parser/parse
Compiler.java: 5479 clojure.lang.Compiler$FnMethod/parse
Compiler.java: 4041 clojure.lang.Compiler$FnExpr/parse
Compiler.java: 7122 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 7191 clojure.lang.Compiler/eval
Compiler.java: 7149 clojure.lang.Compiler/eval
core.clj: 3215 clojure.core/eval
core.clj: 3211 clojure.core/eval
enlighten.clj: 84 cider.nrepl.middleware.enlighten/eval-with-enlighten
enlighten.clj: 78 cider.nrepl.middleware.enlighten/eval-with-enlighten
Var.java: 384 clojure.lang.Var/invoke
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 1990 clojure.core/with-bindings*
core.clj: 1990 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn
main.clj: 437 clojure.main/repl/read-eval-print/fn
main.clj: 437 clojure.main/repl/read-eval-print
main.clj: 458 clojure.main/repl/fn
main.clj: 458 clojure.main/repl
main.clj: 368 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 84 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 56 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 152 nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
AFn.java: 22 clojure.lang.AFn/run
session.clj: 218 nrepl.middleware.session/session-exec/main-loop/fn
session.clj: 217 nrepl.middleware.session/session-exec/main-loop
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 833 java.lang.Thread/run
1. Caused by java.lang.RuntimeException
Unable to resolve symbol: STATE__ in this context
Util.java: 221 clojure.lang.Util/runtimeException
Compiler.java: 7431 clojure.lang.Compiler/resolveIn
Compiler.java: 7375 clojure.lang.Compiler/resolve
Compiler.java: 7336 clojure.lang.Compiler/analyzeSymbol
Compiler.java: 6785 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 3893 clojure.lang.Compiler$InvokeExpr/parse
Compiler.java: 7126 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 3900 clojure.lang.Compiler$InvokeExpr/parse
Compiler.java: 7126 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 3900 clojure.lang.Compiler$InvokeExpr/parse
Compiler.java: 7126 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 6135 clojure.lang.Compiler$BodyExpr$Parser/parse
Compiler.java: 7124 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 7112 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 1020 clojure.lang.Compiler$HostExpr$Parser/parse
Compiler.java: 7124 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 7112 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 6135 clojure.lang.Compiler$BodyExpr$Parser/parse
Compiler.java: 8570 clojure.lang.Compiler$NewInstanceMethod/parse
Compiler.java: 8076 clojure.lang.Compiler$NewInstanceExpr/build
Compiler.java: 7952 clojure.lang.Compiler$NewInstanceExpr$DeftypeParser/parse
Compiler.java: 7124 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 6135 clojure.lang.Compiler$BodyExpr$Parser/parse
Compiler.java: 6453 clojure.lang.Compiler$LetExpr$Parser/parse
Compiler.java: 7124 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 7112 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 6137 clojure.lang.Compiler$BodyExpr$Parser/parse
Compiler.java: 6453 clojure.lang.Compiler$LetExpr$Parser/parse
Compiler.java: 7124 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 6762 clojure.lang.Compiler/analyze
Compiler.java: 6137 clojure.lang.Compiler$BodyExpr$Parser/parse
Compiler.java: 5479 clojure.lang.Compiler$FnMethod/parse
Compiler.java: 4041 clojure.lang.Compiler$FnExpr/parse
Compiler.java: 7122 clojure.lang.Compiler/analyzeSeq
Compiler.java: 6806 clojure.lang.Compiler/analyze
Compiler.java: 7191 clojure.lang.Compiler/eval
Compiler.java: 7149 clojure.lang.Compiler/eval
core.clj: 3215 clojure.core/eval
core.clj: 3211 clojure.core/eval
enlighten.clj: 84 cider.nrepl.middleware.enlighten/eval-with-enlighten
enlighten.clj: 78 cider.nrepl.middleware.enlighten/eval-with-enlighten
Var.java: 384 clojure.lang.Var/invoke
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 1990 clojure.core/with-bindings*
core.clj: 1990 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 nrepl.middleware.interruptible-eval/evaluate/fn
main.clj: 437 clojure.main/repl/read-eval-print/fn
main.clj: 437 clojure.main/repl/read-eval-print
main.clj: 458 clojure.main/repl/fn
main.clj: 458 clojure.main/repl
main.clj: 368 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 84 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 56 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 152 nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
AFn.java: 22 clojure.lang.AFn/run
session.clj: 218 nrepl.middleware.session/session-exec/main-loop/fn
session.clj: 217 nrepl.middleware.session/session-exec/main-loop
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 833 java.lang.Thread/run
This might be super obvious to someone who writes a lot of deftypes. I'm perplexed because this logic is currently working (or at least i believe it is!), so it has to do with the context in which i'm evaling it, or so i'm guessing.
you can see the symbol it complains about is STATE__ which doesn't exist in your code
yeah, that's what it looks like to me to. huh.
but does exist and is used for something connected to the debugger in cider-nrepl https://github.com/clojure-emacs/cider-nrepl/search?q=STATE__
"Let-wrap `body` with STATE__ map containing code, file, line, column etc.
STATE__ is an anaphoric variable available to all breakpoint macros. Ends with
__ to avid conflicts with user locals and to signify that it's an internal
variable which is cleaned in `sanitize-env' along other clojure's
temporaries."
Ah, it's because i have "cider enlighten mode" on. Well, cool, that's a cider feature i really like and i'm hoping to contribute towards at some point, so hopefully ill be able to improve the experience here a bit. ty @U0NCTKEV8 @UK0810AQ2 and @U11BV7MTK i really do appreciate the input!
i'm not even seeing the stacktrace i pasted in either. I'll try it in a vanilla doom emacs install at somepoint to see if it's something i did to myself. (i did click "all" to, it doesn't do anything)
i'm trying to learn why our logging isn't doing what i expect and ... logging. putting a que on a que doesn't seem right so maybe that's something to look into. 👍
Edit: Nevermind. I got it with triple quotes around the version
@seancorfield Is there a reason a fresh install of clj-new
would have an invalid tag error?
Running clojure -Ttools install com.github.seancorfield/clj-new '{:git/tag "v1.2.399"}' :as clj-new
in powershell
You're on Windows? See https://clojure.org/reference/deps_and_cli#quoting (I know you figured it out but this leaves a trail for others who hit this issue)
How many people here are using Kit framework, and how are they liking it?
It's pretty new so I doubt it has many users yet... There's a #kit-clj channel for it (haven't looked in there to see how active it is).