If your dog whines when you leave, loiter outside the closed door and listen for a while. Or, if in doubt, ask the neighbors what happens after you're gone.
If the dog whines but soon quiets and settles down to sleep, then your work is done. He's already learned that crying isn't rewarded (you don't come back) and after a brief whinge, he stops. This is an acceptable state of affairs because interfering could backfire badly and make him cry more.
However, the alternative scenario is the whine is just the beginning, and after you are gone the whine gets louder and crescendos into a full-scale howl or bark. You wouldn't be the first pet parent who has a dog that suffers from anxiety in your absence and makes a noise in order to call you back to end the isolation.
This is a worry for the wellbeing of your best buddy, but it's also bothersome to those in adjoining apartments. To keep the peace, you need to know how to train your dog not to whine when you leave.
You can teach a dog the "Quiet" command, but this may only quiet him while you leave and after you're gone he may resume barking. Instead, it's best to create a new way of being alone where the root cause of the whining is addressed by teaching the dog to be content when alone.
This can be difficult to do since the behavior may be deeply ingrained and, in some cases, prescription medication from the vet may be necessary. However, if the dog has merely gotten into bad habits, then there are steps that will quiet him.
Be aware that accidentally rewarding the whining will reinforce the behavior. Thus it's important to ignore the dog when he makes noise, so he learns it is of no benefit to him. The other side of the coin is to respond and praise the dog when he is being actively quiet, so he learns this is a good thing to do.
Some dogs learn to deal with separation better when crate trained. If your dog is otherwise calm then consider this. However, if your dog's whining spirals into chewing and destructive behavior when you're gone, he may become unduly distressed by being confined and it may make matters worse. If in doubt, consult a qualified animal behaviorist.
Get set for success by equipping yourself with the following: