UniqueUsername's avatar

Laravel, Queue & Logging

Hello, I've been assigned to fix a project built by other people who have since left the project. I don't know much about Laravel and its documentation is.... lacking.

We have a Lavavel sync queue, which processes emails. Today I have attempted to feed it with another variable, and then log that variable. When attempting this I receive this error:

Symfony\Component\Debug\Exception\FatalThrowableError: Class 'log' not found in /usr/local/lib/project/app/Jobs/SendGenericEmailJob.php

We are using Laravel's default logger. I have seen others online be able to use the log class from within a queue script no problem?

I have indeed included: "use Log;" up top.

Any discussion on why this is happening & how to fix it would be greatly appreciated. Thanks

0 likes
4 replies
UniqueUsername's avatar

Hey just wanted to thank you @kalemdzievski for being the only person to reply!

We did restart the workers and the entire queue service, didn't help. We never did figure out why we can't log from within a queue script, the simplest fix was to just not log and move on.

Cheers.

trungtranqn91's avatar

What type of log did you used? logger() or \Log::info() or something else?

Please or to participate in this conversation.