I think it’s best to exercise outdoors. Having said that, there are some advantages to the gym. I’m on vacation, and have been to the gym 4 of the past 5 days. I can see progress on my performance on the treadmill, doing intervals, just in that time. I felt less tired after the last session, and my heart rate at the end of the last interval was lower on day 5 than on day 1. That’s progress! And I record it on my smartphone.
The same is true to using weights – I record the weight, seat position (I don’t use free weights because of my neck problems), reps – and I’ve seen progress there, too.
I try to schedule my exercise; I try to be active during the day (take the stairs; get up out of the chair every 30 min).