1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Feature #2027: Create oneflow log dir if it does not exist

This commit is contained in:
Carlos Martín 2013-07-11 16:24:10 +02:00
parent f5faeba163
commit e50da2e4e7

View File

@ -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}"