2

When we want a Node.js application to redirect every console.log and console.info into a file, we can use either >fileName or 1>fileName, which hooks into process.stdout.

And when we want a Node.js application to redirect every console.warn and console.error into a file, we can use 2>fileName, which hooks into process.stderr.

But how can we redirect the complete console output (for all console methods) into a single file?

I'm looking for something that works on both Windows and Linux.

vitaly-t
  • 24,279
  • 15
  • 116
  • 138

1 Answers1

4

The following syntax works: > filename 2>&1

Per this thread: How can I redirect and append both stdout and stderr to a file with Bash?

vitaly-t
  • 24,279
  • 15
  • 116
  • 138
clusterdude
  • 616
  • 3
  • 16