First perform polynomial division with remainder to write
\begin{equation*}
\frac{x^2}{x^2+2x-1}=1-\frac{2x-1}{x^2+2x-1}\text{.}
\end{equation*}
Next, we factor \(x^2+2x-1=(x-\alpha)(x-\beta)\text{,}\) where
\begin{align*}
\alpha \amp = -1+\sqrt{2} \amp \beta\amp =-1-\sqrt{2}\text{.}
\end{align*}
Now perform partial fraction decomposition
\begin{align*}
\frac{2x-1}{(x-\alpha)(x-\beta)} \amp = \frac{A}{x-\alpha}+\frac{B}{x-\beta}\\
2x-1 \amp = A(x-\beta)+B(x-\alpha)\text{.}
\end{align*}
Evaluating the last identity at \(x=\alpha\) and \(x=\beta\text{,}\) we conclude
\begin{align*}
2\alpha-1 \amp = A(\alpha-\beta)\\
2\beta-1 \amp = B(\beta-\alpha)\text{,}
\end{align*}
or equivalently,
\begin{align*}
-3+2\sqrt{2} \amp = 2\sqrt{2}A\\
-3-2\sqrt{2} \amp= -2\sqrt{2}B\text{.}
\end{align*}
We conclude that \(A=\frac{1}{2\sqrt{2}}(-3+2\sqrt{2})=\frac{4-3\sqrt{2}}{4}\) and \(B=\frac{1}{2\sqrt{2}}(-3-2\sqrt{2})=\frac{4+3\sqrt{2}}{4}\text{,}\) and thus
\begin{align*}
\int \frac{x^2}{x^2+2x-1}\, dx \amp = \int 1-\frac{4-3\sqrt{2}}{4}\frac{1}{x-\alpha}-\frac{4+3\sqrt{2}}{4}\frac{1}{x-\beta}\, dx\\
\amp = x-\frac{4-3\sqrt{2}}{4}\ln\abs{x-(-1+\sqrt{2})}-\frac{4+3\sqrt{2}}{4}\ln\abs{x-(-1-\sqrt{2})}+C
\end{align*}