日志系列之Log4j2 Garbage-free模式
来源:互联网 发布:ui设计软件下载 编辑:程序博客网 时间:2024/06/10 02:28
Garbage-free核心思想:避免或减少对象的创建;
实现方式
- 对象复用(threadlocal、jvm级别复用);
- 避免临时对象的创建;
From version 2.6, Log4j runs in “garbage free” mode by default where objects and buffers are reused and no temporary objects are allocated as much as possible. There is also a “low garbage” mode which is not completely garbage free but does not use ThreadLocal fields. This is the default mode when Log4j detects it is running in a web application.
检测web应用
方式:检测javax.servlet.Servlet是否在classpath上;
系统参数配置
- log4j2.enableThreadlocals - if “true” (the default for non-web applications) objects are stored in ThreadLocal fields and reused, otherwise new objects are created for each log event.
- log4j2.enableDirectEncoders - if “true” (the default) log events are converted to text and this text is converted to bytes without creating temporary objects.
阅读全文
0 0
- 日志系列之Log4j2 Garbage-free模式
- 日志系列之Log4j2异步Loggers
- 日志系列之WEB应用中使用Log4j2
- 日志采集之log4j2.x的使用
- Spring Boot系列教程六:日志输出配置log4j2
- Spring Boot系列教程六:日志输出配置log4j2
- srping boot之日志配置logback和log4j2
- log4j2配置mybatis日志
- log4j2 按天分日志
- Java日志-Log4J2
- log4j2 日志配置
- Log4j2实现异步日志
- LOG4J2 异步日志
- SpringBoot - 日志集成 Log4j2
- log4j2日志配置
- log4j2 按天分日志
- log4j2 日志配置实战
- 日志学习:SLF4J & Log4J2
- [错排] BZOJ2034:「SDOI2016」排列计数
- 区块链资料不断收集
- Python-数组
- TabLayout中的Tab间隔设置方法
- 滑动窗:Subsequence
- 日志系列之Log4j2 Garbage-free模式
- [USACO3.1]最短网络 Agri-Net kruskal
- Kotlin_Recyclerview_Rxjava的封装
- android编译中的BUILD_JAVA_LIBRARY
- CentOS6.5系统"libc.so.6: version 'GLIBC_2.15' not found"解决方法
- 智能合约语言 Solidity 教程系列3
- numpy.log
- POJ 3281 Dining(转换+最大流)
- Sublime text 3 打造Java编译环境