Skip to content

Setting 0 to maximumFileSize #92

@MohamadDabboussi11

Description

@MohamadDabboussi11

In the README it says that setting maximumFileSize to 0 should disable the file size limit, meaning a single file can grow without restriction. But in practice, what happens is that the logger starts creating a flood of files, each only a few bytes long — as if the max file size were literally being treated as 0 bytes. What I actually want is to ignore file size entirely and just rely on daily rolling, so that I get one log file per day.

Also on Android, setTotalSizeCap is assigned as an int, which means its maximum value is 2^31 - 1 (≈2.1 GB). Any value above this overflows into a negative number. When that happens, Logback’s rolling policy breaks and no log files are produced.

Example:

FileLogger.configure({
  maximumNumberOfFiles: 60,
  maximumFileSize: 200 * 1024 * 1024, // 200 MB
  dailyRolling: true,
});

This calculates maximumNumberOfFiles * maximumFileSize as ~12 GB, which doesn’t fit in an int. The overflowed negative value passed to setTotalSizeCap prevents log files from being created

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions