PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, February 4, 2022

[FIXED] Output data on the console from Laravel Controller

 February 04, 2022     laravel, php     No comments   

Issue

I have a following snippet code in a Controller: echo 'something';

So, I need to show it on console listener that I created with:

tail -f storage/logs/laravel.log

I've tried so many things:

\Log::info('info');
\Log::warning('warning');
\Log::error('error');
\Log::debug('debug');

error_log('something log');

I have configured AppServiceProvider.php

    public function boot()
    {
        //
        error_reporting(E_ALL & E_NOTICE);
    }

In config/app.php, I have: 'debug' => env('APP_DEBUG', true),

Nothing works!

What else do I need to do?


Solution

Finally, I found a solution.

I'm using AWS and some logs are in /var/log/nginx.

I entered the folder and there's many file as prefix "error_log", one for each application.

So, I did: sudo tail -f error_log_myapplication.log to open console listener.

Then, I wrote error_log('my message') in Controller and call my request.

That's it!



Answered By - jbernardo
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing