I'm use redirect to logging
println operation output to a
xxx.log file. But I want move the log info to a separate file with name of current days date, such as
2017-08-18.log by crontab.
I have attempt use
> xxx.log shell command to clear the
xxx.log file, but all content recovery when a new log generate.
How to clear the redirect log file?
- After I'm execute
> xxx.log, the
xxx.logfile's size is 0.But if my application print some new log, the
xxx.lognot only contains the new log info but also contains the former cleared log info.
- After use
mv xxx.log xxx2.log, new log info will write to
xxx2.log.But if I use
rm xxx.loginstead of rename, the log action will stop. Besides, the process invoked by
nohup java -jar xxx.jar > xxx.log 2>&1 &if you familiar with playframework, the execute file build by a
distcommand to generate the jar file.
ps wx|grep "xxx.*.logoutput:
3912 pts/10 S+ 0:00 grep --color=auto xxx.log
26234 pts/10 Sl 0:16 /usr/lib/jvm/jdk1.8.0_111/bin/java -Duser.dir=...something ignored... play.core.server.ProdServerStart(it's the process execute command)
Hope it will be helpful, thanks again!