Comments (3)
考虑后期优化,也欢迎 PR。
目前可以在自己的项目注册一个 AccessLogHandler 类型的 Spring Bean,重写 CustomAccessLogHandler#buildLog 方法,会覆盖默认的行为。
另外还可以通过配置 ballcat.log.access.ignore-url-patterns
对指定 url 规则忽略访问日志记录。
from ballcat.
先关闭此 issues, 后续讨论在 #237 内进行
from ballcat.
通过以下配置确实可以解决二维码被保存至数据库报错的问题
ballcat:
log:
access:
ignore-url-patterns:
- /captcha/**
感谢!根据
@Hccake
的提示,通过限制报文的长度,可以解决问题。
import com.hccake.ballcat.common.log.access.handler.AccessLogHandler;
import com.hccake.ballcat.log.handler.CustomAccessLogHandler;
import com.hccake.ballcat.log.model.entity.AccessLog;
import com.hccake.ballcat.log.service.AccessLogService;
import com.hccake.ballcat.log.thread.AccessLogSaveThread;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author SHData
*/
@Slf4j
@Configuration
public class MyCustomAccessLogHandler {
/**
* 重写 CustomAccessLogHandler#saveLog 方法,覆盖默认的行为。
* params 和 RequestBody 长度超过2000 则截断
*/
@Bean
@ConditionalOnBean(AccessLogService.class)
protected AccessLogHandler<AccessLog> accessLogHandler(AccessLogService accessLogService)
{
return new CustomAccessLogHandler(new AccessLogSaveThread(accessLogService))
{
/**
* 记录日志
* @param accessLog 访问日志
*/
@Override
public void saveLog(AccessLog accessLog) {
accessLog.setReqParams(StringUtils.substring(accessLog.getReqParams(),0,2000));
accessLog.setReqBody(StringUtils.substring(accessLog.getReqBody(),0,2000));
super.saveLog(accessLog);
}
};
}
}
from ballcat.
Related Issues (20)
- 菜单配置 HOT 3
- 是否有增加租户的计划 HOT 7
- 数据权限 HOT 1
- 1.0.0 内置的 LogConfiguration 由于 conditional 优先级问题导致相关 bean 没有成功注册
- LambdaAliasWrapper 嵌套条件构建时,生成的 SQL 条件对应值为 null HOT 1
- 访问日志功能优化
- 国际化 中 I18nField注解的 code也是支持Spel的吗,但是不生效 HOT 6
- Dependency org.yaml:snakeyaml, leading to CVE problem HOT 1
- 国际化反射翻译设置值出现性能问题,这个有思路吗 HOT 5
- 有一些mapper的xml为什么找不到呀 HOT 3
- 教程:使数据范围权限DataScope支持Bean Searcher HOT 2
- 数据权限扩展以便支持其他 ORM 框架
- 页面缓存失败,切换tabs标签页时,页面接口重复请求2次 HOT 3
- 官网域名需要备案 HOT 2
- 数据库脚本在mysql 5.7.30 执行错误 HOT 1
- 建议重构或修复关于天一弘短信服务 HOT 1
- SAS模式下未配置resourceserver属性导致初始化失败 HOT 2
- 无法正确本地化security错误信息
- excel导入校验字段时未采用框架i18n正确输出最终的文案 HOT 1
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 ballcat.