title: Different log level for Sidekiq workers - Ruby approach?
body: <p>I have a running environment with a Rails application, Sidekiq and clockwork mod for scheduling purposes.</p>
  
  <p>I have many different workers, filled with logger.debug and logger.info instructions, and I occasionally need to activate debug logging on some of them to know what's going on.
  I like the Sidekiq logger, and I would like to utilize it because it just need a "logger.debug" instruction in the workers to do its job.</p>
  
  <p>What I miss with my current setup is the possibility to activate the DEBUG level for some workers, while leaving the others in standard INFO.</p>
  
  <p>Now in each of my workers I have this initialize method:</p>
  
  <pre><code>class SendMailOnStart
  
     include Sidekiq::Worker
     sidekiq_options :retry =&gt; false, :queue =&gt; :critical
  
      def initialize
        logger.level = Logger::INFO
      end
  
      .... ...
  </code></pre>
  
  <p>But if a change the level in one worker, this level will be overwritten by the level specified in the next one - e.g. if two workers are processed together, the second one will "win".</p>
  
  <p>What's the best way to achieve this in an elegant way? </p>
  
  <p>Coming from Java world, I can think only to create a custom logger and putting it in each worker, copying output format used by Sidekiq logger, adding a logger method in each worker like</p>
  
  <pre><code>def logger
    logger = MyLogger.new
  end
  </code></pre>
  
  <p>and changing the level when I neeed it in initialize method</p>
  
  <p>Is this the best approach in Ruby?</p>