DataflowWorkerHarnessHelper { public static DataflowWorkerHarnessOptions initializeGlobalStateAndPipelineOptions( Class<?> workerHarnessClass) throws Exception { DataflowWorkerHarnessOptions pipelineOptions = WorkerPipelineOptionsFactory.createFromSystemProperties(); pipelineOptions.setAppName(workerHarnessClass.getSimpleName()); DataflowWorkerLoggingMDC.setJobId(pipelineOptions.getJobId()); DataflowWorkerLoggingMDC.setWorkerId(pipelineOptions.getWorkerId()); ExperimentContext ec = ExperimentContext.parseFrom(pipelineOptions); String experimentName = Experiment.EnableConscryptSecurityProvider.getName(); if (ec.isEnabled(Experiment.EnableConscryptSecurityProvider)) { LOG.info( "Dataflow runner is using conscrypt SSL. To disable this feature, " + "remove the pipeline option --experiments={}", experimentName); Security.insertProviderAt(new OpenSSLProvider(), 1); } else { LOG.info( "Not using conscrypt SSL. Note this is the default Java behavior, but may " + "have reduced performance. To use conscrypt SSL pass pipeline option " + "--experiments={}", experimentName); } return pipelineOptions; }  static DataflowWorkerHarnessOptions initializeGlobalStateAndPipelineOptions(
      Class<?> workerHarnessClass); @SuppressWarnings("Slf4jIllegalPassedClass") static void initializeLogging(Class<?> workerHarnessClass); static void configureLogging(DataflowWorkerHarnessOptions pipelineOptions); static Endpoints.ApiServiceDescriptor parseApiServiceDescriptorFromText(
      String descriptorText); static Endpoints.ApiServiceDescriptor getLoggingDescriptor(); static Endpoints.ApiServiceDescriptor getControlDescriptor(); static Endpoints.@Nullable ApiServiceDescriptor getStatusDescriptor(); static RunnerApi.@Nullable Pipeline getPipelineFromEnv();  }
@Test public void testLoggingConfiguration() throws Exception { DataflowWorkerHarnessOptions pipelineOptions = PipelineOptionsFactory.as(DataflowWorkerHarnessOptions.class); pipelineOptions.setJobId(JOB_ID); pipelineOptions.setWorkerId(WORKER_ID); String serializedOptions = new ObjectMapper().writeValueAsString(pipelineOptions); File file = tmpFolder.newFile(); Files.write(Paths.get(file.getPath()), serializedOptions.getBytes(StandardCharsets.UTF_8)); System.setProperty("sdk_pipeline_options_file", file.getPath()); DataflowWorkerHarnessOptions generatedOptions = DataflowWorkerHarnessHelper.initializeGlobalStateAndPipelineOptions( DataflowBatchWorkerHarnessTest.class); assertThat(generatedOptions.getJobId(), equalTo(JOB_ID)); assertThat(generatedOptions.getWorkerId(), equalTo(WORKER_ID)); assertThat(DataflowWorkerLoggingMDC.getJobId(), equalTo(JOB_ID)); assertThat(DataflowWorkerLoggingMDC.getWorkerId(), equalTo(WORKER_ID)); }