Comments (2)
通过过滤系统输出实现了...
但是这样性能太差了!
毕竟这样每次系统输出的时候都要吧所有想要禁用的ST判断一遍_(:з」∠)_
有没有官方的开关哇...
private static SystemOutFilter systemOutFilter = null;
public static void enableSystemOutFilter()
{
if (systemOutFilter != null) return;
System.setOut(systemOutFilter = new SystemOutFilter(System.out));
}
/**
* 关闭Jboot的SQL指令信息报告
*/
public static void disableSqlReport()
{
enableSystemOutFilter();
systemOutFilter.getDisabledStackTraces().add("com.jfinal.plugin.activerecord.SqlReporter.invoke:56");
}
/**
* 系统输出过滤,
* 用来防止Jboot输出Sql指令信息刷屏什么的_(:з」∠)_
*/
public static class SystemOutFilter extends PrintStream
{
@Getter
private ArrayList<String> disabledStackTraces = new ArrayList<>();
private SystemOutFilter(OutputStream out)
{
super(out);
}
/**
* 过滤StackTrace
* @return 是否通过过滤
*/
private boolean verify()
{
StackTraceElement stackTrace = Thread.currentThread().getStackTrace()[3];
String stClass = stackTrace.getClassName();
String stMethod = stackTrace.getMethodName();
String stLine = stackTrace.getLineNumber() + "";
String stFull = stClass + "." + stMethod + ":" + stLine;
for (String disabledStackTrace : disabledStackTraces)
if (disabledStackTrace.equals(stFull)) return false;
return true;
}
@Override
public void println(String s)
{
if (verify()) super.println(s);
}
}
from jboot.
配置 jboot.mode = product 就自动关闭了,这个输出只是在debug模式下才会输出。默认情况下是debug
from jboot.
Related Issues (20)
- 数据源跟表的映射问题
- dubbo的反序列化漏洞
- 是否能支持Springboot3呢? HOT 1
- Jedis插件不支持IPV6地址
- 手机号码验证缺少最新的199等号段 HOT 2
- 错字受就是你了! (雾 HOT 1
- 如何不启动HTTP服务器的情况下使用数据库? HOT 2
- 在插件的类加载器环境无法读取properties HOT 1
- httpPost 方法的参数如果是多层的对象有bug
- Axios跨域调用 预检使用OPTIONS报错 HOT 1
- 是否有支持nacos的计划? HOT 2
- xxl-job-executor-sample-jboot如何设置jboot参数 HOT 1
- 生成代码报错 HOT 1
- 请更新 Dubbo 坐标 HOT 1
- 升级到3.1.x之后,Dubbo配置无效 HOT 1
- JbootInvocation 没有重写Invocation setArg getArg 倒致参数不能向下传递 HOT 1
- jboot代码生成器优化建议 HOT 1
- 关于JbootGatewayConfig 方法添加支持需求 HOT 1
- 新增完整执行时间统计的建议 HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jboot.