Onde é que o para sempre de armazenamento do console.registo de saída?
Pergunta
Eu instaladas para sempre e estou usando-o, achando muito engraçado.
Mas eu percebi que os registros são colocados para algum lugar.Existe alguma dicas?
Solução
Para sempre assume o comando opções de linha de saída:
-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
Por exemplo:
forever start -o out.log -e err.log my-script.js
Ver aqui para mais informações
Outras dicas
Para sempre, por padrão, será colocar os logs em um arquivo aleatório em ~/.forever/
a pasta.
Você deve executar forever list
para ver os processos e seus correspondentes arquivo de log.
Exemplo de saída
>>> 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
No entanto, é provavelmente melhor para especificar com -l
como mencionado por bryanmac.
Se você executar o comando "Forever Logs", poderá ver onde estão os arquivos de logs.
tente o comando
> forever logs
ou
> sudo forever logs
você vai ter o arquivo de log do local
Isso funcionou para mim :
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