All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.javaagent.bootstrap.InternalLoggerFactoryHolder Maven / Gradle / Ivy

The newest version!
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.javaagent.bootstrap;

import java.util.concurrent.atomic.AtomicReference;

final class InternalLoggerFactoryHolder {

  private static final AtomicReference loggerFactory =
      new AtomicReference<>(NoopLoggerFactory.INSTANCE);

  static void initialize(InternalLogger.Factory factory) {
    if (!loggerFactory.compareAndSet(NoopLoggerFactory.INSTANCE, factory)) {
      factory
          .create(InternalLogger.class.getName())
          .log(
              InternalLogger.Level.WARN,
              "Developer error: logging system has already been initialized once",
              null);
    }
  }

  static InternalLogger.Factory get() {
    return loggerFactory.get();
  }

  private InternalLoggerFactoryHolder() {}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy