Fork me on GitHub
#timbre
<
2022-12-27
>
Wesley Matson20:12:30

I'm using https://github.com/viesti/timbre-json-appender alongside timbre, with the first line in my -main as (json-appender/install {:min-level :info}) , any idea why I'd still get the default appender for any threads created (via (Thread. (fn [] ,,,)) after that point? Is there an easy way to fix this?

Wesley Matson21:12:12

It seems that I should be able to get my preferred behavior by instead using (Thread. (bound-fn [] ,,,)), will test and report back

Wesley Matson21:12:40

Using bound-fn did not appear to work 😕

Wesley Matson21:12:41

Oh, maybe json serialization is failing? These do seem to mostly be Exception-related messages that look like they're using the default appender

pavlosmelissinos22:12:38

Check out alter-var-root too, it's the imperative approach (it sets a global context that is visible to the entire process) bound-fn should work with Thread. for typical log lines but weird stuff (that cannot be JSON serialized, like you said) might still bypass the appender, that's to be expected

Wesley Matson22:12:37

Yeah, I think it's json serialization issues, I didn't have the exceptions in the position to automatically Throwable->map

pavlosmelissinos22:12:51

FYI if you run Throwable->map you lose the ability to ex-data ExceptionInfos, which might not be what you want

Wesley Matson22:12:36

This is just for the logging, the viesti json appender seems to handle it properly as long as the exceptions are the first arg to the logging macros (I was putting them under an unrelated key before)

👍 1