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 šŸ’—

Related Topics
  • www. Infront stops website access?

    Solved Configure
    10
    1 Votes
    10 Posts
    473 Views

    @Panda because there is no match for the DNS entry specified. The receiving web server parses the headers looking for a destination hostname to match, and anything the web server is unable to resolve will be sent back to the root.

  • Adding reputation

    Solved Customisation
    17
    4 Votes
    17 Posts
    587 Views

    @OT very odd. Shouldnā€™t be that complex, but glad you have it working.

  • Nodebb design

    Solved General
    2
    1 Votes
    2 Posts
    293 Views

    @Panda said in Nodebb design:

    One negative is not being so good for SEO as more Server side rendered forums, if web crawlers dont run the JS to read the forum.

    From recollection, Google and Bing have the capability to read and process JS, although itā€™s not in the same manner as a physical person will consume content on a page. It will be seen as plain text, but will be indexed. However, itā€™s important to note that Yandex and Baidu will not render JS, although seeing as Google has a 90% share of the content available on the web in terms of indexing, this isnā€™t something youā€™ll likely lose sleep over.

    @Panda said in Nodebb design:

    The ā€œwrite apiā€ is preferred for server-to-server interactions.

    This is mostly based around overall security - you wonā€™t typically want a client machine changing database elements or altering data. This is why you have ā€œclient-sideā€ which could be DOM manipulation etc, and ā€œserver-sideā€ which performs more complex operations as it can communicate directly with the database whereas the client cannot (and if it can, then you have a serious security flaw). Reading from the API is perfectly acceptable on the client-side, but not being able to write.

    A paradigm here would be something like SNMP. This protocol exists as a UDP (UDP is very efficient, as it is ā€œfire and forgetā€ and does not wait for a response like TCP does) based service which reads performance data from a remote source, thus enabling an application to parse that data for use in a monitoring application. In all cases, SNMP access should be ā€œROā€ (Read Only) and not RW (Read Write). It is completely feasible to assume complete control over a firewall for example by having RW access to SNMP and then exposing it to the entire internet with a weak passphrase.

    You wouldnā€™t do it (at least, I hope you wouldnā€™t) and the same ethic applies to server-side rendering and the execution of commands.

  • NodeBB: Privileges for the Announcement channel

    Solved Configure
    6
    1 Votes
    6 Posts
    301 Views

    Up to you really šŸ™‚

  • Chevron up before & after

    Solved Configure
    11
    4 Votes
    11 Posts
    537 Views

    @crazycells you are right šŸ™‚ thank you.

  • NodeBB inline videoplayer

    Solved Customisation
    12
    3 Votes
    12 Posts
    938 Views

    @phenomlab
    YAY! It works
    Thanks so much

  • [NODEBB] Welcome Message

    Solved Customisation
    18
    13 Votes
    18 Posts
    2k Views

    For anyone reviewing this post, thereā€™s an updated version here that also includes an sunrise / sun / moon icon depending on the time of day

    https://sudonix.com/topic/233/nodebb-welcome-message-with-logo-footer-change/3?_=1645445273209

  • Customising NodeBB

    Locked Customisation
    3
    0 Votes
    3 Posts
    754 Views

    Closing this thread as a duplicate of https://sudonix.com/topic/12/nodebb-customisation