Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

FAQ Where does System.out and System.err output go

Short answer

  • System.out goes to stdout (file descriptor 1)
  • System.err goes to stderr (file descriptor 2)

 Long Answer

A UNIX computer (including clones like Linux, BSD) users file descriptors to define the input and output streams. Three of them are hardcoded by the system and fixed:

  • stdin - the standard input stream has file descriptor 0
  • stdout - the standard output stream has file descriptor 1 - this is used by System.out
  • stderr - the standard error stream has file descriptor 2 - this is used by System.err

Normally stdin, stdout, stderr are initially attached to the console process, but this can be redirected by a programme. E.g. the stderr is redirected to a log file, that is stored separately or watched by another process.

Back to the top