Evaluate an improper integral involving log Studying for complex analysis, I stumbled upon this problem. Evaluate
$$\int_{0}^{\infty} \frac{\log(1+x^2)}{1+x^2}~dx.$$
So the integrand suggests that I need to use the function $f(z)=\frac{\log 1+z^2}{1+z^2},$ which has two branch points and two simple poles at $z=i$ and $z=-i,$ which lead me to use a semi-circle contour in the right-halfplane having branch cuts at $i$ and $-i.$ But then the process become too lengthy. Is there any other method to go by doing the problem. I was thinking of making a substitution and reducing this to a form to use Gamma function, but wasn't successful. Any help is appreciated. 
 A: 
Here is a straightforward methodology that relies on "Feynman's Trick" for differentiating under the integral sign.  We proceed as follows.

First, let $I(a)$ be the integral defined by
$$\bbox[5px,border:2px solid #C0A000]{I(a)=\int_0^\infty \frac{\log(a+x^2)}{1+x^2}\,dx} \tag 1$$
where $I(1)=\int_0^\infty \frac{\log(1+x^2)}{1+x^2}\,dx$ is the term of interest.
Second, differentiating under the integral sign yields 
$$\begin{align}
I'(a)&=\int_0^\infty \frac{1}{(a+x^2)(1+x^2)}\,dx\\\\
&=\frac{1}{1-a}\int_0^\infty \left(\frac{1}{a+x^2}-\frac{1}{1+x^2}\right)\,dx\\\\
&=\frac{\pi}{2}\frac{1}{\sqrt{a}(\sqrt{a}+1)} \tag 2
\end{align}$$
Third, integrating $(2)$ reveals that $I(a)=\pi \,\log(1+\sqrt{a})+C$.  Then, since $I(0)=0$, which can be seen easily by enforcing the substitution $x\to 1/x$ in $(1)$, $C=0$ and $I(a) =\pi\,\log(1+\sqrt{a})$.  
Finally, we find that $I(1)=\pi \,\log(2)$ and hence

$$\bbox[5px,border:2px solid #C0A000]{\int_0^\infty \frac{\log(1+x^2)}{1+x^2}\,dx=\pi \, \log(2)}$$

in agreement with the result reported by @jackd'aurizio.
A: Your intuition is correct: it is not difficult to compute such integral through a real-analytic method that involves differentiation under the integral sign and Euler's beta function (so $\Gamma$ function, too).
$$ \int_{0}^{+\infty}\frac{\log(1+t^2)}{1+t^2}\,dt = \left.\frac{d}{d\alpha}\int_{0}^{+\infty}(1+t^2)^{\alpha-1}\,dt\right|_{\alpha=0^+} \tag{1}$$
and by setting $t=\tan\theta$ we have
$$ I(\alpha) = \int_{0}^{+\infty}(1+t^2)^{\alpha-1}\,dt = \int_{0}^{\pi/2}\frac{d\theta}{\cos^{2\alpha}(\theta)}=\frac{\sqrt{\pi}}{2}\cdot\frac{\Gamma\left(\frac{1}{2}-\alpha\right)}{\Gamma\left(1-\alpha\right)}.\tag{2}$$
In order to compute $I'(\alpha)$, we may exploit
$$ I'(\alpha)=I(\alpha)\cdot\frac{d}{d\alpha}\log I(\alpha),\qquad \frac{d}{dx}\log\Gamma(x)=\psi(x)\tag{3} $$
leading to:
$$ I'(\alpha) = -I(\alpha)\cdot\left[\psi\left(\frac{1}{2}-\alpha\right)-\psi(1-\alpha)\right],\qquad I'(0)=-\frac{\pi}{2}\cdot\left[\psi\left(\frac{1}{2}\right)-\psi(1)\right]\tag{4}$$
At least, the identity
$$ \sum_{n\geq 0}\frac{1}{(n+a)(n+b)}=\frac{\psi(a)-\psi(b)}{a-b}\tag{5}$$
proves that $\psi\left(\frac{1}{2}\right)-\psi(1)$ is related with a simple series whose value is $-2\log 2$.
Putting all together,
$$ \int_{0}^{+\infty}\frac{\log(1+t^2)}{1+t^2}\,dt = \color{red}{\pi\log 2}.\tag{6} $$

This is clearly not the simplest or fastest method, I went through it just to demonstrate its power and flexibility. The fastest method here is probably to directly set $t=\tan\theta$ and deduce $(6)$ from the symmetry of the integrand function or from a well known Fourier series. That technique was showed on MSE many times.
A: $\newcommand{\angles}[1]{\left\langle\,{#1}\,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
\color{#f00}{\mathscr{I}} & =
\int_{0}^{\infty}{\ln\pars{1 + x^{2}} \over 1 + x^{2}}\,\dd x
\,\,\,\stackrel{x\ =\ \tan\pars{\theta}}{=}\,\,\,\
\overbrace{-2\int_{0}^{\pi/2}\ln\pars{\cos\pars{\theta}}\,\dd\theta}^{\ds{=\ \color{#f00}{\mathscr{I}}}}\ =\
\overbrace{-2\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta}
^{\ds{=\ \color{#f00}{\mathscr{J}}}}
\end{align}

\begin{align}
\color{#f00}{\mathscr{I}} & =
{\color{#f00}{\mathscr{I}} + \color{#f00}{\mathscr{I}} \over 2} =
-\int_{0}^{\pi/2}\bracks{\ln\pars{\cos\pars{\theta}} + \ln\pars{\sin\pars{\theta}}}\,\dd\theta =
-\int_{0}^{\pi/2}\ln\pars{\sin\pars{2\theta} \over 2}\,\dd\theta
\\[5mm] & =
\half\,\pi\ln\pars{2} - \half\int_{0}^{\pi}\ln\pars{\sin\pars{\theta}}\,\dd\theta
\\[5mm] & =
\half\,\pi\ln\pars{2} - \half\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta -
\half\int_{\pi/2}^{\pi}\ln\pars{\sin\pars{\theta}}\,\dd\theta
\\[5mm] & =
\half\,\pi\ln\pars{2} - \half\int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta -
\half\int_{-\pi/2}^{0}\ln\pars{-\sin\pars{\theta}}\,\dd\theta
\\[5mm] & =
\half\,\pi\ln\pars{2} - \int_{0}^{\pi/2}\ln\pars{\sin\pars{\theta}}\,\dd\theta =
\half\,\pi\ln\pars{2} + \half\,\color{#f00}{\mathscr{I}}
\\[5mm] & \imp\quad
\color{#f00}{\mathscr{I}} =
\int_{0}^{\infty}{\ln\pars{1 + x^{2}} \over 1 + x^{2}}\,\dd x =
\color{#f00}{\pi\ln\pars{2}}
\end{align}
