A logarithmic derivative lemma in several complex variables and its applications