Logging an OutputStreamResponse

24 views
Skip to first unread message

Dan Gravell

unread,
Jul 14, 2016, 7:08:22 AM7/14/16
to Lift
Under certain circumstances (rare, opt-in ones) I want to be able to log the contents of an OutputStreamResponse.

Currently I log requests/responses in LiftRules.onEndServicing.

The approach I considered was to copy the OutputStream into memory, log it, then create a new InMemoryResponse to send to the client.

However onEndServicing doesn't have any control over what is actually sent to the client, so I suspect the OutputStream will return nothing to the client if it is already "evaluated".

Has anyone done this, is there a part of the LiftRules API I'm missing?

Thanks,
Dan

Diego Medina

unread,
Jul 14, 2016, 9:59:23 PM7/14/16
to Lift
Hi Dan,

I could be wrong but I think the whole point of the *StreamResponse is that Lift doesn't really read it, it just passes the data from your source to the client.
If you need to keep using a stream, maybe you can hook for these type of responses earlier, where you read your data from a db or wherever you get the data from, log it at that level, and then generate the OutputStreamResponse.

Thanks

Diego

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Diego Medina
Lift/Scala Consultant
di...@fmpwizard.com
http://blog.fmpwizard.com/

Dan Gravell

unread,
Jul 19, 2016, 9:10:06 AM7/19/16
to Lift
I guess you're right.
Reply all
Reply to author
Forward
0 new messages