* bumping rvmrc to match all other projects, and adding rails-logging gem to mirror jam-web (and because it lets me configure logging the same way using chef and so on)

This commit is contained in:
Seth Call 2013-01-18 00:09:16 -06:00
parent 4494b1e071
commit 8ee826696a
8 changed files with 159 additions and 24 deletions

1
.gitignore vendored
View File

@ -12,5 +12,6 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/log/*.age
/tmp
*~

2
.rvmrc
View File

@ -1 +1 @@
rvm use ruby-1.9.3@jam-admin --create
rvm use ruby-1.9.3-p327@jam-admin --create

View File

@ -45,14 +45,17 @@ gem 'country-select'
gem 'eventmachine', '1.0.0'
gem 'amqp', '0.9.8'
# gem 'logging-rails', :require => 'logging/rails'
gem 'tire', '0.5.1'
gem 'logging-rails', :require => 'logging/rails'
gem 'pg_migrate' # ,'0.1.5' #:path => "#{workspace}/pg_migrate_ruby"
gem 'ruby-protocol-buffers', '1.2.2'
gem 'sendgrid', '1.1.0'
group :libv8 do
gem 'libv8', "~> 3.11.8"
end
group :development do
gem 'thin' # bundle exec rails server thin
end
@ -80,5 +83,5 @@ group :development, :test do
gem 'jasmine', '1.3.1'
gem 'pry'
gem 'execjs', '1.4.0'
gem 'therubyracer', '0.11.0beta8'
gem 'therubyracer' #, '0.11.0beta8'
end

View File

@ -1,3 +1,19 @@
PATH
remote: ~/workspace/jam-db/target/ruby_package
specs:
jam_db (0.0.1)
pg_migrate (= 0.1.6)
PATH
remote: ~/workspace/jam-pb/target/ruby/jampb
specs:
jampb (0.0.1)
PATH
remote: ~/workspace/jam-ruby
specs:
jam_ruby (0.0.1)
GEM
remote: https://rubygems.org/
remote: https://jamjam:blueberryjam@www.jamkazam.com/gems/
@ -109,16 +125,11 @@ GEM
guard-rspec (0.5.5)
guard (>= 0.8.4)
has_scope (0.5.1)
hashr (0.0.22)
hike (1.2.1)
i18n (0.6.1)
inherited_resources (1.3.1)
has_scope (~> 0.5.0)
responders (~> 0.6)
jam_db (0.0.86)
pg_migrate (= 0.1.6)
jam_ruby (0.0.97)
jampb (0.0.3888)
jasmine (1.3.1)
jasmine-core (~> 1.3.1)
rack (~> 1.0)
@ -134,6 +145,7 @@ GEM
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.7.4)
libv8 (3.11.8.13)
libwebsocket (0.1.7.1)
addressable
websocket
@ -141,6 +153,8 @@ GEM
little-plugger (1.1.3)
logging (1.7.2)
little-plugger (>= 1.1.3)
logging-rails (0.4.0)
logging (~> 1.6)
lumberjack (1.0.2)
mail (2.4.4)
i18n (>= 0.4.0)
@ -163,7 +177,7 @@ GEM
polyamorous (0.5.0)
activerecord (~> 3.0)
polyglot (0.3.3)
pry (0.9.11.2)
pry (0.9.11.3)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
@ -196,8 +210,6 @@ GEM
ref (1.0.2)
responders (0.9.3)
railties (~> 3.1)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
@ -232,7 +244,8 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
therubyracer (0.11.0beta8)
therubyracer (0.11.3)
libv8 (~> 3.11.8.12)
ref
thin (1.5.0)
daemons (>= 1.0.9)
@ -240,12 +253,6 @@ GEM
rack (>= 1.0.0)
thor (0.15.4)
tilt (1.3.3)
tire (0.5.1)
activemodel (>= 3.0)
hashr (~> 0.0.19)
multi_json (~> 1.0)
rake
rest-client (~> 1.6)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
@ -279,11 +286,13 @@ DEPENDENCIES
execjs (= 1.4.0)
fpm
guard-rspec (= 0.5.5)
jam_db
jam_ruby
jampb
jam_db!
jam_ruby!
jampb!
jasmine (= 1.3.1)
jquery-rails
libv8 (~> 3.11.8)
logging-rails
meta_search (>= 1.1.0.pre)
pg_migrate
pry
@ -292,9 +301,8 @@ DEPENDENCIES
ruby-protocol-buffers (= 1.2.2)
sass-rails (~> 3.2.3)
sendgrid (= 1.1.0)
therubyracer (= 0.11.0beta8)
therubyracer
thin
tire (= 0.5.1)
uglifier (>= 1.0.3)
unicorn
uuidtools (= 2.1.2)

Binary file not shown.

View File

@ -37,4 +37,10 @@ JamAdmin::Application.configure do
# Expands the lines which load the assets
config.assets.debug = true
# Set the logging destination(s)
config.log_to = %w[stdout file]
# Show the logging configuration on STDOUT
config.show_log_configuration = true
end

View File

@ -64,4 +64,10 @@ JamAdmin::Application.configure do
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
# Set the logging destination(s)
config.log_to = %w[file]
# Show the logging configuration on STDOUT
config.show_log_configuration = false
end

111
config/logging.rb Normal file
View File

@ -0,0 +1,111 @@
Logging::Rails.configure do |config|
# Objects will be converted to strings using the :format_as method.
Logging.format_as :inspect
# The default layout used by the appenders.
layout = Logging.layouts.pattern(:pattern => '[%d] %-5l %c : %m\n')
# Setup a color scheme called 'bright' than can be used to add color codes
# to the pattern layout. Color schemes should only be used with appenders
# that write to STDOUT or STDERR; inserting terminal color codes into a file
# is generally considered bad form.
#
Logging.color_scheme( 'bright',
:levels => {
:info => :green,
:warn => :yellow,
:error => :red,
:fatal => [:white, :on_red]
},
:date => :blue,
:logger => :cyan,
:message => :magenta
)
# Configure an appender that will write log events to STDOUT. A colorized
# pattern layout is used to format the log events into strings before
# writing.
#
Logging.appenders.stdout( 'stdout',
:auto_flushing => true,
:layout => Logging.layouts.pattern(
:pattern => '[%d] %-5l %c : %m\n',
:color_scheme => 'bright'
)
) if config.log_to.include? 'stdout'
# Configure an appender that will write log events to a file. The file will
# be rolled on a daily basis, and the past 7 rolled files will be kept.
# Older files will be deleted. The default pattern layout is used when
# formatting log events into strings.
#
Logging.appenders.rolling_file( 'file',
:filename => config.paths['log'].first,
:keep => 7,
:age => 'daily',
:truncate => false,
:auto_flushing => true,
:layout => layout
) if config.log_to.include? 'file'
# Configure an appender that will send an email for "error" and "fatal" log
# events. All other log events will be ignored. Furthermore, log events will
# be buffered for one minute (or 200 events) before an email is sent. This
# is done to prevent a flood of messages.
#
Logging.appenders.email( 'email',
:from => "server@#{config.action_mailer.smtp_settings[:domain]}",
:to => "developers@#{config.action_mailer.smtp_settings[:domain]}",
:subject => "Rails Error [#{%x(uname -n).strip}]",
:server => config.action_mailer.smtp_settings[:address],
:domain => config.action_mailer.smtp_settings[:domain],
:acct => config.action_mailer.smtp_settings[:user_name],
:passwd => config.action_mailer.smtp_settings[:password],
:authtype => config.action_mailer.smtp_settings[:authentication],
:auto_flushing => 200, # send an email after 200 messages have been buffered
:flush_period => 60, # send an email after one minute
:level => :error, # only process log events that are "error" or "fatal"
:layout => layout
) if config.log_to.include? 'email'
# Setup the root logger with the Rails log level and the desired set of
# appenders. The list of appenders to use should be set in the environment
# specific configuration file.
#
# For example, in a production application you would not want to log to
# STDOUT, but you would want to send an email for "error" and "fatal"
# messages:
#
# => config/environments/production.rb
#
# config.log_to = %w[file email]
#
# In development you would want to log to STDOUT and possibly to a file:
#
# => config/environments/development.rb
#
# config.log_to = %w[stdout file]
#
Logging.logger.root.level = config.log_level
Logging.logger.root.appenders = config.log_to unless config.log_to.empty?
# Under Phusion Passenger smart spawning, we need to reopen all IO streams
# after workers have forked.
#
# The rolling file appender uses shared file locks to ensure that only one
# process will roll the log file. Each process writing to the file must have
# its own open file descriptor for `flock` to function properly. Reopening
# the file descriptors after forking ensures that each worker has a unique
# file descriptor.
#
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
Logging.reopen if forked
end
end
end