Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

LogCleaner can not delete old logs #971

@lingbin

Description

@lingbin

glog version: 0.6.0

My simplified reproduction process is as follows:

  1. Old logs in '/tmp/glogs':
#ll -rt /tmp/glogs/
total 32776
-rw-r--r-- 1 root root 33554535 Oct  1 00:00 test-cleaner.28f8271ff892.root.log.INFO.20231001-000000.65295
  1. Code that can reproduce the problem (simplified):
#include <string>

#include <glog/logging.h>

static constexpr const char* kLogPrefix = "test-cleaner";
static constexpr const char* kLogDirEnv = "LOG_DIR";
const std::string kLogContent(100, 'a');

int main() {
  // Init logging
  FLAGS_log_dir = std::getenv(kLogDirEnv);
  FLAGS_max_log_size = 32;  // 32 MB

  google::InitGoogleLogging(kLogPrefix);
  google::EnableLogCleaner(3);

  for (int i = 0; i < 1'000; ++i) {
    LOG(INFO) << kLogContent;
  }

  google::DisableLogCleaner();
  google::ShutdownGoogleLogging();
}
  1. Environment variables:LOG_DIR=/tmp/glogs

It is set above to delete files that are more than 3 days old, but they are not deleted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions