diff --git a/src/Async/JobExecutionHandler.php b/src/Async/JobExecutionHandler.php index 8a09651..ba63d55 100644 --- a/src/Async/JobExecutionHandler.php +++ b/src/Async/JobExecutionHandler.php @@ -34,7 +34,7 @@ public function handle(JobMessageInterface $message): void } catch (\Throwable $e) { // Should not trigger any exceptions to avoid message requeue $this->logger->error( - \sprintf('Failed to run job[id: %s] message: %s', $message->getJobId(), $e->getMessage()), + \sprintf('Failed to run job[id: %s] | ' . get_class($message) . ' | message: %s', $message->getJobId(), $e->getMessage()), ); } } diff --git a/src/NostoScheduler.php b/src/NostoScheduler.php index c226d01..438196a 100644 --- a/src/NostoScheduler.php +++ b/src/NostoScheduler.php @@ -6,8 +6,10 @@ use Shopware\Core\Framework\Bundle; use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Loader\DelegatingLoader; +use Symfony\Component\Config\Loader\LoaderResolver; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\{XmlFileLoader}; +use Symfony\Component\DependencyInjection\Loader\{DirectoryLoader, GlobFileLoader, XmlFileLoader, YamlFileLoader}; class NostoScheduler extends Bundle { @@ -15,7 +17,18 @@ public function build(ContainerBuilder $container): void { parent::build($container); - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/Resources/config')); - $loader->load('services.xml'); + $locator = new FileLocator('Resources/config'); + + $resolver = new LoaderResolver([ + new YamlFileLoader($container, $locator), + new GlobFileLoader($container, $locator), + new DirectoryLoader($container, $locator), + ]); + + $configLoader = new DelegatingLoader($resolver); + + $confDir = \rtrim($this->getPath(), '/') . '/Resources/config'; + + $configLoader->load($confDir . '/{packages}/*.yaml', 'glob'); } } diff --git a/src/Resources/config/packages/monolog.yaml b/src/Resources/config/packages/monolog.yaml new file mode 100644 index 0000000..a2a2dec --- /dev/null +++ b/src/Resources/config/packages/monolog.yaml @@ -0,0 +1,9 @@ +monolog: + channels: ['nosto_scheduler'] + + handlers: + myPluginLogHandler: + type: rotating_file + path: "%kernel.logs_dir%/nosto_scheduler_%kernel.environment%.log" + level: error + channels: [ "nosto_scheduler" ] diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 91127ed..c1f5736 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -16,7 +16,7 @@ - +