change logger

This commit is contained in:
Matt K. Fu 2013-05-14 10:29:11 +08:00
parent c2331695cd
commit 88d55989de
8 changed files with 8 additions and 36 deletions

View File

@ -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.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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