- Mastering Spring Boot 2.0
- Dinesh Rajput
- 154字
- 2021-06-25 21:29:16
Fine-tuning with logging
Logging is very important in each application to debug and analyze the application's bugs during runtime. If you are working with the old-fashioned Spring Framework, then you have to configure the logging framework explicitly in your application. But Spring Boot provides support for several logging frameworks and also allows you to customize and fine-tune logging in to your Spring application. Spring Boot includes, by default:
- SLF4J: Logging facade
- Logback: SLF4J implementation
But as a best practice, stick to default logging in your application and use the SLF4J abstraction in the application code. Spring Boot also supports other logging frameworks such as Java Util Logging, Log4J, and Log4J2. You can use another logging frameworks by just adding a dependency, as follows:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId> <exclusions> <exclusion> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </dependency>
According to this code, we are using log4j12 instead of the logback logging framework. Let's see how to configure logging output in a Spring application.
- Word/Excel/PPT 2013辦公應(yīng)用從入門(mén)到精通
- 新編電腦辦公(Windows 10 + Office 2010版)從入門(mén)到精通
- 新編電腦辦公(Windows 7 + Office 2013版)從入門(mén)到精通
- 金蝶ERP-K/3培訓(xùn)教程:財(cái)務(wù)/供應(yīng)鏈/生產(chǎn)制造(第2版)
- Excel 2007函數(shù)與公式實(shí)戰(zhàn)技巧精粹
- WPS辦公應(yīng)用四合一:文檔處理+數(shù)據(jù)分析+文稿演示+移動(dòng)辦公
- Excel公式與函數(shù)從入門(mén)到精通
- Excel高效辦公:公司表格設(shè)計(jì)(修訂版)
- 精通Excel數(shù)據(jù)統(tǒng)計(jì)與分析
- Minecraft創(chuàng)客制作:用樂(lè)高、3D打印、Arduino等創(chuàng)建Minecraft真實(shí)世界
- 現(xiàn)用現(xiàn)查:電腦BIOS/注冊(cè)表設(shè)置實(shí)戰(zhàn)秘籍
- 精通Excel數(shù)據(jù)統(tǒng)計(jì)與分析
- AutoCAD2015中文版從入門(mén)到精通
- 情感化PPT設(shè)計(jì)(微視頻版)
- Office 2003辦公應(yīng)用從入門(mén)到精通