So I decided to break my silence with this unfinished patch. It didn't seem right to try out my first commit on something as impactful as this, so I went with the patch. I haven't even really tested it yet. It's really just the concept I've been working on, but I think in a lot of ways is much more in line with what Ralph was talking about.
On Thu, Jun 5, 2014 at 9:58 PM, Bruce Brouwer (JIRA) <j...@apache.org> wrote: > > [ > https://issues.apache.org/jira/browse/LOG4J2-609?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel > ] > > Bruce Brouwer updated LOG4J2-609: > --------------------------------- > > Attachment: LOG4J2-609.unfinished.patch > > Here is my second attempt. It's going to require some explanation. It > isn't finished, but I wanted to get your thoughts. > > # Using just a listener that many configurations shared will not work when > they each want to log at a different level. The real goal is to make > configure (or filter) which status logs end up on System.out or System.err > or some file. So rather than a single registerListener which takes a > StatusListener, I have added registerSystemOutFilter, > registerSystemErrFilter and registerFileFilter. This way, each > configuration can register its own filter and the StatusLogger will look > for the least specific filter for the specified target and log at that > level. > # Rather than a single fall-back SimpleLogger, there is now a SimpleLogger > registered for System.out, System.err and each file filter that is > registered. I don't know if that simplified the code much, but at least the > logging statements are much closer to a straight pass-through for the > majority of cases > # The only thing that is using registerListener now is > jmx.StatusLoggerAdmin some JmsTests in log4j-core, which I haven't figured > out why they are there yet. > # I refactored away StatusConfiguration in favor of > AbstractStatusLoggingConfiguration so that XmlConfiguration and > JsonConfiguration can be more consistent in their configuration. The only > different I saw is that they had seemingly opposite behavior for what > "verbose" meant, and even if you don't consider it opposite (the > terminology I think is confusing) they were definitely using different > values (true/false vs. quiet/verbose). > > > > StatusConfiguration doesn't close files > > --------------------------------------- > > > > Key: LOG4J2-609 > > URL: https://issues.apache.org/jira/browse/LOG4J2-609 > > Project: Log4j 2 > > Issue Type: Bug > > Components: Core > > Affects Versions: 2.0-rc1 > > Reporter: Bruce Brouwer > > Assignee: Ralph Goers > > Attachments: LOG4J2-609.unfinished.patch, log4j2-609.patch > > > > > > {{org.apache.logging.log4j.core.config.status.StatusConfiguration}} > allows you to specify a destination such as "out", "err" or a file name. If > specifying a file, that file stream is used when creating a > {{StatusConsoleListener}} that is added to the {{StatusLogger}}. Those > {{StatusLogger}} listeners are never cleaned up when, for example, the > {{XmlConfiguration}} is reconfigured or when the {{LoggerContext}} is shut > down (e.g. in {{InitialLoggerContext.apply()}}). This leaves open file > handles and is the source of the failing test {{FileOutputTest}} on Windows. > > > > -- > 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 > > -- Bruce Brouwer about.me/bruce.brouwer [image: Bruce Brouwer on about.me] <http://about.me/bruce.brouwer>