[GH-ISSUE #581] create logdir if not exists #203

Closed
opened 2026-03-04 02:13:06 +03:00 by kerem · 5 comments
Owner

Originally created by @dominikzogg on GitHub (Jun 18, 2015).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/581

Hello @Seldaek

Would be cool if the StreamHandler or another handler would be able to create the log directory (if its a path, not a stream), if it not exists.

see: https://github.com/silexphp/Silex/pull/1183

If you like the idea i would prepare a pullrequest.

Regards @dominikzogg

Originally created by @dominikzogg on GitHub (Jun 18, 2015). Original GitHub issue: https://github.com/Seldaek/monolog/issues/581 Hello @Seldaek Would be cool if the StreamHandler or another handler would be able to create the log directory (if its a path, not a stream), if it not exists. see: https://github.com/silexphp/Silex/pull/1183 If you like the idea i would prepare a pullrequest. Regards @dominikzogg
kerem closed this issue 2026-03-04 02:13:07 +03:00
Author
Owner

@Seldaek commented on GitHub (Jun 18, 2015):

See #555 - but if you can provide a safe implementation I am not really against it..

<!-- gh-comment-id:113302662 --> @Seldaek commented on GitHub (Jun 18, 2015): See #555 - but if you can provide a safe implementation I am not really against it..
Author
Owner

@dominikzogg commented on GitHub (Jun 19, 2015):

@Seldaek well a resource definition is a string, which has :// within, or a resource itself, isn't it?

<!-- gh-comment-id:113363877 --> @dominikzogg commented on GitHub (Jun 19, 2015): @Seldaek well a resource definition is a string, which has :// within, or a resource itself, isn't it?
Author
Owner

@Seldaek commented on GitHub (Jun 19, 2015):

'foo.log' is valid, 'file://foo.log' is valid but has ://, ftp://foo.log is valid but should perhaps not get mkdir called on it (well I guess with ftp it works but not necessarily with other streams). I think doing a is_dir+mkdir check for file:// or no-protocol paths is probably safe.

<!-- gh-comment-id:113462774 --> @Seldaek commented on GitHub (Jun 19, 2015): 'foo.log' is valid, 'file://foo.log' is valid but has ://, ftp://foo.log is valid but should perhaps not get mkdir called on it (well I guess with ftp it works but not necessarily with other streams). I think doing a is_dir+mkdir check for file:// or no-protocol paths is probably safe.
Author
Owner

@dominikzogg commented on GitHub (Jun 20, 2015):

@Seldaek You mean only paths with file:// should get considered? Would be a compromise i could live with, should be in documentation as well. Should i prepare a pull request which works like this?

<!-- gh-comment-id:113718396 --> @dominikzogg commented on GitHub (Jun 20, 2015): @Seldaek You mean only paths with file:// should get considered? Would be a compromise i could live with, should be in documentation as well. Should i prepare a pull request which works like this?
Author
Owner

@Seldaek commented on GitHub (Jun 20, 2015):

No I mean paths with file:// and those that don't have a protocol defined, like "foo.log" has no XXX:// and as such you know php defaults to the file:// stream. And yes if you like to send a PR please go ahead :)

<!-- gh-comment-id:113752115 --> @Seldaek commented on GitHub (Jun 20, 2015): No I mean paths with file:// and those that don't have a protocol defined, like "foo.log" has no `XXX://` and as such you know php defaults to the file:// stream. And yes if you like to send a PR please go ahead :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#203
No description provided.