Fork me on GitHub
#beginners
<
2018-10-13
>
danny00:10:31

for clojure code that throws using ex-info how do people tend to differentiate different errors when matching with catch statements?

thiru03:10:11

I'm using hikari-cp with Postgresql and it's creating a ton of logs in my repl.. how can I change this?

seancorfield03:10:38

@clarkenciel You can catch Exception or clojure.lang.ExceptionInfo and then use ex-data to get the payload and process it however you want.

thiru03:10:48

With ring/jetty I use jetty-logging.properties file.. there must be an analog for postgres/jdbc?

seancorfield03:10:03

@thiru0130 Much will demand on how you're dealing with logging overall.

seancorfield03:10:32

We use Timbre and the adapters that route all the Java logging through Timbre, so we can control the logging level in one place.

seancorfield03:10:13

I don't know what hikari-cp uses for logging... I suspect you're dealing with Java-level logging tho', rather than a Clojure issue πŸ™‚

thiru03:10:19

Oh that's nice.. I should probably set that up

thiru03:10:39

Yea.. Java level

seancorfield03:10:13

Maybe put a logging.properties on your classpath...

seancorfield03:10:22

You might be able to put that level setting in logging.properties rather than as a JVM option...

thiru03:10:12

Hmm the logging.properties file didn't seem to work

thiru03:10:39

I'm guess I can pass along the JVM option when using clj?

seancorfield03:10:45

Yup, with -J or via a :jvm-opts alias with -O...

thiru03:10:55

Ah yes it works!

thiru03:10:06

Thank you @seancorfield - you are awesome!

seancorfield03:10:27

I'm just quick with Bing πŸ™‚

thiru03:10:35

Even more impressive that you're using a lesser search engine! πŸ˜‰

thiru03:10:49

jk.. I have no bias myself

seancorfield03:10:08

Meh, I switched from Google to Bing years ago and I actually find it to be way more accurate and useful than Google...

seancorfield03:10:45

(I've been an Apple guy since the early 90's but lately I've been very impressed with MS and very not impressed with Apple -- I run Bing, Edge, Outlook, and Cortana on my iPhone πŸ™‚ )

thiru03:10:53

Really? I'll have to give Bing a go then.. I've tried using http://duckduckgo.com several times but always ended up going back to google

djz14:10:36

so for getting started in clojure on a mac again, is java 11 fully supported these days? or is that going to be a pain point? also does using the oracle jdk (https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html) vs openjdk (https://jdk.java.net/11/) make a significant difference? thx!

deliciousowl15:10:27

afaik "clojure tries to be 2 versions behind"

deliciousowl15:10:47

I personally am using Java 10 with no issues though

alexmiller15:10:56

There are some minor issues, which resolved in the upcoming Clojure 1.10

Dormo15:10:07

Is there any reason to choose clj-http over clj-http-lite if the latter has all the necessary features?

djz19:10:05

@seancorfield @alexmiller & @coinedtalk thanks for the insights!

djz19:10:53

@seancorfield wow, that was pretty sobering... tl;dr = use openjdk πŸ™‚

seancorfield19:10:44

Yeah, that's about the bottom line. Unless you want Oracle's paid support πŸ™‚

hoopes20:10:19

kind of a weird question - is there a way i can stash a value to inspect later in the repl? I have a ring request map (and afaik, no step-through debugger on the command line?), so it would be cool to somehow say "Store this value in that global name to inspect in the repl after the request"

hoopes20:10:44

now that i type that out, i could swap it into some atom in my-app.debug or somesuch?

dadair20:10:36

you can use a standard def from within a function that processes the ring request

dadair20:10:02

Then call some.ns/whatever-def from the repl

hoopes20:10:12

yeah, awesome, thanks @dadair - i'd still kill for a step-through debugger in the repl though (like python's pdb)

dadair20:10:01

There’s a library called scope-capture that might get you further along that direction

hoopes20:10:05

nice! i'll give it a shot