@DownPW it’s your only realistic option at this stage.
adding some console.log to Nodebb
-
I’m trying some code small addition to NodeBB.
for debugging purposed where do any outputs from console.log() go?Usually, when I run my own stand-alone node code it ‘hangs the screen’ until Ctrl-X out of it, hence you can see console.logs
But as nodeBB runs as a service in the background, you dont see console.log output on the screen -
@eeeee output from
console.log
will be in the console tab of the browser when your press F12 to access the developer tools. -
-
@phenomlab
oh, surely only javascript console.log goes to front end, Im meaning using console.log in server side node code.
What I want is a note to myself on server, not viewable front end.
for example Ive added some code which doesnt work, and I want to log (somewhere)
“Reached this code”
x=10
etc
So I want to console log to a server side file I can go and read to help me debug.
Is there a nodebb log already in use I can write to?
I tried making my own txt file as using fs.writeFile and that did not work, but thinking some built in console.log command would be simpler -
@eeeee if you’re using the console, you could try
node app.js > app.log 2>&1
This would redirect stdout to a file named app.log and redirect stderr to stdout.
I’m not sure about standard logging under NodeBB, but there is an error log located at
logs/error.log
.Failing that, you could always stop the NodeBB service then use
./nodebb dev
from the console which would then provide debug output.
Did this solution help you?
Related Topics
-
NodeBB socket with CloudFlare
Unsolved Performance -
-
-
-
-
-
-