"Recently I caught my dog peeing in the house. He's never done this before, what's going on?"
Dogs do this for any number of reasons. If he has been properly house-trained he should not be doing this. He might have UTI (Urinary Tract Infection), in which case the vet should be your first stop, or he might be scent marking.
"What is scent marking?"
Scent marking is a completely natural thing for your dog to do. By peeing somewhere he leaves his scent telling other dogs that this is his territory. Remember that a dog's sense of smell is much better than our own, so for him a scent marked spot is a very interesting place, while to us it just smells like dog pee!
"Do all dogs do this?"
Yes, they do. Some dogs are more likely to do so than others, males more than females, small dogs more than larger dogs, and so on. Two or more dogs in the same house may regard each other as competition and are then more prone to marking. Small dogs are also more likely to pee inside the house in general.
"Okay, I understand what marking is, but why is he doing it in the house?"
Your dog might be struggling with confidence problems, any sudden change in his home environment can trigger this behavior. For instance; the arrival of a new baby may mean that your dog is now not getting as much attention as previously. Changes such as this engender anxiety, and may cause marking behavior.
"What can I do about it? I want him to stop!"
Firstly, clean any spots where he has peed very well, using a 50/50 solution of water and vinegar. Don't use ammonia - you'll only encourage him! Unless you clean the spots well, it is impossible to stop the dog peeing in the house.
Secondly, don't rant and rave at him. You'll make the problem worse by eroding his confidence further.
Thirdly, observe him closely for a few days and when you see him looking for a place to mark distract him. You could build a shaker can (a soda can with a few coins in it that makes a rattling noise) and use this to distract him. When you have his attention play with him, or take him outside. You could even say "NO PEE" sternly when you see him getting ready. The distraction will be enough to stop your dog peeing in the house, at least until you can take him to a place where he IS allowed to pee. Remember to praise him lavishly when he does so. Dogs learn by positive reinforcement.
Fourthly, be consistent in your approach. You don't want to confuse him.
"He's not ill, and I don't think he's marking. What now?
If he's not ill, and he's not marking, it means that he really needs to pee during a time when he can't get out. Make sure you give him ample time to pee before going to sleep, and don't let him drink too much right before bedtime.