-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[5.6] Use env APP_NAME variable for syslog identifier #22267
Conversation
Instead of hardcoded syslog identifier "laravel" I propose to use environment variable APP_NAME. In case when you have a few Laravel projects on the same machine that log to syslog all of them will write to log with same identifier "laravel" thats not very transparent which message belongs to which project
@@ -101,7 +101,7 @@ protected function configureDailyHandler(Writer $log) | |||
*/ | |||
protected function configureSyslogHandler(Writer $log) | |||
{ | |||
$log->useSyslog('laravel', $this->logLevel()); | |||
$log->useSyslog(env('APP_NAME', 'laravel'), $this->logLevel()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use config('app.name') instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, thanks
@akaroot I feel like we should add a fallback of 'laravel'. $log->useSyslog($this->app->make('config')->get('app.name', 'laravel'), $this->logLevel()); While unlikely that this config key is missing, we don't want an empty value if it is missing. |
@browner12 useSyslog method already has a fallback for empty name |
@akaroot that value will be overriden if config('app.name') is null, but inside config/app.php there is already a fallback for the app name. |
Would it make sense to change this to use a hyphen seperated string? When using spaces, it looks kinda weird in Papertrail. Not sure about other services. Papertrail also uses some logic to filter or group by name, which fails when using spaces.. Edit: See #25784 |
Instead of hardcoded syslog identifier "laravel" I propose to use environment variable APP_NAME.
In case when you have a few Laravel projects on the same machine that log to syslog all of them will write to log with same identifier "laravel" thats not very transparent which message belongs to which project