New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document logger configuration #680
Comments
@bytehead can you have a look at this? |
I'll check! |
It's now adjusted: #683 |
I added the contao handler to my monolog config. Now I get the following error message:
|
What does this output in your installation?
|
This can't be the case actually: |
So I guess the error is somewhere else. |
The output of the console command is:
The service is not public. How can I make it public? |
The service should be made public by Contao's |
I added the following dd: if (!$container->hasDefinition($service)) {
dd($service);
continue;
} It was never called so I added a dd at the start of the methode: public function process(ContainerBuilder $container): void
{
dd('test');
// ...
} It was not called either. |
That explains why your service is not public. What about this line? |
That is also not called. That is very strange. I thought that I can not have a Contao backend if the ContaoCoreBundle is not initialized. But I have a backend. |
That's really strange. How does your |
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
public function registerBundles(): iterable
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class();
}
}
}
public function getProjectDir(): string
{
return \dirname(__DIR__);
}
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
$container->setParameter('container.dumper.inline_factories', true);
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}
protected function configureRoutes(RouteCollectionBuilder $routes): void
{
$confDir = $this->getProjectDir().'/config';
$routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
}
} |
That is the normal Symfony Kernel. I did not do the steps in "Enable Cache and Front End Preview" in the documentation because I thought this was not mandatory. |
Hmm. Looks like the |
In the developer documentation of using Contao as a Symfony bundle there is no documentation of installing and configuring Monolog. https://docs.contao.org/dev/getting-started/initial-setup/symfony-application/contao-4.9/
I think Monolog is needed because in the Contao backend I get the following error:
The text was updated successfully, but these errors were encountered: