Re: Socket servers, threads, and redirecting error output.

2021-01-06 Thread jum...@gmail.com
Thanks Sean, the stuff with file/line and thread name was helpful! I updated my own logging-future macro(s) - here's an interesting version (logging-future+) that logs the client stacktrace at the time when it called future. I often find that much more useful that the stacktrace inside the

Re: Socket servers, threads, and redirecting error output.

2021-01-05 Thread Austin Haas
Thank you, Sean. That is an excellent example. -austin On Sunday, January 3, 2021 at 12:48:55 PM UTC-8 Sean Corfield wrote: > Austin, > > You might find a macro like this helpful -- just use it directly instead > of future. You can replace println with whatever sort of logging you want. > >

Re: Socket servers, threads, and redirecting error output.

2021-01-03 Thread Sean Corfield
Austin, You might find a macro like this helpful -- just use it directly instead of future. You can replace println with whatever sort of logging you want. (defmacro logged-future "Given a body, execute it in a try/catch and log any errors." [& body] (let [line (:line (meta )) file *file*]

Re: Socket servers, threads, and redirecting error output.

2021-01-02 Thread Austin Haas
Ah, thanks for pointing that out. I must've overlooked your example, because I'd already written off futures. It seems like what you are suggesting, catch and print, might be about as good as I could hope for. If I don't want to block the main thread, then I don't see what else I could

Re: Socket servers, threads, and redirecting error output.

2021-01-02 Thread Justin Smith
to be clear, in my second example you see the error from the future without using deref good luck finding your solution On Sat, Jan 2, 2021 at 12:50 PM Austin Haas wrote: > Thank you very much for the explanation, Justin. > > I don't see how I can use futures, though, without blocking on the

Re: Socket servers, threads, and redirecting error output.

2021-01-02 Thread Austin Haas
Thank you very much for the explanation, Justin. I don't see how I can use futures, though, without blocking on the main thread (to get the exception when it occurs). I'm spawning a long-running process that never returns a value. On Saturday, January 2, 2021 at 12:43:14 AM UTC-8

Re: Socket servers, threads, and redirecting error output.

2021-01-02 Thread Justin Smith
By the time the exception is caught, you are already outside the context of the Thread which the repl client is interacting with. The default exception handler has no information tying the executing thread to the repl process (not to mention the dynamic variables clojure is using to associate