How to redirect output with error function to log.err file?

For instance:

sqrt(-1)

p.s.: I don’t need to see it in the console. It’s App.
Thanks