Add LOG4J2 domain to the Log4j 2.x agent
[lttng-ust.git] / src / lib / lttng-ust-java-agent / java / lttng-ust-agent-log4j2 / org / lttng / ust / agent / log4j2 / LttngLog4j2Agent.java
index cb7c35ad0ce8f5217fec9a413839e14fa98e9e86..707639a1f48babb6722e904767034cb39acaa573 100644 (file)
@@ -27,17 +27,25 @@ import org.lttng.ust.agent.AbstractLttngAgent;
  */
 class LttngLog4j2Agent extends AbstractLttngAgent<LttngLogAppender> {
 
-       private static LttngLog4j2Agent instance = null;
+       private static LttngLog4j2Agent log4j2_instance = null;
+       private static LttngLog4j2Agent log4j1_instance = null;
 
-       private LttngLog4j2Agent() {
-               super(Domain.LOG4J);
+       private LttngLog4j2Agent(Domain domain) {
+               super(domain);
        }
 
-       public static synchronized LttngLog4j2Agent getInstance() {
-               if (instance == null) {
-                       instance = new LttngLog4j2Agent();
+       public static synchronized LttngLog4j2Agent getLog4j1Instance() {
+               if (log4j1_instance == null) {
+                       log4j1_instance = new LttngLog4j2Agent(Domain.LOG4J);
                }
-               return instance;
+               return log4j1_instance;
+       }
+
+       public static synchronized LttngLog4j2Agent getLog4j2Instance() {
+               if (log4j2_instance == null) {
+                       log4j2_instance = new LttngLog4j2Agent(Domain.LOG4J2);
+               }
+               return log4j2_instance;
        }
 
        @Override
This page took 0.023608 seconds and 4 git commands to generate.