Skip to content
Advertisement

Can’t see console.log() in Linux terminal

I’m running node.js on my Linux EC2 Instance but I’m not able to see logs when I refresh my homepage.

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; });
});

How do I get the logs?

edit: running through pm2

Advertisement

Answer

You have to use

pm2 logs

to see the all latest logs

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement