diff --git a/lib/rbpkg/log.rb b/lib/rbpkg/log.rb
index 4426772..6ceab40 100644
--- a/lib/rbpkg/log.rb
+++ b/lib/rbpkg/log.rb
@@ -54,6 +54,8 @@ EOF
end
def puts(string)
+ dir = File.dirname(path)
+ cmd! "mkdir -p #{sh_quote(dir)}" unless File.directory?(dir)
File.open(path, "a") do |output|
output.puts string
end