Giter Site home page Giter Site logo

Comments (10)

pqpo avatar pqpo commented on August 11, 2024

你是测试出来没改变吗?
代码逻辑上是会 flush 缓存,然后重建缓存:

void LogBuffer::changeLogPath(char *log_path) {
    if(log_file != nullptr) {
        async_flush();
    }
    initData(log_path, strlen(log_path), is_compress);
}

from log4a.

mainlxl avatar mainlxl commented on August 11, 2024

是这样 首先正常初始化(初始化文件名字取得是当日日期)输出日志 而后修改手机时间更换保存名字初始化 两次初始化缓存文件使用同一份 结果后换保存文件名的日志正常写入缓存 最后脏数据会写入第一次保存名字的文件中

from log4a.

pqpo avatar pqpo commented on August 11, 2024

一般在 Application 初始化 Log, 那么更换手机时间后,杀死进程,重启应用,这个时候理论上会先写脏数据,然后重建缓存。
如果要在应用使用中更换日志文件路径,那么需要手动调用一下 me.pqpo.librarylog4a.LogBuffer 的 changeLogPath();

from log4a.

mainlxl avatar mainlxl commented on August 11, 2024

from log4a.

pqpo avatar pqpo commented on August 11, 2024

我用本项目的 DEMO 进行如下测试:

  1. log content 输入:“7月10日”, 点击 WRITE LOG, 此时内容会输出到缓存文件中。
  2. 杀进程,确保日志还留在缓存文件中(点击返回会 flush 到日志文件中)。
  3. 修改时间到 7月11日,打开应用,此时会回写脏数据,然后重建缓存。
  4. 按 HOME 键退到后台,然后去日志目录验证一下,打开日志文件 2018_07_10.txt 发现存在日志 “7月10日” ,符合预期。
  5. log content 输入:“7月11日”, 点击 WRITE LOG, 点击返回退出应用,确保缓存已经刷新到日志文件中。
  6. 查看日志文件 2018_07_11.txt 存在日志 “7月11日”, 符合预期。

from log4a.

mainlxl avatar mainlxl commented on August 11, 2024

from log4a.

pqpo avatar pqpo commented on August 11, 2024

奇怪了,我按你视频里的操作了一遍是正常的,我的系统是 7.1.2

from log4a.

mainlxl avatar mainlxl commented on August 11, 2024

我的也是7.1.2 - -!

from log4a.

Chen-Sir avatar Chen-Sir commented on August 11, 2024

我这边测试也发现类似这个的问题。
BufferFilePath不改变的话,setLogFilePath不会生效。
我这边测试了下,修改了LogFilePath之后再重新安装app后,每次写入的logfile都是第一次设置的那个logfile文件

from log4a.

pqpo avatar pqpo commented on August 11, 2024

#32 有可能是这个问题造成的,1.4.2 已修复

from log4a.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.