Console.log is not working in sync function

I have been trying to debug sync function and for that I am using “console.log”; however, I could not see any data log (console.log stdoutput) in “Couchbase\var\lib\couchbase\logs\sync_gateway_error.log” file. sync gateway config I am using “log”: ["*"];

When i tried with various casing like “Console.log” or “console.Log” I see an error " 500 Exception in JS sync function".
I have also tried just a “log()” function, to my surprise it does not break sync function neither it log anything.

What I am doing wrong here?

I am using couchbase sync gateway 1.5.1 (Windows)

console.log should work but will be logged to sync_gateway_access.log.

tail -n 50 /home/sync_gateway/logs/sync_gateway_access.log

Thanks @jamiltz … I could not find this file anywhere in my C:\ (“couchbase installation drive”)… Do you know If I need to enable something somewhere to get these log created?

@abhi.chouksey,

I have observed that console.log() does not work properly on Windows boxes.

There is a new sglog() being proposed here:

It be great to have a way to dynamically turn on and off sglog() instead of change the sync function and adding console.log and un commenting console.log.

1 Like

Thanks @househippo I read this issue before and tried no luck :unamused: I know one point of time it did work… I remember vaguely log level was not set to log :["*"] it was something else.

How can we view this on a Windows machine? This file is not present.

We have the same problem with our testing of SG 2.7. console.log is passed 5 variables and we get this error message:

 Sync fn exception: RangeError: expected 1 argument(s); got 5;

Remove 4 of the variables from the call and it works just fine. This was OK in SG 2.5