# Debugging RPCs and handling lists as RPC output

**URL:** <https://dmap-community.ductus.global/t/debugging-rpcs-and-handling-lists-as-rpc-output/1938>\
**Category:** Core Engine and APIs\
**Created:** [May 30, 2018, 3:48pm UTC](https://dmap-community.ductus.global/t/debugging-rpcs-and-handling-lists-as-rpc-output/1938 "2018-05-30T15:48:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rick\_r](https://avatars.discourse-cdn.com/v4/letter/r/71c47a/32.png) [@rick\_r](https://dmap-community.ductus.global/u/rick_r)\
**Post date:** [May 30, 2018, 3:48pm UTC](https://dmap-community.ductus.global/t/debugging-rpcs-and-handling-lists-as-rpc-output/1938/1 "2018-05-30T15:48:35Z")

</div>

I have an RPC where the output is a list, as follows:

```
rpc myrpc {
tailf:actionpoint spoint;

output {      
  list my-list {

    key "elemA";

    leaf elemA {
      type string;
    }
    leaf elemB {
      type uint8;
    }
    leaf elemC {
      type boolean;
    }
}

```

Let’s suppose that my python code returns the following:

```
result = [
    _confd.TagValue(_confd.XmlTag(ns_hash, my_list_tag),
                    _confd.Value(_confd.C_XMLBEGIN)),
    _confd.TagValue(_confd.XmlTag(ns_hash, elemA_tag),
                    _confd.Value('a1')),
    _confd.TagValue(_confd.XmlTag(ns_hash, elemB_tag),
                    _confd.Value(1)),
    _confd.TagValue(_confd.XmlTag(ns_hash, elemC_tag),
                    _confd.Value(True)),
    _confd.TagValue(_confd.XmlTag(ns_hash, my_list_tag),
                    _confd.Value(_confd.C_XMLEND)),
    _confd.TagValue(_confd.XmlTag(ns_hash, my_list_tag),
                    _confd.Value(_confd.C_XMLBEGIN)),
    _confd.TagValue(_confd.XmlTag(ns_hash, elemA_tag),
                    _confd.Value('a2')),
    _confd.TagValue(_confd.XmlTag(ns_hash, elemB_tag),
                    _confd.Value(2)),
    _confd.TagValue(_confd.XmlTag(ns_hash, elemC_tag),
                    _confd.Value(False)),
    _confd.TagValue(_confd.XmlTag(ns_hash, my_list_tag),
                    _confd.Value(_confd.C_XMLEND))]

dp.action_reply_values(uinfo, result)

```

Is that the correct way of returning lists? I’m prepending `_confd.C_XMLBEGIN` and appending `_confd.C_XMLEND` to each list element, as explained in a [previous question](https://discuss.tail-f.com/t/python-format-for-returning-a-list-output-for-confd-action/1027). Am I missing something?

In confd CLI, I am getting this error:

```
> request myrpc
my-list --ERROR--
Error: bad response from action
[error][2018-05-30 15:26:32]

```

I had a vague memory that in `/var/log/syslog` I could find more details if the `developerLogLevel` of confd is set to “trace”, but even after editing `confd.conf` so that all logs are active and are active on syslog, I only get the following:

```
May 30 15:53:51 localhost confd[3598]: devel-c new_action request daemon id: 3 usid: 17
May 30 15:53:51 localhost confd[3598]: devel-c new_action succeeded daemon id: 3 session id: -27 worker id: 11
May 30 15:53:51 localhost confd[3598]: devel-c action action() request for callpoint spoint path
May 30 15:53:51 localhost confd[3598]: devel-c action action() succeeded for callpoint spoint path

```

Is there a way to get more debug messages from ConfD so as to know exactly what went wrong?

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [June 12, 2018, 10:39am UTC](https://dmap-community.ductus.global/t/debugging-rpcs-and-handling-lists-as-rpc-output/1938/2 "2018-06-12T10:39:09Z")

</div>

As you saw in the response from the user in that previous question, my reply there had an issue with the begin and end tags. So in your case:

```python
result = [
    _confd.TagValue(_confd.XmlTag(ns_hash, my_list_tag),
                               _confd.Value((my_list_tag,ns_hash),_confd.C_XMLBEGIN)),
    _confd.TagValue(_confd.XmlTag(ns_hash, elemA_tag),
                               _confd.Value('a1', _confd.C_STR)),
    _confd.TagValue(_confd.XmlTag(ns_hash, elemB_tag),
                               _confd.Value(1, _confd.C_UINT8)),
    _confd.TagValue(_confd.XmlTag(ns_hash, elemC_tag),
                               _confd.Value(True, _confd.C_BOOL)),
    _confd.TagValue(_confd.XmlTag(ns_hash, my_list_tag),
                               _confd.Value((my_list_tag,ns_hash),_confd.C_XMLEND))
]
dp.action_reply_values(self.uinfo, result)

```

Note that it is a good habit to enter the type for the value too, even though for the string and boolean it is not required.
