You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2015/06/03 09:47:39 UTC
logging-log4j2 git commit: Help test with MongoDB.
Repository: logging-log4j2
Updated Branches:
refs/heads/master 388595a1b -> 914c5647b
Help test with MongoDB.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/914c5647
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/914c5647
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/914c5647
Branch: refs/heads/master
Commit: 914c5647b04539f817714bd6242a30adeb7bda94
Parents: 388595a
Author: Gary Gregory <ga...@gmail.com>
Authored: Wed Jun 3 00:47:36 2015 -0700
Committer: Gary Gregory <ga...@gmail.com>
Committed: Wed Jun 3 00:47:36 2015 -0700
----------------------------------------------------------------------
.../log4j/nosql/appender/MongoDbTest.java | 37 ++++++++++++++++++++
.../src/test/resources/log4j2-mongodb.xml | 30 ++++++++++++++++
2 files changed, 67 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/914c5647/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/MongoDbTest.java
----------------------------------------------------------------------
diff --git a/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/MongoDbTest.java b/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/MongoDbTest.java
new file mode 100644
index 0000000..2b061c6
--- /dev/null
+++ b/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/MongoDbTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.nosql.appender;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.junit.InitialLoggerContext;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("Requires a running MongoDB server")
+public class MongoDbTest {
+
+ @ClassRule
+ public static InitialLoggerContext context = new InitialLoggerContext("log4j2-mongodb.xml");
+
+ @Test
+ public void test() {
+ final Logger logger = LogManager.getLogger();
+ logger.info("Hello log");
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/914c5647/log4j-nosql/src/test/resources/log4j2-mongodb.xml
----------------------------------------------------------------------
diff --git a/log4j-nosql/src/test/resources/log4j2-mongodb.xml b/log4j-nosql/src/test/resources/log4j2-mongodb.xml
new file mode 100644
index 0000000..c759054
--- /dev/null
+++ b/log4j-nosql/src/test/resources/log4j2-mongodb.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<Configuration status="error">
+ <Appenders>
+ <NoSql name="MongoDbAppender">
+ <MongoDb databaseName="test" collectionName="applog" server="localhost" />
+ </NoSql>
+ </Appenders>
+ <Loggers>
+ <Root level="ALL">
+ <AppenderRef ref="MongoDbAppender" />
+ </Root>
+ </Loggers>
+</Configuration>