<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sentry | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/tag/sentry/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Thu, 27 Aug 2026 06:54:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>
	<item>
		<title>Enable Sentry Bundle Logging</title>
		<link>https://nerdpress.org/2026/08/26/enable-sentry-bundle-logging/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Wed, 26 Aug 2026 15:35:06 +0000</pubDate>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Monolog]]></category>
		<category><![CDATA[Sentry]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=3499</guid>

					<description><![CDATA[<p>When using the SentryBundle (Version 5.12.0) in a Symfony project, one might want to log the events it sends to Sentry. This is useful for debugging and monitoring. Here is how to enable it. Configure the LogsHandler Service All following definitions got to sentry.yaml file in your config/packages folder.Define a LogsHandler service with the minimum &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2026/08/26/enable-sentry-bundle-logging/" class="more-link">Continue reading<span class="screen-reader-text"> "Enable Sentry Bundle Logging"</span></a></p>
The post <a href="https://nerdpress.org/2026/08/26/enable-sentry-bundle-logging/">Enable Sentry Bundle Logging</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">When using the <a title="" href="https://github.com/getsentry/sentry-symfony" target="_blank" rel="noopener">SentryBundle</a> (Version 5.12.0) in a Symfony project, one might want to log the events it sends to Sentry. This is useful for debugging and monitoring. Here is how to enable it.</p>



<span id="more-3499"></span>



<p class="wp-block-paragraph"><strong>Configure the LogsHandler Service</strong></p>



<p class="wp-block-paragraph">All following definitions got to <em>sentry.yaml</em> file in your <em>config/packages</em> folder.<br />Define a <em>LogsHandler</em> service with the minimum log level you want to capture:</p>


<pre class="wp-block-code"><span><code class="hljs language-javascript">services:
  Sentry\SentryBundle\Monolog\LogsHandler:
    <span class="hljs-built_in">arguments</span>:
      - !php/<span class="hljs-keyword">const</span> Monolog\Logger::WARNING</code></span></pre>


<p class="wp-block-paragraph"><br /><strong>Add the Handler to Monolog</strong></p>



<p class="wp-block-paragraph">Add the handler to the <em>monolog</em> configuration:</p>


<pre class="wp-block-code"><span><code class="hljs">monolog:
  handlers:
    sentry:
      type: service
      id: Sentry\SentryBundle\Monolog\LogsHandler</code></span></pre>


<p class="wp-block-paragraph"><strong>Configure the Logger in Sentry</strong></p>



<p class="wp-block-paragraph">Add the main logger service to the SentryBundle configuration:</p>


<pre class="wp-block-code"><span><code class="hljs language-css"><span class="hljs-selector-tag">sentry</span>:
  <span class="hljs-selector-tag">logger</span>: <span class="hljs-selector-tag">monolog</span><span class="hljs-selector-class">.logger</span></code></span></pre>


<p class="wp-block-paragraph"><strong>Enable Logging</strong></p>



<p class="wp-block-paragraph">Finally, enable logging in the SentryBundle configuration:</p>


<pre class="wp-block-code"><span><code class="hljs language-javascript">sentry:
  logging:
    enable_logs: <span class="hljs-literal">true</span></code></span></pre>


<p class="wp-block-paragraph"><strong>Result</strong></p>



<p class="wp-block-paragraph">Now, when an exception is captured by the SentryBundle, it will also be logged to the configured logger. For example:</p>


<pre class="wp-block-code"><span><code class="hljs language-css"><span class="hljs-selector-tag">Sent</span> <span class="hljs-selector-tag">event</span> <span class="hljs-selector-attr">&#91;eaaf669ea6834546a20beb6ae0c5773f]</span> <span class="hljs-selector-tag">to</span> <span class="hljs-selector-tag">sentry</span><span class="hljs-selector-class">.example</span><span class="hljs-selector-class">.com</span> <span class="hljs-selector-attr">&#91;project:12]</span>. <span class="hljs-selector-tag">Result</span>: "<span class="hljs-selector-tag">success</span>" (<span class="hljs-selector-tag">status</span>: 200).</code></span></pre>


<p class="wp-block-paragraph">The Sentry documentation on <a href="https://docs.sentry.io/platforms/php/guides/symfony/integrations/monolog/" target="_blank" rel="noopener" title="">Monolog integration</a> is almost complete. <br /><br />However, it misses the part where the logger service must be configured in the SentryBundle configuration. <br />Without it, the logger defaults to a `NullLogger`, and nothing gets logged.<br /><br />Hope it helps.</p>The post <a href="https://nerdpress.org/2026/08/26/enable-sentry-bundle-logging/">Enable Sentry Bundle Logging</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
