[ https://issues.apache.org/jira/browse/LOG4J2-547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bruce Brouwer updated LOG4J2-547: --------------------------------- Attachment: log4j2-547-bbrouwer.patch Here is my solution to LoggerStream (log4j2-547-bbrouwer.patch). It includes logger versions of InputStream, BufferedInputStream, Reader, BufferedReader, OutputStream, PrintStream, Writer and PrintWriter. Something missing from the current LoggerPrintStream is that it cannot handle character sets other than the default system character set. In this patch, InputStream, BufferedInputStream, OutputStream and PrintStream can all handle any specified character set. Supporting other character sets is the reason for some of the extra complexity in this patch. Also, because of the wide variety of options for creating them, there are multiple constructors to all of these classes. This goes with the spirit of the corresponding classes in Java where they are created by calling their constructors. Because of the wide variety of options, this would add a significant amount of new methods on the LogManager interface. I am proposing that we not do that. As directed, I put this in log4j-api, but I want to make one last request that this not be included in log4j-api but rather in a new artifact called log4j-streams. These new classes stand alone on their own and I see little value in adding corresponding factory methods in LogManager for each constructor specified by these classes. This patch relies on my latest patch in LOG4J2-555 and because of the overlap with some classes in the LOG4J-555 patch, I am not able to cleanly provide a patch that gets rid of LoggerStream and LoggerWriter and the existing printStream and printWriter methods in LogManager. It is my intent that these all be removed should this patch be accepted. > Update LoggerStream API > ----------------------- > > Key: LOG4J2-547 > URL: https://issues.apache.org/jira/browse/LOG4J2-547 > Project: Log4j 2 > Issue Type: Improvement > Components: API > Affects Versions: 2.0-rc1 > Reporter: Matt Sicker > Assignee: Ralph Goers > Fix For: 2.0 > > Attachments: 0001-PrintStream-API-update.patch, > Add_caller_info_tests.patch, log4j2-547-bbrouwer.patch, > log4j2-loggerStream.patch > > > I've got some ideas on how to improve the LoggerStream idea that I added a > little while ago. The main thing I'd like to do is extract an interface from > it, rename the default implementation to SimpleLoggerStream (part of the > SimpleLogger stuff), and allow log4j implementations to specify a different > implementation if desired. > In doing this, I'm not sure where specifically I'd prefer the getStream > methods to be. Right now, it's in Logger, but really, it could be in > LoggerContext instead. I don't think I should be required to get a Logger > just to get a LoggerStream. > Now if only the java.io package used interfaces instead of classes. This > would be so much easier to design! -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org