1

I wanted to know like where does the stderr dumps its content. I have a question like whether it dumps to syslog? Please explain.

Anton Kovalenko
  • 20,999
  • 2
  • 37
  • 69
kzs
  • 1,793
  • 3
  • 24
  • 44

5 Answers5

4

stderr is just another output stream, just like stdout.

Where it's hooked up depends on how the application is called.

For example if I run foo.exe 2> errors.txt then stderr will write to the specified file.

Kos
  • 70,399
  • 25
  • 169
  • 233
1

Stderr output is dumped whenever you decide to redirect it.

If you run a program in a GUI enviroment, by clicking on an icon or something, look for .xsession-errors in your $HOME.

If you run a program from a shell and don't redirect stderr, you just see it on your terminal (and it is not saved anywhere else).

Anton Kovalenko
  • 20,999
  • 2
  • 37
  • 69
1

That depends on the environment.

By default, stderr is typically connected to the same place as stdout, i.e. the current terminal.

Otherwise, you wouldn't see the errors which would be kind of annoying.

Here is a blog post about redirecting stderr to the system's logging mechanism.

unwind
  • 391,730
  • 64
  • 469
  • 606
0

stderr is a stream. It's managed by and output to by the owning process. Where it 'goes' is defined by how the process is invoked. The parent process can gather it and write it to a file, ignore it, redirect it to /dev/null (esssentially binning it) etc.

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
0

Whilst stderr can be redirected elsewhere, it typically outputs to the same place as stdout. To make it into syslog, you'd definitely have to work a bit. This link: With bash, how can I pipe standard error into another process?

shows how you pipe stderr to a pipe, and if the other process is a process that writes to "syslog", it would do what you want. But for most cases, it's probably easier to just add syslog functionality to your own program.

Community
  • 1
  • 1
Mats Petersson
  • 126,704
  • 14
  • 140
  • 227