D
D
Dwellss2021-11-29 01:00:19
linux
Dwellss, 2021-11-29 01:00:19

How to display the log on the screen and save it to a file?

I run the script in the console:
php script.php > log.log

It works, and as it works, it saves the logs to the log.log file Can
I add one more parameter so that everything that is saved to the log is displayed on the terminal screen?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2021-11-29
@Dwellss

man tee
https://en.wikipedia.org/wiki/Tee_(command)#Examples

A
Andrey Barbolin, 2021-11-29
@dronmaxman

It is possible so
php script.php | tee log.log
Or in a separate window run
tail -f log.log
multitail -f log.log

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question