doudui9516 2018-10-18 20:25
浏览 145

Laravel Lumen Logging不参与生产

I have a small project on Laravel/Lumen where I use logging messages like this

Log::info('User failed to login.', 
    ['Env token' => $this->envToken, 'Request token' =>$request->header('Authorization')]);

I can check my log in storage/logs/lumen.log just fine. The problem is when I push it to my vps where the log stops working. In there I ran composer install --no-dev to install the production dependencies only.

Is there a required dev dependency for logging or it can be something else??

More info: Vendor/laravel/lumen-framework/config/logging.php (I haven't change it, so it's by default)

<?php

return [

/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/

'default' => env('LOG_CHANNEL', 'stack'),

/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
|                    "errorlog", "custom", "stack"
|
*/

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single'],
    ],

    'single' => [
        'driver' => 'single',
        'path' => storage_path('logs/lumen.log'),
        'level' => 'debug',
    ],

    'daily' => [
        'driver' => 'daily',
        'path' => storage_path('logs/lumen.log'),
        'level' => 'debug',
        'days' => 7,
    ],

    'slack' => [
        'driver' => 'slack',
        'url' => env('LOG_SLACK_WEBHOOK_URL'),
        'username' => 'Lumen Log',
        'emoji' => ':boom:',
        'level' => 'critical',
    ],

    'syslog' => [
        'driver' => 'syslog',
        'level' => 'debug',
    ],

    'errorlog' => [
        'driver' => 'errorlog',
        'level' => 'debug',
    ],
],

];

.env file

APP_ENV=local
APP_DEBUG=true
APP_KEY=stuffkey
APP_TIMEZONE=UTC    

LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=stuffdb
DB_USERNAME=stuffuser
DB_PASSWORD=stuffkey

CACHE_DRIVER=file
QUEUE_CONNECTION=sync

RESTTOKEN=blablablabla
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 fluent的在模拟压强时使用希望得到一些建议
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
    • ¥15 模糊pid与pid仿真结果几乎一样
    • ¥15 java的GUI的运用
    • ¥15 Web.config连不上数据库
    • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
    • ¥15 怎么配置广告联盟瀑布流
    • ¥15 Rstudio 保存代码闪退