How to log 500 error/exception from other services? #1819
-
Hello, I have just used it. It works well but I have one concern that how to log exception (Http code 500) from downstream services. Currently, if I switch log level to "error", I cannot receive anything. However, if log level is "trace", there is some below info
Please let me know if there is any missing. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 5 replies
-
@tungphuong I will test this and get back to you ASAP! If you want to submit a PR that adds the logging let me know. |
Beta Was this translation helpful? Give feedback.
-
from other issue
|
Beta Was this translation helpful? Give feedback.
-
Yes, 2 items are the same. Ok, I will submit one PR :) |
Beta Was this translation helpful? Give feedback.
-
Are you still with Ocelot? |
Beta Was this translation helpful? Give feedback.
-
Interesting, can I replicate on AWS EC2 with cloudwatch? Such that nothing is found on cloudwatch when loglevel set as "Error"? Can I try replicating issue on this case? |
Beta Was this translation helpful? Give feedback.
-
Hey Phuong Le! What details of 500 error would you like to log by Ocelot?
And, why do you think that Ocelot should log error details of downstream service? If you want to transfer root cause of 500 error then you have to control downstream service, develop, setup, and prepare error details model to send all this information in response as JSON for example to allow Ocelot to handle this response, detect the case, and log finally by internal Ocelot logger. Do you understand that you've described invalid user scenario?
Right, because Ocelot has internal Error Mapper logic, see the feature docs: Error Status Codes | Design From second side,
Exactly, because OcelotDiagnosticListener logs only if
Seems the root cause of downstream service failure is invalid CORS policies of the request! Ups! 💥 Bingo! |
Beta Was this translation helpful? Give feedback.
@tungphuong on Jul 24, 2018:
Hey Phuong Le!
Seems you are no longer with Ocelot... This is last try to ping you...
What details of 500 error would you like to log by Ocelot?
And, why do you think that Ocelot should log error details of downstream service?
I believe downstream should log service errors.
If you want to transfer root cause of 500 error then you have to control downstream service, develop, setup, and prepare error details model to send all this information in response as JSON for example to allow Ocelot…