always set logger and call .register

This commit is contained in:
Pete Fritchman 2011-02-21 08:59:18 -08:00
parent 003a680d78
commit 42394069a9
2 changed files with 12 additions and 4 deletions

View file

@ -80,8 +80,11 @@ class LogStash::Agent
# Start inputs
@inputs.each do |input|
@logger.info(["Starting input", input])
input.logger = @logger
@threads[input] = Thread.new { input.run(queue) }
@threads[input] = Thread.new do
input.logger = @logger
input.register
input.run(queue)
end
end
# Create N filter-worker threads
@ -121,8 +124,8 @@ class LogStash::Agent
@threads["outputs/#{output}"] = Thread.new do
JThread.currentThread().setName("output/#{output}")
output.register
output.logger = @logger
output.register
while event = queue.pop do
output.receive(event)

View file

@ -12,6 +12,11 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
config_name "file"
config :path => nil # no validation on path, it can be anything.
public
def register
# nothing
end # def register
public
def run(queue)
@@filemanager_lock.synchronize do
@ -24,5 +29,5 @@ class LogStash::Inputs::File < LogStash::Inputs::Base
end
@@filemanager.watch(@path, @config)
end
end # def run
end # class LogStash::Inputs::File