Skip to content

Unable to delete the log file used by zap. #1469

Open
@charankamarapu

Description

Describe the bug
I have add a file to the development config like this -

LogCfg.OutputPaths = []string{
		"stdout",
		"./logs.txt",
}

and then created a logger with logCfg.build() and later while exiting my application I wanted to delete that file but it throws an error saying file is being used by another process(windows) most probably it is being used by the logger. I was creating the file to upload the logs to somewhere and once app is about to exit I want to delete it. How can I do it? I even tried assigning nil to logger before deleting the file.

To Reproduce
You can just create a simple logger and try to delete the log file.

Expected behavior
File should get deleted.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions