Answers.Body: <p>You should be able to do that with something like this:</p>
  
  <pre><code>Craft::getLogger()-&gt;flush();
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-25T22:14:21.570Z
Answers.LastActivityDate: 2015-04-25T22:14:21.570Z
Answers.UserDisplayName: Brad Bell
Body: <p>Sometimes I have long running requests that do imports or similar. </p>
  
  <p>Currently logging using <code>MyPlugin::log</code> is only actually written to file once the request is done. </p>
  
  <p>Is there a way to trigger log-flushing mid-request?</p>
  
Tags: <plugin-development><logging>
Title: Flushing logs halfway through a request?
ThreadText: # Flushing logs halfway through a request?
  
  (Asked by: username_0 on 2015-04-25)
  
  Sometimes I have long running requests that do imports or similar.
  
  Currently logging using `MyPlugin::log` is only actually written to file once the request is done.
  
  Is there a way to trigger log-flushing mid-request?
  
  **Tags:** plugin-development, logging
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-04-25. Score: 2 | Accepted answer
  
  You should be able to do that with something like this:
  
  ```
  Craft::getLogger()->flush();
  
  ```
  
  
  ---
  
  