From 9bdd9e2294d89b1c6b8f8e3a22171976fa6e64b1 Mon Sep 17 00:00:00 2001 From: emeroad Date: Fri, 15 Nov 2024 17:01:36 +0900 Subject: [PATCH] [#noissue] Remove deprecated PLogger API --- .../pinpoint/bootstrap/logging/PLogger.java | 8 ------ .../bootstrap/logging/PLoggerFactory.java | 25 ------------------- .../plugin/sdk/AgentSdkAsyncPlugin.java | 1 - .../sdk/interceptor/CommandInterceptor.java | 1 - .../logging/Log4J2PluginLoggerAdapter.java | 5 ++-- .../profiler/logging/Log4j2LoggingSystem.java | 11 ++++---- 6 files changed, 7 insertions(+), 44 deletions(-) delete mode 100644 agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/logging/PLogger.java delete mode 100644 agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/logging/PLoggerFactory.java diff --git a/agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/logging/PLogger.java b/agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/logging/PLogger.java deleted file mode 100644 index 058148af4f12..000000000000 --- a/agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/logging/PLogger.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.navercorp.pinpoint.bootstrap.logging; - -/** - * @deprecated Since 3.0.0 Use {@link com.navercorp.pinpoint.bootstrap.logging.PluginLogger} instead. - */ -@Deprecated -public interface PLogger extends PluginLogger { -} diff --git a/agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/logging/PLoggerFactory.java b/agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/logging/PLoggerFactory.java deleted file mode 100644 index a1794471e76f..000000000000 --- a/agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/logging/PLoggerFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.navercorp.pinpoint.bootstrap.logging; - -/** - * @deprecated Since 3.0.0 Use {@link com.navercorp.pinpoint.bootstrap.logging.PluginLogManager} instead. - */ -@Deprecated -public class PLoggerFactory { - - public static void initialize(PluginLoggerBinder loggerBinder) { - PluginLogManager.initialize(loggerBinder); - } - - public static void unregister(PluginLoggerBinder loggerBinder) { - PluginLogManager.unregister(loggerBinder); - } - - public static PLogger getLogger(String name) { - return (PLogger) PluginLogManager.getLogger(name); - - } - - public static PLogger getLogger(Class clazz) { - return (PLogger) PluginLogManager.getLogger(clazz); - } -} diff --git a/agent-module/plugins/agentsdk-async/src/main/java/com/navercorp/pinpoint/plugin/sdk/AgentSdkAsyncPlugin.java b/agent-module/plugins/agentsdk-async/src/main/java/com/navercorp/pinpoint/plugin/sdk/AgentSdkAsyncPlugin.java index 0b717e1bdeed..f77645969c7f 100644 --- a/agent-module/plugins/agentsdk-async/src/main/java/com/navercorp/pinpoint/plugin/sdk/AgentSdkAsyncPlugin.java +++ b/agent-module/plugins/agentsdk-async/src/main/java/com/navercorp/pinpoint/plugin/sdk/AgentSdkAsyncPlugin.java @@ -122,7 +122,6 @@ private void addTraceExecutor(final String className) { } public static class ExecutorExecuteTransformCallback implements TransformCallback { -// private final PLogger logger = PLoggerFactory.getLogger(getClass()); @Override public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader, String className, Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException { diff --git a/agent-module/plugins/agentsdk-async/src/main/java/com/navercorp/pinpoint/plugin/sdk/interceptor/CommandInterceptor.java b/agent-module/plugins/agentsdk-async/src/main/java/com/navercorp/pinpoint/plugin/sdk/interceptor/CommandInterceptor.java index a584e6b0b699..da5eb4083d62 100644 --- a/agent-module/plugins/agentsdk-async/src/main/java/com/navercorp/pinpoint/plugin/sdk/interceptor/CommandInterceptor.java +++ b/agent-module/plugins/agentsdk-async/src/main/java/com/navercorp/pinpoint/plugin/sdk/interceptor/CommandInterceptor.java @@ -25,7 +25,6 @@ public class CommandInterceptor extends AsyncContextSpanEventSimpleAroundInterceptor { -// private final PLogger logger = PLoggerFactory.getLogger(this.getClass()); public CommandInterceptor(TraceContext traceContext, MethodDescriptor methodDescriptor) { super(traceContext, methodDescriptor); diff --git a/agent-module/profiler-logging/src/main/java/com/navercorp/pinpoint/profiler/logging/Log4J2PluginLoggerAdapter.java b/agent-module/profiler-logging/src/main/java/com/navercorp/pinpoint/profiler/logging/Log4J2PluginLoggerAdapter.java index 662b27355381..2e9e6adde1a4 100644 --- a/agent-module/profiler-logging/src/main/java/com/navercorp/pinpoint/profiler/logging/Log4J2PluginLoggerAdapter.java +++ b/agent-module/profiler-logging/src/main/java/com/navercorp/pinpoint/profiler/logging/Log4J2PluginLoggerAdapter.java @@ -16,7 +16,7 @@ package com.navercorp.pinpoint.profiler.logging; -import com.navercorp.pinpoint.bootstrap.logging.PLogger; +import com.navercorp.pinpoint.bootstrap.logging.PluginLogger; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; @@ -25,8 +25,7 @@ /** * @author emeroad */ -@SuppressWarnings("deprecation") -public class Log4J2PluginLoggerAdapter extends AbstractLoggerAdapter implements PLogger { +public class Log4J2PluginLoggerAdapter extends AbstractLoggerAdapter implements PluginLogger { private final Logger logger; private final boolean isDebug; diff --git a/agent-module/profiler-logging/src/main/java/com/navercorp/pinpoint/profiler/logging/Log4j2LoggingSystem.java b/agent-module/profiler-logging/src/main/java/com/navercorp/pinpoint/profiler/logging/Log4j2LoggingSystem.java index 1c25534769be..c822a5f24467 100644 --- a/agent-module/profiler-logging/src/main/java/com/navercorp/pinpoint/profiler/logging/Log4j2LoggingSystem.java +++ b/agent-module/profiler-logging/src/main/java/com/navercorp/pinpoint/profiler/logging/Log4j2LoggingSystem.java @@ -54,7 +54,7 @@ public void start() { logger.info("LoggerContextFactory:{} LoggerContext:{}", LogManager.getFactory().getClass().getName(), loggerContext.getClass().getName()); this.binder = new Log4j2Binder(loggerContext); - bindPLoggerFactory(this.binder); + bindPluginLogFactory(this.binder); this.setupGrpcLogger(loggerContext); } @@ -84,8 +84,7 @@ private void setupGrpcLogger(LoggerContext loggerContext) { private Logger getLoggerContextLogger() { - Logger logger = loggerContext.getLogger(getClass().getName()); - return logger; + return loggerContext.getLogger(getClass().getName()); } @@ -155,11 +154,11 @@ private void rollback(String key, String backup) { } - private void bindPLoggerFactory(PluginLoggerBinder binder) { + private void bindPluginLogFactory(PluginLoggerBinder binder) { final String binderClassName = binder.getClass().getName(); PluginLogger pluginLogger = binder.getLogger(binder.getClass().getName()); - pluginLogger.info("PLoggerFactory.initialize() bind:{} cl:{}", binderClassName, binder.getClass().getClassLoader()); - // Set binder to static LoggerFactory + pluginLogger.info("PluginLogManager.initialize() bind:{} cl:{}", binderClassName, binder.getClass().getClassLoader()); + // Set binder to static PluginLogManager // Should we unset binder at shutdown hook or stop()? PluginLogManager.initialize(binder); }