Why it is wrong? (differentiation under the integral sign) Why is it wrong?
$$
\frac{d^2}{dx^2}\int_{-1}^1\log|x-t|dt=\int_{-1}^1\frac{\partial^2}{\partial x^2}\log|x-t|dt=\int_{-1}^1\frac{-1}{(x-t)^2}dt.
$$
 A: Setting
$$
I(x):=\int_{-1}^1\log|x-t|dt,
$$
we have
$$
I(\pm1)=2\log2-2,
$$
and for every $x \in \mathbb{R}\setminus\{-1,1\}$:
$$
I(x)=\left[(t-x)\log|t-x|-t\right]_{-1}^1=(1-x)\log|1-x|+(1+x)\log|1+x|-2.
$$
Clearly
$$
I''(x)=\int_{-1}^1\frac{\partial^2}{\partial x^2}\log|x-t|dt \quad \forall x \in \mathbb{R}\setminus\{-1,1\}.
$$
Furthermore $I$ is not differentiable at $x=\pm1$, and therefore $I''(\pm1)$ does not exist.

Added 
For every $x \in \mathbb{R}\setminus\{-1,1\}$ we have
\begin{eqnarray}
I'(x)&=&\log|1+x|-\log|1-x|=\int_{-1}^1\frac{dt}{x-t}dt=\int_{-1}^1\frac{\partial}{\partial x}\log|x-t|dt\cr
I''(x)&=&\frac{1}{1+x}+\frac{1}{1-x}=\int_{-1}^1\frac{-1}{(x-t)^2}dt=\int_{-1}^1\left(\frac{\partial^2}{\partial x^2}\log|x-t|\right)dt.
\end{eqnarray}
Now the cases $x=1$ and $x=-1$. We just treat the case $x=1$, the other one (i.e. $x=-1$) can be treated in the same manner.
For every $h \ne 0$ we have
\begin{eqnarray}
\frac{I(1+h)-I(1)}{h}
&=&\int_{-1}^1\frac{\log|1-t+h|-\log|1-t|}{h}dt
=\int_0^2\frac{\log|s+h|-\log|s|}{h}ds\cr
&=&\frac{1}{h}\left[(s+h)\log|s+h|-s\log|s|\right]_0^2\cr
&=&\frac{(2+h)\log|2+h|-2\log2}{h}-\log|h|.
\end{eqnarray}
It follows that
$$
\lim_{h \to 0}\frac{I(1+h)-I(1)}{h}=\infty
$$
A: Oh boy... let's try defining the second derivative as a difference quotient:
$$ f''(x) = \lim_{\epsilon \to 0} \frac{f(x+\epsilon) - 2f(x) + f(x-\epsilon) }{\epsilon^2} \text{ where } f(x) = \int_{-1}^1 \log |x-t| dt $$
Now let's try it with your integral:
\begin{eqnarray}\frac{d^2}{dx^2} \int_{-1}^1 \log |x-t| dt &=& \lim_{\epsilon \to 0} \frac{1}{\epsilon^2} \int_{-1}^1 \log \left| \frac{(x-t)^2-\epsilon^2 }{(x-t)(x-t)}\right| dt \\ &=& \lim_{\epsilon \to 0} \frac{1}{\epsilon^2} \int_{-1}^1 \log \left|1 - \frac{  \epsilon^2}{(x-t)^2}\right| dt\end{eqnarray}
As long as $|x - t| > \epsilon$ we can use Taylor approximation $\log (1 - x) = - x + O(x^2)$:
$$  \frac{1}{\epsilon^2} \int_{-1}^1  \frac{  -\epsilon^2}{(x-t)^2} dt 
= \int_{-1}^1  \frac{  -1}{(x-t)^2} dt $$
So $f(x)$ is divergent whenever $x \in [-1,1]$.

In that case, you may wish to consider $f(x \pm i\delta)$
