Theorem: Let $y<x$ be real numbers, and let $f:[y,x]\rightarrow \mathbb{R}$ be a monotone function, then we know that $$\sum_{n\in \mathbb{Z}:y\leq n\leq x}f(n)=\int_y^xf(t)\,dt+O(|f(x)|+|f(y)|)$$.
Prove that $$\sum_{1\leq n\leq x}\log(n)=x\log x -x+O(\log (2+x)),$$ or more generally $$\sum_{1\leq n\leq x}\log^k(n)=xP_k(\log x)+O_k(\log^k (2+x)),$$ where $P_k(t)$ is a polynomial with leading term $t^k$ for $k=0,1,2,\cdots$.
Hence, or otherwise, prove that for non-negative numbers $k,l\geq 0$, $$\sum_{1\leq n\leq x}\log^k(n)\log^l\frac{x}{n}=xP_{k,l}(\log x)+O_{k,l}(\log^{k=l}(2+x))$$ where $P_{k,l}(t)$ is a polynomial with leading term $l!t^k$.
By the above theorem, we have $$\sum_{1\leq n\leq x}\log(n)=\int_1^x\log t\,dt+O(|\log 1|+|\log x|)$$ $$=[t\log t]_1^x-\int_1^xt\cdot \frac{1}{t}\,dt + O(\log x).$$ $$=x\log x - x +1+O(\log x)$$. But then I don't know how it leads to the big oh error $O(\log (2+x))$. Similarly for the $\sum \log^k n$, I can use integration by parts repeated to get the polynomial term, but i'm not sure how it leads to the big oh error.
For the last sum $\sum \log^k(n)\log^l\frac{x}{n}$, I am not sure how to proceed cuz integration by parts seems to get messy.
Thanks a lot for the help in advance.
For your question about $\log (2+x)$ I answer it in a comment above. For the question about $(\log n)^k(\log x/n)^l$ you are forgetting one of your logarithm properties:)