# Flogger - the advanced logging node!

**URL:** <https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382>\
**Category:** Share Your Nodes\
**Created:** [19 June 2019 04:34 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382 "2019-06-19T04:34:02Z")\
**Posts on this page:** 17\
**Page:** 3

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [10 July 2019 19:57 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/41 "2019-07-10T19:57:15Z")

</div>

> [@Steve-Mcl](#):
>
> I disagree with permitting a msg property to override an explicitly entered property

There certainly are risks when you are writing files, but I don't see making a general rule of this. In the case of the `flogger` node, the issue starts with the use of `msg.filename`, which is shared with the core `file` nodes and perhaps others. As suggested above, the risk of error could be reduced by instead using `msg.logfile` (or better yet, `msg.flogger.logfile`) for this property. Also, the node configuration allows the user to define a `Log Dir` , which can help isolate any damage to that directory. I have used a strategy for overriding defaults that greatly reduces the chance of errors. I name properties that can be overridden as `msg.nodename.property`, so that for `flogger` the overrides object might be

```auto
msg.flogger = {
   logfile: "mylog.log",
   loglevel: "INFO"
};

```

The chance of a message accidentally carrying something like this into a `flogger` node is very small, but the node could still have defaults configured to deal with the case where the message doesn't provide valid parameters.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 July 2019 21:34 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/42 "2019-07-10T21:34:00Z")

</div>

All perfectly good workarounds. As is the suggestion to use a typedinput which I would argue is slightly more user friendly? (Certainly reduces the need to add change nodes before nodes & therefore simplifies things to some degree)

As @dceejay and I started originally, it is ultimately the DEVs choice...

> [@Steve-Mcl](#):
>
> That is of course your prerogative

> [@dceejay](#):
>
> At the end of the day it is up the author

...we just provide the information, make our requests and hope we provide a good argument with reasoned advice. 🙂

Anyhow, I don't think anyone disagrees that in its prior form (msg.filename overriding the explicit form property) was not the best idea for a couple of reasons.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 July 2019 21:40 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/43 "2019-07-10T21:40:46Z")

</div>

> [@drmibell](#):
>
> I have used a strategy for overriding defaults that greatly reduces the chance of errors. I name properties that can be overridden as `msg.nodename.property` , so that for `flogger` the overrides object might be

Btw, that is something I'm going to bear in mind for future. Good Nugget of info.

---

<div class="post-metadata">

**Author:** ![x375993](https://avatars.discourse-cdn.com/v4/letter/x/9de053/32.png) [@x375993](https://discourse.nodered.org/u/x375993)\
**Post date:** [12 July 2019 05:47 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/44 "2019-07-12T05:47:27Z")

</div>

Thank you for the input - it almost got heated a little bit 🙂 Here are my decisions:

- I made the status text date on the node consistent with the local/UTC setting on the node (drmibell)
- I added a Z designator to the UTC logtime because it makes good sense to know what for the ones reading an unknown logfile (drmibell)
- Changed back to original behaveour of allowing overriding the filename. To avoid name collisions like Steve talked about, I decided that from now on it should be overridden with msg.logfile. The risk of a name collision with this name is very small. I like drmibell's nested object solution, but I think it's a little too much for the average Joe - my feeling is that it overcomplicates the usage just to protect from extremely rare edge cases.  
I know this goes a little against normal node behavior, but I really feel that it makes sense in this case. It also makes it consistent with the error-level override functionality which I like (drmibell). I feel it's OK because it is well documented in the info section of the node.

Like dceejay says: At the end of the day it is up the author... 😁

Version 1.1.7 has been committed.

---

<div class="post-metadata">

**Author:** ![x375993](https://avatars.discourse-cdn.com/v4/letter/x/9de053/32.png) [@x375993](https://discourse.nodered.org/u/x375993)\
**Post date:** [15 July 2019 16:15 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/45 "2019-07-15T16:15:46Z")

</div>

I have just added log rotation to flogger. Now you can specify how big your logfiles can get before they get rotated. Old logfiles can be gzip compressed if you wish.

I also did a lot of refactoring of the code, but that shouldn't affect the functionality. It was getting a little to big and bulky to easily read.

Version 1.2.1 is now committed

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [14 May 2020 23:10 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/46 "2020-05-14T23:10:49Z")

</div>

Flogger is close to my idea of a perfect logger. Thanks for the contribution!

The only thing I'm wishing it had that I haven't found yet is millisecond granularity.

But how am I to shut the log off??? Short of deleting the node I couldn't get it to stop logging. I thought for sure unwiring it's input would do it but no.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 May 2020 23:12 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/47 "2020-05-14T23:12:38Z")

</div>

> [@LosinIt](#):
>
> But how am I to shut the log off???

If you don't send a msg, it shouldn't log anything. Are you certain you deployed changes? Are there other flogger instances still operating?

Try searching for flogger in node red (CTRL+f) see if there is more than one

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [14 May 2020 23:14 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/48 "2020-05-14T23:14:07Z")

</div>

> [@Steve-Mcl](#):
>
> certain you deployed changes

Yes. I'll do it again just to be sure. Hang on...

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [14 May 2020 23:37 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/49 "2020-05-14T23:37:52Z")

</div>

Something strange is going on. I had it hooked up to a MQTT "read all" node which I'm also testing and the 2nd time I had trouble getting it to start logging. So I restarted NR and still iffy. I copied the flogger node to a live flow and it works as expected, both starting and stopping by disconnecting it's input wires (and Deploy of course).

So I'll retract my original comments... except

> [@LosinIt](#):
>
> Flogger is close to my idea of a perfect logger. Thanks for the contribution!

Sorry to bother you.

---

<div class="post-metadata">

**Author:** ![mich3000](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@mich3000](https://discourse.nodered.org/u/mich3000)\
**Post date:** [8 April 2021 10:40 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/50 "2021-04-08T10:40:27Z")

</div>

When i use moustache Response payload {{payload}} i get in file [moustache] Response payload [object Object]. What is correct way to render object?  
Thanks

---

<div class="post-metadata">

**Author:** ![CreativeWarlock](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/creativewarlock/32/102051_2.png) [@CreativeWarlock](https://discourse.nodered.org/u/CreativeWarlock)\
**Post date:** [3 July 2021 13:41 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/51 "2021-07-03T13:41:05Z")

</div>

Awesome node. Much much appreciated!

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [3 June 2022 16:11 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/52 "2022-06-03T16:11:45Z")

</div>

I know its been sometime . Have been using flogger node for a while. Excellent node.  
Is it possible to add following 2 functionalities to the node .

1. If msg.LOG\_LEVEL is set - then print only those messages which are node.LOG\_LEVEL = msg.LOG\_LEVEL - aim being we can go for run time decision how much to print in log. Only for trouble shooting i may need huge logs.
2. Can the name of the node printing the message be printed as part of the log message . This will make it very easy to trace each line to the node which printed the message.

I can do both changes and share the JS. Unfortunately I do not know how to create a node.

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [3 June 2022 16:21 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/53 "2022-06-03T16:21:33Z")

</div>

> [@SandeepA](#):
>
> I can do both changes and share the JS. Unfortunately I do not know how to create a node.

If I understand what you're looking for, just copy the existing code and modify it if you just want it for your own purposes. I've done the same with the Gate node because I wanted it to have both open and closed outputs.

If you want to contribute back to the community you can either make a Pull Request in Github or change the name (Flogger2?) and publish it as a new node.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [3 June 2022 18:07 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/54 "2022-06-03T18:07:17Z")

</div>

> [@LosinIt](#):
>
> ou want to contribute back to the community you can either make a Pull Request in Github or change the name (Flogger2?) and publish it as a new node.

We would always recommend trying to contribute back to the existing node rather than fork and publish a clone.

@SandeepA As this particular node isn't one the core project maintains, you may want to raise an issue in its GitHub repository for its author to see.

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [3 June 2022 19:56 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/55 "2022-06-03T19:56:31Z")

</div>

> [@knolleary](#):
>
> @SandeepA As this particular node isn't one the core project maintains, you may want to raise an issue in its GitHub repository for its author to see.

Thanks Nick. Will do. Will raise it to the author.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 December 2022 20:04 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/56 "2022-12-28T20:04:36Z")

</div>

15 posts were split to a new topic: [Trying to track down an error in a function node](https://discourse.nodered.org/t/trying-to-track-down-an-error-in-a-function-node/72850)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 December 2022 20:05 UTC](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382/57 "2022-12-28T20:05:31Z")

</div>



[Previous page](https://discourse.nodered.org/t/flogger-the-advanced-logging-node/12382.md?page=2)
