You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Luigi Pellico (Jira)" <ji...@apache.org> on 2020/12/04 14:32:00 UTC

[jira] [Comment Edited] (LOG4J2-2886) File Hangs when Rolling file on log4j

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

Luigi Pellico edited comment on LOG4J2-2886 at 12/4/20, 2:31 PM:
-----------------------------------------------------------------

Sorry [~rgoers],

I have another question.

On file [^SystemOut_20.08.21_18.31.16.log]I have identified the point that could be problem.

Can I use another compression mode in log4j instead of GzCompressAction?

Or can I delete the file in another way?

In my opinion the problem is the cancellation mode which has some problem with the operating system.

--define rolling on file
 server.startup : 0 DEBUG RollingRandomAccessFileAppender$Builder(fileName="/var/log/il/qa/jobs/system-events-manager.log", filePattern="/var/log/il/qa/jobs/archive/system-events-manager-%d\{yyyy-MM-dd}-%i.log.gz", append="null", Policies(CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=3145728)])), DefaultRolloverStrategy(DefaultRolloverStrategy(min=1, max=7, useMax=true)), advertise="null", advertiseURI="null", filePermissions="null", fileOwner="null", fileGroup="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout(%d\{yyyy-MM-dd HH:mm:ss} %p %-40.40C\{1}:%M - %m%n), name="system-events-log", Configuration(/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/conf/log4j2.xml), Filter=null, ={})

--start rolling on file
 server.startup : 0 DEBUG Starting RollingRandomAccessFileManager /var/log/il/qa/jobs/system-events-manager.log
 ....
 --execute rolling
 server.startup : 1 DEBUG RollingFileManager executing synchronous FileRenameAction[/var/log/il/qa/jobs/system-events-manager.log to /var/log/il/qa/jobs/archive/system-events-manager-2020-08-20-1.log, renameEmptyFiles=false]
 ...
 --execute gz from file with delete source=true (+*This is the hangh file system-events-manager-2020-08-20-1.log*+)
 server.startup : 1 DEBUG RollingFileManager executing async CompositeAction[*GzCompressAction*[/var/log/il/qa/jobs/archive/system-events-manager-2020-08-20-1.log to /var/log/il/qa/jobs/archive/system-events-manager-2020-08-20-1.log.gz, *deleteSource=true*], DeleteAction[basePath=/var/log/il/qa/jobs/archive, options=[], maxDepth=2, conditions=[IfFileName(glob:system-events-manager-*.log.gz), IfLastModified(age=P7D)]]]


was (Author: luigi.pellico):
Sorry [~rgoers],

I have another question.

On file [^SystemOut_20.08.21_18.31.16.log]I have identified the point that could be problem.

Can i use another compression mode in log4j instead of GzCompressAction?

--define rolling on file
server.startup : 0 DEBUG RollingRandomAccessFileAppender$Builder(fileName="/var/log/il/qa/jobs/system-events-manager.log", filePattern="/var/log/il/qa/jobs/archive/system-events-manager-%d\{yyyy-MM-dd}-%i.log.gz", append="null", Policies(CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=3145728)])), DefaultRolloverStrategy(DefaultRolloverStrategy(min=1, max=7, useMax=true)), advertise="null", advertiseURI="null", filePermissions="null", fileOwner="null", fileGroup="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout(%d\{yyyy-MM-dd HH:mm:ss} %p %-40.40C\{1}:%M - %m%n), name="system-events-log", Configuration(/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/conf/log4j2.xml), Filter=null, ={})

--start rolling on file
server.startup : 0 DEBUG Starting RollingRandomAccessFileManager /var/log/il/qa/jobs/system-events-manager.log
....
--execute rolling
server.startup : 1 DEBUG RollingFileManager executing synchronous FileRenameAction[/var/log/il/qa/jobs/system-events-manager.log to /var/log/il/qa/jobs/archive/system-events-manager-2020-08-20-1.log, renameEmptyFiles=false]
...
--execute gz from file with delete source=true (+*This is the hangh file system-events-manager-2020-08-20-1.log*+)
server.startup : 1 DEBUG RollingFileManager executing async CompositeAction[*GzCompressAction*[/var/log/il/qa/jobs/archive/system-events-manager-2020-08-20-1.log to /var/log/il/qa/jobs/archive/system-events-manager-2020-08-20-1.log.gz, *deleteSource=true*], DeleteAction[basePath=/var/log/il/qa/jobs/archive, options=[], maxDepth=2, conditions=[IfFileName(glob:system-events-manager-*.log.gz), IfLastModified(age=P7D)]]]

> File Hangs when Rolling file on log4j
> -------------------------------------
>
>                 Key: LOG4J2-2886
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2886
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.9.1
>         Environment: Java 8, log4j 2.9.1, Linux radhat 7, Websphere Application Server 8.5.5.14
>            Reporter: Luigi Pellico
>            Priority: Major
>         Attachments: MicrosoftTeams-image.png, SystemOut.log, SystemOut_20.08.21_18.31.16.log, SystemOut_20.08.21_18.33.47.log, image-2020-08-21-22-16-04-742.png, log4j2.xml, lsof_20200821.txt
>
>
> expose my question
> Enviroment:
> Java 8, log4j 2.9.1, Linux radhat 7, Websphere Application Server 8.5.5.14
> Problem:
> When rolling file log the rolled file hangs. Only Websphere Application Server restar resolve problem and empty file system from hangs file.
> This problem cause full disk space on log partition.
> try:
> try to change appender mode but problem remain try solution on this similar question:
>  * [How can I get log4j to delete old rotating log files?|https://stackoverflow.com/questions/1050256/how-can-i-get-log4j-to-delete-old-rotating-log-files]
>  * [Log4j2 Rolled Files that are deleted are still open and disk space not freed|https://stackoverflow.com/questions/27855869/log4j2-rolled-files-that-are-deleted-are-still-open-and-disk-space-not-freed]
> Other info:
> File are deleted but space is not free:
>  {{$ /usr/sbin/lsof | grep deleted}}
>  java 114u REG 253,12 191 8814849 /var/log/archive/<filename>.log (deleted)
> This is log4j configuration:
> {code:java}
>  <RollingRandomAccessFile name="<filename>" fileName="/<filename>.log" filePattern="/archive/<filename>%d {yyyy-MM-dd} %i.log.gz">
>   <ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>
>   <!- Log pattern layout -><PatternLayout><pattern>|%X{traceID}|%m%n</pattern></PatternLayout>
>   <!- File size policy -->
>   <Policies>
>     <TimeBasedTriggeringPolicy />
>     <SizeBasedTriggeringPolicy size="150 MB"/>
>   </Policies>
>   <DefaultRolloverStrategy>
>     <Delete basePath="/archive/" maxDepth="2">
>       <IfFileName glob="<filename>*.log.gz" />
>       <IfLastModified age="7d" />
>     </Delete>
>   </DefaultRolloverStrategy>
> </RollingRandomAccessFile>{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)