logging.level的含义及设置 【java 日志 (logback、log4j)】

日志级别 trace<debug<info<warn<error<fatal

常用的有:debug,info,warn,error

通常我们想设置日志级别,会用到 logging.level.root=info

**logging.level设置日志级别,后面跟生效的区域。root表示整个项目。**也可以写某个包,或者某个类。

例如:logging.level.com.ali.service=error。在com.ali.service包下所有的类,都是error级别打印。如果代码里有logger.info("xxx");,则不会打印日志。logger.error("xxx")会打印。

日志级别的值不区分大小写:INFO,info都可以。

java 复制代码
private static final Logger logger = LoggerFactory.getLogger(xxxx.class);

...

public void t1(){
    logger.info("打印info日志");
    logger.error("打印error日志");
}
相关推荐
会周易的程序员2 天前
使用 pybind11 封装 C++ 日志库 microLog 为 Python 模块
java·c++·python·物联网·架构·日志·aiot
cfm_29142 天前
SpringBoot MockMvc
spring boot·后端·log4j
豆瓣鸡3 天前
整合Logback日志框架
logback
会周易的程序员3 天前
使用 LuaBridge 封装 C++ 日志库 microLog 为 Lua 模块
c++·物联网·junit·lua·日志·iot·aiot
会周易的程序员3 天前
microLog 的 log_reader 架构解析:嵌入式日志检索引擎的设计之道
c++·物联网·架构·日志·iot·aiot
天真的银耳汤4 天前
01 静态分析(Static Analysis)
log4j
会周易的程序员4 天前
microLog 的本地日志读取接口 log_reader — 本地日志文件读取工具开发指南
linux·物联网·架构·嵌入式·日志·iot·aiot
会周易的程序员5 天前
microLog 后端开发指南
开发语言·c++·物联网·设计模式·日志·iot·aiot
会周易的程序员6 天前
microLog:专为嵌入式与高可靠场景打造的高性能日志库
c++·物联网·日志·iot·aiot
周杰伦fans25 天前
记一次 Visual Studio 突然报错“未能加载 Microsoft.Internal.VisualStudio.Interop”的奇葩经历
microsoft·log4j·visual studio