Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of configuring Mongodb3 in springboot2 log4j2

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "the method of springboot2 log4j2 configuring Mongodb3". In the daily operation, I believe that many people have doubts about the method of configuring Mongodb3 in springboot2 log4j2. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "springboot2 log4j2 configuration Mongodb3 method". Next, please follow the editor to study!

The first step, Check the proper configuration to ensure that the incoming packages are consistent with org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-logging org.springframework.boot spring-boot-starter-log4j2 org.mongodb Mongo-java-driver 3.10.1 org.apache.logging.log4j log4j-core 2.9.1 org.apache.logging.log4j log4j-nosql 2.9.1 second step, Configure log4j2 xml configuration Information

There was a problem with the configuration:

I couldn't connect with the previous version of mongodb4 or above.

There is also the xml item NoSql > MongoDb look at the document using a MongoDb3 connection is also a failure. Maybe the information you found is old.

The third step, configuring the contents of the configuration file, the fourth step application.propertiesserver.port=8084logging.config=classpath:log4j2-d.xmlspring.data.mongodb.host=127.0.0.1spring.data.mongodb.port=27017spring.data.mongodb.database=megatronspring.data.mongodb.username=spring.data.mongodb.password=, and the configuration items are all completed. See the results.

The running result does not report an error, and it starts normally, so there is still so much information. Let's take a look at the result of mongodb.

Finally, we see that the data in mongodb is successfully inserted and the error log information is output.

If the configuration information is incomplete, you can view the transmission of the low-end version.

At this point, the study on "the method of springboot2 log4j2 configuring Mongodb3" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report