-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Create missing directories in file logging appenders #117666
Conversation
@@ -73,4 +75,8 @@ export class FileAppender implements DisposableAppender { | |||
}); | |||
}); | |||
} | |||
|
|||
private ensureDirectory(path: string) { | |||
mkdirSync(dirname(path), { recursive: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not proud of the sync mkdir here, but I'm not sure there's any other way to do this if it happens in the append
step? At least this is just a rare thing only when outputStream
is undefined
, so probably not any issue if understand the flow correctly
@spalger + @tylersmalley: This PR isn't as important now that I commited a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely think it's worth the tiny cost of verifying the directory exists before opening the file.
5424655
to
97827ea
Compare
97827ea
to
ece7800
Compare
I'm not sure if this requires a release note? |
Just my 2c, I believe it certainly deserves a |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @watson |
Pinging @elastic/kibana-operations (Team:Operations) |
When using either the
FileAppender
or theRollingFileAppender
with a path to a logfile where the directories doesn't exist, they are now created automatically the first time anything is written to the path.Release note
Improves the file logging capabilities of Kibana, so that missing directories in the configured file path now are created before Kibana attempts to write to the file.