Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to enable session.Log("") output always ( without starting the installer with /lv argument) ? #1656

Open
kipamgs opened this issue Oct 10, 2024 · 6 comments

Comments

@kipamgs
Copy link
Contributor

kipamgs commented Oct 10, 2024

When using
session.Log("Some logging message") it is only written to the log file when the installer is started with /LV arguments.
Is it possible to enable writing to the logfile always?

@oleg-shilo
Copy link
Owner

Unfortunately, MSI does not provide any interface for that.

When WixSharp ManagedUI is used it intercepts all messages from the progress dialog and always redirects all log messages to the log file. This is exactly the behaviour you want. But it's only available if you use ManagedUI. There is no other way.

@kipamgs
Copy link
Contributor Author

kipamgs commented Oct 16, 2024

I use the ManagedUI but session.Log messages are only written to the log file if i start the installer with /lv installer.log arguments.

@oleg-shilo
Copy link
Owner

Yes but not exactly.
If you did not start your msi with /lv you can still click the "view log" button in the exit dialog and see the log file:
image

@kipamgs
Copy link
Contributor Author

kipamgs commented Oct 16, 2024

I tried that but the messages that i write via session.Log are not displayed in this log file. I think it is not written without /lv.
WixSharp-wix.WPF version 2.4.1 .

@oleg-shilo
Copy link
Owner

OK, you are right.

I checked the code and indeed the native MSI log is unavailable. Even from ManagedUI. It is a limitation of MSI API. Apologies for misleading you.

What I do in ManagedUI is intercept the progress messages and runtime exceptions and log them in the memory.
When the user clicks "View Log" I simply display this custom log in the system's default text viewer. This is a poor man substitution for the MSI log.

But what it means is that
You can still do so

@kipamgs
Copy link
Contributor Author

kipamgs commented Oct 16, 2024

Thanks. Is there an example available? Or do you just use a property/static variable to store the log?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants