Skip to content

Commit

Permalink
spike: add log message with encoding info
Browse files Browse the repository at this point in the history
  • Loading branch information
yaauie committed Feb 23, 2024
1 parent d6546b7 commit 49ca706
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ci/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if [ -n "$BUILD_JAVA_HOME" ]; then
GRADLE_OPTS="$GRADLE_OPTS -Dorg.gradle.java.home=$BUILD_JAVA_HOME"
fi

echo "LOCALE INFO:"$'\n'"$(locale | pr -to2)"

if [[ $1 = "setup" ]]; then
echo "Setup only, no tests will be run"
exit 0
Expand Down
10 changes: 10 additions & 0 deletions logstash-core/lib/logstash/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,16 @@ def execute
jvmArgs = ManagementFactory.getRuntimeMXBean().getInputArguments()
logger.info "JVM bootstrap flags: #{jvmArgs}"

ruby_encoding_info = %w(external internal locale filesystem).map do |type|
Encoding.find(type)&.name&.then { |name| "#{type}:#{name}" }
end.compact.join(", ")

logger.info <<~ENCODINGINFO.tr("\n", ' ')
Ruby.Encoding=(#{ruby_encoding_info})
Java.Locale=`#{java.util.Locale::getDefault().toLanguageTag()}`
Java.Charset=`#{java.nio.charset.Charset::defaultCharset().displayName()}`
ENCODINGINFO

# Add local modules to the registry before everything else
LogStash::Modules::Util.register_local_modules(LogStash::Environment::LOGSTASH_HOME)

Expand Down
13 changes: 10 additions & 3 deletions qa/integration/specs/monitoring_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
describe "Test Monitoring API" do
before(:all) {
@fixture = Fixture.new(__FILE__)
ruby_encoding_info = %w(external internal locale filesystem).map do |type|
Encoding.find(type)&.name&.then { |name| "#{type}:#{name}" }
end.compact.join(", ")

$stderr.puts <<~ENCODINGINFO.tr("\n", ' ')
INFO(spec runner process)
Ruby.Encoding=(#{ruby_encoding_info})
Java.Locale=`#{java.util.Locale::getDefault().toLanguageTag()}`
Java.Charset=`#{java.nio.charset.Charset::defaultCharset().displayName()}`
ENCODINGINFO
}

after(:all) {
Expand Down Expand Up @@ -171,7 +181,6 @@

it "can retrieve queue stats" do
logstash_service = @fixture.get_service("logstash")
logstash_service.env_variables = { 'LANG' => 'en_US.UTF-8' }
logstash_service.start_with_stdin('--pipeline.id' => pipeline_id)
logstash_service.wait_for_logstash

Expand Down Expand Up @@ -202,7 +211,6 @@

it "retrieves the pipeline flow statuses" do
logstash_service = @fixture.get_service("logstash")
logstash_service.env_variables = { 'LANG' => 'en_US.UTF-8' }
logstash_service.start_with_stdin('--pipeline.id' => pipeline_id)
logstash_service.wait_for_logstash
number_of_events.times {
Expand Down Expand Up @@ -252,7 +260,6 @@
EOPIPELINE

logstash_service = @fixture.get_service("logstash")
logstash_service.env_variables = { 'LANG' => 'en_US.UTF-8' }
logstash_service.start_with_stdin('--pipeline.id' => pipeline_id, '--config.string' => plugins_config)
logstash_service.wait_for_logstash
number_of_events.times {
Expand Down

0 comments on commit 49ca706

Please sign in to comment.