with the new Version of Shopware 6.5.4.1 I got small issue with the LoggerFactory (https://sindhitutorials.com/pages/shopware-6-custom-plugin-logger)
Till the update it was so that for Plugin to own its own .log File in var/log
.
Now with this update everything is logged within dev.log
and there it gets its own Channel displayed.
services.xml
looks like this:
<service id="Company\PluginName\Core\Util\Logger" class="Monolog\Logger">
<factory service="Shopware\Core\Framework\Log\LoggerFactory" method="createRotating" />
<argument type="string">Company_PluginName</argument>
</service>
I managed to do move the log in a separate file creating the following services
<service id="company.plugin.logger" class="Monolog\Logger">
<argument type="string">Company_PluginName</argument>
<argument type="collection">
<argument type="service" id="company.plugin.rotatingHandler"/>
</argument>
</service>
<service id="company.plugin.rotatingHandler" class="Monolog\Handler\RotatingFileHandler">
<argument type="string">%kernel.logs_dir%/company-name-%kernel.environment%.log</argument>
</service>
One service that extends the default RotatingFileHandler
, here you provide a the location of your log file %kernel.logs_dir%/company-name-%kernel.environment%.log
then you use that service as a parameter for your Monolog\Logger
service