# Callback in Node red

**URL:** https://discourse.nodered.org/t/callback-in-node-red/5919
**Category:** General
**Created:** [18 December 2018 07:22 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919 "2018-12-18T07:22:15Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![akhilendharreddy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/akhilendharreddy/32/6953_2.png) [@akhilendharreddy](https://discourse.nodered.org/u/akhilendharreddy)
#### Post date: [18 December 2018 07:22 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919/1 "2018-12-18T07:22:15Z")

</div>

I have lot of flows in my node red project, i want to track each and every flow, after success of each flow i want do some action like store data in db flow1 successfully injected , how can track each and every flow?

---

<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: [18 December 2018 08:16 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919/2 "2018-12-18T08:16:09Z")

</div>

Right now you have to explicitly create the flows to do what you want. The node-red runtime has no concept of a flow being 'successful' - so there's nothing to hook into for what you want.

In the future, we will have a new node api that will allow nodes to tell the runtime they have finished with success. That will come with a new 'Complete' node that can be used to trigger (much like the Status/Catch nodes). However, even once we release the new api, it will take some time to be adopted - there are 1700+ nodes out there, many of which are not actively maintained.

---

<div class="post-metadata">

### Author: ![RoganFPS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/roganfps/32/3208_2.png) [@RoganFPS](https://discourse.nodered.org/u/RoganFPS)
#### Post date: [18 December 2018 08:17 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919/3 "2018-12-18T08:17:33Z")

</div>

You could store a status value in a global context and present each state on a dashboard.[https://nodered.org/docs/user-guide/context](https://nodered.org/docs/user-guide/context)

---

<div class="post-metadata">

### Author: ![akhilendharreddy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/akhilendharreddy/32/6953_2.png) [@akhilendharreddy](https://discourse.nodered.org/u/akhilendharreddy)
#### Post date: [18 December 2018 12:09 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919/4 "2018-12-18T12:09:33Z")

</div>

@knolleary how can i log my flow, i mean each node executed or not with timings start time and end time

---

<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: [18 December 2018 12:33 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919/5 "2018-12-18T12:33:37Z")

</div>

Enable the metrics log level in settings.js.

You may want to create a custom logger to handle just the metrics events rather than flood your main log. The docs have some details.

Whether that gives you what you want, you'll have to try and see.

---

<div class="post-metadata">

### Author: ![akhilendharreddy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/akhilendharreddy/32/6953_2.png) [@akhilendharreddy](https://discourse.nodered.org/u/akhilendharreddy)
#### Post date: [19 December 2018 06:44 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919/6 "2018-12-19T06:44:31Z")

</div>

@knolleary how can i put in all logs in file like access.log, error.log files

---

<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: [19 December 2018 07:03 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919/7 "2018-12-19T07:03:00Z")

</div>

> [@akhilendharreddy](#):
>
> how can i put in all logs in file like access.log, error.log files

There is only a single, unified log in Node-RED, it isn't like a web server in the traditional sense.

If you have a separate reverse proxy in front of the Node-RED service and want those logs and Node-RED's all in one place, you will need some kind of log aggregation service.

---

<div class="post-metadata">

### Author: ![dhpatel177](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dhpatel177/32/39248_2.png) [@dhpatel177](https://discourse.nodered.org/u/dhpatel177)
#### Post date: [20 July 2020 13:39 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919/8 "2020-07-20T13:39:12Z")

</div>

@knolleary after depoy node ...if i want to close my current browser tab then how should i do that in node red???

i tried with window.close() but it is giving some error...can you please suggest me the solution?

---

<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: [20 July 2020 13:49 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919/9 "2020-07-20T13:49:16Z")

</div>

@dhpatel177 this thread is 2 years old and unrelated to your question. Please do not post to random old threads - start a new thread.

You cannot programmatically close a browser window, unless that window was originally opened with a `Window.open` call - see [https://developer.mozilla.org/en-US/docs/Web/API/Window/close](https://developer.mozilla.org/en-US/docs/Web/API/Window/close) for more information. I have nothing to add. If you want to follow up , start a new thread. But to be clear, the answer to your question is : you cannot do that.

---

<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: [20 July 2020 13:49 UTC](https://discourse.nodered.org/t/callback-in-node-red/5919/10 "2020-07-20T13:49:32Z")

</div>


