There are three general solutions:
1. a Program which intercepts the TTY and captures input/output for the session
2. Solaris auditing can give you fine-grained detail about this.
3. an LD_PRELOAD module which intercepts library calls to exec. This is provided by a program called snoopy. Read
here for more. It's known to work on Linux and should work with Solaris.