Are there exception cases when you are bringing an exponent out of a logarithm? The domain of a logarithm $\log(x^2)$ 
is  $D:x\in(-\infty,0)\cup(0,\infty)$.
But if I use the identity $\log(a^b)=b\log(a)$
and do: $\log(x^2)=2\log(x)$
the domain becomes $D: x\in(0,\infty)$
The two are aparently not the same even though they are identity.
Am I missing something?

The identity 
$$\log(a^b)=b\log(a)$$
only holds when $a$ is positive. Thus, you can only use the identity on half of the domain, on the other half of the domain you have to keep it as $\log(x^2)$.
If you want to use the identity on the entire domain, note that $x^2=|x|^2$. Therefore
$$\log(x^2)=2 \log |x| $$
which doesn't lead to any issue anymore.
