Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

1

Logging all RestConf/MD-SAL API requests and responses

asked 2016-10-07 07:38:11 -0800

nullop gravatar image

During testing it is infinitely helpful to log the original incoming JSON to the MD-SAL Api.

The provider code only receives the java object, not the XML or JSON itself. So I don't think the MD-SAL provider implementation can do this.

Is it possible to spit the original XML/JSON out to a log every time ANY MD-SAL Api is invoked? Are there examples or classes I should look at?

In other projects CXF interceptors were used to intercept all HTTP traffic and log it appropriately.

If something similar meshes with MD-SAL please let me know. Or if there is an alternative approach to logging the incoming and outgoing XML/JSON.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-10-13 14:40:09 -0800

Hello,

As of today, such logging exist in the BrokerFacade class, at TRACE level. All REST calls are logged, you just have to enable the logging. To do so you can use this execute this command on the karaf CLI:

log:set TRACE org.opendaylight.netconf.sal.restconf.impl.BrokerFacade

But it doesn't dump the XML/JSON payload, it's dumping the NormalizedNode, e.g. the parsed version of the received payload. And it only log the request, not the response.

Hope this helps, Alexis

edit flag offensive delete publish link more
Login/Signup to Answer

Stats

Asked: 2016-10-07 07:38:11 -0800

Seen: 123 times

Last updated: Oct 13 '16