[ https://issues.apache.org/jira/browse/LOGGING-152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17816438#comment-17816438 ]
Elliotte Rusty Harold commented on LOGGING-152: ----------------------------------------------- Generally logs are redirected where the program is invoked in the shell, not inside the program itself. That's implicit in how a lot of designs work. Libraries that accept an OutputStream as a target for debug messages are uncommon at best. I can't say I've ever seen one. The point of logging libraries is that the logger configuration is applied to loggers and libraries write their messages to the logger, not to an arbitrary output stream. The logger can be controlled by library clients without having to pollute the API with logger objects. Thinking about it now, I'm not sure it had to be that way, but it is what the ecosystem seems to have settled on for multiple decades now. > Helper class that redirects OutputStream to Log > ----------------------------------------------- > > Key: LOGGING-152 > URL: https://issues.apache.org/jira/browse/LOGGING-152 > Project: Commons Logging > Issue Type: Improvement > Affects Versions: 1.1.1 > Reporter: Dmitry Katsubo > Priority: Major > Attachments: LoggingOutputStream.java > > > Some libraries accept {{PrintStream}} or {{OutputStream}} as a target for > debug messages to be printed to. The attached class acts as a bridge between > {{OutputStream}} and {{org.apache.commons.logging.Log}}. > Example of usage: > {code} > PrintStream loggingPrintStream = new PrintStream(new > LoggingOutputStream(logger, LoggingOutputStream.LogLevel.INFO, "[XJC] ")); > com.sun.tools.xjc.Driver.run(opts, loggingPrintStream, loggingPrintStream); > {code} > Also has some overlap with LOGGING-110. -- This message was sent by Atlassian Jira (v8.20.10#820010)