Discussion:
[jira] [Updated] (LOG4J2-1086) SizeBasedTriggeringPolicy is not working properly
Pierrick HYMBERT (JIRA)
2017-06-28 10:34:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-1086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pierrick HYMBERT updated LOG4J2-1086:
-------------------------------------
Attachment: LOG4J2-1086.Test.patch

Hello [~***@dslextreme.com] and team,

I am not sure this is the correct way to reproduce and what is the acceptable size overload in log files: one log event ?

With this unit test, more thread you add, bigger files you got at the end, with 32 threads on Windows I got 5248 bytes log instead of 2048.

I have also disabled {{log4j2.enable.direct.encoders}}, because it looks it didnt call {{RollingFileAppender.append}} method directly but the problem persist.

I didnt find correct place to fix or move {{RollingFileAppender.checkRollover}} method, it seems to be called to early.
SizeBasedTriggeringPolicy is not working properly
-------------------------------------------------
Key: LOG4J2-1086
URL: https://issues.apache.org/jira/browse/LOG4J2-1086
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.3, 2.4.1
Environment: Windows 7 OS Websphere 8.5.5.6
Reporter: Sharat
Assignee: Ralph Goers
Priority: Minor
Labels: features
Attachments: LOG4J2-1086.Test.patch
Original Estimate: 24h
Remaining Estimate: 24h
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<RollingFile name="RollingFile" fileName="/logs/test.log"
filePattern="/logs/test-%i.log">
<PatternLayout>
<pattern>%d %-5p %class{36} (%M:%L) -%msg%xEx%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 KB" />
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingFile>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<root level="trace">
<appender-ref ref="RollingFile"/>
<appender-ref ref="console"/>
</root>
</Loggers>
</Configuration>
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Gary Gregory (JIRA)
2017-07-06 09:46:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-1086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory updated LOG4J2-1086:
---------------------------------
Affects Version/s: 2.8
SizeBasedTriggeringPolicy is not working properly
-------------------------------------------------
Key: LOG4J2-1086
URL: https://issues.apache.org/jira/browse/LOG4J2-1086
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.3, 2.4.1, 2.8
Environment: Windows 7 OS Websphere 8.5.5.6
Reporter: Sharat
Assignee: Ralph Goers
Priority: Minor
Labels: features
Attachments: LOG4J2-1086.Test.patch
Original Estimate: 24h
Remaining Estimate: 24h
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<RollingFile name="RollingFile" fileName="/logs/test.log"
filePattern="/logs/test-%i.log">
<PatternLayout>
<pattern>%d %-5p %class{36} (%M:%L) -%msg%xEx%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 KB" />
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingFile>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<root level="trace">
<appender-ref ref="RollingFile"/>
<appender-ref ref="console"/>
</root>
</Loggers>
</Configuration>
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Saras (JIRA)
2017-08-03 05:17:03 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-1086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16112204#comment-16112204 ]

Saras commented on LOG4J2-1086:
-------------------------------

HI All,

log4j2 version : 2.8.2

I am facing similar issue.
<SizeBasedTriggeringPolicy size="10 KB" />

SizeBasedTriggeringPolicy is not working. The file is continuing appending text in file.

Could you please help ASAP, We are on the process of migrating log4j 1 to log4j 2.
SizeBasedTriggeringPolicy is not working properly
-------------------------------------------------
Key: LOG4J2-1086
URL: https://issues.apache.org/jira/browse/LOG4J2-1086
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.3, 2.4.1, 2.8
Environment: Windows 7 OS Websphere 8.5.5.6
Reporter: Sharat
Assignee: Ralph Goers
Priority: Minor
Labels: features
Attachments: LOG4J2-1086.Test.patch
Original Estimate: 24h
Remaining Estimate: 24h
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<RollingFile name="RollingFile" fileName="/logs/test.log"
filePattern="/logs/test-%i.log">
<PatternLayout>
<pattern>%d %-5p %class{36} (%M:%L) -%msg%xEx%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 KB" />
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingFile>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<root level="trace">
<appender-ref ref="RollingFile"/>
<appender-ref ref="console"/>
</root>
</Loggers>
</Configuration>
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Ralph Goers (JIRA)
2017-08-21 04:05:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-1086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16134684#comment-16134684 ]

Ralph Goers commented on LOG4J2-1086:
-------------------------------------

Perrick,

The creates 100 Excectuors on 32 threads. Each of those 100 workers is likely to pass through the SizeBasedTriggeringPolicy check before any data is written to disk. At a size of 30-32 bytes you are looking at over 3000 bytes to be written. Then as the data is being written the workers will keep writing more events until the number of bytes finally exceeds the max file size. At that time there will be 99 events in the process of being written ahead of the thread that is going to perform the rollover.

