Improved logging.
This commit is contained in:
parent
cf3e6274d0
commit
89b19caa1d
4 changed files with 9 additions and 9 deletions
|
@ -41,7 +41,7 @@ class String
|
||||||
return if ActiveRecord::Base.connection_config[:adapter] != 'mysql2'
|
return if ActiveRecord::Base.connection_config[:adapter] != 'mysql2'
|
||||||
self.each_char.select {|c|
|
self.each_char.select {|c|
|
||||||
if c.bytes.count > 3
|
if c.bytes.count > 3
|
||||||
puts "WARNING: strip out 4 bytes utf8 chars '#{c}' of '#{ self }'"
|
Rails.logger.warn "strip out 4 bytes utf8 chars '#{c}' of '#{ self }'"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
c
|
c
|
||||||
|
|
|
@ -37,7 +37,7 @@ class GeoIp::ZammadGeoIp
|
||||||
|
|
||||||
Cache.write( cache_key, data, { expires_in: 90.days } )
|
Cache.write( cache_key, data, { expires_in: 90.days } )
|
||||||
rescue => e
|
rescue => e
|
||||||
puts "ERROR: #{host}#{url}: " + e.inspect
|
Rails.logger.error "#{host}#{url}: #{e.inspect}"
|
||||||
Cache.write( cache_key, data, { expires_in: 60.minutes } )
|
Cache.write( cache_key, data, { expires_in: 60.minutes } )
|
||||||
end
|
end
|
||||||
data
|
data
|
||||||
|
|
|
@ -57,7 +57,7 @@ create/update/delete index
|
||||||
password: Setting.get('es_password'),
|
password: Setting.get('es_password'),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
puts "# #{response.code.to_s}"
|
Rails.logger.info "# #{response.code}"
|
||||||
return true if response.success?
|
return true if response.success?
|
||||||
raise response.inspect
|
raise response.inspect
|
||||||
end
|
end
|
||||||
|
@ -108,7 +108,7 @@ remove whole data from index
|
||||||
url = build_url( type, o_id )
|
url = build_url( type, o_id )
|
||||||
return if !url
|
return if !url
|
||||||
|
|
||||||
puts "# curl -X DELETE \"#{url}\""
|
Rails.logger.info "# curl -X DELETE \"#{url}\""
|
||||||
|
|
||||||
response = UserAgent.delete(
|
response = UserAgent.delete(
|
||||||
url,
|
url,
|
||||||
|
@ -210,7 +210,7 @@ return search result
|
||||||
|
|
||||||
Rails.logger.info "# #{response.code.to_s}"
|
Rails.logger.info "# #{response.code.to_s}"
|
||||||
if !response.success?
|
if !response.success?
|
||||||
puts "ERROR: #{response.inspect}"
|
Rails.logger.error "ERROR: #{response.inspect}"
|
||||||
return []
|
return []
|
||||||
end
|
end
|
||||||
data = response.data
|
data = response.data
|
||||||
|
@ -220,7 +220,7 @@ return search result
|
||||||
return ids if !data['hits']
|
return ids if !data['hits']
|
||||||
return ids if !data['hits']['hits']
|
return ids if !data['hits']['hits']
|
||||||
data['hits']['hits'].each { |item|
|
data['hits']['hits'].each { |item|
|
||||||
puts "... #{item['_type'].to_s} #{item['_id'].to_s}"
|
Rails.logger.info "... #{item['_type'].to_s} #{item['_id'].to_s}"
|
||||||
data = {
|
data = {
|
||||||
id: item['_id'],
|
id: item['_id'],
|
||||||
type: item['_type'],
|
type: item['_type'],
|
||||||
|
|
|
@ -24,9 +24,9 @@ put working hours matrix and timezone in function, returns UTC working hours mat
|
||||||
begin
|
begin
|
||||||
time_diff = Time.parse(start_time.to_s).in_time_zone(timezone).utc_offset
|
time_diff = Time.parse(start_time.to_s).in_time_zone(timezone).utc_offset
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "ERROR: Can't fine tomezone #{timezone}"
|
Rails.logger.error "Can't fine tomezone #{timezone}"
|
||||||
puts e.inspect
|
Rails.logger.error e.inspect
|
||||||
puts e.backtrace
|
Rails.logger.error e.backtrace
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
beginning_of_workday = Time.parse("1977-10-27 #{config['beginning_of_workday']}")
|
beginning_of_workday = Time.parse("1977-10-27 #{config['beginning_of_workday']}")
|
||||||
|
|
Loading…
Reference in a new issue