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 -
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. -
-
@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 -
@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?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (ether email, or push notification). You'll also be able to save bookmarks, use reactions, and upvote to show your appreciation to other community members.
With your input, this post could be even better 💗
RegisterLog in