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

Hitesh Chopra

09/04/2021, 7:28 AM
Hi, is there any way I can debug or set breakpoints for incoming APIs requests in Ktor? The logs are returning minimal information. Actually I have implemented JWT authentication in ktor and I am getting status code 401(unauthorised) in API response and something similar in logs as well. I am stuck here since long time, how do I get more details on what is causing it?
This problem got fixed. But question still remains how to set breakpoints so that I can debug the incoming API requests
h

hfhbd

09/04/2021, 7:44 AM
What about setting a breakpoint and attach the debugger?
h

Hitesh Chopra

09/04/2021, 8:03 AM
Debug Application(instead of run) worked for me. It was somehow not working earlier when I was getting 401 status code. Maybe the code did not reach there. Thanks I am able to debug now.
c

CLOVIS

09/04/2021, 8:23 AM
Have you used the Logging plugin?
h

Hitesh Chopra

09/04/2021, 8:25 AM
Yes, I have used. It returns detailed logs for some request codes like bad request (400) but for unauthorised (401) there were no details available except one line which said 401 unauthorised
c

CLOVIS

09/04/2021, 9:23 AM
I wonder if that's on purpose.
a

Aleksei Tirman [JB]

09/06/2021, 9:53 AM
@Hitesh Chopra feel free to file an issue if you think that the logger should store more detailed logs for the 401 status code response.
h

Hitesh Chopra

09/07/2021, 4:53 AM
@Aleksei Tirman [JB] sure Aleksi. I have raised a feature request for the same.
3 Views