mark.warren
2019-3-13 07:22:45

@greg @soegaard2 Thanks guys, just what I need.


jjwiseman
2019-3-13 20:23:22

if i want log messages (from log-info etc.) to have a custom format (timestamps, etc.), what’s the best way to do that?


samth
2019-3-13 20:25:34

@jjwiseman where should this custom format appear?


jjwiseman
2019-3-13 20:26:50

to start, could it be “the default”? that is, say the only change i want to make is to add a timestamp?


samth
2019-3-13 20:27:09

I think the shortest answer is you can’t


samth
2019-3-13 20:27:33

The next shortest answer is that you can write your own log reciever that gets the log events and prints them however it wants


samth
2019-3-13 20:28:00

But the log reciever that is run at startup isn’t configurable


samth
2019-3-13 20:28:11

(at least, I don’t think it is)


jjwiseman
2019-3-13 20:29:05

are there good (production) examples of doing that? e.g. it would seem that i’d need to wrap my main in a dynamic-wind to make sure log messages get displayed/handled in the case of an exception.


jjwiseman
2019-3-13 20:29:19

and there are probably other issues i’m not aware of.


samth
2019-3-13 20:30:08

I think @greg has mentioned having some production examples of logging to an AWS service


jjwiseman
2019-3-13 20:30:09

(i.e. (dynamic-wind ... ... (lambda () (drain-log-message-queue)) or something)


notjack
2019-3-13 21:23:14

@jjwiseman I think dynamic-wind shouldn’t be necessary regardless, since log messages are sent and received asynchronously


notjack
2019-3-13 21:23:50

I imagine instead at program startup time you’d start a thread that receives logs and processes them before sending them somewhere like stderr or syslog or whatever cloud logging service you’re using


jjwiseman
2019-3-13 21:30:04

it’s because of the asynchronicity that i think it is needed… without it, i may not even see the log messages that preceded a program-killing exception.


jjwiseman
2019-3-13 21:31:50

(usually those are the most interesting log messages, so you don’t want to miss them :slightly_smiling_face: )


jjwiseman
2019-3-13 21:39:33

i don’t think it even requires an exception to see weird behavior—if the last thing my program does before exiting is (log-error "woo"), i probably wouldn’t/might not see it.


jjwiseman
2019-3-13 21:39:55

(unless i’m missing something?)


greg
2019-3-13 22:31:39

@jjwiseman IIRC I used a plumber to flush the log-receiver and that seemed to work.



greg
2019-3-13 22:34:41

Also, I was “batching” logger messages, waiting until I had N or X seconds elapsed, before doing the AWS put to CloudWatch HTTP request. I think that was my main motivation for the plumber, to handle even just a graceful exit, or a break. So maybe it doesn’t help with an exception exit? But I think it would??


jjwiseman
2019-3-13 22:38:32

ah, thanks, hadn’t known about plumbers.


jjwiseman
2019-3-13 23:31:38

(i also did the batching thing. i’d be curious to see your implementation. mine is https://gist.github.com/wiseman/5d6fa929bf71925a577d48d220feb30c)