Skip to content

adding some console.log to Nodebb

Solved Customisation
  • 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
  • @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 💗

  • 36 Votes
    55 Posts
    4k Views

    @DownPW I see why. The code relies on the existence of

    [component="topic/quickreply/container"]

    However, this by definition means that the below has to be enabled

    aeef638f-4188-489d-a9f2-f3a26dbca9d8-image.png

    It will then work

    7fb38631-e0f3-46ef-b652-00929d927b13-image.png

    For some unknown reason, this is hidden in Harmony, and only shows if you select it. In v2, it seems that the <section> is deleted altogether in Persona if “Quick Reply” is disabled, meaning it won’t fire as it can’t locate that specific component.

    The downside is that you might not want the quick reply function, but I think it’s a PITA to scroll up to the top of the post just to reply, so I have it on 🙂

  • Custom badges

    Solved Customisation
    103
    49 Votes
    103 Posts
    9k Views

    Perfect 😉

  • 0 Votes
    4 Posts
    528 Views

    @cagatay You’d target the body tag and use the below line of CSS

    background: url(/assets/customcss/backgrounds/default/default.png) no-repeat center center fixed;

    Obviously, you need to change the path to suit where your image is being stored.

    More info around the background property can be found here

    https://www.w3schools.com/cssref/css3_pr_background.php

  • fading in /tags page

    Solved Customisation
    32
    30 Votes
    32 Posts
    3k Views

    Fix working perfectly 👍 🙂

  • NodeBB Design help

    Solved Customisation
    8
    2 Votes
    8 Posts
    834 Views

    @riekmedia I’ve applied some new CSS to your site. Can you reload the page and try again ?

    For the record, this is what I added

    #footer { background: #2d343e; border-top: 4px solid #2d343e; font-size: 0.9em; margin-top: 70px; padding: 80px 0 0; position: relative; clear: both; bottom: 0; left: 0; right: 0; z-index: 1000; margin-left: -15px; margin-right: -338px; }

    The /categories page seems a bit messed up, so looking at that currently

    EDIT - issued some override CSS in the CATEGORIES widget

    <!--- CSS fix for overspill on /categories page - DO NOT DELETE --> <style> #footer { margin-right: -45px; } </style>

    That should resolve the /categories issue.

  • 9 Votes
    47 Posts
    4k Views

    @phenomlab said in RSS parser script [NodeBB]:

    @jac Not yet. Sorry. Have some other work commitments I need to prioritise. Hoping to get to this over the weekend.

    No worries at all mate, thanks 👍🏻

  • 1 Votes
    6 Posts
    978 Views

    @jac said in [NodeBB] custom Gravatar image not showing:

    @phenomlab said in [NodeBB] custom Gravatar image not showing:

    @jac are you using Custom ?

    Sure am mate 👍🏻

    Confirmed Fixed

  • 0 Votes
    3 Posts
    689 Views

    @phenomlab many thanks Mark 😁.