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

Command line arg --internal=filename ignores filename #122

Open
esumerfd opened this issue Sep 9, 2022 · 3 comments
Open

Command line arg --internal=filename ignores filename #122

esumerfd opened this issue Sep 9, 2022 · 3 comments
Assignees
Labels
planning-to-reproduce-the-issue Planning to reproduce the issue

Comments

@esumerfd
Copy link

esumerfd commented Sep 9, 2022

Starting the server like this:

algernon --verbose --accesslog=ssl.log --internal=algernon.log

Writes the internal log to a file called internal.log while the ServerInfo() says

Internal log file:	algernon.log

: algernon --version
Algernon 1.14.0

@xyproto
Copy link
Owner

xyproto commented Sep 10, 2022

Thanks for reporting!

@xyproto xyproto added the planning-to-reproduce-the-issue Planning to reproduce the issue label Sep 10, 2022
@xyproto xyproto self-assigned this Sep 10, 2022
@esumerfd
Copy link
Author

esumerfd commented Sep 12, 2022

SCRATCH THIS: bad info: config.go:694 should reference ac.internalLogFilename instead of hard coding "internal.log"

@esumerfd
Copy link
Author

Now perhaps I understand. Perhaps if the os.Open was an OpenFile with a O_CREATE option it would create the custom file name.

I can make it work by touching the file before running then it choose it. Feels like the flows for selecting the default filename may need to be done before the open.

	// Direct internal logging elsewhere
	internalLogFile, err := os.Open(ac.internalLogFilename)
	if err != nil {
		// Could not open the internalLogFilename filename, try using another filename
		internalLogFile, err = os.OpenFile("internal.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, ac.defaultPermissions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
planning-to-reproduce-the-issue Planning to reproduce the issue
Projects
None yet
Development

No branches or pull requests

2 participants