Skip to content
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

Unable to create configured logger #1

Open
netomarchiori opened this issue Oct 9, 2024 · 2 comments
Open

Unable to create configured logger #1

netomarchiori opened this issue Oct 9, 2024 · 2 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@netomarchiori
Copy link

I keep on getting this issue, the crazy thing is that newrelic.log is created and the permission is also correctly set.

Any ideas?

[2024-10-09 14:55:14] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. 
{"exception":"[object] (TypeError(code: 0): teraone\\NewRelicLogger\\NewRelicLogFormatter::__construct(): Argument #1 ($source) must be of type string, null given, called in /home/path/public_html/vendor/teraone/laravel-newrelic-logger/src/NewRelicLoggerServiceProvider.php on line 26 at /home/path/public_html/vendor/teraone/laravel-newrelic-logger/src/NewRelicLogFormatter.php:10)
@rechl
Copy link

rechl commented Oct 9, 2024

@netomarchiori please try with this config

'newrelic' => [
    'driver' => 'newrelic',
    'source' => 'newrelic', // seems like this line is missing in our docs
    'additional_info' => [
        'env' => env('APP_ENV'),
        'hostname' => gethostname()
    ]
]

@PaulW01 can you please fix this?

@rechl rechl added bug Something isn't working documentation Improvements or additions to documentation labels Oct 9, 2024
@netomarchiori
Copy link
Author

I actually did

'newrelic' => [
    'driver' => 'newrelic',
    'source' => env('APP_NAME'), // ended up passing the app name, worked like a charm
    'additional_info' => [
        'env' => env('APP_ENV'),
        'hostname' => gethostname()
    ]
]

The lack of 'source' was breaking this line:

 $formatter = new NewRelicLogFormatter($config['source'] ?? env('APP_NAME'), $config['additional_info'] ?? []);

$formatter = new NewRelicLogFormatter($config['source'] ?? env('APP_NAME'), $config['additional_info'] ?? []);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants