0

I have an application that must run without administrative privileges. I need the application to append to this log no matter the user that runs this application. The log is created by the application. Obviously the Program Files directory is out of the question, considering it requires administrator privs to create files in said directory. It seemed like ProgramData did the trick, and change the write permissions to all users, using File.setWritable(true, false); However, it seems dependent on the UAC settings across different systems, this operation could not be performed, due to lack of sufficient privileges. I confirm this using Windows Explorer, and to change the permissions would require Administrator privileges. So when Java creates the directory in ProgramData, it requires Administrator privileges to change permissions, however when I manually create the directory, I can change folder permissions without requiring administrator privileges. Considering the application is running as my user, why is this behavior different? So this is a two part question, is there a better directory to put this log, and if not, why is the behavior different, how can I set the permissions without requiring administrator privileges.

Thank you greatly

Geoff Lentsch
  • 1,054
  • 11
  • 17
  • Can't you use your application directory to save the logs by creating a folder or at its root? If your user doesn't have enough privileges to change the permission of a folder, you must log in as administrator to do it. – Paulo Sep 01 '15 at 16:55
  • We've used `{user.home}\AppData\{Local/Remote}\{Your App Name}` successfully. This does mean that for each user, the logs location will be different. Not sure if that's a good thing or a bad thing – MadProgrammer Sep 02 '15 at 00:41

0 Answers0