This piece of code is working when the request successfully reaches to service, because request is not able to bind properly I guess due to which it is not even entering into the request pipeline/lifecycle.
May I kindly request you to please guide me that using RequestLogger in this situation how can I log this request and the response (I am returning custom response) returned to the consumer in the same log file.
I’m not sure if you provided other related code like your Request/Response DTOs via a different channel but for completeness it would be good to have here as well.
When value types like DateTime travel over the wire or are represented in something like a Query String value, it needs to be serialized. In this case, the value 1700064350 looks like Unix timestamp which is the number of seconds since 1970.
You can configure the DateHandler (which my default is TimestampOffset) to use UnixTime application wide by using the config in your AppHost:
That is likely, depending on your apps configuration, the binding of the property could be failing in a way that is causing the issue. If you create a minimal reproduction, I can take a look.
From my side I thought I have described in great detail but seems I didn’t. Apologize if I confused you guys. My issues is resolved and the date is working fine.
But as I mentioned earlier, can you guide me if there is any way that when due to some exception I am landing into UncaughtExceptionHandlers method how can I log this request/response using RequestLogsFeature into the same csv file. I need to log the request/response
But this wont be an accurate recreation of the Request DTO as it’ll only be able to create the Request DTO from the /path/info and QueryString and wont be able to re-parse the HTTP Request body, if that fails (e.g. from an invalid QueryString) it’ll try recreating an empty Request DTO without parsing the QueryString, otherwise, if that fails it wont be able to recreate the Request DTO to be able to log it.