# How to custom log format

**URL:** <https://discourse.nodered.org/t/how-to-custom-log-format/64601>\
**Category:** General\
**Created:** [1 July 2022 23:33 UTC](https://discourse.nodered.org/t/how-to-custom-log-format/64601 "2022-07-01T23:33:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mafeifan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mafeifan/32/64092_2.png) [@mafeifan](https://discourse.nodered.org/u/mafeifan)\
**Post date:** [1 July 2022 23:33 UTC](https://discourse.nodered.org/t/how-to-custom-log-format/64601/1 "2022-07-01T23:33:18Z")

</div>

currently

```auto
let str = JSON.stringify(msg.payload);
node.warn(str); 
return msg;

```

the output is  
`2 Jul 06:56:16 - [warn] [function:1a91795a.0f8ff7] { "msg": {...}}`

How to implement a custom format

for example:

node.warn(["my-tag"],str);

`2 Jul 06:56:16 - [warn] [my-tag] [function:1a91795a.0f8ff7] { "msg": {...}}`

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 July 2022 06:03 UTC](https://discourse.nodered.org/t/how-to-custom-log-format/64601/2 "2022-07-02T06:03:01Z")

</div>

See custom logging in the docs [Logging : Node-RED](https://nodered.org/docs/user-guide/runtime/logging)

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [2 July 2022 07:53 UTC](https://discourse.nodered.org/t/how-to-custom-log-format/64601/3 "2022-07-02T07:53:49Z")

</div>

Use node-red-contrib-flogger, set `< incl topic` in it's node config, then set the message topic to "my-tag".

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [31 August 2022 07:54 UTC](https://discourse.nodered.org/t/how-to-custom-log-format/64601/4 "2022-08-31T07:54:44Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
