Deriving an asymptotic for $\pi(x)$ directly from $\log \zeta(s)$? Denote by $\pi(x)$ the number of primes $p\leq x$. We generally give approximations for $\pi(x)$ by first approximating $\psi(x) = \sum_{n\leq x} \Lambda(n)$. Part of the reason is presumably that, if we apply Perron's formula directly, without going through $\psi(x)$, we end up with an expression for $\pi(x)$ in terms of an integral involving $\log \zeta(s)$. Here we see what the issue is: $\log \zeta(s)$ has a branch point at $s=1$, and that is unpleasant.
At the same time, it is not that unpleasant; you can do a little loop ("truncated Hankel contour") around $s=1$. Is there a standard reference where $\pi(x)$ is estimated in this way?
 A: A paper of Landau where he uses an integral of $Z(s) := \log \zeta(s)$ against $x^s/s^2$ (not $x^s/s$) was published in 1908 and can be found here. The function $Z(s)$ is introduced on p. 753, a funky contour is drawn on p. 754, and lower down on that page he starts integrating $Z(s)x^s/s^2$ and he converts things into $\pi(x)$ in Section 7.
I found this information in Narkiewicz's book "The Development of Prime Number Theory". Section 6.2 is on Landau's approach to PNT and in part 5 (starting on p. 283) he mentions the above paper:

In the year 1908 Landau gave (Landau 1908d) two new proofs of the Prime Number Theorem in its simplest form, i.e. without giving any evaluation of the error term. The first is similar to the proof presented above but instead of dealing with the the function $\zeta'(s)/\zeta(s)$ Landau considers $Z(s) = \log \zeta(s)$. This necessitates a small modification of the integration path to take care of the essential singularity of the integrand at $s=1$ but the remainder of the argument is carried out along the lines of the preceding proof...

The reference Landau 1908d is the paper I link to above.
A: Certainly Ayoub does it that way (starting on page 65), considering $\int\log\zeta(s){x^s\over s}ds$.
https://archive.org/details/introductiontoan0000ayou
His notes in the Introduction suggest he is following Landau, but I don't think Handbuch does it this way.
A: When $T\le\sqrt x$ and $x=\frac12+\mathbb Z^+$, it is possible to show using Perron's formula that
$$
\pi(x)={1\over2\pi i}\int_{k-iT}^{k+iT}{x^s\over s}\log\zeta(s)\mathrm ds+\mathcal O\left(x\log x\over T\right)
$$
After applying certain analytic properties of $\zeta(s)$ in the critical strip, the task turns into evaluating the following residue integral:
$$
{1\over2\pi i}\oint_{(1+)}{x^s\over s}\log{1\over s-1}\mathrm ds
$$
where $(1+)$ represents any counterclockwise path containing $s=1$ but not $s=0$. A possible approach to handle the integral, inspired by Riemann (see chapter 1 of Edwards's 1974 classic Riemann's zeta function), is to introduce a new parameter $r$ to the problem:
$$
f(r)={1\over2\pi i}\oint_{(r+)}{x^s\over s}\log{1\over s/r-1}\mathrm ds
$$
Taking derivatives on both side gives $f'(r)=x^r/r$, and integrating back we get
$$
f(r)=\operatorname{li}(x^r)+\mathcal O(1)
$$
where $\operatorname{li}(x)$ is the logarithmic integral function. The reason why there is an O-term is because the sign of $\Im(r)$ will introduce certain $i\pi$ deviation to the final result. A full derivation of the PNT using this idea can be found here.
