Really fix verbose logging in tests

Fixes #8117
This commit is contained in:
Guy Boertje 2017-08-31 19:30:17 +01:00
parent cfe2ca208b
commit 5c60888f66
3 changed files with 3 additions and 7 deletions

View file

@ -73,7 +73,7 @@ module LogStash
raise ArgumentError, "invalid level[#{level}] for logger[#{path}]"
end
def self.initialize(config_location)
def self.reconfigure(config_location)
@@config_mutex.synchronize do
config_location_uri = URI.create(config_location)
file_path = config_location_uri.path

View file

@ -249,7 +249,7 @@ class LogStash::Runner < Clamp::StrictCommand
java.lang.System.setProperty("ls.log.level", setting("log.level"))
unless java.lang.System.getProperty("log4j.configurationFile")
log4j_config_location = ::File.join(setting("path.settings"), "log4j2.properties")
LogStash::Logging::Logger::initialize("file:///" + log4j_config_location)
LogStash::Logging::Logger::reconfigure("file:///" + log4j_config_location)
end
# override log level that may have been introduced from a custom log4j config file
LogStash::Logging::Logger::configure_logging(setting("log.level"))

View file

@ -35,7 +35,7 @@ describe LogStash::Runner do
allow(LogStash::Logging::Logger).to receive(:configure_logging) do |level, path|
allow(logger).to receive(:level).and_return(level.to_sym)
end
allow(LogStash::Logging::Logger).to receive(:reconfigure).with(any_args)
# Make sure we don't start a real pipeline here.
# because we cannot easily close the pipeline
allow(LogStash::Agent).to receive(:new).with(any_args).and_return(agent)
@ -43,10 +43,6 @@ describe LogStash::Runner do
allow(agent).to receive(:shutdown)
end
after :each do
LogStash::Logging::Logger::configure_logging("info")
end
describe "argument precedence" do
let(:config) { "input {} output {}" }
let(:cli_args) { ["-e", config, "-w", "20"] }