开发者

Why does log4j default to outputting the "No appenders could be found" message rather than outputting to stdout?

开发者 https://www.devze.com 2022-12-16 21:33 出处:网络
I have long wondered why log4j defaults to outputting an error message when there is no log4j.properties. A reasonable default to stdout or stderr would make more sense. Is there a FAQ or a discussion

I have long wondered why log4j defaults to outputting an error message when there is no log4j.properties. A reasonable default to stdout or stderr would make more sense. Is there a FAQ or a discussion about this somewhere that indicates the reasoning behind this decision? I have always con开发者_C百科sidered that to be the only thing about log4j that is worse than other logging alternatives.


Let's say that you use log4j in a program where fds 0, 1, and 2 are either closed (which would cause write(2) to fail with EBADF) or redirected to /dev/null. Then log4j tries to output a log message. What would happen in this situation? You'd have a silent failure, which is something you'd want to avoid having happen in a logging library at all costs.

0

精彩评论

暂无评论...
验证码 换一张
取 消