Dove viene output Forever Store.log?
Domanda
Ho installato per sempre e sto usandolo, trovandolo abbastanza divertente.
Ma ho capito che i tronchi sono posti da qualche altra parte.C'è qualche suggerimento?
Soluzione
Forever prende le opzioni della riga di comando per l'output:
-l LOGFILE Logs the forever output to LOGFILE
-o OUTFILE Logs stdout from child script to OUTFILE
-e ERRFILE Logs stderr from child script to ERRFILE
.
Ad esempio:
forever start -o out.log -e err.log my-script.js
.
Vedi qui per maggiori informazioni
Altri suggerimenti
Forever, per impostazione predefinita, inserirà i registri in un file casuale nella cartella ~/.forever/
.
È necessario eseguire forever list
per visualizzare i processi in esecuzione e il loro file di registro corrispondente.
Output del campione
>>> forever list
info: Forever processes running
data: uid command script forever pid logfile uptime
data: [0] 6n71 /usr/bin/node app.js 2233 2239 /home/vagrant/.forever/6n71.log 0:0:0:1.590
.
Tuttavia, è probabilmente il migliore specificare con -l
come menzionato da Bryanmac.
Se si esegue il comando "Forever Logs", è possibile visualizzare dove sono i file di registri.
prova il comando
> forever logs
.
o
> sudo forever logs
.
Otterrai la posizione del file di registro
Questo ha funzionato per me:
forever -a -o out.log -e err.log app.js
. Need to do normal
forever start script.js
to start, and to check console/error logs use
forever logs
this will print list of all logs being stored by forever
and then you can use tail -f /path/to/logs/file.log
and this will print live logs to your window. hit ctrl+z to stop logs print.
It is a old question but i ran across the same issues. If you wanna see live output you can run
forever logs
This would show the path of the logs file as well as the number of the script. You can then use
forever logs 0 -f
0 should be replaced by the number of the script you wanna see the output for.
Help is your best saviour, there is a logs action that you can call to check logs for all running processes.
forever --help
Shows the commands
logs Lists log files for all forever processes
logs <script|index> Tails the logs for <script|index>
Sample output of the above command, for three processes running. console.log output's are stored in these logs.
info: Logs for running Forever processes
data: script logfile
data: [0] server.js /root/.forever/79ao.log
data: [1] server.js /root/.forever/ZcOk.log
data: [2] server.js /root/.forever/L30K.log
You need to add the log destination specifiers before the filename to run. So
forever -e /path/error.txt -o /path/output.txt start index.js
Based on bryanmac's answer. I'm just saving all logs into one file and then reading it with tail. Simple, but effective way to do this.
forever -o common.log -e common.log index.js && tail -f common.log
By default forever places all of the files it needs into /$HOME/.forever. If you would like to change that location just set the FOREVER_ROOT environment variable when you are running forever:
FOREVER_ROOT=/etc/forever forever start index.js