Hello everyone,

I have a strange side effect when our disks run out of space. (I know it's
not a task of a logging framework and log4 is also not a cause of our
problem, but it is still a side effect of the log4j :))

Log4 (2.5) starts to generate 0-Byte files and these files will be
immediately "gunzipped". So at the end of a day I have 2-5 "real" log files
and some hundreds of 0-byte *.log and *.log.gz files.

Is this side effect already known? Is there some workaround for this
problem? It's not a really blocker but it is also not nice...

I thought it were possible to delete such files with IfAccumulatedFileSize
policy, but there is a check with IllegalParameterException (>=0)

My config file is attached.

Regards,
Dmitriy

P. S. CdllFileAppender extends
AbstractOutputStreamAppender<RollingFileManager>
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>

    <Properties>
        <Property name="path">${sys:our.project.location}/logs/project</Property>
        <Property name="logFilePath">${path}/${sys:com.sun.aas.hostName}</Property>
        <Property name="logFileName">${logFilePath}-XYZ.log</Property>
        <Property name="logFilePattern">${logFilePath}-XYZ.log.%d{yyyy-MM-dd-HH-mm}.gz</Property>
    </Properties>

    <Appenders>
        <CdllFileAppender name="CdllFileAppender"
                          fileName="${logFileName}"
                          filePattern="${logFilePattern}"
                          appID="XYZ" hub="EMEA" environment="XYZ">


            <Policies>
                <SizeBasedTriggeringPolicy size="5 MB"/>
            </Policies>

            <DefaultRolloverStrategy>
                <Delete basePath="${path}" maxDepth="1">
                    <IfFileName glob="*.log.*" >
                        <IfLastModified age="P32D" />
                    </IfFileName>
                </Delete>
            </DefaultRolloverStrategy>

        </CdllFileAppender>

        <Console name="console" target="SYSTEM_OUT">
            <PatternLayout pattern="%-6level %cdllAttributes %n"/>
        </Console>

    </Appenders>

    <Loggers>

        <Root level="info">
            <AppenderRef ref="console"/>
        </Root>

        <Logger name="our.logger.name" level="info" additivity="false">
            <AppenderRef ref="CdllFileAppender"/>
            <AppenderRef ref="console" />
        </Logger>

    </Loggers>

</Configuration>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to