You can use `Reduce` to solve the same problem in equation form:

    Reduce[(Sqrt[2] + 1)^n == 5 Sqrt[2] + 7, n, Integers]
> n == 3

    Reduce[(Sqrt[2] + 1)^n == 17 - 12 Sqrt[2], n, Integers]
> n == -4

    Reduce[
      (5 Sqrt[2] + 7)^(c*n) == (3 + 2 Sqrt[2])^a (17 - 12 Sqrt[2])^b
      \[And] a != 0 \[And] b != 0 \[And] c != 0,
      n, Reals
    ]
> a != 0 && b != 0 && c != 0 && n == -((-2 a + 4 b)/(3 c))