react-native-file-logger icon indicating copy to clipboard operation
react-native-file-logger copied to clipboard

Setting 0 to maximumFileSize

Open MohamadDabboussi11 opened this issue 3 months ago • 0 comments

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

MohamadDabboussi11 avatar Sep 05 '25 04:09 MohamadDabboussi11