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

WIndows GUI doesn't create the log file #1077

Closed
b00f opened this issue Feb 7, 2024 · 0 comments · Fixed by #1081
Closed

WIndows GUI doesn't create the log file #1077

b00f opened this issue Feb 7, 2024 · 0 comments · Fixed by #1081
Assignees
Labels
bug Something isn't working high priority It has high priority Pactus-GUI

Comments

@b00f
Copy link
Collaborator

b00f commented Feb 7, 2024

Description

The Windows GUI application fails to generate a log file; the pactus.log file is missing from the data folder.

How To Reproduce

  1. Download version v1.0.0 of the software.
  2. Run the Windows-GUI application.
  3. Observe that no log file is produced.

What Happened

The root cause of this issue is the use of the -H windowsgui flag during the releasing process for the Windows binary, look here.
This flag is documented here and specifies that:

On Windows, the -H windowsgui option produces a GUI binary instead of a console binary.

Using -H windowsgui detaches the console from the application.
The logging mechanism works like this: Logs are written to stderr, and then the system reads the stderr output and writes it into a file. In the absence of a console, both stdout and stderr are nullified, resulting in no log file being generated.

Solution

To resolve the issue, verify if stderr is null. If true, create a buffer writer to redirect log output from the logger to the file writer, ensuring log file creation.

Environment

  • Operation System: Windows
  • Pactus Version: 1.0.0
  • Go Version: 21.0
@b00f b00f added high priority It has high priority Pactus-GUI labels Feb 7, 2024
@b00f b00f added the bug Something isn't working label Feb 9, 2024
@b00f b00f closed this as completed in #1081 Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority It has high priority Pactus-GUI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants