How to use the Prime Number Theorem in order to prove Selberg's Formula?

The $O(x)$ term can be refined by completely elementary means that are not at all complicated. Filip Saidak (On the prime number lemma of Selberg, Math. Scand. 103 (2008), no. 1, 5–10) proved a much clearer connection between Selberg's result and the prime number theorem. He stated this for $\psi(x) = \sum_{n\leq x}\Lambda(n)$, but this holds with trivial modifications for $\vartheta(x)=\sum_{p\leq x}\log p$.

If $\vartheta(x):=\sum_{n\leq x}\Lambda(n) = x + E(x)$, then

$\vartheta(x)\log x + \sum_{p\leq x} (\log p)\vartheta(x/p)=2x\log x -(2\gamma+1)x+O(E(x)(\log x)^2)$,

where $\gamma$ is the Euler-Mascheroni constant. So if all that you know is that $E(x) = o(x)$, then you cannot recover Selberg's result. Selberg's breakthrough that $-(2\gamma+1)x+O(E(x)(\log x)^2) = O(x)$ appears to be equivalent to the stronger estimate $E(x) \ll x/(\log x)^2$.


Edit: Answer to GH from MO by author.

Edit2: Changed a sign.

Let $$l(n)=\left\{\begin{array}{11} \log p, & if\ n = p\ prime \\ 0, & else. \end{array}\right.$$ Then $$\sum_{pq\leq x}(\log p)(\log q)=\sum_{n\leq x}(l\ast l)(n)$$ So far, so good. However, using Dirichlet's hyperbola identity, I only obtain $$\sum_{n\leq x}(l\ast l)(n)=2\sum_{p\leq x^\frac{1}{2}}(\log p)\vartheta(\frac{x}{p})-\vartheta(x^\frac{1}{2})^2 $$, where obviously $\vartheta(x^\frac{1}{2})^2=O(x)$.

Thus I am back at my original problem, as I would have to show $$\sum_{p\leq x^\frac{1}{2}}(\log p)\vartheta(\frac{x}{p})=\frac{1}{2}x\log x+O(x)$$

Where do I fail to see the shortpath? Thanks for answering anyways, appreciate it!