public void init()

in internal-logging/src/main/java/co/elastic/otel/logging/ElasticLoggingCustomizer.java [38:60]


  public void init(EarlyInitAgentConfig earlyConfig) {

    // trigger loading the slf4j provider from the agent CL, this should load log4j implementation
    LoggerFactory.getILoggerFactory();

    // make the agent internal logger delegate to slf4j, which will delegate to log4j
    InternalLogger.initialize(Slf4jInternalLogger::create);

    AgentLog.init();

    Level level = null;
    if (earlyConfig.getBoolean("otel.javaagent.debug", false)) {
      // set debug logging when enabled through configuration to behave like the upstream
      // distribution
      level = Level.DEBUG;
    } else {
      String levelConfig = earlyConfig.getString("elastic.otel.javaagent.log.level");
      if (levelConfig != null) {
        level = Level.getLevel(levelConfig);
      }
    }
    AgentLog.setLevel(level != null ? level : Level.INFO);
  }