In analytic number theory, for example as in ternary Goldbach problem via circle method, when one has to deal with exponential sums over primes often people use von Mangoldt function or log weight. In other words, instead of $$ \sum_{p < X}e^{2 \pi i f(p)} $$ one considers $$ \sum_{n < X} \Lambda(n) e^{2 \pi i f(n)} $$ or $$ \sum_{n < X} \log (n) 1_{\mathbb{P}}(n) e^{2 \pi i f(n)} $$ where $1_{\mathbb{P}}$ is the characteristic function on the primes and $f$ is a polynomial with integer coefficients.

Is the reason for introducing these log weights only so that certain computation becomes less messy? or are there cases where introducing such weights was actually crucial? [are there even some philosophy behind this maneuver?]

Thank you very much!