Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlog分割及删除日志问题 #266

Open
ssgnh opened this issue Aug 22, 2024 · 2 comments
Open

zlog分割及删除日志问题 #266

ssgnh opened this issue Aug 22, 2024 · 2 comments

Comments

@ssgnh
Copy link

ssgnh commented Aug 22, 2024

目的

多个分类日志存储再同一个日志记录文件里,限制单个文件的大小和总日志文件的数量

问题

zlog配置如下:

# # 单个日志最大5M,最多存10个
modbus_tcp.INFO     "./logs/bau-%d(%F).log" , 5MB * 10 ~ "./logs/bau-old-%d(%Y%m%d).#2s.log"; detail
main.INFO           "./logs/bau-%d(%F).log"; detail
data_storage.INFO   "./logs/bau-%d(%F).log"; detail
config.DEBUG        "./logs/bau-%d(%F).log"; detail
gpio.DEBUG          "./logs/bau-%d(%F).log"; detail
sqlite3.INFO        "./logs/bau-%d(%F).log"; detail
rs_485_screen.INFO  "./logs/bau-%d(%F).log"; detail
watch_dog.DEBUG     "./logs/bau-%d(%F).log"; detail
pcs_tcp.DEBUG       "./logs/bau-%d(%F).log"; detail
env_dev.INFO        "./logs/bau-%d(%F).log"; detail
can.INFO            "./logs/bau-%d(%F).log"; detail
# # *.*     "aa.log", 100MB ~ "aa-%d(%Y%m%d).#2s.log"
  1. 多个分类存放在同一文件时,限制日志数量和大小的语句5MB * 10 ~ "./logs/bau-old-%d(%Y%m%d).#2s.log",是每个分类都要写上吗?
  2. 在测试时,日志在到底5MB时会自动分割,但是数量超过10时,并没有删除旧日志。请教下,我配置的超过10个日志文件删除,==是指程序不间断运行期间产生超过10个日志文件删除,还是指日志文件夹下总数量超过10个文件才删除==。因为我的测试环境是频繁的运行和关闭程序,生成的日志超过10个时并没有删除,所有猜想是程序不间断运行期间生成的超过10个才删除

期待您的回复!

@nocanstillbb
Copy link

2.好像只有#r 结尾的可以自动删除, 你想啊, 文件名前辍都不一样,他怎么根据文件名统计数量,删除呢

@zhouyunbin
Copy link

zhouyunbin commented Dec 3, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants