Opened applications log
There is an application called Time Sink ($5, free trial available) which can track time spent in an application in the foreground. I believe it also tracks background time too.

For a native and more techy solution, you can run this terminal command:

top -d 5 -b &gt; /var/log/top.txt


This command will run top every 5 seconds as defined by -d, -b is for batch mode and this is used for sending output to a file. You wouldn't want to have this running all the time unless you're compressing the log file or using logrotate, as the log file would get large.