user796443
user796443

Reputation:

php(exec) - how do I add a new line to a generated log file?

Consider:

exec("php gmail-smtp.php >> basic-email-template/debug-mailer.log");

I want to log file messages to start on a new line. But I cannot find relevant information about Bash pipes.

Upvotes: 0

Views: 214

Answers (2)

Alma Do
Alma Do

Reputation: 37365

The problem could lie inside your log file. I.e., you're using >> correctly.

The single line in the result file could be because your logger gmail-smtp.php is writing log entries as a single line (without a line-break delimiter). Check that first.

Upvotes: 0

Soundz
Soundz

Reputation: 1300

I can't give you the right answer according the way you do it, but just do this:

file_put_contents('basic-email-template/debug-mailer.log', "\n", FILE_APPEND)

Upvotes: 1

Related Questions