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.

What is Symfony? Features and applications

**Symfony is a PHP framework** whose work in building and maintaining web applications works very quickly and turns into recurring coding tasks. There are some prerequisites to start it in your computer-Such as - Linux, FreeBSD, Mac OS or...

Symfony is a PHP framework whose work in building and maintaining web applications works very quickly and turns into recurring coding tasks. There are some prerequisites to start it in your computer-Such as - Linux, FreeBSD, Mac OS or Microsoft Windows and a web server with PHP 5. The current version 1.2 only supports PHP 5.2 or higher, but previous versions can run on PHP 5.0 and 5.1 systems. it is compatible with almost every RDBMS (Relational Database Management System) and has low performance overheads.Unfortunately, like many other new, modern frameworks, Symphony also lacks support for PHP4, but, on the other hand,

Symfony framework overview

Symfony is an open-source MVC framework for rapidly developing modern web applications. Symfony is a full-stack web framework. It contains a set of reusable PHP components. ... Symfony components are being used by a lot of open source projects that include Composer, Drupal, and phpBB.

Enlist major features of Symfony?

There are some best features:-

1.Database engine-independent
2.Easy to install and configure on most platforms (and guaranteed to work on standard *nix and Windows platforms)
3.Very readable code, with phpDocumentor comments, for easy maintenance
4.Easy to extend, allowing for integration with other vendor libraries
5.Compliant with most web best practices and design patterns

Features Summary-Symfony,

Symfony, It is designed to optimize the development of web applications, for the features grows in with every release. Aimed at shortening the development time of complex web applications, it automates common tasks so that developers can focus only on the specificities of an application.

Symfony, which is designed to optimize the development of web applications, grows in features with every release. Aimed at shortening the development time of complex web applications, it automates common tasks so that developers can focus only on the specificities of an application.

Symfony - a database engine-independent PHP framework, which can be easily installed and configured, generates readable code with phpDocumentor comments. This MVC framework is easy to extend, features Propel plugins and allows integration with other vendor libraries. Developers can take advantage of the inbuilt internationalization layer allowing data and interface translation and content localization, and can reduce the amount of presentation code by encapsulating large shares of code in simple function calls. The presentation avails of templates and layouts that can be built by HTML designers who have no knowledge of the framework.

The in-built form generator offers automated validation and repopulation of the forms. All Symfony-built applications support output escaping which protects them from attacks via corrupted data.

The webmasters can benefit from the search-engine friendly routing, smart URLs, built-in e-mail and API management features, easily implementable Ajax interactions, and last, but definitely not least - one-line helpers that encapsulate cross-browser-compatible JavaScript effects.

Read more Symfony Interview Question for the best preparation of all programming languages, here you can read according your interview question and answers .

Thank You,