# Mathematica as Windows Service — Problem with Error Messages

I have installed Mathematica in a Windows machine as a service using srvany and now I have problems with error messages — they don't get written in logs file like they should!

For example, if I do:

• set \$Messages to {OpenAppend["error.log"]}
• execute 1/0

There will be nothing in error.log.

But if I write to file with WriteString[OpenAppend["error.log"],"Hello world!"], error.log get succesfully written!

Do you have any explanation for this? If I do exactly the same from the front-end the error get written inside the file like it should!

-
Mathematica runned as service sometimes tell me: FrontEndObject::notavail: A front end is not available; certain operations require a front end., can this help? –  Francesco Feb 27 '12 at 9:47
In a more standard setup this should work. Can you elaborate on what exactly you did to "run Mathematica as a service" and what "I do execute 1/0" exactly means? I think giving more details will increase the probability that someone will eventually try what you did and give a useful answer a lot. I haven't checked but I don't think redirecting messages would need the FrontEnd. –  Albert Retey Mar 26 '12 at 7:19
Out of curiosity, what is the purpose of running Mathematica as a service? –  Szabolcs Apr 10 '12 at 9:07
Are you using an absolute pathname? When running as a service, Mathematica's notion of "current directory" may not be what you expect. And if you are using an absolute pathname, you should check whether the service will have write permissions to the directory. –  John Fultz Jun 10 '12 at 7:35
Which Mathematica version are you using? Which Windows version? –  Ailton Andrade de Oliveira Aug 17 '12 at 18:11