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

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?

symfony

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

GraphQL between Angular and Symfony

GraphQL between Angular and Symfony: What is GraphQL? Add GraphQL to Symfony. Add GraphQL to Angular and how to request data. GraphQL is a query language for APIs.

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.)

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 Vs Laravel Framework – What to Select

Wondering if you want to choose Symfony or Laravel for your project? Let's have a look at some key points of Symfony Vs Laravel comparison to help you choose a framework for your upcoming project.