<?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>Linux Archives ~ Carlos Guzman</title>
	<atom:link href="https://carlosguzman.dev/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://carlosguzman.dev/tag/linux/</link>
	<description>Web developer</description>
	<lastBuildDate>Thu, 25 Jun 2020 11:11:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://carlosguzman.dev/wp-content/uploads/2019/06/favicon.ico</url>
	<title>Linux Archives ~ Carlos Guzman</title>
	<link>https://carlosguzman.dev/tag/linux/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to see the error logs in WordPress with Docker in Linux</title>
		<link>https://carlosguzman.dev/how-to-see-the-error-logs-in-wordpress-with-docker-in-linux/</link>
					<comments>https://carlosguzman.dev/how-to-see-the-error-logs-in-wordpress-with-docker-in-linux/#comments</comments>
		
		<dc:creator><![CDATA[Carlos Guzmán]]></dc:creator>
		<pubDate>Fri, 24 Jan 2020 17:47:42 +0000</pubDate>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://carlosguzman.dev/?p=48</guid>

					<description><![CDATA[<p>Recently I was working in the development of a WordPress plugin and I didn&#8217;t find an easy way to see the error logs in WordPress with Docker. I started to read and learn about Docker some few time ago. I created a WordPress development instance using the official Docker image for WordPress in Docker Hub. [&#8230;]</p>
<p>The post <a href="https://carlosguzman.dev/how-to-see-the-error-logs-in-wordpress-with-docker-in-linux/">How to see the error logs in WordPress with Docker in Linux</a> appeared first on <a href="https://carlosguzman.dev">Carlos Guzman</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Recently I was working in the development of a WordPress plugin and I didn&#8217;t find an easy way to see the error logs in WordPress with Docker. I started to read and learn about Docker some few time ago. I created a WordPress development instance using <a rel="noreferrer noopener" aria-label="the official Docker image for WordPress in DockerHub (opens in a new tab)" href="https://hub.docker.com/_/wordpress" target="_blank">the official Docker image for WordPress in Docker Hub</a>. In some cases, you want to see the log of errors and do not activate the debug mode in WordPress. In example, a plugin can generate warnings that make difficult to debug and that could break responses for Ajax requests in your site.</p>



<p>My first attempt to see the error logs was to login in a bash session it the Docker container. Then I searched for the error log file but the errors are sent to the I/O stream STDERR by default.<mark class="annotation-text annotation-text-yoast" id="annotation-text-4058d5b7-636c-4a18-bcd5-ab1e309368af"></mark></p>



<figure class="wp-block-image"><a href="https://carlosguzman.dev/wp-content/uploads/2020/01/default-error-logs-wordpress-docker.jpg"><img fetchpriority="high" decoding="async" width="892" height="134" src="https://carlosguzman.dev/wp-content/uploads/2020/01/default-error-logs-wordpress-docker.jpg" alt="Default configuration of error logs for WordPress with Docker" class="wp-image-60" srcset="https://carlosguzman.dev/wp-content/uploads/2020/01/default-error-logs-wordpress-docker.jpg 892w, https://carlosguzman.dev/wp-content/uploads/2020/01/default-error-logs-wordpress-docker-300x45.jpg 300w, https://carlosguzman.dev/wp-content/uploads/2020/01/default-error-logs-wordpress-docker-768x115.jpg 768w" sizes="(max-width: 892px) 100vw, 892px" /></a><figcaption>Default configuration of error logs for WordPress with Docker</figcaption></figure>



<p>Instead to create a custom image to change this configuration, I tried with the <a rel="noreferrer noopener" aria-label="Docker cli tool to access to the logs of the container (opens in a new tab)" href="https://docs.docker.com/engine/reference/commandline/logs/" target="_blank">Docker cli tool to access to the logs of the container</a>. Using <code>docker logs ID_CONTAINER</code>, I was able to see the logs of the web server. It was progress but it wasn&#8217;t what I want. I got all logs entries of the web server including access and warning entries. It would be difficult to spot the error entries easily in a website loading multiple resources and doing multiple Ajax requests.</p>



<figure class="wp-block-image"><a href="https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs.jpg"><img decoding="async" width="824" height="500" src="https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs.jpg" alt="Show logs of the Docker WordPress image container." class="wp-image-54" srcset="https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs.jpg 824w, https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-300x182.jpg 300w, https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-768x466.jpg 768w" sizes="(max-width: 824px) 100vw, 824px" /></a><figcaption>Show logs of the Docker WordPress image container.</figcaption></figure>



<h2 class="wp-block-heading">The solution</h2>



<p>If we discard the output sent to the standard stream, then the access entries are gone. So using <code>docker logs -f ID_CONTAINER &gt;/dev/null</code>, we get only the entries sent to the error stream. Most of the entries here are the useful entries for debugging, they are the warning and error messages. The option -f in docker logs command is to follow and refresh automatically the logs in the console.</p>



<figure class="wp-block-image"><a href="https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-without-access-entries.jpg"><img decoding="async" width="828" height="478" src="https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-without-access-entries.jpg" alt="" class="wp-image-56" srcset="https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-without-access-entries.jpg 828w, https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-without-access-entries-300x173.jpg 300w, https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-without-access-entries-768x443.jpg 768w" sizes="(max-width: 828px) 100vw, 828px" /></a><figcaption>Show entries sent to the error stream only</figcaption></figure>



<h3 class="wp-block-heading">Extra tip</h3>



<p>If you want to see the error messages only without changing the error reporting directive, you can use the <em>grep</em> tool to filter the other entries. Using <code>docker logs -f ID_CONTAINER 2&gt;&amp;1 &gt;/dev/null | grep -i error</code>, the entries are filtered to display only the lines with the error word in them. This command replaces the output of the standard stream with the output of the error stream. Then <em>grep</em> filters the content. The option -i in the <em>grep</em> command is to be case insensitive in the search.</p>



<figure class="wp-block-image"><a href="https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-only-errors.jpg"><img loading="lazy" decoding="async" width="828" height="341" src="https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-only-errors.jpg" alt="Show only error logs of WordPress with Docker" class="wp-image-57" srcset="https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-only-errors.jpg 828w, https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-only-errors-300x124.jpg 300w, https://carlosguzman.dev/wp-content/uploads/2020/01/console-wordpress-docker-logs-only-errors-768x316.jpg 768w" sizes="auto, (max-width: 828px) 100vw, 828px" /></a><figcaption>Show only error logs of WordPress with Docker</figcaption></figure>



<p>Maybe it isn&#8217;t the most elegant but at least it is an effective way to see the error logs in WordPress with Docker.</p>



<p></p>
<p>The post <a href="https://carlosguzman.dev/how-to-see-the-error-logs-in-wordpress-with-docker-in-linux/">How to see the error logs in WordPress with Docker in Linux</a> appeared first on <a href="https://carlosguzman.dev">Carlos Guzman</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://carlosguzman.dev/how-to-see-the-error-logs-in-wordpress-with-docker-in-linux/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk
Database Caching 15/50 queries in 0.028 seconds using Disk

Served from: carlosguzman.dev @ 2026-05-20 15:50:59 by W3 Total Cache
-->