title: Perl Log::Dispatch: Change logging location mid-run?
body: <p>I'm using <code>Log::Dispatch</code> in a large Mooseified app, via <code>MooseX::LogDispatch</code>. My setup is more or less:</p>
  
  <pre class="lang-perl prettyprint-override"><code>use Moose;
  with 'MooseX::LogDispatch';
  
  has log_dispatch_conf =&gt; (
      is =&gt; 'ro',
      isa =&gt; 'HashRef',
      lazy =&gt; 1,
      required =&gt; 1,
      default =&gt; sub {
          my $self = shift;
          return {
              class =&gt; 'Log::Dispatch::File',
              min_level =&gt; 'debug',
              filename =&gt; $self-&gt;config-&gt;{logfile},
              mode =&gt; '&gt;&gt;',
              newline =&gt; 1
          };
      },
  );
  </code></pre>
  
  <p>Is there any way I can change the location of the log file in the middle of a running process? My specific use case is that I'm processing a number of different large [things], which are passed in at runtime, and I'd like each [thing] to log to its own file. Something like this:</p>
  
  <pre class="lang-perl prettyprint-override"><code>foreach my $thing (@things) {
      my $logfile = $self-&gt;config-&gt;{log_base} . $thing-&gt;{name} . time() . ".log";
      # do something here to set log location
      $self-&gt;logger-&gt;info("Start processing " . $thing-&gt;{name} . " at " . scalar localtime());
      # process $thing
  }
  </code></pre>