rabol's avatar
Level 14

Why does \Log not work in Jobs

Hi

What can I do to log actions or error in jobs?

I use \Log::Info() but nothing is logged

0 likes
8 replies
oliverbusk's avatar

I believe you need to change the jobs to run from async to synchronized.

QUEUE_DRIVER=sync

ronon's avatar

\Log::info(); Log::debug() are working in jobs. Make sure that if you use Linux that your files have the same owner as the webserver is running under, e.g. www-data.

It doesn't has to do with what for a QUEUE_DRIVER you're using

rabol's avatar
Level 14

@RONON - I'm using homestead so I assume that it is www-data, I will give it a try

rabol's avatar
Level 14

Changing owner did not solve the issue

Snapey's avatar

Are you are talking about jobs that are run by cron or by supervisor?

rabol's avatar
Level 14

@SNAPEY - Job is run by Supervisor - but even if i start the worker from command line, Log is not working

Snapey's avatar

if you start it from the command line then it uses whatever account you are logged in as. this account might not have write access if the logfile is owned by www-data and permissions are 644

rabol's avatar
Level 14

@SNAPEY - After a good night's sleep, I doubled checked all configuration and ensured that Supervisor was properly restarted - Now it works.

Lessons learned: Make sure that Supervisor is 'restarted' correctly, otherwise it does not pick up any code changes

2 likes

Please or to participate in this conversation.