BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.7k stars 218 forks source link

Create a more convenient way to view clojure-lsp server logs #1166

Open bpringe opened 3 years ago

bpringe commented 3 years ago

Sometimes Calva users run into issues that are related (or may be) to clojure-lsp, and we have to inform them of where the log files are and ask that they send log info. It would be nice if Calva assisted with getting these logs.

@ericdallo There isn't just one log file though, right? I see many in my /tmp directory like:

clojure-lsp.11239431043345925702.out
clojure-lsp.12206753788920356503.out
clojure-lsp.13692266621008575021.out
clojure-lsp.16161092552635628092.out

So, I'm not sure what the best path here is for making it convenient to get the recent logs (assuming the most recent file is the one we want).

Some ideas:

  1. Create a command that finds and opens the latest output file in a VS Code editor
  2. Create some way to tail the latest file, though if a new file is created in the middle of this, that could complicate things I imagine

What other things could we do?

ericdallo commented 3 years ago

clojure-lsp uses java.io temp folder when initializing if user doesn't provide a :log-path, that's why you have different clojure-lsp logs, because every time you initialize clojure-lsp it will create a different log path unless you provide a log-path.

We made this way because we started to have issues with users without permission on /tmp/ folder, so we couldn't always set the log to there.

bpringe commented 3 years ago

I'm a bit confused on multiple levels. You're saying we can provide an exact file path, like /tmp/clojure-lsp.out and clojure-lsp will always log to that single file? I figured the separate files were to keep the log files under a certain size or something :smile:. If we made it always log to a certain file, does it ever clear this file or the file just grows infinitely? (I'm really just curious here.)

We made this way because we started to have issues with users without permission on /tmp/ folder, so we couldn't always set the log to there.

It defaults to A JVM tmp path, usually /tmp/clojure-lsp.*.out... and then if the user has a permission issue they can change it?

If we are to create a method for displaying the log file, I'm guessing we can get the :log-path from the server info command, then open it. Does that sound like a good approach?

ericdallo commented 3 years ago

Yes, it grows infinitely and this was never an issue since clojure-lsp doesn't log that much.

It defaults to A JVM tmp path, usually /tmp/clojure-lsp.*.out... and then if the user has a permission issue they can change it?

No, actually it defaults for JVM tmp path which most of the time is /tmp but for some macos for example it's /var/log/.... The thing here is, we will never face permission issues with that.

If we are to create a method for displaying the log file, I'm guessing we can get the :log-path from the server info command, then open it. Does that sound like a good approach?

Yes, it sounds perfect! I didn't think about that option 😅