4. Given the function
$$
y=f(x)=\log _{a+2}\left[a x^{2}+(a+2) x+a+2\right] \text {. }
$$

If $f(x)$ has a maximum or minimum value, then the range of values for $a$ is . $\qquad$
$$
\begin{array}{l}
4 .(-2,-1) \cup(-1.0) \cup\left(\frac{2}{3},+\infty\right) \text {. } \\
\text { Let } a(x)=a x^{2}+(a+2) x+a+2 \text {. } \\
\end{array}
$$

Considering the possible values, we find that the solution is $a>\frac{2}{3}$.
Solving, we get $-2<a<0$. However, for $-1<a<0$, we have $1<a+2<2$, so $y=f(x)$ is decreasing in this interval.