https://kotlinlang.org logo
#ktor
Title
# ktor
c

CLOVIS

02/18/2023, 9:06 AM
Would it be possible to access the entire client log for a request as a String? I'm interested in storing it to a file as a regression test (if the file changes, there may be an API breaking change). The full logs as printed by the clients already have all the needed information, but I don't know how to get the logs for a specific request as a String.
a

Aleksei Tirman [JB]

02/20/2023, 11:37 AM
Do you mean the logs which are written by the
Logging
plugin?
c

CLOVIS

02/20/2023, 11:38 AM
Yes
a

Aleksei Tirman [JB]

02/20/2023, 11:45 AM
The best you can do is implementing the
Logger
interface to separate logs for individual requests. For example, by detecting the
BODY END
string.
c

CLOVIS

02/20/2023, 12:00 PM
Is it guaranteed that they are never intermingled?
a

Aleksei Tirman [JB]

02/20/2023, 12:02 PM
Unfortunately, it’s not.
5 Views