liveBook · Manning

Standard output

As explained in The Art of Code

Console output is text written to an interactive terminal or standard output and displayed directly to a user or developer.

Standard output writes console text directly to an interactive terminal, making development-time logs easy to see and debug. That convenience becomes a liability in production, where logs need persistence, aggregation, and monitoring. section 7.2.3

A fragile error path

A Java catch block may print an exception and a message with exception.printStackTrace or System.out.println. This exposes the failure locally but sends it only to the console, rather than a persistent or centralized destination. section 7.2.3

try {
  int parsedNumber = Integer.parseInt(data);
} catch (NumberFormatException exception) {
  exception.printStackTrace();                #1
  System.out.println("Big problem!");    #2
  System.err.println("Big problem!");    #3
}

Compare stack-trace output with messages sent to standard output and standard error in the same Java error handler. section 7.2.3

How The Art of Code covers it

How deep it goes
Defines direct terminal display and stops short of persistence, aggregation, monitoring, and configurable log routing.
Examples
Uses Java exception.printStackTrace, System.out.println, and System.err.println inside a catch block.
What you can do after
Diagnose/debug development failures by inspecting messages printed directly to the terminal.
How it connects
Connects console output with logging libraries, log levels, log files, centralized logging, and monitoring.

Also explained in

Compare how 6 books explain standard output →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of Code. The section links point to the parts of the book it draws on.