2011/11/23 Christopher Schultz <ch...@christopherschultz.net>: > On 11/23/11 11:29 AM, Caldarale, Charles R wrote: >>> From: Christopher Schultz [mailto:ch...@christopherschultz.net] >>> Subject: Babysitting ThreadLocals >> >>> Removing the ThreadLocal after every request of course means that >>> the use of ThreadLocal is entirely useless. >> >>> Should I stop worrying about the overhead of creating a >>> SimpleDateFormat? >> >> Given that the cost of generating and writing a log entry is going >> to vastly outweigh any object creation or synchronization impact, >> then, yes, you should stop worrying. > > External reality checks are always useful. ;)
The yyyy-MM-dd value changes only ~365 times a year. You do not need to regenerate it every second. Tomcat does some clever things when it needs to generate timestamp for logging purposes (e.g. in org.apache.juli.OneLineFormatter), but that looks like an overkill for your use case. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org