To find the domain of the function $f(x) = \log_y a$ it's enough to check if the base (y) is greater than 0 and not equals to 1 and the number (a) is greater than 0.
But what if we have a power of the number (e.g. $a^2$)? Should we check if $a^2$ is greater that 0 or if $a$ is greater than 0? We can transform $\log_y a^2$ to $2\log_y a$ so I suppose that second way is correct.
The same method works: check that $y>0$ with $y\ne 1$ and that $a^2>0$.
The transformation (for $a\in \Bbb R$) writes
$$\log_y (a^2) = 2\log_y (|a|).$$