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
  • 22,286
  • 10
  • 106
  • 127

1 Answers1

3

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
  • 22,286
  • 10
  • 106
  • 127
clusterdude
  • 587
  • 2
  • 16