Guilherme Giani created LOG4J2-2666:
---------------------------------------

             Summary: ERROR NoSql contains an invalid element or attribute 
"MongoDb3"
                 Key: LOG4J2-2666
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2666
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.12.0
         Environment: Java 12.
            Reporter: Guilherme Giani


I'm trying to setup log4j2 with mongo db in a very simple java project, but 
log4j keeps throwing me the following error:

 

2019-07-31 14:38:07,064 main ERROR NoSql contains an invalid element or 
attribute "MongoDb3"
2019-07-31 14:38:07,072 main ERROR NoSQL provider not specified for appender 
[databaseAppender].
2019-07-31 14:38:07,075 main ERROR Null object returned for NoSql in Appenders.
2019-07-31 14:38:07,087 main ERROR Unable to locate appender "databaseAppender" 
for logger config "root"

 

 This is my current log4j2.xml:

 

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="error">
 <Appenders>
 <NoSql name="databaseAppender">
 <MongoDb3 collectionName="applicationLog" 
factoryClassName="org.example.db.ConnectionFactory"
 factoryMethodName="getNewMongoClient" />
 </NoSql>
 </Appenders>
 <Loggers>
 <Root level="warn">
 <AppenderRef ref="databaseAppender"/>
 </Root>
 </Loggers>
</Configuration>

 

And these are the dependencies I have:

 

<dependency>
 <groupId>org.apache.logging.log4j</groupId>
 <artifactId>log4j-api</artifactId>
 <version>2.12.0</version>
 </dependency>

<dependency>
 <groupId>org.apache.logging.log4j</groupId>
 <artifactId>log4j-core</artifactId>
 <version>2.12.0</version>
 </dependency>

<dependency>
 <groupId>org.mongodb</groupId>
 <artifactId>mongo-java-driver</artifactId>
 <version>2.12.3</version>
 </dependency>



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to