在 Linux 终端中看不到 console.log()



我正在我的 Linux EC2 实例上运行 node.js,但在刷新主页时无法看到日志。

client.connect()
.then(function () {
return client.execute('SELECT * FROM test_keyspace.users');
})
.then(function (result) {
const row = result.rows[0];
console.log('Obtained row: ', row);
})
.catch(function (err) {
console.error('There was an error when connecting', err);
return client.shutdown().then(() => { throw err; });
});

如何获取日志?

编辑:运行PM2

你必须使用

pm2 logs

查看所有最新日志

最新更新