diff --git a/Gemfile b/Gemfile index 4fb5e7753..16e6e069b 100644 --- a/Gemfile +++ b/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. diff --git a/Gemfile.lock b/Gemfile.lock index 05696d956..e4750c630 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/app/jobs/backup_server.rb b/app/jobs/backup_server.rb index ae7128b10..0010b51fe 100644 --- a/app/jobs/backup_server.rb +++ b/app/jobs/backup_server.rb @@ -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 diff --git a/app/jobs/dashboard_counter.rb b/app/jobs/dashboard_counter.rb index ce934aaee..68b2ca470 100644 --- a/app/jobs/dashboard_counter.rb +++ b/app/jobs/dashboard_counter.rb @@ -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 diff --git a/app/jobs/update_tag_cloud.rb b/app/jobs/update_tag_cloud.rb index 08fd16ee0..95fa6df7e 100644 --- a/app/jobs/update_tag_cloud.rb +++ b/app/jobs/update_tag_cloud.rb @@ -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 \ No newline at end of file diff --git a/config/environment.rb b/config/environment.rb index 0d9f5fdb9..2f3a7e013 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -6,4 +6,4 @@ YAML::ENGINE.yamler = 'syck' # Initialize the rails application Orbit::Application.initialize! Me = Site.first -OrbitJobLogger = OrbitJobLog.new \ No newline at end of file +OrbitLogger = Logger::Syslog.new diff --git a/config/environments/production.rb b/config/environments/production.rb index ad900d0eb..3138ea3c7 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -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 diff --git a/lib/orbit_job_log.rb b/lib/orbit_job_log.rb deleted file mode 100644 index f8ba54888..000000000 --- a/lib/orbit_job_log.rb +++ /dev/null @@ -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 \ No newline at end of file