cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Alibaba
Level 6

write logfile in AllUsers (Appdata)

Hi,

I want to write my log file in the AllUsers Profile or AllUsers\AppData. I cannot found a working variable for it to pass through CmdLine to setup.exe.

I know that I can use /LI "%WINDIR%\MyApp.install.log" (for Windows Dir) or /LI "%UserProfile%\pCon.planner.6.install.log" (for User Profile).

But how can I adress AllUser Profile or the AllUserAppData?

Thanks for any help! 🙂
Labels (1)
0 Kudos
(9) Replies
girishkatti123
Level 7

CommonAppDataFolder Property

The CommonAppDataFolder property is the full path to the file directory containing application data for all users.
0 Kudos
Alibaba
Level 6

Ah thank you girishkatti! 🙂
But unfortuneately I cannot use this in the commandline.
If I set /LI "%CommonAppDataFolder%\MyApp.install.log" in the setup.ini in [Startup] Section and CmdLine Key I always get the MSI Error that the logfile cannot be created. If I use %UserProfile% instead of %CommonAppDataFolder% it works - but I need the log file in the AllUsers file directory because there it is accessible for all Users in case of support issues.
0 Kudos
girishkatti123
Level 7

try passing the following command to CmdLine
/LI "%ALLUSERSPROFILE%\Application Data\MyApp.install.log"

It did work for me.
0 Kudos
Alibaba
Level 6

Again thank you very much girishkatti123 that you are the one who tries to help me 🙂 .
Your suggestion works fine, but sdaly not on a german XP where the CommonAppDataFolder Name is AllUsers\Anwendungsdaten...
So if there is no variable usable for this folder in the commandline then I will not be able to adress this folder in a multi language setup.
Another Problem is that I cannot create a new folder like %ALLUSERSPROFILE%\MyCompany\MyApp.log.
Does anyone have other suggestions? Where should I write my installation.log, that is it accessible for all users? Currently we write into WINDIR, but this it not a good idea for some reasons...
0 Kudos
girishkatti123
Level 7

One way is to create a seperate component for different language.
Condition these component based on your OS language using SystemLanguageID to create the log files in AllUsersFolder.

One more way to check the ALLUSERPROFILE folder
Goto Cmd type set. You will get the environment variable. Create the folder you need to install the log file using OnBegin() Funtion.
0 Kudos
Alibaba
Level 6

Sorry, but the first approach with the component I don't understand. I know how to install a component based on ProductLanguage, but what should this has to do with logfile? Components are installed later in installation I thought.

The second solution is a great idea that I understand. I never used the OnBegin Function, because I didn't know that it will be executed before everything else . I will try to implement what I need: get ALLUSERPROFILE and create MyCompany directory within - sounds trivial.

But writing a log in the CommonAppDataFolder\MyCompany will not be able with the second approach.
0 Kudos
Alibaba
Level 6

Could somebody help me with this problem.
How can I create a Folder in AllUsers directory before the logging is started?
OnBegin can't be used since IS12 and a custom action (FirstAction) is too late because loggin already startet.
Or tell me another place where do you write your logfiles?
0 Kudos
Alibaba
Level 6

Or different questioned: Is there a MSI CommandLine Variable that points to [COMMONAPPDATA] like %APPDATA% for current user?
0 Kudos
HenryL
Level 5

As far as I know, there is no predefined environment variable for CommonAppDataFolder/CSIDL_COMMON_APPDATA. I'm also interested in the alternatives for your question.
0 Kudos