pinpoint-apm/pinpoint · warning
LoggerBinder is already initialized
Error message
LoggerBinder is already initialized
What it means
In Log4j2LoggingSystem.bindPluginLogFactory(), if PluginLogManager.initialize(binder) returns false, a binder is already registered, and 'LoggerBinder is already initialized' is warned. The call happens during profiler start; a second initialize means the plugin log factory was bound more than once in this classloader, usually because start() ran twice or another subsystem pre-bound the binder.
Source
Thrown at agent-module/profiler-logging/src/main/java/com/navercorp/pinpoint/profiler/logging/Log4j2LoggingSystem.java:150
logger.info("{} stop", this.getClass().getSimpleName());
this.binder.shutdown();
if (loggerContext instanceof LifeCycle) {
logger.info("{} loggerContext stop", this.getClass().getSimpleName());
((LifeCycle) loggerContext).stop();
}
}
}
private void bindPluginLogFactory(PluginLoggerBinder binder) {
final String binderClassName = binder.getClass().getName();
PluginLogger pluginLogger = binder.getLogger(binder.getClass().getName());
pluginLogger.info("PluginLogManager.initialize() bind:{} cl:{}", binderClassName, binder.getClass().getClassLoader());
// Set binder to static PluginLogManager
// Should we unset binder at shutdown hook or stop()?
if (!PluginLogManager.initialize(binder)) {
pluginLogger.warn("LoggerBinder is already initialized");
}
}
}
View on GitHub (pinned to 744c3d3075)
Solutions
- Ensure start() is called only once per classloader lifecycle (guard with started flag)
- Call stop()/unregister before re-initializing
- Check whether Log4j2LoggerBinderInitializer.beforeClass() also ran in the same JVM and remove the duplicate path
- Verify only one profiler logging component is on the classpath
Example fix
// before
profilerLoggingSystem.start();
profilerLoggingSystem.start(); // warns 'already initialized'
// after
if (!started) { profilerLoggingSystem.start(); started = true; } Defensive patterns
Strategy: try-catch
Validate before calling
// guard start(): boolean alreadyBound = com.navercorp.pinpoint.profiler.logging.PluginLogManager.bound(); if (alreadyBound) skip initialize;
Try / catch
if (!PluginLogManager.initialize(binder)) { pluginLogger.warn("PluginLogManager already bound; skipping re-bind"); } Prevention
- Call profilerLoggingSystem.start() once per lifecycle; guard with a started flag
- Always stop()/unregister before restart
- Avoid mixing Log4j2LoggerBinderInitializer and Log4j2LoggingSystem init in one classloader
- Keep only one profiler-logging binder implementation on the classpath
When it happens
Trigger: ProfilerLoggingSystem.start() invoked twice on the same agent classloader; an earlier component (e.g. Log4j2LoggerBinderInitializer) already registered a binder for the same classloader.
Common situations: Agent restart logic calling start() again without stop(); tests initializing both the logging system and the binder initializer; multiple agent modules in one JVM sharing a classloader.
Related errors
- LoggerBinder is already initialized
- 'log4j2-agent.xml' not found. agentPath:${profilePath}
- ProcessingEnvOptionsHolder not initialized yet.
- J9BootLoader create fail Caused by:
- initialize fail Caused by:
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/90c63de53a6af5d3.
Report an issue: GitHub.