当前位置:网站首页>[idea] use of log
[idea] use of log
2022-04-22 21:58:00 【Li ear】
In the use of MyBatis When , Actually MyBatis The framework will print some necessary log information , During the development phase, this log information is useful for
We analyze the problem , Understanding the execution of code is particularly helpful ;
Including after the project goes online , We can also collect the error log of the project into the file ;
So we use a special log system to deal with .
The logging system is a tool
-
Copy coordinates
-
<!-- log start --> <!-- The specific implementation of log --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.12</version> </dependency> <!-- Interface --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.6</version> </dependency> <!-- Intermediate transformation jar package --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.6.6</version> </dependency> -
Copy log4j.properties To project
-
## Set the way of logging to the console log4j.appender.std=org.apache.log4j.ConsoleAppender log4j.appender.std.Target=System.err log4j.appender.std.layout=org.apache.log4j.PatternLayout log4j.appender.std.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %c{1}:%L - %m%n ## Set the way of logging to file log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.File=mylog.txt log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n ## The level of log output , And configuration record scheme log4j.rootLogger= debug,std,file
Configuration file general configuration
-
The development phase : log4j.rootLogger= debug,std,file
-
After the launch : log4j.rootLogger= error ,file
-
Level :error > warn > info>debug>trace
版权声明
本文为[Li ear]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221554467147.html
边栏推荐
- CSV Column Extract列提取
- Markdown advanced usage
- Suggestions for improving C program 4: implementation of standard dispose mode in C
- Expérience 3
- IM即时通讯开发如何设计能支撑百万并发的数据库
- uClibc 和 Glibc 不一样
- Outside of social engineering -- cryptography
- Noise problem at the end of alsa playback
- 如何实现根据照片获取地理位置及如何防御照片泄漏地理位置
- [JS] 实现网页指定区域导出PDF
猜你喜欢

What does 302 mean in PHP

未来源码 | 吴恩达教授重磅演讲:Tips for using a data-centric AI approach

MySQL deadlock analysis and solution caused by index merging!

CSV Column Extract列提取

The principle of training multilayer neural networks using back propagation
Go daily news (March 28, 2021) -- non type safe pointers in golang language

Dealers organize a group to review Auchan Z6: praise high-energy products

短视频内容理解与生成技术在美团的创新实践

c语言怎么实现猜数字小游戏

Brief introduction of Microsoft testers
随机推荐
The principle of training multilayer neural networks using back propagation
Apache configuration multiport
[operation tutorial] how to turn on the voice intercom function on the national standard gb28181 platform easygbs?
职场PUA,管理者的五宗罪
地球日集合:微软与英特尔邀你Get绿色大使徽章,予能负碳排!
Summary of problems encountered in ffmpeg audio decoding
未来源码 | 吴恩达教授重磅演讲:Tips for using a data-centric AI approach
Underlying principle of MySQL index
[JS] 实现网页指定区域导出PDF
Why do we need to do enterprise growth evaluation and analysis?
Future source code | Professor Wu Enda's lecture: Tips for using a data centric AI approach
Ampere Computing释放观测云“芯”算力,强强联合推动可观测性发展
Continuous delivery - Blue Ocean application
CSV Column Extract列提取
Comprehensive practice of linear regression and logical regression of user portrait
Introduction to golang -- six ways to define a map
leetcode--806. Number of lines required to write string
glib 和 glibc
如何在项目中引入SPI
Experiment 3