Why are bugs attracted to light bulbs but not flames?
It has nothing to do with temperature, but with the color of the light. Insects are especially attracted to lights with short wavelenghts, especially Ultraviolet (UV) light. Yellow and red light attract far less insects. (Rich &amp; Longcore 2006). PDF

White light, like the one emitted by an average light bulb, consists of a broad spectrum, that includes UV. Halogen lights also emit UV. Flames on the other hand emit mostly red and yellow light.   

Unless the flames burn at a very high temperature, then the flames turn blue. To illustrate this, my parents used to have a candlelight on gas they used during camping. This light burnt at a very high temperature, and hence the flame had a bluish color. And it did attract insects, especially moths.