mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-16 17:53:08 +09:00
Feature #2027: Create oneflow log dir if it does not exist
This commit is contained in:
1 parent
f5faeba163
commit
e50da2e4e7
1 file changed
+10
-2
+10
-2
@@ -132,12 +132,20 @@ class Log
|
||||
end
|
||||
|
||||
begin
|
||||
open("#{LOG_LOCATION}/oneflow/#{service_id}.log", 'a') do |f|
|
||||
f << MSG_FORMAT % [
|
||||
msg = MSG_FORMAT % [
|
||||
Time.now.strftime(DATE_FORMAT),
|
||||
Logger::SEV_LABEL[severity][0..0],
|
||||
component,
|
||||
message ]
|
||||
|
||||
open("#{LOG_LOCATION}/oneflow/#{service_id}.log", 'a') do |f|
|
||||
f << msg
|
||||
end
|
||||
rescue Errno::ENOENT => e
|
||||
FileUtils.mkdir("#{LOG_LOCATION}/oneflow/")
|
||||
|
||||
open("#{LOG_LOCATION}/oneflow/#{service_id}.log", 'a') do |f|
|
||||
f << msg
|
||||
end
|
||||
rescue => e
|
||||
message = "Could not log into #{LOG_LOCATION}/oneflow/#{service_id}.log: #{e.message}"
|
||||
|
||||
Reference in new issue
Block a user