Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Update the dea to use the new logger
Browse files Browse the repository at this point in the history
Test plan:

- Ran BVTs locally
- Deployed to my bosh instance, ran BVTs against it

Change-Id: I143a7a3f6138520a9a7286c90cf10253bdf5ddd2
  • Loading branch information
mpage committed Jun 16, 2011
1 parent fe7de5a commit 09a74c5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -12,6 +12,7 @@ gem 'yajl-ruby', :require => ['yajl', 'yajl/json_gem']
gem 'logging', '>= 1.5.0'

gem 'vcap_common', :path => '../common'
gem 'vcap_logging', :require => ['vcap/logging']

group :test do
gem "rspec"
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Expand Up @@ -49,6 +49,7 @@ GEM
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
vcap_logging (0.1.0)
yajl-ruby (0.8.2)

PLATFORMS
Expand All @@ -67,4 +68,5 @@ DEPENDENCIES
rspec
thin
vcap_common!
vcap_logging
yajl-ruby
3 changes: 2 additions & 1 deletion config/dea.yml
Expand Up @@ -5,7 +5,8 @@ filer_port: 12345
mbus: nats://localhost:4222/
intervals:
heartbeat: 10
log_level: DEBUG
logging:
level: debug
multi_tenant: true
max_memory: 4096
secure: false
Expand Down
3 changes: 2 additions & 1 deletion config/dea2.yml
Expand Up @@ -5,7 +5,8 @@ filer_port: 12346
mbus: nats://localhost:4222/
intervals:
heartbeat: 10
log_level: DEBUG
logging:
level: debug
multi_tenant: true
max_memory: 4096
secure: false
Expand Down
8 changes: 5 additions & 3 deletions lib/dea/agent.rb
Expand Up @@ -24,6 +24,7 @@

require 'vcap/common'
require 'vcap/component'
require 'vcap/logging'

module DEA

Expand Down Expand Up @@ -73,8 +74,8 @@ class Agent
APPS_DUMP_INTERVAL = 30*60

def initialize(config)
@logger = VCAP.create_logger('dea', :log_file => config['log_file'], :log_rotation_interval => config['log_rotation_interval'])
@logger.level = config['log_level']
VCAP::Logging.setup_from_config(config['logging'])
@logger = VCAP::Logging.logger('dea')
@secure = config['secure']
@enforce_ulimit = config['enforce_ulimit']

Expand Down Expand Up @@ -203,6 +204,7 @@ def run()

NATS.on_error do |e|
@logger.error("EXITING! NATS error: #{e}")
@logger.error(e)
# Only snapshot app state if we had a chance to recover saved state. This prevents a connect error
# that occurs before we can recover state from blowing existing data away.
snapshot_app_state if @recovered_droplets
Expand All @@ -211,7 +213,7 @@ def run()

EM.error_handler do |e|
@logger.error "Eventmachine problem, #{e}"
@logger.error("#{e.backtrace.join("\n")}")
@logger.error(e)
end

NATS.start(:uri => @nats_uri) do
Expand Down

0 comments on commit 09a74c5

Please sign in to comment.