clojure

sirwobin 2025-08-06T10:15:23.586689Z

Good morning! I'm using structured logging in my app which has logging output configured by logback and the consuming service wants JSON. I've managed to get the logstash encoder to produce pretty good output but the message (which I've already formatted as a JSON string) is being wrapped in a string. What I really want is the message to contain the nested JSON instead of wrapping it in a string. Is this possible and if so, do you mind sharing a working example?

Shantanu Kumar 2025-08-06T11:38:13.584989Z

#cambium solves this problem using a codec - you may want to look at it for inspiration: https://cambium-clojure.github.io

sirwobin 2025-08-06T14:44:56.423629Z

Thanks for the suggestion Shantanu. I found a very simple solution which is working perfectly. I use the default encoder and format the pattern with JSON elements like so:


    
        {"timestamp": "%d{yyyy-MM-dd'T'HH:mm:ssXXX}", "level": "%level", "event": %msg}%n
    

👍🏽 1
sirwobin 2025-08-06T14:47:16.906319Z

Java logging is such a mess.

2025-08-06T15:02:50.134489Z

Is there a way to produce a lazy sequence that implements CollFold in order to permit compute-heavy parallel execution over partitions of a lazy input source? I'm trying to think about transducers and reducers in the context specifically of producing a parallel execution of a fold over a monoid where the input is too large to hold in memory but the monoidal add function is computationally expensive enough as to warrant parallel execution.

respatialized 2025-08-06T15:49:45.618229Z

I haven't used https://github.com/aphyr/tesser, but it may be close to what you're describing. I have also used https://github.com/clj-commons/claypoole for controlled parallelism of larger-than-memory compute-intensive data processing, and it works well for this, and also has a namespace with lazy versions of its API. I don't know about whether it implements CollFold, however.

2025-08-06T15:58:00.081669Z

tesser looks great!

emccue 2025-08-06T18:39:24.068149Z

there is also obviously, once you break out of clojure, spliterator and standard java streams. you can make an implementation of spliterator and make use of parallel streams

2025-08-06T18:40:46.978549Z

Yes, i was aware of this, but I don't want to java 😂

emccue 2025-08-06T18:41:19.794459Z

i mean, clojure did just add stream interop. might as well use it once in a blue moon

👍 1
David Ko 2025-08-06T23:00:00.157379Z

Hey there, I wonder if any Clojurian is working for Qlik in Ottawa