First of all, the sensor for sensing the teeth on a steel gear is CHEAP. You can roll your own. It's nothing more than a bar magnet with several hundred turns of fine wire wrapped around it. A few dips in shellac and a good coating of epoxy will give it good environmental protection.
If all you need to sense is a full rotation of the shaft, it shouldn't be a problem. It's rare to find a shaft that doesn't have some periodic abberation in its rotation, whether a flat or a setscrew. Or you can attach a magnet.
If you need incremental shaft information, that's a different story. But how can setting up all those ring magnets be easier in the long run than slipping a commercially-made gear on somewhere along the shaft?
Now, if you need absolute position information even when the shaft is stationary, you will need either optoelectronic or Hall-effect sensors. Opto is usually ruled out in dusty environs. I was going to help a guy add a lot of electronics to his big sawmill and was working around that problem, but he died before the project really got started, so I didn't mess around with it anymore. He was wanting to replace the limit switches that he was using because they wouldn't adjust for creep in the hydraulics. It didn't take me but a few microseconds to realize that opto wasn't going to work unless everything was enclosed, which made everything a lot more expensive, mechanically.
Dean