title: Monolog: Send errors to Sentry with preserved lower-level log records
body: <p><strong>The goal:</strong></p>
  
  <p>I want to send all ERROR+ Monolog records to Sentry along with lower-level records (for easier debugging what's happening) and they should be all sent as one event.</p>
  
  <p><strong>What I have:</strong></p>
  
  <p>I have Symfony4 app with <code>config/packages/prod/monolog.yaml</code>:</p>
  
  <pre><code>monolog:
      handlers:
          # there is also fingers_crossed for file logging, but it is rather not related
  
          sentry_buffer:
              type: fingers_crossed
              action_level: error
              handler: sentry_transparent
              # ignore records logged by exception listener
              channels: ["!exceptions"]
          sentry_transparent:
              type: whatfailuregroup
              members: [sentry]
          sentry:
              type:  raven
              # Use Sentry client registered by SentryBundle
              client_id: sentry.client
              level: debug
              auto_log_stacks: true
  </code></pre>
  
  <p>I have custom exception listener which creates JSON response but before sending it's also logging error to the <code>exceptions</code> channel (so I exclude this channel in <code>fingers_crossed</code> handler so I don't get duplicates.</p>
  
  <p>It's working locally - Sentry events are created only when ERROR+ records occurs in Monolog and all collected logs are attached in record's context.</p>
  
  <p>Somehow on production we got maaaaaaany events with <code>info</code> level and it does not make sense:</p>
  
  <p><a href="https://i.stack.imgur.com/XlHJc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XlHJc.png" alt="enter image description here"></a></p>
  
  <p>These events are not related to any error but in breadcrumbs I see there is some deprecation error triggered:</p>
  
  <p><a href="https://i.stack.imgur.com/qEQbR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qEQbR.png" alt="enter image description here"></a></p>
  
  <p>I've tried to reproduce this with <code>trigger_error</code> like in <code>ProcessBuilder</code> (from breadcrumbs) but whatever I do I don't get INFO events in my Sentry.</p>
  
  <p>Those events are from long-running processes (Enqueue consumers), but I did all the steps from production (request, processing queue) and I don't get result as in our production instance.</p>
  
  <p>Any suggestions what's going on? How can I improve our config to achieve what we need but without spamming our Sentry with events we don't want?</p>