How can one use a defined channel, in monolog handler from a tagged service?

I have the following monolog handler definitions:

I have the following monolog handler definitions:

    # config_prod.yml
    app_generic:
        type: rotating_file
        max_files:      15
        path: "%param.app_logging_config.log_generic_file%"
        level: info
        channels: [app]
app_api:
     max_files: 15
     path: "%param.app_logging_config.log_api_file%"
     level: info
     channels: [app]
     level: info

app_response:
    max_files: 15
    path: "%param.app_logging_config.log_response_file%"
    channels: [app]
    level: info

And in service.yml, my intention is to inject monolog (@logger) with an array of the above defined handlers.

#service.yml
app.app_logger:
class: AppBundle\Classes\AppLogger
arguments: ['@logger': ['@app_generic', '@app_api', '@app_response']]
calls:
- [init, ['%app_logging_config%']
tags:
- { name: monolog.logger, channel: app }

How does one pass arguments to an injected argument?

  • Update:

Re-reading the description, I was going for this approach, by just tagging on the service definition:

app.logger:
arguments: ['@logger']
tags:
- { name: monolog.logger, channel: app }
channels: ['app']

Or even ( if I understood correctly), adding a channels: ['app'] key and just having this in service argument:

app.logger:
arguments: ['@monolog.logger.app']

I have not been able to use ( or see via dump ) the handlers defined in config_prod.yml. I have placed these at top because of other "fingers_crossed" handlers I thought may interfere.

I woud like to know, why neither of above (documented) approaches seem to work?

Why is this Symfony annotation not working?

Before I start, I should mention that this is&nbsp;<strong>Symfony 2.8.25</strong>. (I just started working on this code base, and once we get some critical issues resolved, we'll be upgrading.)

Before I start, I should mention that this is Symfony 2.8.25. (I just started working on this code base, and once we get some critical issues resolved, we'll be upgrading.)

I have an existing class using annotations with a number of routes that work fine.

I added a new one, and I get a 404 on that one every time. I did a console cache:clear which did not help. When I did a console debug:route, the new Routes appear in the list. But I still get a 404 on them, while the others in the same source file work.

All the routes use a POST, the working and non-working ones.

The routing.yml looks like this:

app:
    resource: '@AppBundle/Controller/'
    type: annotation

logout:
path: /logout

The class looks like this:

<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Entity\Environment;
use AppBundle\Entity\Instance;
use AppBundle\Entity\Migration;
use AppBundle\Entity\UserActivity;
use AppBundle\Entity\Task;
use AppBundle\Form\Environment\EnvironmentType;
use AppBundle\Services\Api;
use AppBundle\Utils\HashRequest;

class EnvironmentController extends Controller
{
...
/**
*
* @Route("/api/envtype/add", name="api_envtype_add")
*
*/
public function addEnvtypeAction(Request $request){
...

When I try another route from this same class, it works. But not this new one.

I tried renaming the route, and that made no difference. I checked the annotation comment for TABs, since that's a (semi-)known bug in older versions. No TABs in the annotation.

This annotation looks to me exactly like the others that work. (None of them have a @return, for example.)

PostMan reports No route found for "POST /api/envtype/add"

I am completely out of ideas.

Symfony 3 application running on OSX

My Symfony 3.4 application is running super slow on DEV environment - it is taking about 35 seconds when using Docker and 20 seconds when running with Symfony's server.

My Symfony 3.4 application is running super slow on DEV environment - it is taking about 35 seconds when using Docker and 20 seconds when running with Symfony's server.

Profiler shows my controller takes too much time to compile.

Symfony Profiler

What I noticed is Symfony Profiler does not shows performance metrics when I run it using Docker - it does when I run using it's own server.

Any idea where I can look at? I already tried lots of workarounds without zero success.

Thanks