Unfortunately, those things violate Family Law and State and Federal Criminal laws, and their results are inadmissible in a Family Law case, so I can't recommend that you use a keylogger or that you record your wife's phone conversations, even with you.
Please note that this answer does not constitute legal advice, and should not be relied on, as each situation is fact specific, and it is not possible to evaluate a legal problem without a comprehensive consultation and review of all the facts and court pleadings filed in the case. This answer does not create an attorney-client relationship.
In short: it's illegal and don't do it. California Penal Code 502(c)(2) makes it a misdemeanor to access computer or other electronic data without permission. This includes keylogging. Nothing you would garner would be admissible anyway. In addition, California is a no-fault state. That means it doesn't make any difference if your spouse was cheating on you or not.
If you really need to know if she is cheating before you get divorced--if you have a joint cell phone plan, read the bill. Look at the phone numbers and times. You should be able to figure it out from that. However, 9 times out of 10--if a spouse thinks the other is cheating, they probably are.
Best of luck.
Cameron Norris, Esq. of the Law Office of Gary W. Norris can be reached at (805) 482-1170 or at firstname.lastname@example.org. This and other interactions through Avvo do not constitute an attorney-client relationship and are made for informational purposes only. No guarantees are made.