Proving $\int_0^\infty\frac{\mathrm dw}{(n+w)(\pi^2+(\log w)^2)}=\frac1{\log n}-\frac1{n-1}$ for any positive integer $n\geq 2$
$\def\C{\mathbb{C}}\def\d{\mathrm{d}}\def\e{\mathrm{e}}\def\i{\mathrm{i}}\def\R{\mathbb{R}}\def\peq{\mathrel{\phantom{=}}{}}\DeclareMathOperator{\Im}{Im}\DeclareMathOperator{\Re}{Re}\DeclareMathOperator{\Res}{Res}$A general proposition can be proved by contour integration:
Proposition: Suppose that $f: \C → \C$ is a rational function with poles $z_1, \cdots, z_n \in \C \setminus \R_{\geqslant 0}$, all of which are simple. If $f(∞) = 0$ and $f(-1) ≠ 0$, then$$ \int_0^{+∞} \frac{f(x)}{(\ln x)^2 + π^2} \,\d x = \sum_{k = 0}^n \Res\left( \frac{f(z)}{\ln z - π\i}, z_k \right), $$ where $z_0 = -1$, $\ln z = \ln|z| + \i \arg z$, $\arg z \in (0, 2π)$.
Proof: There exists $g \in \C[z]$ such that $f(z) = \dfrac{g(z)}{\prod\limits_{k = 1}^n (z - z_k)}$, and $f(∞) = 0$ implies that $\deg g \leqslant n - 1$ and $f(z) = O\left( \dfrac{1}{z} \right)$ as $z → ∞$.
Define $h(z) = \dfrac{f(z)}{\ln z - π\i}$ for $z \in \C \setminus \R_{\geqslant 0}$. For $R > \max\limits_{0 \leqslant k \leqslant n} |z_k|$, define the (counterclockwise-oriented) contour $γ_R = γ_{1, R} \cup γ_{2, R} \cup γ_{3, R}$, where$$ γ_{1, R} = \{t \mid 0 \leqslant t \leqslant R\},\ γ_{2, R} = \{R \e^{\i t} \mid 0 < t < 2π\},\ γ_{3, R} = \{t \mid R \geqslant t \geqslant 0\}. $$ Note that for $x \in \R_+$,$$ \lim_{\substack{z → x\\\Im z > 0}} h(z) = \frac{f(x)}{\ln x - π\i},\quad \lim_{\substack{z → x\\\Im z < 0}} h(z) = \frac{f(x)}{\ln x + π\i}, $$ thus\begin{align*} &\peq \int_{γ_R} h(z) \,\d z = \int_{γ_{R_1}} h(z) \,\d z + \int_{γ_{R_2}} h(z) \,\d z + \int_{γ_{R_3}} h(z) \,\d z\\ &= \int_0^R \frac{f(x)}{\ln x - π\i} \,\d x + \int_{γ_{R_2}} h(z) \,\d z + \int_R^0 \frac{f(x)}{\ln x + π\i} \,\d x\\ &= \int_0^R \frac{f(x)}{\ln x - π\i} \,\d x - \int_0^R \frac{f(x)}{\ln x + π\i} \,\d x + \int_{γ_{R_2}} h(z) \,\d z\\ &= 2π\i \int_0^R \frac{f(x)}{(\ln x)^2 + π^2} \,\d x + \int_{γ_{R_2}} h(z) \,\d z. \end{align*} Since the poles of $h$ are $z_0, \cdots, z_n$ and are all simple, by Cauchy's integral formula,$$ \int_{γ_R} h(z) \,\d z = 2π\i \sum_{k = 0}^n \Res(h, z_k). $$ Because $|h(z)| = \dfrac{|f(z)|}{|\ln z - π\i|} \leqslant \dfrac{|f(z)|}{\ln|z|}$, so$$ \left| \int_{γ_{R_2}} h(z) \,\d z \right| \leqslant \int_{γ_{R_2}} |h(z)| \,\d z \leqslant 2πR \max_{|z| = R} |h(z)| \leqslant \frac{2πR}{\ln R} \max_{|z| = R} |f(z)|, $$ combining with $f(z) = O\left( \dfrac{1}{z} \right)$ ($z → ∞$) yields $\displaystyle \lim_{R → +∞} \int_{γ_{R_2}} h(z) \,\d z = 0$. Therefore,\begin{gather*} 2π\i \sum_{k = 0}^n \Res(h, z_k) = \lim_{R → +∞} \int_{γ_R} h(z) \,\d z\\ = 2π\i \lim_{R → +∞} \int_0^R \frac{f(x)}{(\ln x)^2 + π^2} \,\d x + \lim_{R → +∞} \int_{γ_{R_2}} h(z) \,\d z = 2π\i \int_0^{+∞} \frac{f(x)}{(\ln x)^2 + π^2} \,\d x, \end{gather*} which implies\begin{gather*} \int_0^{+∞} \frac{f(x)}{(\ln x)^2 + π^2} \,\d x = \sum_{k = 0}^n \Res(h, z_k) = \sum_{k = 0}^n \Res\left( \frac{f(z)}{\ln z - π\i}, z_k \right). \tag*{$\square$} \end{gather*}
Now return to the question. For $n > 0$ with $n ≠ 1$, by the proposition,\begin{gather*} \int_0^{+∞} \frac{1}{(n + x)((\ln x)^2 + π^2)} \,\d x\\ = \Res\left( \frac{1}{(n + z)(\ln z - π\i)}, -1 \right) + \Res\left( \frac{1}{(n + z)(\ln z - π\i)}, -n \right). \end{gather*} Since\begin{gather*} \Res\left( \frac{1}{(n + z)(\ln z - π\i)}, -1 \right) = \lim_{z → -1} \frac{z + 1}{(n + z)(\ln z - π\i)} = \lim_{w → π\i} \frac{\e^w + 1}{(n + \e^w)(w - π\i)}\\ = \left( \lim_{w → π\i} \frac{1}{n + \e^w} \right) \left( \lim_{w → π\i} \frac{\e^w + 1}{w - π\i} \right) = \frac{1}{n - 1} · (\e^w)'\bigr|_{w = π\i} = -\frac{1}{n - 1}, \end{gather*}$$ \Res\left( \frac{1}{(n + z)(\ln z - π\i)}, -n \right) = \lim_{z → -n} \frac{z + n}{(n + z)(\ln z - π\i)} = \frac{1}{\ln(-n) - π\i} = \frac{1}{\ln n}, $$ then$$ \int_0^{+∞} \frac{1}{(n + x)((\ln x)^2 + π^2)} \,\d x = \frac{1}{\ln n} - \frac{1}{n - 1}. $$