Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nothing is logged to cider-log buffer #3751

Closed
maacl opened this issue Oct 27, 2024 · 11 comments
Closed

Nothing is logged to cider-log buffer #3751

maacl opened this issue Oct 27, 2024 · 11 comments

Comments

@maacl
Copy link

maacl commented Oct 27, 2024

Expected behavior

cider-log buffer receives and displays log messages.

Actual behavior

cider-log buffer remains empty and all messages are logged to the repl.

Steps to reproduce the problem

cider-log-show

Environment & Version information

WSL

CIDER version information

CIDER 1.15.1 (Cogne), nREPL 1.3.0, Clojure 1.12.0, Java 23

Lein / Clojure CLI version

See above.

Emacs version

29.4

Operating system

Ubuntu 22.04.5 LTS under WSL:

WSL version: 2.3.24.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22631.4317

JDK distribution

openjdk version "21.0.2" 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)

@vemv
Copy link
Member

vemv commented Oct 27, 2024

This happened to both of us as we were trying to use the Timbre integration.

The cider-log buffer is empty because JUL is chosen instead of Timbre, because JUL is determined as the sole available option, because Timbre cannot be loaded:

logjam.framework> (require 'logjam.framework.timbre :reload)
Syntax error (ArityException) compiling at (logjam/framework/timbre.clj:82:9).
Wrong number of args (1) passed to: taoensso.timbre/log!

This looks like a breaking change from Timbre's side. Should have a simple fix in Logjam.

@bbatsov
Copy link
Member

bbatsov commented Oct 27, 2024

@r0man Can you take a look at this?

@r0man
Copy link
Contributor

r0man commented Oct 28, 2024

Hi,

I had a quick look, but I'm having a hard time to reproduce this. This is what I did:

  1. Checked out logjam from https://github.com/clojure-emacs/logjam
  2. Make sure cider/cider-nrepl is at version "0.50.2" (the one in the repo is missing a fix from @vemv)
  3. Start a REPL with lein update-in :dependencies conj \[nrepl/nrepl\ \"1.3.0\"\] -- update-in :dependencies conj \[refactor-nrepl/refactor-nrepl\ \"3.10.0\"\] -- update-in :plugins conj \[refactor-nrepl/refactor-nrepl\ \"3.10.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.50.2\"\] -- with-profile +test repl :headless :host localhost
  4. Open logjam.framework.timbre-test
  5. Run M-x cider-log-show
  6. Eval (timbre/infof "foo %s" 42) at line 66

After doing so, I see the log line in the *cider-log* buffer as:

2024-10-28 09:31:18.000 [nREPL-session-b3a1e5bc-fd2d-4d08-97cf-75ef5f18c554] INFO logjam.framework.timbre-test:66:5 - foo 42

I also see it in the REPL as:

2024-10-28T08:31:18.301Z precision INFO [logjam.framework.timbre-test:66] - foo 42

What I see in *cider-log* looks good to me. The line in the REPL I would not have expected, but I guess this is Timbre's default logger. @vemv is this the expected behaviour when you implemented this? I'm not using Timbre and never tried it before with cider-log.

I opened a PR over here that updates some of logjams dependencies:
clojure-emacs/logjam#19

But this isn't fixing the issue at hand. It only includes a fix from @vemv in cider-nrepl which I run into while trying this in the logjam repository.

I need more information:

  • About which Timbre version are we talking about?
  • @vemv Do you know which breaking change?
  • @vemv I also didn't see the exception you got from reloading (require 'logjam.framework.timbre :reload) How can I reproduce this?

@vemv
Copy link
Member

vemv commented Oct 28, 2024

Hey @r0man , thanks for your efforts!

You are right, it works. What I had to do locally in my specific project was:

For a long while I was actually unable to upgrade Timbre/Encore in my work project, for contrived reasons. But now I finally can, and it all works.

I'd just add these some tips to the manual:

  • Elisp side, one can M-: (cider-sync-request:log-frameworks)
    • if our framework of choice is absent, then things won't work properly and signals some problem
  • Clojure side, one can debug why a specific framework may be absent by running (require 'logjam.framework.timbre :reload)
    • Or any other such namespace listed in logjam.framework/*frameworks*
  • For Timbre specifically, it's often useful to have Timbre + Encore at latest stable.

You can try those right now, @maacl .

Cheers - V

@r0man
Copy link
Contributor

r0man commented Oct 28, 2024

Thanks @vemv. Maybe @maacl can come up with exact steps to reproduce this (in the logjam repo)?

@maacl
Copy link
Author

maacl commented Oct 28, 2024

Hey @r0man , thanks for your efforts!

You are right, it works. What I had to do locally in my specific project was:

For a long while I was actually unable to upgrade Timbre/Encore in my work project, for contrived reasons. But now I finally can, and it all works.

I'd just add these some tips to the manual:

  • Elisp side, one can M-: (cider-sync-request:log-frameworks)

    • if our framework of choice is absent, then things won't work properly and signals some problem
  • Clojure side, one can debug why a specific framework may be absent by running (require 'logjam.framework.timbre :reload)

    • Or any other such namespace listed in logjam.framework/*frameworks*
  • For Timbre specifically, it's often useful to have Timbre + Encore at latest stable.

You can try those right now, @maacl .

Cheers - V

M-: (cider-sync-request:log-frameworks)

gives me:

Debugger entered--Lisp error: (void-function cider-sync-request:log-frameworks)
  (cider-sync-request:log-frameworks)
  eval-expression((cider-sync-request:log-frameworks) nil nil 127)
  funcall-interactively(eval-expression (cider-sync-request:log-frameworks) nil nil 127)
  command-execute(eval-expression)

@vemv
Copy link
Member

vemv commented Oct 28, 2024

Try (require 'cider-log) beforehand

@maacl
Copy link
Author

maacl commented Oct 28, 2024

This works for me now too. I think it was an timbre/encore version issue. Thanks.

@bbatsov
Copy link
Member

bbatsov commented Oct 28, 2024

I think we should probably add something in the docs, so that people are not surprised by such version combination issues.

@vemv
Copy link
Member

vemv commented Oct 28, 2024

I'm generally tight on time any given day so I'd appreciate if someone could add my recap to the manual #3751 (comment)

@r0man
Copy link
Contributor

r0man commented Oct 29, 2024

I added something here: #3753 Wdyt? I'm closing this one. I think we are done here.

@r0man r0man closed this as completed Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants