Recall that
[tex]\cos z=\dfrac{e^{iz}+e^{-iz}}2[/tex]
Then
[tex]\dfrac{e^{iz}+e^{-iz}}2=5\implies e^{iz}+e^{-iz}=10\implies e^{2iz}-10e^{iz}+1=0[/tex]
Let [tex]\zeta=e^{iz}[/tex], then
[tex]\zeta^2-10\zeta+1=0\implies\zeta=5\pm2\sqrt6[/tex]
Solving back for [tex]z[/tex] gives
[tex]e^{iz}=5+2\sqrt 6\implies z=2n\pi-i\log(5+2\sqrt6)[/tex]
or
[tex]e^{iz}=5-2\sqrt6\implies z=2n\pi+i\log(5-2\sqrt6)[/tex]
where [tex]n[/tex] is any integer.