Mautic Community Forums

Adding info to log files and not overwriting

My Mautic version is: 2.15.2
My PHP version is: 7.2.19

I’m using for example “…domain.com/public_html/mautic/segments_update.log 2>&1” command to put the output of the cronjob to the log. The problem is that every time the cronjob is run, the output of the job is written over the old one, so I can’t see if past jobs were ok. Is there a way to add the outputs to the existing ones and not to overwrite them?

One more log related side question:
I’ve added a command to create cronjob “email:send” log file, but it’s empty all the time. Can this be related to that I am using my php mail at the moment as I am still testing my Mautic setup? Or should I look for problems elsewhere? The emails are being sent.

Thank you :+1:

A quick search yielded this thread: https://serverfault.com/questions/499054/getting-cron-logs-to-add-to-file-not-override-it/499055 which should answer part 1.

In regards to the second question, are you sending emails immediately or using the queue? Are you using the : in the filename? If so that might cause an issue.

Thank you for your reply.

thank you, it seems that your search skills are better than mine :blush:

I am sending in queue. The logging functionality by itself is working ok, cause when I turn the queue off, I’m getting an output message “Mautic is not set to queue email” to my log file every time the email:send cronjob is executed… and then I turn the queue on again, I get no output message again

What output do you get if you run it at command line? That might give you an indication as to what you might expect to see. Not sure what is actually output in the email send cron myself!

it’s the same. If I run a script on a command line, I get no output to my email_send.log and a normal output to a corresponding logs if I run every other script

that means you did not sey up cron jobs properly

what do you mean? I do send and receive the email on time indicated by my cronjob. And do get the output to email_send.log if I change from queued to immediate my email sending settings. I just don’t get any log output if I use queue.

I also ran email:send command directly from command line (not by the help of a script as in case above) and do not get any output on terminal screen either. The email is being sent.