From: Robert Klemme Date: 2011-11-26T00:58:37+09:00 Subject: Re: set logger.progname on a per thread basis On Fri, Nov 25, 2011 at 2:57 PM, Kassym Dorsel wrote: > Sorry I should have specified. > > In each thread I'm creating a new instance of Mechanize and login with a > different user. I send get requests from each user and I'm using the > built-in Mechanize logger. On DEBUG mode the log can generate up to 20 > lines of log per request. Since there can be multiple requests going at > once I want a way to differentiate between them. > > The easiest way I thought of doing this was to change the progname on a > per thread basis, but for that to be thread safe I need to synchronize > the whole method that uses Mechanize (Browse). I'd check whether you can insert a thread local into the log. Java's log4j has such a feature and I guess the logger you are using might have as well. Way better than to synchronize the whole call. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/