Skip to content

adding some console.log to Nodebb

Solved Customisation
4 2 1.2k 1
  • 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.

  • phenomlabundefined phenomlab has marked this topic as solved on
  • @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?
Did you find the suggested solution useful? Why not buy me a coffee? It's a nice gesture, and a great way to show your appreciation šŸ’—

Related Topics
  • NodeBB v4.0.0

    General nodebb sudonix version 4
    28
    4 Votes
    28 Posts
    2k Views
    @Panda said in NodeBB v4.0.0: the workings of World aren’t intuitive Its not easy to get World populating when a forum is new to it This is a good point and one I’ve considered also. It’s a little confusing to be honest.
  • Forum customisation

    Customisation nodebb forum customised
    11
    2
    6 Votes
    11 Posts
    1k Views
    Thank you Mark, the changes look fantastic!!
  • SEO and Nodebb

    Performance nodebb seo
    2
    2 Votes
    2 Posts
    645 Views
    @Panda It’s the best it’s ever been to be honest. I’ve used a myriad of systems in the past - most notably, WordPress, and then Flarum (which for SEO, was absolutely dire - they never even had SEO out of the box, and relied on a third party extension to do it), and NodeBB easily fares the best - see below example https://www.google.com/search?q=site%3Asudonix.org&oq=site%3Asudonix.org&aqs=chrome..69i57j69i60j69i58j69i60l2.9039j0j3&sourceid=chrome&ie=UTF-8#ip=1 However, this was not without significant effort on my part once I’d migrated from COM to ORG - see below posts https://community.nodebb.org/topic/17286/google-crawl-error-after-site-migration/17?_=1688461250365 And also https://support.google.com/webmasters/thread/221027803?hl=en&msgid=221464164 It was painful to say the least - as it turns out, there was an issue in NodeBB core that prevented spiders from getting to content, which as far as I understand, is now fixed. SEO in itself is a dark art - a black box that nobody really fully understands, and it’s essentially going to boil down to one thing - ā€œcontentā€. Google’s algorithm for indexing has also changed dramatically over the years. They only now crawl content that has value, so if it believes that your site has nothing to offer, it will simply skip it.
  • 14 Votes
    69 Posts
    19k Views
    @phenomlab Seems to be better with some scaling fix for redis on redis.conf. I haven’t seen the message yet since the changes I made # I increase it to the value of /proc/sys/net/core/somaxconn tcp-backlog 4096 # I'm uncommenting because it can slow down Redis. Uncommented by default !!!!!!!!!!!!!!!!!!! #save 900 1 #save 300 10 #save 60 10000 If you have other Redis optimizations. I take all your advice https://severalnines.com/blog/performance-tuning-redis/
  • Gettin Erors NodeBB

    Solved Configure nodebb eror
    7
    0 Votes
    7 Posts
    816 Views
    @phenomlab no forum is working goods. there is no eror message since yestarday.
  • [NODEBB] Welcome Message

    Solved Customisation css html nodebb
    20
    2
    13 Votes
    20 Posts
    5k Views
    @DownPW the ā€˜js’ code for the banner takes the time from the client, so what it displays really depends on the regional settings for the operating system. I’ve not seen this issue myself but would like to see some examples of screenshots if possible.
  • NodeBB Footer

    Solved Customisation footer nodebb
    10
    1 Votes
    10 Posts
    2k Views
    @phenomlab said in NodeBB Footer: @jac and you. Hope all is well and you recover quickly Thanks pal
  • NodeBB Discord Plugins

    Unsolved Customisation nodebb discord plugin
    7
    0 Votes
    7 Posts
    2k Views
    @RiekMedia hi. Just following up on this thread (I know it’s old) but was curious to understand if it’s still an issue or not ?