Early detection and avoidance are the best way to deal with strainers. Be very aggressive in steering clear of strainers. If you come across a strainer that can't be safely avoided, ram your boat ashore upstream if possible and get out. If swimming with your boat and it looks like you can't safely steer the boat away from the strainer, push off the boat and swim quickly away from the strainer.

Assuming you can't avoid the strainer, the typical defensive swimming approach - feet downstream with a back stroke will not work. Once your feet go under the strainer, the rest of your body will do the same. The best approach is to face downstream in an american crawl, swim aggressively towards the strainer, launch/push your body over the log and kick hard to get the bottom half over the strainer. Sometimes you can climb a strainer pile if there are a number of decent hand and foot holds. Do whatever you can to prevent any part of your body going under the strainer. In the ACA SWR class, we practice this technique with an artificial PVC pipe strainer. Here is an excellent video demonstration of this drill: Strainer Drill.