Click here to Skip to main content
15,905,233 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have no trouble logging to a file when running my app as a console app but if I convert it to run as a service my file writes fails it seems.

I'm writing in c/c++ using visual studio
Posted
Comments
barneyman 25-Aug-15 18:46pm    
what's the code, what call fails, what's the error, (GetLastError()), where are you writing it to etc, etc

"my washing machine isn't working" - can you diagnose and fix it from that one statement? ;)
Sergey Alexandrovich Kryukov 25-Aug-15 19:41pm    
Good points.

Nevertheless, I recommended the alternative in Solution 1; your very reasonable comment is credited.

—SA

1 solution

Please see the comment to the question by barneyman; it is very reasonable.

Instead of writing directly to a file, better utilize reliability and flexibility of Windows Event Log. Please start here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385780%28v=vs.85%29.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900