lib/karafka/instrumentation/logger.rb in karafka-1.3.0 vs lib/karafka/instrumentation/logger.rb in karafka-1.3.1
- old
+ new
@@ -34,13 +34,14 @@
Karafka::Helpers::MultiDelegator
.delegate(:write, :close)
.to(STDOUT, file)
end
- # Makes sure the log directory exists
+ # Makes sure the log directory exists as long as we can write to it
def ensure_dir_exists
- dir = File.dirname(log_path)
- FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
+ FileUtils.mkdir_p(File.dirname(log_path))
+ rescue Errno::EACCES
+ nil
end
# @return [Pathname] Path to a file to which we should log
def log_path
@log_path ||= Karafka::App.root.join("log/#{Karafka.env}.log")