In short, the file is rolling over but I don't believe the granularity can be guaranteed at that fine a level.

I doubt that this test accurately reflects what might be going on when the size is set to 10KB and the file doesn't roll over.
SizeBasedTriggeringPolicy is not working properly
-------------------------------------------------
Key: LOG4J2-1086
URL: https://issues.apache.org/jira/browse/LOG4J2-1086
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.3, 2.4.1, 2.8
Environment: Windows 7 OS Websphere 8.5.5.6
Reporter: Sharat
Assignee: Ralph Goers
Priority: Minor
Labels: features
Attachments: LOG4J2-1086.Test.patch
Original Estimate: 24h
Remaining Estimate: 24h
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<RollingFile name="RollingFile" fileName="/logs/test.log"
filePattern="/logs/test-%i.log">
<PatternLayout>
<pattern>%d %-5p %class{36} (%M:%L) -%msg%xEx%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 KB" />
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingFile>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<root level="trace">
<appender-ref ref="RollingFile"/>
<appender-ref ref="console"/>
</root>
</Loggers>
</Configuration>
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Ralph Goers (JIRA)
2017-08-21 04:06:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-1086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16134684#comment-16134684 ]

Ralph Goers edited comment on LOG4J2-1086 at 8/21/17 4:05 AM:
--------------------------------------------------------------

Perrick,

The test creates 100 Excectuors on 32 threads. Each of those 100 workers is likely to pass through the SizeBasedTriggeringPolicy check before any data is written to disk. At a size of 30-32 bytes you are looking at over 3000 bytes to be written. Then as the data is being written the workers will keep writing more events until the number of bytes finally exceeds the max file size. At that time there will be 99 events in the process of being written ahead of the thread that is going to perform the rollover.

In short, the file is rolling over but I don't believe the granularity can be guaranteed at that fine a level.

I doubt that this test accurately reflects what might be going on when the size is set to 10KB and the file doesn't roll over.


was (Author: ***@dslextreme.com):
Perrick,

The creates 100 Excectuors on 32 threads. Each of those 100 workers is likely to pass through the SizeBasedTriggeringPolicy check before any data is written to disk. At a size of 30-32 bytes you are looking at over 3000 bytes to be written. Then as the data is being written the workers will keep writing more events until the number of bytes finally exceeds the max file size. At that time there will be 99 events in the process of being written ahead of the thread that is going to perform the rollover.

In short, the file is rolling over but I don't believe the granularity can be guaranteed at that fine a level.

I doubt that this test accurately reflects what might be going on when the size is set to 10KB and the file doesn't roll over.
SizeBasedTriggeringPolicy is not working properly
-------------------------------------------------
Key: LOG4J2-1086
URL: https://issues.apache.org/jira/browse/LOG4J2-1086
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.3, 2.4.1, 2.8
Environment: Windows 7 OS Websphere 8.5.5.6
Reporter: Sharat
Assignee: Ralph Goers
Priority: Minor
Labels: features
Attachments: LOG4J2-1086.Test.patch
Original Estimate: 24h
Remaining Estimate: 24h
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<RollingFile name="RollingFile" fileName="/logs/test.log"
filePattern="/logs/test-%i.log">
<PatternLayout>
<pattern>%d %-5p %class{36} (%M:%L) -%msg%xEx%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 KB" />
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingFile>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<root level="trace">
<appender-ref ref="RollingFile"/>
<appender-ref ref="console"/>
</root>
</Loggers>
</Configuration>
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Pierrick HYMBERT (JIRA)
2017-08-21 21:20:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-1086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16135855#comment-16135855 ]

Pierrick HYMBERT commented on LOG4J2-1086:
------------------------------------------

Hi Ralph,

agreed thanks for your feedback, then need another test case to reproduce this issue if exists.
SizeBasedTriggeringPolicy is not working properly
-------------------------------------------------
Key: LOG4J2-1086
URL: https://issues.apache.org/jira/browse/LOG4J2-1086
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.3, 2.4.1, 2.8
Environment: Windows 7 OS Websphere 8.5.5.6
Reporter: Sharat
Assignee: Ralph Goers
Priority: Minor
Labels: features
Attachments: LOG4J2-1086.Test.patch
Original Estimate: 24h
Remaining Estimate: 24h
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<RollingFile name="RollingFile" fileName="/logs/test.log"
filePattern="/logs/test-%i.log">
<PatternLayout>
<pattern>%d %-5p %class{36} (%M:%L) -%msg%xEx%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 KB" />
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingFile>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<root level="trace">
<appender-ref ref="RollingFile"/>
<appender-ref ref="console"/>
</root>
</Loggers>
</Configuration>
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Loading...