That is great Andrea! As for failing the use of system outband system err - can we make a quick ant script to grep the test directory and fail any use of system.out or system.err ?
On Sun, Oct 7, 2018 at 2:26 AM Andrea Aime <andrea.a...@geo-solutions.it> wrote: > Hi, > during the incoming sprint I believe we'll spend a lot of time looking at > build logs. > So I thought it would have been nice to have a clean log, but right now > it's littered with printouts > and stack traces that have been accumulated over the years. > > So I have set out to do three things: > > 1. Setup a quiet logging profile that we can use to avoid all these > logs (used by default) > 2. Comment out all System.out and System.err > 3. Turn all print stack trace into logging statements > > The result is in this massive pull request: > https://github.com/geotools/geotools/pull/2094 > > Step 1 was simple enough. Open to suggestion to make it better. > > Step 2 was a pain. There are lots of System.out and System.err spread out > pretty much everywhere > (not just in tests). I did a quick replace via regular expressions, made > it compile again, and then > started looking one by one the cases that were not in the tests and see if > it made sense to turn > them into logging statements instead. > Took a ton of time but the result seems reasonable. > Contributions to make it better are more than welcomed, there are for sure > other places that could use > transformation from sysout to logging statement, but it's just too much > work for a single person > acting in spare time. > > Step 3 was reasonably simple using regular expressions (400+ of them!), > although I had to compromise a bit here > too, the replacement was done using a import-less statement: > java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, > "", e); > Again, the logging level might be tuned class by class, some classes might > do without the package prefixes, > and some might use their existing LOGGER... but again, that would have > required more effort than I can spend. > > Despite the limitations of the work, I believe the changes are leaving the > codebase better than they found it, > and the build output much cleaner. > > I also searched for ways to make the build fail if anything was written by > tests on the standard output > (to keep things clean after this change) or standard error, but could not > find anything useful so far, > looks like the way to go would be to use PMD, but that also slows down the > build a lot and would require > a fair amount of configuration and discussion work... something for > another day :-) > > Cheers > Andrea > > == GeoServer Professional Services from the experts! Visit > http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf > Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa > (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 > http://www.geo-solutions.it http://twitter.com/geosolutions_it > ------------------------------------------------------- *Con riferimento > alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - > Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni > circostanza inerente alla presente email (il suo contenuto, gli eventuali > allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i > destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per > errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le > sarei comunque grato se potesse darmene notizia. This email is intended > only for the person or entity to which it is addressed and may contain > information that is privileged, confidential or otherwise protected from > disclosure. We remind that - as provided by European Regulation 2016/679 > “GDPR” - copying, dissemination or use of this e-mail or the information > herein by anyone other than the intended recipient is prohibited. If you > have received this email by mistake, please notify us immediately by > telephone or e-mail.* > _______________________________________________ > GeoTools-Devel mailing list > GeoTools-Devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-devel > -- -- Jody Garnett
_______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel