RE: [VFS] anonymous debug logging
Hi! From: Ralph Goers [mailto:ralph.go...@dslextreme.com] I'm not a big fan of that. Me too, any decent logging facility should allow to configure the logger on a per package level, so no problem to make the logging silent for a given package. I'd prefer to switch to SLF4J and just replace Everyone in commons land is using commons-logging, no? There is no good reason to leave this path. Sure, for my work-projects I use slf4j too, lately I even use the Java Logging API (which is worse), but always by using a the commons-logging API (not the Impl, just the API) Everyone wanting to use slf4j can easily do that by using the slf4j-commons-logging adapter and removing the commons-logging jar. Not a big deal. There is no benefit in switching to slf4j at all for commons-vfs, or? if (log.isDebugEnabled()) { log.debug(putFile: + file.getName()); } with logger.entry(file.getName()); This is not the same, in the second example getName() gets evaluated every time, regardless of the configured log-level. Depending on how complicated it is to collect the message, this might become a performance problem. the if (log.isXXXEnabled()) prevents that. I'd prefer to keep it the way it is. Ciao, Mario - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [VFS] anonymous debug logging
On Mar 25, 2009, at 11:49 PM, Mario Ivankovits wrote: if (log.isDebugEnabled()) { log.debug(putFile: + file.getName()); } with logger.entry(file.getName()); This is not the same, in the second example getName() gets evaluated every time, regardless of the configured log-level. Depending on how complicated it is to collect the message, this might become a performance problem. the if (log.isXXXEnabled()) prevents that. I'd prefer to keep it the way it is. a) As I said in my original response, although I prefer SLF4J I wouldn't switch from commons-logging without a lot of discussion. There isn't a good reason to do it at this point. b) You are correct that file.getName() gets evaluated every time. Usually the call to getName() should be extremely cheap and will actually be inconsequential to the time it takes to check whether logging is enabled. If it was routinely doing some expensive String construction then, yes it should be wrapped in if (logger.isTraceEnabled()). Ralph - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [VFS] anonymous debug logging
I'm not a big fan of that. I prefer using Logback's and Log4j's ability to include the class name, method name and line number in the logging pattern. The overhead of that is not that large now that they are both using the getStackTrace method to get the information. In fact, I'd prefer to switch to SLF4J and just replace if (log.isDebugEnabled()) { log.debug(putFile: + file.getName()); } with logger.entry(file.getName()); using SLF4J's XLogger class. But although that is what I would prefer I wouldn't dream about doing that without lots of discussion first. Ralph On Mar 25, 2009, at 4:00 PM, Gary Gregory wrote: Hi VFS: When we turn debug on for every thing I our app I noticed that we are getting a lot of log entries like: 2009-03-25 12:17:06,342 [main] DEBUG: putFile: file:///C:/... I see that this is done from VFS in: http://commons.apache.org/vfs/xref/org/apache/commons/vfs/cache/SoftRefFilesCache.html#147 This is all fine except that it is unhelpful to have log entries be what I'd call 'anonymous'. What about prefixing all VFS log entries with 'VFS '? I'm sure that this could be discussed at the [all] commons level, but I'd like to start here. Thoughts? I am happy to patch VFS or commit directly. Gary Gregory Sr. Software Engineer Seagull Software, a Rocket Software Company 3340 Peachtree Road, Suite 820 * Atlanta, GA 30326 * USA Tel: +1.404.364.1752 * Fax: +1.404.760.0061 Email: ggreg...@rocketsoftware.commailto:ggreg...@rocketsoftware.com Web: www.seagullsoftware.comhttp://www.seagullsoftware.com/ - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org