2

I am using docker-compose up to start a web server in linux but am finding that the stdout is printing "\n" characters instead of creating new lines. This makes stack traces difficult to read;

172.19.0.1 - - [12/Sep/2020:02:19:18 +0000] "GET /node/100 HTTP/1.1" 500 337 "http://localhost/node/100/edit" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"
[Sat Sep 12 02:19:18.426082 2020] [php7:notice] [pid 21] [client 172.19.0.1:58954] ParseError: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting identifier (T_STRING) in /opt/drupal/web/modules/custom/rsvplist/src/Plugin/Block/RSVPBlock.php on line 37 #0 /opt/drupal/vendor/composer/ClassLoader.php(322): Composer\\Autoload\\includeFile('/opt/drupal/web...')\n#1 [internal function]: Composer\\Autoload\\ClassLoader->loadClass('Drupal\\\\rsvplist...')\n#2 [internal function]: spl_autoload_call('Drupal\\\\rsvplist...')\n#3 /opt/drupal/web/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php(96): class_exists('Drupal\\\\rsvplist...')\n#4 /opt/drupal/web/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(17): Drupal\\Component\\Plugin\\Factory\\DefaultFactory::getPluginClass('rsvp_block', Array, 'Drupal\\\\Core\\\\Blo...')\n#5 /opt/drupal/web/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(76): Drupal\\Core\\Plugin\\Factory\\ContainerFactory->createInstance('rsvp_block', Array)\n#6 /opt/drupal/web/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(62): Drupal\\Component\\Plugin\\PluginManagerBase->createInstance('rsvp_block', Array)\n#7 /opt/drupal/web/core/modules/block/src/BlockPluginCollection.php(57): Drupal\\Core\\Plugin\\DefaultSingleLazyPluginCollection->initializePlugin('rsvp_block')\n#8 /opt/drupal/web/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(80): Drupal\\block\\BlockPluginCollection->initializePlugin('rsvp_block')\n#9 /opt/drupal/web/core/modules/block/src/BlockPluginCollection.php(45): Drupal\\Component\\Plugin\\LazyPluginCollection->get('rsvp_block')\n#10 /opt/drupal/web/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(83): Drupal\\block\\BlockPluginCollection->get('rsvp_block')\n#11 /opt/drupal/web/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(99): Drupal\\Core\\Plugin\\DefaultSingleLazyPluginCollection->setConfiguration(Array)\n#12 /opt/drupal/web/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(55): Drupal\\Core\\Plugin\\DefaultSingleLazyPluginCollection->addInstanceId('rsvp_block', Array)\n#13 /opt/drupal/web/core/modules/block/src/BlockPluginCollection.php(34): Drupal\\Core\\Plugin\\DefaultSingleLazyPluginCollection->__construct(Object(Drupal\\Core\\Block\\BlockManager), 'rsvp_block', Array)\n#14 /opt/drupal/web/core/modules/block/src/Entity/Block.php(156): Drupal\\block\\BlockPluginCollection->__construct(Object(Drupal\\Core\\Block\\BlockManager), 'rsvp_block', Array, 'rsvpblock')\n#15 /opt/drupal/web/core/modules/block/src/Entity/Block.php(145): Drupal\\block\\Entity\\Block->getPluginCollection()\n#16 /opt/drupal/web/core/modules/block/src/BlockAccessControlHandler.php(118): Drupal\\block\\Entity\\Block->getPlugin()\n#17 /opt/drupal/web/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(105): Drupal\\block\\BlockAccessControlHandler->checkAccess(Object(Drupal\\block\\Entity\\Block), 'view', Object(Drupal\\Core\\Session\\AccountProxy))\n#18 /opt/drupal/web/core/lib/Drupal/Core/Entity/EntityBase.php(314): Drupal\\Core\\Entity\\EntityAccessControlHandler->access(Object(Drupal\\block\\Entity\\Block), 'view', Object(Drupal\\Core\\Session\\AccountProxy), true)\n#19 /opt/drupal/web/core/modules/block/src/BlockRepository.php(56): Drupal\\Core\\Entity\\EntityBase->access('view', NULL, true)\n#20 /opt/drupal/web/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php(137): Drupal\\block\\BlockRepository->getVisibleBlocksPerRegion(Array)\n#21 /opt/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(259): Drupal\\block\\Plugin\\DisplayVariant\\BlockPageVariant->build()\n#22 /opt/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(117): Drupal\\Core\\Render\\MainContent\\HtmlRenderer->prepare(Array, Object(Symfony\\Component\\HttpFoundation\\Request), Object(Drupal\\Core\\Routing\\CurrentRouteMatch))\n#23 /opt/drupal/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\\Core\\Render\\MainContent\\HtmlRenderer->renderResponse(Array, Object(Symfony\\Component\\HttpFoundation\\Request), Object(Drupal\\Core\\Routing\\CurrentRouteMatch))\n#24 /opt/drupal/vendor/symfony/event-dispatcher/LegacyEventDispatcherProxy.php(78): Drupal\\Core\\EventSubscriber\\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\\Component\\HttpKernel\\Event\\ViewEvent), 'kernel.view', Object(Symfony\\Component\\EventDispatcher\\LegacyEventDispatcherProxy))\n#25 /opt/drupal/vendor/symfony/http-kernel/HttpKernel.php(163): Symfony\\Component\\EventDispatcher\\LegacyEventDispatcherProxy->dispatch(Object(Symfony\\Component\\HttpKernel\\Event\\ViewEvent), 'kernel.view')\n#26 /opt/drupal/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#27 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#28 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\\Core\\StackMiddleware\\Session->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#29 /opt/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#30 /opt/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\\page_cache\\StackMiddleware\\PageCache->pass(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#31 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\\page_cache\\StackMiddleware\\PageCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#32 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#33 /opt/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#34 /opt/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(705): Stack\\StackedHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#35 /opt/drupal/web/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#36 {main}, referer: http://localhost/node/100/edit
172.19.0.1 - - [12/Sep/2020:02:19:18 +0000] "GET /node/100 HTTP/1.1" 500 337 "http://localhost/node/100/edit" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"

I am unsure whether this is a "Docker" or a "Unix" question. Ideally there would be some kind of setting I can use to make docker run respect unix line endings, but I'm also open to other solutions.

1

Try to read logs as follows:

docker logs -f <container-name or container-ID> 2>&1

[NOTE]:

  • -f option follows live logs.
  • 2>&1 makes output as stdout and stderr which is useful for grepping and standardizing.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.