How to log something in ArangoDB Foxx Test?

181 Views Asked by At

I'm currently testing Foxx service in ArangoDB : https://docs.arangodb.com/3.11/develop/foxx-microservices/guides/testing-foxx-services/

In order to help debugging i want to log the response body. I tried to use console.log :

describe('test of action service', function(){
    it('should return 200 on diagnostic', function(){
        const response = request.get(baseUrl+'/action/diagnostic');
        console.log(response.body);
        expect(response.status).to.equal(200);
    });
});

but when i launch my tests it doesn't seems to work. Did i miss something here?

1

There are 1 best solutions below

0
dothebart On BEST ANSWER

The output of console.log() ends up in the ArangoDB server logfile. So if you previously configured logging in the etc/arangodb3/arangod.conf:

[log]
file = /var/log/arangodb3/arangod.log

You should find the logfile /var/log/arangodb3/arangod.log on your disk.

So, invoking:

console.log("hello log");

will write this into /var/log/arangodb3/arangod.log:

2019-02-25T13:20:47Z [87753] INFO hello log

You should be able to do similar for the response.body - maybe you want to try:

console.log(JSON.stringify(response));

to get the output of the complete serialized object.