There could be an underlying problem that a vet can determine.
The dog could have crystals in its kidneys.
Male dogs cock their legs to mark their territory. When doing this, they only need to pass a drop. So long as he can pee a good quantity when he merely wants to empty his bladder, this is ok.
A female dog repeatedly trying to pee has likely got cystitis - a bladder infection.
A female dog repeatedly trying to pee has likely got cystitis - a bladder infection.