This was an exercise to use the approach here to estimate the sum $\sum_{p_2 \leq x} \log (p_2)^2,$ in which $p_2$ are numbers containing two prime factors (repetitions allowed). $\pi_2(x)$ is the number of $p_2$ not exceeding x.
My question is whether I have done anything illegal in adapting this method. The numbers (below) suggest it works. If someone happens to know the correct form of A(x) that would also be appreciated. (Edit: Landau, Handbuch, p.203. I may be able to fill in the error from this.)
$$\sum_{n\leq x} \pi_{2}(n)(\log(n+1)^2-\log(n)^2)$$
$$= \sum_{n\leq x}\pi_2(n)\frac{2\log m}{m} $$
$$= \sum_{n\leq x}( \frac{n\log\log n}{\log n} + O(A ))(\frac{2\log(n)}{n} +O(\frac{\log(n)}{n^2})) $$
$$= 2\log\log n + O(B) $$
Summing by parts:
$$\sum_{p_2\leq x}\log (p_{2})^2 = \sum_{n\leq x} \log(n)^2(\pi_2(n)-\pi_2(n-1))$$
$$= \log(x)^2\pi_2(x) - \sum_{n \leq x}\pi_2(n)(\log(n+1)^2- \log (n)^2) $$
$$= \log(x)^2(\frac{x\log\log x}{\log x} + O(A) ) - c\log\log x + O(B) $$
$$= x\log x \log\log x - c \log\log x + O(C) $$
So the sum of the squares of the logs of the near-primes less than x is asymptotically
$$\sum_{p_2 \leq x} \log(p_{2})^2 \sim x\log x \log\log x$$
Some numbers: $$ \begin{array}{r|c|c|c} x&(\sum_{p_2\leq x}\log(p_2)^2) / (x\log x\log\log x)\\ \hline\\ 10000 &0.867 \\ 100000 & 0.918\\ 500000&0.941 \end{array} $$