SLN Spotlight_SAP Labs India: debugging and error handling implementation in Olingo 2.0 OData Services
In olingo OData services exposes error condition response with error status code, and when you get error like “An exception occurred.” This, apparently, is a result of decision by the Olingo team to not be dependent on a specific logging library (although I’m not sure how this makes sense, since they are dependent on CXF, which seems pretty heavy). The simple solution to this problem they recommend is to add a callback method to your ODataServiceFactory implementation,
The debug feature can be enabled by the following callback implementation:
To implement the error log and to get control of error implementation following class needs to be implemented
And register debug Call back and error call back in OdataServiceFactory class can be done by writing the below code snippet in CustomOdataServcieFactory class
If this is in place, then the url query option odata-debug=json will return detailed error information in json format for each request.
Query for Debug Information
JSON Debug View
Request url: http://localhost:8080/java /sample.svc/?odata-debug=json
As mentioned above, you can implement the debugging for oData services, In next blog .i.e. Part 6 will be explaining about the REST services implementation through JPAContext.