A friend of mine constantly battles with himself and his inability to break bad habits. On the one hand, he knows that every breath he takes through the filter of a cigarette is another nail in the coffin. He's more than well aware of the negative repercussions that come about with smoking. Ironically, and under the complete awareness that smoking will kill him, he cannot get enough of it.
So here lies an example of cognitive dissonance - the mental divide caused by opposing thoughts which pull at your sanity. One would surely go mental if we did not do something about this polarization of the mind. Thankfully, we as somewhat logical beings seek one of the two following solutions to this mental anguish. You could try and change those negative habits in your life, or you could rationalize the seemingly unsurmountable flaw in order to maintain any shred of sanity that may still remain when you realize that you're still causing harm to yourself.
The latter is typically what we tend to do, but the goal is to try and be better than that. Most people will seek confirmatory evidence in the hope of rationalizing their misguided actions, all in the hope of continuing what they internally know as something they shouldn't be doing.
Self-awareness is a rare trait amongst people, but an essential one if you are truly seeking to improve yourself. Once you see your flaws for what they truly are, then you can begin to accept that you, like every single human on this earth, are not perfect.
Don't shroud yourself in conscious self-deceit. Deeply, we all know what's harming us, but we have an incredible ability to make the most obviously harmful things seem like they're good for us.