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

Node.js 在Linux终端中看不到console.log(),node.js,linux,amazon-ec2,Node.js,Linux,Amazon Ec2,我在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(f

我在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

要查看所有最新日志

您是如何通过pm2运行node.js应用程序的???@Subburaj是的,通过pm2Ah这是我的问题没有想到,我需要做pm2日志。你能把它贴在下面吗?这样我就可以把你的答案标对了?谢谢