【问题标题】:Logging data passed to the queue is not working as expected传递给队列的日志数据未按预期工作
【发布时间】:2014-05-14 03:24:09
【问题描述】:

我正在尝试使用 laravel 4.1 队列。我有下面的代码

Queue::push('TopicQueue', array('string' => 'Hello World'));

TopicQueue如下

class TopicQueue {

    public function fire($job, $data){
         Log::info('This is from the worker thread . The data array is = '.var_export($data));

        $job->delete();

    }

} 

在日志中我得到了这个

[2014-05-14 03:19:02] production.INFO:这是来自工作线程。数据数组为 = [] []

我的问题是“如何将数据传递给 TopicQueue 触发方法?如果我做错了什么,有人可以为我指出吗?

【问题讨论】:

    标签: logging laravel laravel-4 queue


    【解决方案1】:

    你需要改变

    Log::info('This is from the worker thread . The data array is = '.var_export($data));
    

    Log::info('This is from the worker thread . The data array is = '.var_export($data, true));
    

    【讨论】:

    • 工作.. 谢谢.. 不幸的是我现在不能接受.. 我被要求等待 9 分钟。再次感谢!
    猜你喜欢
    • 2015-02-25
    • 2021-03-22
    • 2018-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多