ekino / EkinoNewRelicBundle

Add NewRelic support to Symfony
MIT License
280 stars 104 forks source link

Unwanted logs sent to New Relic #291

Open pauljura opened 7 months ago

pauljura commented 7 months ago

I have an API that logs failed requests to a local file. It's implemented by listening to the Response event, and if the status code is not 200 then I log a message to the custom channel. I have it configured in monolog.yaml as follows:

monolog:
    channels: ['unsuccessful_api_requests'] # adding custom channels
    handlers:
        # main (fingers_crossed) -> deduplicate -> mailer
        main:
         ...
         ...
         ...

        # log unsuccessful api requests to file
        unsuccessful_api_requests:
            type: rotating_file
            max_files: 10
            path: "%kernel.logs_dir%/unsuccessful_api_requests.log"
            level: error
            channels: ["unsuccessful_api_requests"]

My ekino_new_relic.yaml file is as follows:

ekino_new_relic:
    enabled: true
    application_name: '%env(APP_NAME)%'
    api_key: "%env(NEWRELIC_API_KEY)%"
    exceptions: true
    deprecations: true
    monolog:
        enabled: false

Even with monolog enabled: false (which should be redundant because the docs say it defaults to false) I see that these log records are still being sent to New Relic.