I am using tarantool/tarantool:2.6.0
Docker image (the latest at the moment) and writing lua scripts for the project. I try to find out how to see the results of callin' print()
function. It's quite difficult to debug my code without print() working.
In tarantool console print() have no effect also.
Using simple print()
Docs says that print() works to stdout
, but I don't see any results when I watch container's logs by docker logs -f <CONTAINER_NAME>
I also tried to set container's logs driver to local
. Than I get one time print to container's logs, but only once...
The container's /var/log
directory is always empty.
Using box.session.push()
Using box.session.push()
works fine in console, but when I use it in lua script:
-- app.lua
function log(s)
box.session.push(s)
end
-- No effect
log('hello')
function say_something(s)
log(s)
end
box.schema.func.create('say_something')
box.schema.user.grant('guest', 'execute', 'function', 'say_something')
And then call say_something()
from nodeJs connector like this:
const TarantoolConnection = require('tarantool-driver');
const conn = new TarantoolConnection(connectionData);
const res = await conn.call('update_links', 'hello');
I get error:
Any suggestions? Thanx!
I suppose you've missed io.flush()
after print
command.
After I added io.flush()
after each print
call my messages start to write to logs (docker logs -f <CONTAINER_NAME>
).
Also I'd recommend to use log
module for such purpose. It writes to stderr without buffering.
Regarding the error in the connector, I think nodejs connector simply doesn't support pushes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With