3b0943fbaa59b1d7f5993856e467346427f49671
2 * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 package org
.lttng
.ust
.agent
.integration
.events
;
21 import java
.io
.IOException
;
23 import org
.apache
.log4j
.Appender
;
24 import org
.apache
.log4j
.Level
;
25 import org
.apache
.log4j
.Logger
;
26 import org
.junit
.jupiter
.api
.AfterAll
;
27 import org
.junit
.jupiter
.api
.AfterEach
;
28 import org
.junit
.jupiter
.api
.BeforeAll
;
29 import org
.junit
.jupiter
.api
.BeforeEach
;
30 import org
.junit
.jupiter
.api
.Tag
;
31 import org
.lttng
.tools
.ILttngSession
.Domain
;
32 import org
.lttng
.ust
.agent
.log4j
.LttngLogAppender
;
33 import org
.lttng
.ust
.agent
.utils
.Log4jTestUtils
;
36 * Log4j tests for multiple concurrent tracing sessions
40 public class Log4jMultiSessionIT
extends MultiSessionITBase
{
42 private static final Domain DOMAIN
= Domain
.LOG4J
;
44 private Logger loggerA
;
45 private Logger loggerB
;
46 private Logger loggerC
;
47 private Logger loggerD
;
53 public static void log4jClassSetup() {
54 Log4jTestUtils
.testClassSetup();
61 public static void log4jClassCleanup() {
62 Log4jTestUtils
.testClassCleanup();
68 * @throws SecurityException
72 public void log4jSetup() throws SecurityException
, IOException
{
73 // TODO Wipe all existing LTTng sessions?
75 loggerA
= Logger
.getLogger(EVENT_NAME_A
);
76 loggerB
= Logger
.getLogger(EVENT_NAME_B
);
77 loggerC
= Logger
.getLogger(EVENT_NAME_C
);
78 loggerD
= Logger
.getLogger(EVENT_NAME_D
);
80 loggerA
.setLevel(Level
.ALL
);
81 loggerB
.setLevel(Level
.ALL
);
82 loggerC
.setLevel(Level
.ALL
);
83 loggerD
.setLevel(Level
.ALL
);
85 handlerA
= new LttngLogAppender();
86 handlerB
= new LttngLogAppender();
87 handlerC
= new LttngLogAppender();
88 handlerD
= new LttngLogAppender();
90 loggerA
.addAppender((Appender
) handlerA
);
91 loggerB
.addAppender((Appender
) handlerB
);
92 loggerC
.addAppender((Appender
) handlerC
);
93 loggerD
.addAppender((Appender
) handlerD
);
100 public void log4jTeardown() {
101 loggerA
.removeAppender((Appender
) handlerA
);
102 loggerB
.removeAppender((Appender
) handlerB
);
103 loggerC
.removeAppender((Appender
) handlerC
);
104 loggerD
.removeAppender((Appender
) handlerD
);
113 protected Domain
getDomain() {
118 protected boolean closeHandlers()
124 protected void sendEventsToLoggers() {
125 Log4jTestUtils
.send10Events(loggerA
);
126 Log4jTestUtils
.send10Events(loggerB
);
127 Log4jTestUtils
.send10Events(loggerC
);
128 Log4jTestUtils
.send10Events(loggerD
);
This page took 0.05664 seconds and 3 git commands to generate.