{"id":5059,"date":"2024-02-13T17:52:08","date_gmt":"2024-02-13T15:52:08","guid":{"rendered":"https:\/\/www.h-hennes.fr\/blog\/?p=5059"},"modified":"2024-02-13T17:52:09","modified_gmt":"2024-02-13T15:52:09","slug":"magento-2-mute-logs-add-of-item-with-id-and-other-useless-in-developement","status":"publish","type":"post","link":"https:\/\/www.h-hennes.fr\/blog\/2024\/02\/13\/magento-2-mute-logs-add-of-item-with-id-and-other-useless-in-developement\/","title":{"rendered":"Magento 2 : Mute logs Add of item with id &#8230; and other useless in developement"},"content":{"rendered":"\n<p>Note rapide sur comment r\u00e9duire au silence les logs du module Magento_Backend qui remplis le fichier system.log\u00a0 avec des centaines d&rsquo;entr\u00e9es inutiles du type<\/p>\n<p>[2024-02-10T17:13:48.877379+00:00] main.INFO: Add of item with id Magento_Sales::sales was processed [] []<br \/>[2024-02-10T17:13:48.878055+00:00] main.INFO: Add of item with id Magento_Sales::sales_operation was processed [] []<\/p>\n<p>Pareil pour moi qui fait essentiellement du d\u00e9veloppement back office pour tous les logs du type <br \/><br \/>[2024-02-13T10:54:24.978175+00:00] report.INFO: Broken reference: the &lsquo;catalog.leftnav&rsquo; element cannot be added as child to &lsquo;sidebar.main&rsquo;, because the latter doesn&rsquo;t exist [] []<\/p>\n<p>Cela\u00a0 noie les informations int\u00e9ressantes d&rsquo;autant que c&rsquo;est une information qui n&rsquo;est pas tr\u00e8s utile.<br \/><br \/>Pour masquer \u00e7a la m\u00e9thode la plus simple est de faire un fichier patch, avec le contenu suivant\u00a0 :<br \/>Dans un fichier qui s&rsquo;appelerais par exemple : <em>LOCAL-mute-useless-logs.patch<\/em><\/p>\n\n\n\n<pre>\ndiff --git a\/vendor\/magento\/framework\/View\/Layout\/Data\/Structure.php b\/vendor\/magento\/framework\/View\/Layout\/Data\/Structure.php\n--- a\/vendor\/magento\/framework\/View\/Layout\/Data\/Structure.php\n+++ b\/vendor\/magento\/framework\/View\/Layout\/Data\/Structure.php\n@@ -122,10 +122,10 @@\n                 $siblingParentName = $this->getParentId($sibling);\n                 if ($parentName !== $siblingParentName) {\n                     if ($this->state->getMode() === State::MODE_DEVELOPER) {\n-                        $this->logger->info(\n+                        \/*$this->logger->info(\n                             \"Broken reference: the '{$childName}' tries to reorder itself towards '{$sibling}', but \" .\n                             \"their parents are different: '{$parentName}' and '{$siblingParentName}' respectively.\"\n-                        );\n+                        );*\/\n                     }\n                     return;\n                 }\ndiff --git a\/vendor\/magento\/framework\/View\/Layout\/ScheduledStructure\/Helper.php b\/vendor\/magento\/framework\/View\/Layout\/ScheduledStructure\/Helper.php\n--- a\/vendor\/magento\/framework\/View\/Layout\/ScheduledStructure\/Helper.php\n+++ b\/vendor\/magento\/framework\/View\/Layout\/ScheduledStructure\/Helper.php\n@@ -197,10 +197,10 @@\n                 $scheduledStructure->setElementToBrokenParentList($key);\n\n                 if ($this->state->getMode() === State::MODE_DEVELOPER) {\n-                    $this->logger->info(\n+                    \/*$this->logger->info(\n                         \"Broken reference: the '{$name}' element cannot be added as child to '{$parentName}', \" .\n                         'because the latter doesn\\'t exist'\n-                    );\n+                    );*\/\n                 }\n             }\n         }\ndiff --git a\/vendor\/magento\/module-backend\/Model\/Menu.php b\/vendor\/magento\/module-backend\/Model\/Menu.php\n--- a\/vendor\/magento\/module-backend\/Model\/Menu.php\n+++ b\/vendor\/magento\/module-backend\/Model\/Menu.php\n@@ -86,9 +86,9 @@\n             $index = (int) $index;\n             if (!isset($this[$index])) {\n                 $this->offsetSet($index, $item);\n-                $this->_logger->info(\n+                \/*$this->_logger->info(\n                     sprintf('Add of item with id %s was processed', $item->getId())\n-                );\n+                );*\/\n             } else {\n                 $this->add($item, $parentId, $index + 1);\n             }\ndiff --git a\/vendor\/magento\/module-backend\/Model\/Menu.php b\/vendor\/magento\/module-backend\/Model\/Menu.php\n--- a\/vendor\/magento\/module-backend\/Model\/Menu.php\n+++ b\/vendor\/magento\/module-backend\/Model\/Menu.php\t(date 1679414562983)\n@@ -151,9 +151,9 @@\n             if ($item->getId() == $itemId) {\n                 unset($this[$key]);\n                 $result = true;\n-                $this->_logger->info(\n+                \/*$this->_logger->info(\n                     sprintf('Remove on item with id %s was processed', $item->getId())\n-                );\n+                );*\/\n                 break;\n             }\n\n\n<\/pre>\n\n\n\n<p>Ensuite plus qu&rsquo;\u00e0 l&rsquo;appliquer via la ligne de commande suivante :<\/p>\n\n\n\n<pre lang=\"bash\">\npatch -p1  < LOCAL-mute-useless-logs.patch\n<\/pre>\n\n\n\n<p>Pour ceux qui travaillent avec magento-cloud il est \u00e9galement possible de d\u00e9poser le fichier dans le dossier m2-hotfixes<br \/>Et de l'ex\u00e9cuter via la commande\u00a0 .\/vendor\/bin\/ece-patches apply<\/p>\n<p>Une fois ce nettoyage appliqu\u00e9 fini les kms de logs inutiles :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note rapide sur comment r\u00e9duire au silence les logs du module Magento_Backend qui remplis le fichier system.log\u00a0 avec des centaines d&rsquo;entr\u00e9es inutiles du type [2024-02-10T17:13:48.877379+00:00] main.INFO: Add of item with id Magento_Sales::sales was processed [] [][2024-02-10T17:13:48.878055+00:00] main.INFO: Add of item with id Magento_Sales::sales_operation was processed [] [] Pareil pour moi qui fait essentiellement du d\u00e9veloppement [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[246],"tags":[603,482],"class_list":["post-5059","post","type-post","status-publish","format-standard","hentry","category-magento-2","tag-logs","tag-magento-2"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts\/5059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/comments?post=5059"}],"version-history":[{"count":2,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts\/5059\/revisions"}],"predecessor-version":[{"id":5086,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts\/5059\/revisions\/5086"}],"wp:attachment":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/media?parent=5059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/categories?post=5059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/tags?post=5059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}