System.out与System.err的区别

来源:互联网 发布:淘宝店铺排行 编辑:程序博客网 时间:2024/06/06 00:51

近日,在看logback配置文件时,突然发现有个配置可以是System.out或者System.err,引起了本屌的好奇,这是啥玩意?这不是以前的控制台标准和error输出吗,本屌好奇的查看了下api,发现:

out
The "standard" output stream. This stream is already open and ready to accept output data. Typically this stream corresponds to display output or another output destination specified by the host environment or user. 

“标准”输出流。此流已经打开,并准备接受输出数据。通常,此流对应于主机环境或用户指定的显示输出或其他输出目的地。


err
Typically this stream corresponds to display output or another output destination specified by the host environment or user. By convention, this output stream is used to display error messages or other information that should come to the immediate attention of a user even if the principal output stream, the value of the variable out, has been redirected to a file or other destination that is typically not continuously monitored.


通常,此流对应于主机环境或用户指定的显示输出或其他输出目的地。按照惯例,输出流是用来显示 想得到用户的关注 的错误信息或其他信息,该变量的值会被重定向到一个文件或其他目的地,通常是不连续地监测。