This is the continuation of  previous blog (blog series) and this blog will be explaining about the debugging and error log handling mechanism in Olingo 2.0 oData services,

 

Introduction

 

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:

/wp-content/uploads/2016/10/1_1044035.png

 

 

To implement the error log and to get control of error implementation following class needs to be implemented

 

 

/wp-content/uploads/2016/10/2_1044036.png

And register debug Call back and error call back in OdataServiceFactory class can be done by writing the below code snippet in CustomOdataServcieFactory class

/wp-content/uploads/2016/10/3_1044037.png

 

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.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply