Answer
$f\circ g(x)=\log(x^{2}),\qquad(-\infty,0)\cup(0,+\infty)$
$ g\circ f(x)=[\log x]^{2},\qquad(0,+\infty$)
Work Step by Step
Restriction on the domain for logarithmic functions:
argument must be positive.
$ f\circ g(x)=f(g(x))=\log$(g(x))=$\log(x^{2}),$
Restriction$:\quad x^{2}>0$
Squares are nonnegative so
we write the restriction as $x\neq 0$
domain$=(-\infty,0)\cup(0,+\infty)$
$g\circ f(x)=g(f(x)=[f(x)]^{2}=[\log x]^{2}$
restriction$:\quad x>0$
domain=$(0,+\infty$)