I was fortunate to get into the going-to-the-gym habit about 5 years ago after I had both of my knees replaced. I was so thrilled to be able to walk and shop and work in the garden without pain that I wanted to make sure my legs and hips stayed strong. I also added cardio and upper body workouts to my routine.
I also analyzed my past failures at regular exercise. The first thing to make me stop was bad weather, so the gym is perfect. 68 degrees year round and no rain or snow inside.
The second thing was boredom. Well, there are so many things to do at the gym it's pretty hard to get bored. You can even walk around the track a few times to get a mile or two in.
The only piece of exercise equipment I owned that I really liked was a ski machine (not sure if it's really called that, but you move your arms and legs without picking them up.) I had to quit that when my right side started really hurting. I blamed the machine, but it was really my right knee that had gone bone-on-bone that was causing the problem. Wish I had not got rid of the thing!