Crate training is one of the most powerful methods of teaching obedience to a new puppy. A crate provides a dog with a safe place to spend the night, and helps you to keep the puppy out of trouble while out of the house or during the night. Most dogs will not urinate in their crates -- a dog using the restroom in a crate is indicative of some sort of issue with the training process or dog.
Timing
Healthy, normal dogs will not urinate where they sleep. If your dog is using the restroom in his crate, the first thing to consider is the duration of his stays. Young puppies need to be let out every couple of hours -- a good rule of thumb is two months of life equals about one hour of holding it. If your pup is stuck in his crate for longer than he can hold his pee, he will have no choice but to go. Try taking the dog out more frequently and see if that resolves the problem.
Crate Size
The reason crate training works is that it provides a small, safe space for the dog to rest. A properly sized crate provides the dog with enough room to walk in, turn around, and lay down. If the crate is too large, puppies may use one corner of it as a restroom. It makes sense to purchase a crate that will be large enough for your pup when he grows up, but blocking off extra space (many crates come with a removable spacer) could prevent future accidents.
Health Problems
If you are taking your puppy out frequently and his crate is the correct size but accidents are still occurring, it is possible that he is experiencing some sort of medical or psychological issue. In these circumstances, it is always best to get the opinion of a veterinarian to ensure the problem isn’t health related. Trouble with housetraining can be hints toward a number of mental or physical issues, and you will need the help of a vet to resolve them.
Puppy Mill Puppies
There is one major complication with crate training when it comes to a very specific type of dog: Puppy mill puppies. These dogs, often found in local pet stores, are raised in terrible conditions in which they pee and defecate in cages without bottoms. Because they never learn to leave their sleeping area to use the restroom (a behavior normally taught by the mother), they will often use the restroom without even seeming aware of it. Crate training a puppy mill puppy is possible, but incredibly difficult and will take far more time than training a puppy that was raised by its mother or a reputable breeder.