-
Notifications
You must be signed in to change notification settings - Fork 53
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
Logger is not working when using "go run" #2
Comments
Please try this: logger.Init("C:\log", ... 在 2016年9月11日 23:50,JamesCullum notifications@github.com写道:Run on Win32 during development When i use the code from the example but execute the file via "go run main.go", it tries to navigate through temporary folders to save the log. E17:39:53 logger.go:350] open ./log/C:\Users\USERNAME\AppData\Local\Temp\go-build405325394\command-line-arguments_obj\exe\main.exe.COMPUTERNAME.USERNAME.log.ERROR.20160911-608393956683: The filename, directory name, or volume label syntax is incorrect. I used this code from the example for creation logger.Init("./log", // specify the directory to save the logfiles —You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/antigloss/go","title":"antigloss/go","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/antigloss/go"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Logger is not working when using "go run" (#2)"}],"action":{"name":"View Issue","url":"https://github.com/antigloss/go/issues/2"}}} |
I fixed it myself by simply removing the program name from the filename, as it was undocumented and counter intuitive anyways. I will make a PR later on with my changes. |
Hi James. Thank your for informing me this bug. I think I've fixed this bug with the following code: func init() { I'm sorry I don't have a Windows Environment for testing if it's actually fixed. Would you please kindly have a try and tell me if it's fixed? |
Tested, it works. Thanks! |
Run on Win32 during development
When i use the code from the example but execute the file via "go run main.go", it tries to navigate through temporary folders to save the log.
I used this code from the example for creation
The problem is that the variable gProgname is being used, which is used like this
When using the run command, the executioning arguments change
The text was updated successfully, but these errors were encountered: