You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2016/07/13 20:09:19 UTC
[15/50] [abbrv] logging-log4j2 git commit: Incomplete test to
illustrate LOG4J2-1452
Incomplete test to illustrate LOG4J2-1452
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/723040dc
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/723040dc
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/723040dc
Branch: refs/heads/feature/LOG4J2-1430
Commit: 723040dc9d433e94eca9a147e629dc32a8bfb152
Parents: da3550d
Author: Mikael St�ldal <mi...@magine.com>
Authored: Wed Jun 29 21:39:24 2016 +0200
Committer: Mikael St�ldal <mi...@magine.com>
Committed: Wed Jun 29 21:39:24 2016 +0200
----------------------------------------------------------------------
.../logging/log4j/core/FlowTracingTest.java | 44 ++++++++++++++++++++
.../src/test/resources/FlowTracingTest.xml | 16 +++++++
2 files changed, 60 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/723040dc/log4j-core/src/test/java/org/apache/logging/log4j/core/FlowTracingTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/FlowTracingTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/FlowTracingTest.java
new file mode 100644
index 0000000..feef612
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/FlowTracingTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.config.ConfigurationFactory;
+import org.apache.logging.log4j.message.EntryMessage;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Incomplete test to illustrate LOG4J2-1452.
+ */
+public class FlowTracingTest {
+
+ @BeforeClass
+ public static void beforeClass() {
+ System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, "FlowTracingTest.xml");
+ }
+
+ @Test
+ public void testFlowTracing() throws Exception {
+ final org.apache.logging.log4j.Logger logger = LogManager.getLogger("com.foo.Bar");
+
+ EntryMessage entryMessage = logger.traceEntry(logger.getMessageFactory().newMessage("the entry"));
+ logger.info("something else");
+ logger.traceExit(entryMessage);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/723040dc/log4j-core/src/test/resources/FlowTracingTest.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/FlowTracingTest.xml b/log4j-core/src/test/resources/FlowTracingTest.xml
new file mode 100644
index 0000000..8b4c257
--- /dev/null
+++ b/log4j-core/src/test/resources/FlowTracingTest.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="ERROR">
+ <Appenders>
+ <Console name="Console">
+ <PatternLayout>
+ <Pattern>%p %c{1} %m%n</Pattern>
+ </PatternLayout>
+ </Console>
+ </Appenders>
+
+ <Loggers>
+ <Root level="trace">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
\ No newline at end of file