# How to display logs when setting Node-RED as a scheduled task on Windows

**URL:** <https://discourse.nodered.org/t/how-to-display-logs-when-setting-node-red-as-a-scheduled-task-on-windows/8528>\
**Category:** General\
**Created:** [2 March 2019 13:28 UTC](https://discourse.nodered.org/t/how-to-display-logs-when-setting-node-red-as-a-scheduled-task-on-windows/8528 "2019-03-02T13:28:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thkfighter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thkfighter/32/6420_2.png) [@thkfighter](https://discourse.nodered.org/u/thkfighter)\
**Post date:** [2 March 2019 13:28 UTC](https://discourse.nodered.org/t/how-to-display-logs-when-setting-node-red-as-a-scheduled-task-on-windows/8528/1 "2019-03-02T13:28:42Z")

</div>

I run Node-RED on Windows 10 startup by setting it as a scheduled task, according to the documentation " [Run Node-RED on Startup](https://nodered.org/docs/platforms/windows)".  
Is there a way to display the log to the CLI, like PowerShell, with some command like node-red-log, which is used when [running Node-RED on Raspberry Pi](https://nodered.org/docs/hardware/raspberrypi)?

---

<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:** [2 March 2019 15:10 UTC](https://discourse.nodered.org/t/how-to-display-logs-when-setting-node-red-as-a-scheduled-task-on-windows/8528/2 "2019-03-02T15:10:00Z")

</div>

As usual, you have a number of choices. The easiest to ensure that the scheduled job doesn't start until a user is actually logged in. Then create a job that has an action to start node-red in the normal way.

Here I'm starting it somewhat differently as I use npm with a package.json file to start my development environment:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/ae883e8addc4b33e78b351ec2b3e4ec40ef104fb.png)

As a user is logged in, you will get a console displayed. Of course, you could create a batch/PowerShell script to run node-red but there is little point.

The issue with this is that the console will immediately disappear if Node-RED stops. Not terribly useful if you are trying to track down issues.

To avoid this, redirect all output (including error output) to a file. Then use a decent file viewer to track the output. There are various tools that will track streamed files - I tend to use Notepad++.

Another alternative that many people use is to globally install "pm2", this is a runner for Node.js. Set your job to run Node-RED via pm2. pm2 has log redirection built in. It can be a bit heavy on the resources though if your machine is thin on memory or processor.

Either way of running with log redirection will also let you run Node-RED before a user is logged in if you wish. Though watch out for permissions issues.

---

<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:** [2 March 2019 23:46 UTC](https://discourse.nodered.org/t/how-to-display-logs-when-setting-node-red-as-a-scheduled-task-on-windows/8528/3 "2019-03-02T23:46:49Z")

</div>

I use redirection to log node-red to file  
E.g. `node-red > log.log` however this locks the file so log rotation locks the file.
