In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "Springboot project how to deal with the log", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Springboot project how to deal with the log" bar!
As shown in the figure above, a new log file is generated every day, and then the logs are classified. I only classify error and info here.
How do I do that?
First, create a new file in the resource directory named logback-spring.xml
% d -% msg%n ERROR DENY ACCEPT% msg%n / var / log/tomcat/sell/info.%d.log ERROR% msg%n / var/log/tomcat/sell/error.%d.log
Singleton test:
Import lombok.Data;import lombok.extern.slf4j.Slf4j;import org.junit.jupiter.api.Test;import org.junit.runner.RunWith;import org.springframework.boot.test.context.SpringBootTest;import org.springframework.test.context.junit4.SpringRunner;@RunWith (SpringRunner.class) @ SpringBootTest@Slf4j@Datapublic class LoggerTest {@ Test public void test1 () {String name= "laomi"; String password= "123456"; log.info ("debug.") Log.info ("info."); log.error ("error...."); log.info ("name: {}, password: {}", name,password);}
Add dependencies:
Org.projectlombok lombok test
FileNamePattern this is the file path. I found the newly created folder in the sibling directory of this project.
Thank you for reading, the above is the content of "how to deal with the log of the Springboot project", after the study of this article, I believe you have a deeper understanding of how to deal with the log of the Springboot project, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.