How should I be avoiding this mistake? (To avoid missing solutions)
The formula $$\log_a b^c = c \log_a b$$ is true only if $b > 0$ (if we assume that $\log_a$ is a real-valued function). Therefore, an alternative method of solution can proceed as follows: $$\log (x+2)^2 = 2 \log 5 = \log 5^2 = \log 25,$$ and because now all the arguments to $\log$ on both sides must be positive, we have $$(x+2)^2 = 25$$ or $$(x+2-5)(x+2+5) = (x-3)(x+7) = 0,$$ and both solutions are found.
Rule of thumb when dealing with squares (even powers) if you don't have an absolute value you're most likely missing it.
Here as written in comments $\ln(x^2)=2\ln(|x|)$ because as you said their domains must be the same. This is because $\ln(ab)=\ln a+\ln b$ only if $a,b>0$.
Another example is that $\sqrt{x^2}=|x|$.
Congratulations on understanding why the other solution exists and why you missed it.
How to avoid this:
Whenever you see a real number squared, or raised to any even power, (make sure it's not a complex number that you're dealing with!), perform the following substitution:
$$x^2 \iff |x|^2$$
Note that both expressions are always equal (in real numbers), so it is 100% correct to make this substitution at any time.
Only then, perform your rules.
In other words, never "take the square out" unless it's surrounded by the absolute-value function.
In your example, $(x+2)^2$ would first become $|x+2|^2$, and only then you should proceed as you did, and this way you wouldn't miss any solutions.