change logger
This commit is contained in:
parent
c2331695cd
commit
88d55989de
1
Gemfile
1
Gemfile
|
@ -63,6 +63,7 @@ gem 'chinese_pinyin', '0.4.1'
|
|||
gem 'rmmseg-cpp-huacnlee', '0.2.9'
|
||||
gem 'redis-namespace'
|
||||
gem 'redis-search'
|
||||
gem 'syslog-logger'
|
||||
|
||||
# Gems used only for assets and not required
|
||||
# in production environments by default.
|
||||
|
|
|
@ -319,6 +319,7 @@ GEM
|
|||
nokogiri
|
||||
sunspot (= 1.3.3)
|
||||
sunspot_solr (1.3.3)
|
||||
syslog-logger (1.6.8)
|
||||
terminal-table (1.4.5)
|
||||
thor (0.17.0)
|
||||
tilt (1.3.3)
|
||||
|
@ -402,6 +403,7 @@ DEPENDENCIES
|
|||
sunspot-rails-tester
|
||||
sunspot_mongo
|
||||
sunspot_solr
|
||||
syslog-logger
|
||||
tinymce-rails
|
||||
uglifier
|
||||
watchr
|
||||
|
|
|
@ -11,7 +11,7 @@ class BackupServer
|
|||
|
||||
%x[rm #{archive_db_list_path}]
|
||||
%x[ls #{Rails.root}/tmp/#{dbname}* | du -h --max-depth=1 --block-size=1M |sort -h >> #{archive_db_list_path}]
|
||||
OrbitJobLogger.info "DB backup done Path:#{dbdirectory}"
|
||||
OrbitLogger.info "DB backup done Path:#{dbdirectory}"
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class DashboardCounter < Resque::Plugins::RestrictionJob
|
|||
site.dashboard_counter[:visitors_this_month] = obj.display_visitors_this_month
|
||||
site.dashboard_counter[:visitors_this_year] = obj.display_visitors_this_year
|
||||
site.save
|
||||
OrbitJobLogger.info "DashboardCounter done #{site.dashboard_counter.to_s}"
|
||||
OrbitLogger.info "DashboardCounter done #{site.dashboard_counter.to_s}"
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@ class UpdateTagCloud
|
|||
Tag.all.each do |tag|
|
||||
tag.update_attribute(:cloud_view_count, tag.impressionist_count(:created_at.gte => 14.days.ago, :created_at.lte => Time.now))
|
||||
end
|
||||
OrbitJobLogger.info "UpdateTagCloud Done"
|
||||
OrbitLogger.info "UpdateTagCloud Done"
|
||||
end
|
||||
end
|
|
@ -6,4 +6,4 @@ YAML::ENGINE.yamler = 'syck'
|
|||
# Initialize the rails application
|
||||
Orbit::Application.initialize!
|
||||
Me = Site.first
|
||||
OrbitJobLogger = OrbitJobLog.new
|
||||
OrbitLogger = Logger::Syslog.new
|
||||
|
|
|
@ -19,6 +19,7 @@ Orbit::Application.configure do
|
|||
|
||||
# Generate digests for assets URLs
|
||||
config.assets.digest = true
|
||||
config.logger = Logger::Syslog.new
|
||||
|
||||
# Defaults to Rails.root.join("public/assets")
|
||||
# config.assets.manifest = YOUR_PATH
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
class OrbitJobLog < Logger
|
||||
FORMAT = "%m/%d/%Y %H:%M%p: "
|
||||
def initialize
|
||||
case Rails.env
|
||||
when 'production'
|
||||
# Logger::Syslog.new("orbit_routine", Syslog::LOG_LOCAL5)
|
||||
super(Orbit::Application.config.root.to_s+'/log/orbit_job.log','daily')
|
||||
when 'development'
|
||||
super(Orbit::Application.config.root.to_s+'/log/orbit_job.dev.log','daily')
|
||||
end
|
||||
end
|
||||
|
||||
def debug(msg)
|
||||
super(Time.now.strftime()+msg)
|
||||
end
|
||||
|
||||
def info(msg)
|
||||
super(Time.now.strftime(FORMAT)+msg)
|
||||
end
|
||||
|
||||
def warn(msg)
|
||||
super(Time.now.strftime(FORMAT)+msg)
|
||||
end
|
||||
|
||||
def error(msg)
|
||||
super(Time.now.strftime(FORMAT)+msg)
|
||||
end
|
||||
|
||||
def fatal(msg)
|
||||
super(Time.now.strftime(FORMAT)+msg)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue