I looked at commercially available track cleaners such as the LUX vacuum and motorized cleaner cars but they seemed pretty expensive. I had heard about a product from Noch (60157) that clips onto the axles of the rolling stock and drags a small cleaning pad along the rails. I ordered a pack of 5 ($8) and put the cleaners onto my trains and ran them around a bit. The pads did start getting dirty.
I decided this was probably going to be a bit slow and decided to wipe the rails by hand with cloths. Trouble with that is that sharp rail joints tend to go right through the cloth and injure the fingers. Next I decided to make a block of wood to place in the cloth to protect the fingers. Then I decided it would work better if I cut the block so that there were small ridges that fitted into the rail so I made one and tried it with the cloth. It was a bit too tight and I was about the cut it down some more when I tried it without the cloth. To my surprise it worked really well without the cloth! Thus was born the Crud-B-Gone cleaner. Since a bunch of train friends were going to be visiting my layout this month I decided to make a batch of them and give each visitor one.
The cleaner is made out of pine wood and needs to be machined to have just the right size grooves to fit into the rail such that it does not touch the center studs, ties and trackside items. All 4 edges are machined and the short ends are used for cleaning curves.
I find it very easy to push it along the track, even in areas that are difficult to reach. Since the track guides the cleaner along it is possible to rub it up and down along stretches of track that cannot be seen.
I have now cleaned the entire layout as well as all the wheels of the trains currently on the layout. I can no longer get a dirty finger from the rails. I have left the Noch cleaners on the trains since they can do no harm.