There are a lot of opinions about this one.
So at the risk of sparking a long thread on the subject I will tell you of my experience and method.
NEVER use petrol (gasoline). Whilst it will clean the metal surfaces very quickly, it will eat the rubber O rings in days.
I've never used WD 40 as a chain cleaner, but I know people that do.
I use kerosene on a rag as well as an old toothbrush and wash it off with water, run the bike in gear on the center stand to dry it, then spray on chain lube. I've done this for years about once a fortnight and regularly get 20k - 25k per chain and sprockets.
I've recently discovered Liquid Lanolin. It doesnt contain harsh solvents so I use that instead of WD 40 for all sorts of applications including applying to threads to prevent corrosion & freezing. It works well for cleaning the chain as well.
Hope this helps,
Brett.