Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace Newsgroups: comp.lang.java.programmer Subject: Re: ultralog: new concept of logging API Date: Sun, 27 Jan 2013 10:39:56 -0800 Organization: A noiseless patient Spider Lines: 62 Message-ID: References: <0cfefb99-94f9-44e0-9b58-926818a9560d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 27 Jan 2013 18:39:59 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="22949"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18YWA2ryQPIQLD2uM12SynY/kOxf2hZIBA=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: <0cfefb99-94f9-44e0-9b58-926818a9560d@googlegroups.com> Cancel-Lock: sha1:lBMP1lIHb2sQqHLxWnpVqI7txbM= Xref: csiph.com comp.lang.java.programmer:21800 On 1/26/2013 10:05 PM, Mikhail Vladimirov wrote: > Advantages of this approach: It's an interesting idea. However I don't think it really does enough to make it better than existing logging solutions. I don't think, for example, the syntax of your approach is any more clear than calling a method. (Your approach is, frankly, a little less clear.) I don't see how defining messages in one place is different than existing solutions, which have the same capability. Nor do I see how it interacts with IDEs any better than the current approaches. So to make this review a little more positive, here's a few things I think I'd like in a logger. The main idea I'd like is the ability to just plain write logging statements for me. For example, given the following code: package my.package; public class MyStuff { public static void main( String... args ) { System.out.println( "Hello World." ); } } I'd like to be able to have the logger, on the fly, instrument this with: - a static or instance logger declaration - method invocation - parameter values on invocation - return value, if any - variable assignment within the method All at varying levels of debug priority. For example, the middle three are typically at a level of FINER, while the last one should be FINEST. (The first one obviously has to happen all the time, in order for anything to work.) There's probably more logging patterns, I'm just making one for discussion. The idea here, and this is very important for the requirements, is similar to the idea of Aspect Oriented programming and Cross-Cuts. Certain things are necessary in programming (logging is a classic example), but are also "noise" when a developer looks at the source code (logging is again the classic example of this problem). Could you imagine the source code above with all of the logging statements I asked for? It would be a mess! And all for one little line of code. Yet if we instrument the code on the fly, we gain all the benefits of fully instrumented code, without having to pay nearly as much price in maintenance. That's what I'm really going for here: logging, but without the cost in lines of code. That would be a real win, imo.