Fork me on GitHub
#cider
<
2022-05-06
>
MikeE12:05:16

hello - i just opened up a project that I haven't touched in a few months on my new iMac M1 which I just setup as a dev machine. I just realized all my logging statements no longer show logs in the cider repl anymore and I can't figure out what would be causing this issue. Has there been any changes to how logging works due to the log4j fiasco maybe? I have upgraded my dependencies to the latest versions of everything but I can't find any issues on any of the projects related to this. Here's my dependencies and logback XML

[org.clojure/clojure "1.11.1"]
                 [org.clojure/data.json "2.4.0"]
                 [com.github.seancorfield/next.jdbc "1.2.780"]           
                 [org.postgresql/postgresql "42.3.4"]
                 [hikari-cp "2.14.0"]
                 [com.layerware/hugsql-core "0.5.3"]
                 [com.layerware/hugsql-adapter-next-jdbc "0.5.3"]
                 [migratus "1.3.6"]
                 [integrant "0.8.0"]
                 [environ "1.2.0"]
                 [clj-http "3.12.3"]
                 [ring/ring-core "1.9.5"]
                 [ring/ring-jetty-adapter "1.9.5"]
                 [ovotech/ring-jwt "2.3.0"]
                 [metosin/reitit "0.5.18"]
                 [metosin/muuntaja "0.6.8"]
                 [metosin/ring-http-response "0.9.3"]
                 [software.amazon.awssdk/s3 "2.17.183"]      
                 [com.cognitect.aws/api "0.8.539"]
                 [com.cognitect.aws/endpoints "1.1.12.206"]
                 [com.cognitect.aws/sqs "822.2.1109.0"]
                 [com.cognitect.aws/s3 "822.2.1109.0"]
                 [org.clojure/tools.logging "1.2.4"]
                 [org.slf4j/slf4j-log4j12 "1.7.36"]
                 [integrant/repl "0.3.2"]
                 [ch.qos.logback/logback-classic "1.2.11"]]

MikeE12:05:22

<configuration debug="false">
 <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %-10contextName %logger{36} - %msg%n</pattern>
    </encoder>
 </appender>
 <logger name="com.zaxxer.hikari">
     <level value="error"/>
 </logger>
  <root level="INFO">
    <appender-ref ref="CONSOLE"/>
  </root>
</configuration>

Quest18:05:14

Anyone have ideas on how to run the full Emacs cider-connect-clj&cljs sequence off a single keystroke? My normal keypresses to connect to my initialized server is below.

C-c C-x C-c Enter (cider-connect-clj&cljs) ->
Enter (Host: localhost) ->
Enter (Port: 51834) ->
Enter (Select ClojureScript REPL Type: shadow) ->
Y (Reuse previous cider nrepl buffer, optional) ->
Enter (select shadow-cljs build :app)
You can kinda cheat this by using a KBD macro, but it can't handle the optional Reuse previous cider nrepl buffer & can occasionally trip up

practicalli-johnny20:05:51

I assume you can set defaults for all (or most of these) using a .dir-locals.el file. For example https://practical.li/spacemacs/clojure-projects/project-configuration.html It would be a matter of finding the right variables to set. There are some cljs and shadow-cljs specific variables here https://practical.li/spacemacs/reference/cider/configuration-variables.html For example:

cider-shadow-cljs-command 		The command used to execute shadow-cljs. By default we favour the project-specific shadow-cljs over the system-wide.
cider-shadow-cljs-global-options 		Command line options used to execute shadow-cljs (e.g. -v for verbose mode).
cider-shadow-cljs-parameters 		Params passed to shadow-cljs to start an nREPL server via cider-jack-in.
cider-default-cljs-repl 	ClojureScript REPL to start for cljs jack-in commands (.dir-locals.el approach recommended)

💯 1
Quest00:05:34

Ooo, I'm going to take a look into this at start of next workweek, thanks! (It probably seems like a small thing, but I had to execute this keysequence 100 times in the last week while chasing a bug that required a server restart, and I just really wished I could automate it)

Quest17:05:10

Thanks for guidance -- I set below snippet in repo/.dir-locals.el

((nil . ((cider-preferred-build-tool . clojure-cli)
         (cider-default-cljs-repl . shadow)
         (cider-shadow-default-options . "app"))))
It cuts two of the steps so this becomes my flow
C-c C-x C-c Enter (cider-connect-clj&cljs) ->
Enter (Host: localhost) ->
Enter (Port: 51834) ->
Y (Reuse previous cider nrepl buffer, optional) ->
I searched but couldn't figure out settings to skip over host (should default to localhost) or port (should default to .nrepl-port), or an option to "always reuse previous REPL buffers", but it's still nice to have 4 keypresses instead of 6! thanks

onetom04:05:56

if u look into the source of cider-connect-*, you can see what underlying functions does it call, so u can just make your own variant, which doesn't do the prompting.

1
onetom04:05:36

not that i tried to hack on this specifically, but that's the general approach u should follow, when using emacs. here is some inspirational demonstration of an emacs old-timer demonstrating how is he whipping up small elisp programs for more complicated, but ad-hoc use-cases: https://www.youtube.com/watch?v=cVy-kMSnaHc

👍 1
Quest01:05:30

Just coming back from the long weekend, but I'll give this a shot this week. I've never gone hacking into library internals (besides theming) but what you're saying makes sense

Ian Fernandez19:05:23

How can I decide between 2 instances of a repl when I'm sending eval?

Ian Fernandez19:05:57

like, my C-x C-e goes to which of those repl's ?

anonimitoraf00:05:37

To the one whose buffer you last focused

Quest00:05:19

Anonimitoraf's answer has been my experience -- if you hit C-u C-c C-z (cider-repl-set-ns), Then it should pop your focus over to the corresponding buffer that would've been used for eval, which is the last one with focus. (This is also how it picks between clj vs cljs when you're in a cljc file)

Ian Fernandez04:05:00

But I'm having 2 repls with the same ns

Ian Fernandez04:05:00

But I'm having 2 repls with the same ns

Quest17:05:10

Thanks for guidance -- I set below snippet in repo/.dir-locals.el

((nil . ((cider-preferred-build-tool . clojure-cli)
         (cider-default-cljs-repl . shadow)
         (cider-shadow-default-options . "app"))))
It cuts two of the steps so this becomes my flow
C-c C-x C-c Enter (cider-connect-clj&cljs) ->
Enter (Host: localhost) ->
Enter (Port: 51834) ->
Y (Reuse previous cider nrepl buffer, optional) ->
I searched but couldn't figure out settings to skip over host (should default to localhost) or port (should default to .nrepl-port), or an option to "always reuse previous REPL buffers", but it's still nice to have 4 keypresses instead of 6! thanks