Skip to content

log file generation not proper #8187

Open
@Nithin005

Description

@Nithin005

ImageMagick version

7.1.1-47

Operating system

Linux

Operating system, version and so on

wsl2-ubuntu

Description

i have configured custom log.xml.

<logmap>
  <log events="all"/>
  <log output="file"/>
  <log filename="/home/nithin005/imagemagick_test/log/Magick-%g.log"/>
  <log generations="3"/>
  <log limit="100"/>
  <log format="%t %r %u %v %d %c[%p]: %m/%f/%l/%d\n  %e"/>
</logmap>

https://imagemagick.org/source/log.xml says "Limit is the number of logging events before generating a new log generation"
but its actually generating a new log file after 100mb is reached? and not based on log event count?. on checking the source code, it seems to be comparing the limit with file size?

"Generations is the number of log files to retain"
but i found, its a bit weird
scenario1 (first log file is above limit) - every time a log is written, the first log line is always written in Magick-0.log, it writes next log lines in Magick-1.log ..., so first log file always grows slightly even if its already above limit.
scenario2 (all log file is above limit) - the logs is written mixed among Magick-0.log, Magick-1.log ..., so all log file size grow equally.

1, why is log file split based on filesize, instead of log event count as mentioned in comment?
2, in scenario1, why is the first line of log always written in first generation file?
3, in scenario2, why is logs keep getting written in existing log files which are already overlimit? this makes the log files grow indefinitely . shouldnt we delete the old logs and create new ones?

Steps to Reproduce

1, configure policy.xml like in description. set limit to very low for testing <log limit="1"/>
2, run magick resize command on an image repeatedly, so that the log file size grows.
3, see that after 1mb is reached, the log file is split.
4, see that for next resize run, the first log for it is written in Magick-0.log and the next logs are written in Magick-1.log
5, keep repeatedly running magick resize, so all log file are generated upto generations limit to reproduce scenario2

Images

see description

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