logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remko Popma (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LOG4J2-1162) Memory-mapped file appender creates null-padded files.
Date Sun, 18 Oct 2015 16:00:06 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-1162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14962473#comment-14962473
] 

Remko Popma edited comment on LOG4J2-1162 at 10/18/15 3:59 PM:
---------------------------------------------------------------

Note in that output how it seems to start two XML configurations but it only stops one.
This means that the ref count on the MMap Manager is not zero and the file will not be closed/truncated.

This may happen if you erroneously call {{LoggerContext.getContext(true)}} instead of {{LoggerContext.getContext(false)}}.


was (Author: remkop@yahoo.com):
Note in that output how it seems to start two XML configurations but it only stops one.
This means that the ref count on the MMap Manager is not zero and the file will not be closed/truncated.

> Memory-mapped file appender creates null-padded files.
> ------------------------------------------------------
>
>                 Key: LOG4J2-1162
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1162
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.4.1
>         Environment: Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T04:57:37-07:00)
> Maven home: C:\Java\apache-maven-3.3.3\bin\..
> Java version: 1.7.0_79, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_79\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>            Reporter: Gary Gregory
>             Fix For: 2.5
>
>
> Memory-mapped file appender creates null-padded files.
> If configured my app like this:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- Copyright 2014-2015 Rocket Software, Inc. All rights reserved. -->
> <Configuration status="WARN" monitorInterval="5">
>   <Appenders>
>     <Console name="Console" target="SYSTEM_OUT">
>       <PatternLayout noConsoleNoAnsi="true"
>         pattern="%style{%d}{white} %highlight{%-5level}{TRACE=white} %style{[%t][%logger]}{white}
%highlight{%msg%n%throwable}{TRACE=white}" />
>     </Console>
>     <RollingRandomAccessFile name="RollingFile" append="false" fileName="/test/dv/logs/dv.log-OFF"
>       filePattern="/test/dv/logs/$${date:yyyy-MM}/dv-%d{yyyy-MM-dd}-%i.log.gz">
>       <PatternLayout>
>         <Pattern>%d %-5level [%t][%logger] %msg%n%throwable</Pattern>
>       </PatternLayout>
>       <Policies>
>         <SizeBasedTriggeringPolicy size="100 MB" />
>       </Policies>
>     </RollingRandomAccessFile>
>     <MemoryMappedFile name="MemMapFile" append="false" fileName="/test/dv/logs/dv.log">
>       <PatternLayout>
>         <Pattern>%d %-5level [%t][%logger] %msg%n%throwable</Pattern>
>       </PatternLayout>
>     </MemoryMappedFile>
>   </Appenders>
>   <Loggers>
>     <Root level="trace">
> <!--       <AppenderRef ref="Console" /> -->
> <!--       <AppenderRef ref="RollingFile" /> -->
>       <AppenderRef ref="MemMapFile" />
>     </Root>
>     <Logger name="javax.management" level="INFO" />
>     <Logger name="sun.rmi" level="INFO" />
>     <Logger name="com.rs.dv.util.LoggerEnvironmentReporter" level="OFF" />
>   </Loggers>
>   <!-- Filters -->
>   <Filters>
>     <!-- SQL only -->
>     <!-- <MarkerFilter marker="DV.SQL" onMatch="ACCEPT" onMismatch="DENY" />
<MarkerFilter marker="DV.SQL.QUERY" onMatch="ACCEPT" 
>       onMismatch="DENY" /> <MarkerFilter marker="DV.SQL.UPDATE" onMatch="ACCEPT"
onMismatch="DENY" /> -->
>     <!-- No buffer hex dumps -->
>     <!-- <MarkerFilter marker="DV.BUFFER" onMatch="DENY" onMismatch="NEUTRAL" />
-->
>   </Filters>
> </Configuration>
> {code}
> After the app runs, I have a 32 MB log file, with the later 2/3 of the file, all null
bytes.
> Clearly, we need to limit what we write out.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message