save console log to file code example
Example 1: output to log file bash
#!/bin/bash
echo "This logs to where I want, but using echo" > /var/log/mycustomlog
OR
#!/bin/bash
echo "I will just append to my custom log file" >> /var/log/customlog
Example 2: how to get output of console.log in a file in javascript
node script-file.js >log-file.txt 2>error-file.txt