[
https://issues.apache.org/jira/browse/LOG4J2-547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13917268#comment-13917268
]
Bruce Brouwer edited comment on LOG4J2-547 at 3/2/14 2:15 AM:
--------------------------------------------------------------
Thanks, I'll use those unit tests.
Here's what I was thinking and a quick spike proved it works. If I pass the
FQCN to the LoggerWriter and make the FQCN=java.io.PrintWriter, I get the
correct call information. I don't have to decorate any classes. But is that too
hacky to give PrintWriter as the FQCN to the LoggerWriter?
Also, I didn't realize initially that you were using PrintStream, not
PrintWriter. In some ways, I prefer your idea of using PrintStream. It is
easier to turn a PrintStream into a PrintWriter than the other way around. Or
do you think there is value in keeping both?
was (Author: bruce.brouwer):
Thanks, I'll use those unit tests.
Here's what I was thinking and a quick spike proved it works. If I pass the
FQCN to the LoggerWriter and make the FQCN=java.io.PrintWriter, I get the
correct call information. I don't have to decorate any classes. But is that too
hacky to give PrintWriter as the FQCN to the LoggerWriter?
Also, I didn't realize initially that you were using PrintStream, not
PrintWriter. In some ways, I prefer your idea of using PrintWriter. It is
easier to turn a PrintStream into a PrintWriter than the other way around. Or
do you think there is value in keeping both?
> 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-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.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]