0

I've a application launched by bash script. I redirected stderr and stdout to different files:

./app >> /home/user/logs/debug.log 2>>/home/user/logs/debug.err &

And I need to add a timestamp for stderr lines. How I can do it?

crossmax
  • 346
  • 3
  • 20

1 Answers1

3

check this out

./app >> /home/user/logs/debug.log 2> >( while read line; do echo "$(date): ${line}"; done > /home/user/logs/debug.err )
Derviş Kayımbaşıoğlu
  • 28,492
  • 4
  • 50
  • 72