0

I am using apache log4j from java 1.6.
I am creating exe file using exe4j and when I place it in the production folders -
logs are being created successfully.

Now, I have turned it into service exe
(checked a "service" checkbox in exe4j and installed it with SC command )
and log files stopped being created .

is there an explanation/solution for it ? Thanks.

Bick
  • 17,833
  • 52
  • 146
  • 251

1 Answers1

1

Your service most likely is running as an account (LOCAL SERVICE?) that does not have permission to write to the log folder.

To check the account under the service is running on, right-click the service in the Services panel, select Properties, and view the LogOn tab (for Windows 7... exact steps for other Windows versions will vary but the idea is the same).

I would suggest continuing to run your service with the least privileges it needs and modify access rights to the log folder to allow the account the service is running under to write to that folder (Principal of Least Privilege). Of course, don't have anything except logs in that folder.

Eric J.
  • 147,927
  • 63
  • 340
  • 553
  • least privileges && don't have anything except logs - can you explain both points ? – Bick Jul 02 '12 at 11:40
  • 1
    You generally want to run any program with the least amount of privilege it needs to accomplish it's job (added a link to my answer). If you are granting write permission to a folder so that the logs can be written, you don't want to put anything else in that folder that you would not want a hacker to be able to modify if they somehow hikack the ability to write to your logs folder. For example, if you put a JAR file in the same folder the logs are written to, a successful hacker could modify your JAR file. – Eric J. Jul 02 '12 at 17:14
  • Also the log files should be written to one of Window's app data directories and not in Program Files. – Michael Krussel Jul 02 '12 at 19:10