Jump to content

[Solved] Node.js Errors


gleason

Recommended Posts

Does anyone know where to view Node.js Errors? I tried under cpanel >> errors located under metrics. This doesn't seem to display anything (running a discord bot). I have noticed I can generate some feedback within the start.py "webpage" as in my app.js script I am running console.log commands, but when the script dies I don't have any logs that feedback to the start.py window or the Errors page. I have seen Krydos post logs on the forum before, do we have a page for those? Or if anyone familiar with a way for python to display these errors if (A) leave the start.py webpage up, or (B) have a console.py script that watches for node crashes/or console crashes.  Not positive how this would work in this use case, I would imagine watch console.  But I would also imagine we don't have access to "console".

 

--GalaxyMule

Link to comment
Share on other sites

Here is the output of your bot:

MySQL has been connected!
[ RowDataPacket {
    guildID: '700047xxxxx0608151',
    setting: '.',
    value: null,
    createdAt: 2021-03-28T20:31:06.000Z,
    updatedAt: 2021-03-28T20:31:06.000Z },
  RowDataPacket {
    guildID: '775927xxxxx5018378',
    setting: '.',
    value: null,
    createdAt: 2021-03-28T20:50:39.000Z,
    updatedAt: 2021-03-28T20:50:39.000Z } ]
Aesir-Wolf-Pack#0694 is online!
I edited out some of the guildID in case that's private. Not sure.

 

Anyways, since your bot starts just fine, it's up to you from there to log errors yourself from inside the bot's code. Don't rely on console.log(), and definitely don't rely on python. The python just starts the node code, and then disconnects from it to let it run on its own. Just write the logs to a file. Log file permissions can be tricky sometimes for non-linux people. The way I would do it is create an empty file that has write permissions on it and then have the bot append to that. If you have the bot try to create it's own files then you need to worry about directory permissions too, but if the file is already created it's less to figure out.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks
 

Here is the output of your bot:

MySQL has been connected!
[ RowDataPacket {
    guildID: '700047xxxxx0608151',
    setting: '.',
    value: null,
    createdAt: 2021-03-28T20:31:06.000Z,
    updatedAt: 2021-03-28T20:31:06.000Z },
  RowDataPacket {
    guildID: '775927xxxxx5018378',
    setting: '.',
    value: null,
    createdAt: 2021-03-28T20:50:39.000Z,
    updatedAt: 2021-03-28T20:50:39.000Z } ]
Aesir-Wolf-Pack#0694 is online!
I edited out some of the guildID in case that's private. Not sure.

Anyways, since your bot starts just fine, it's up to you from there to log errors yourself from inside the bot's code. Don't rely on console.log(), and definitely don't rely on python. The python just starts the node code, and then disconnects from it to let it run on its own. Just write the logs to a file. Log file permissions can be tricky sometimes for non-linux people. The way I would do it is create an empty file that has write permissions on it and then have the bot append to that. If you have the bot try to create it's own files then you need to worry about directory permissions too, but if the file is already created it's less to figure out.

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...