You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Philip (JIRA)" <ji...@apache.org> on 2019/02/23 19:56:00 UTC

[jira] [Comment Edited] (LOG4J2-2137) SizeBasedTriggeringPolicy with DefaultRolloverStrategy is not working

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

Philip edited comment on LOG4J2-2137 at 2/23/19 7:55 PM:
---------------------------------------------------------

With DefaultRolloverStrategy commented out and Configuration status set to debug (and a slight formatting mistake fixed), I get a file by the name of 2019-02-23-12-48-18

[INFO] [12:48:18.636] [Main] ------ ROBOT CONFIGURATION = competitionbot -----------
 [INFO] [12:48:18.914] [Main] Starting services
 [INFO] [12:48:19.064] [Main] ********************* ALL SERVICES STARTED *******************************

 

This is what I expected to be there since I am changing from a different logger and only changed one class to use log4j2


was (Author: confrizz):
With DefaultRolloverStrategy commented out and Configuration status set to debug (and a slight formatting mistake fixed), I get a file by the name of 2019-02-23-12-48-18

[INFO] [12:48:18.636] [Main] ------ ROBOT CONFIGURATION = competitionbot -----------
[INFO] [12:48:18.914] [Main] Starting services
[INFO] [12:48:19.064] [Main] ********************* ALL SERVICES STARTED *******************************

> SizeBasedTriggeringPolicy with DefaultRolloverStrategy is not working
> ---------------------------------------------------------------------
>
>                 Key: LOG4J2-2137
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2137
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.3
>         Environment: Linux
> IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260-20080816_22093 (JIT enabled, AOT enabled)
>            Reporter: Ajay Pachlangia
>            Priority: Major
>              Labels: features
>             Fix For: 2.3
>
>
> Hi Team,
> I have used below given log4j file and expect my logs to be getting generated up to size 1 MB with limit of 5 files but files are not reaching to the max size and next files getting started written.
> 1048596 Dec 1 18:31 A-2017-12-01-3.log
> 449246  Dec 1 18:33 A-2017-12-01-1.log
> 1048636 Dec 1 18:32 A-2017-12-01-2.log
> 123424  Dec 1 18:33 A-2017-12-01-5.log
> 565972  Dec 1 18:33 A-2017-12-01-4.log
> 270800  Dec 1 18:33 A.log
> ---Log4j used ----
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration monitorInterval="5">
>     <Appenders>
> <RollingFile name="Online" fileName="My_Logs_Path/A.log" append="true" immediateFlush="true" bufferedIO="false" filePattern="My_Logs_Path/A-%d{yyyy-MM-dd}-%i.log">
> 			<PatternLayout>
> 				<pattern>|%-5p|%d{yyyy-MM-dd|HH:mm:ss,SSS}|%X{InterfaceId}|%X{SeqNo}|%X{Ouid} %X{srch1} %X{BussRef}|${sys:hostname}|${sys:ApplicationComponent}|%X{ExternalRefSend}|%m||%C{6}:%L|%t%n</pattern>
> 			</PatternLayout>
> 			<Policies>
> 				<SizeBasedTriggeringPolicy size="1 MB" />
> 			</Policies>
> 			<DefaultRolloverStrategy max="5"/>
> 			<Filters>
> 				<ThresholdFilter level="FATAL" onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="ERROR" onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="WARN"  onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="INFO"  onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="DEBUG" onMatch="ACCEPT"   onMismatch="NEUTRAL"/>						
> 			</Filters>
> 		</RollingFile>
> 		
> 			   <RollingFile name="abcd" fileName="My_Logs_Path/B.log" append="true" immediateFlush="true" bufferedIO="false" filePattern="My_Logs_Path/B-%d{yyyy-MM-dd}-%i.log">
> 			<PatternLayout>
> 				<pattern>|%-5p|%d{yyyy-MM-dd|HH:mm:ss,SSS}|%X{InterfaceId}|%X{SeqNo}|%X{Ouid} %X{srch1} %X{BussRef}|${sys:hostname}|${sys:ApplicationComponent}|%X{ExternalRefSend}|%m||%C{6}:%L|%t%n</pattern>
> 			</PatternLayout>
> 			<Policies>
> 				<SizeBasedTriggeringPolicy size="1 MB" />
> 			</Policies>
> 			<DefaultRolloverStrategy max="5"/>
> 			<Filters>
> 				<ThresholdFilter level="FATAL" onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="ERROR" onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="WARN"  onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="INFO"  onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="DEBUG" onMatch="ACCEPT"   onMismatch="NEUTRAL"/>						
> 			</Filters>
> 		</RollingFile>
> 	   <RollingFile name="efgh" fileName="My_Logs_Path/C.log" append="true" immediateFlush="true" bufferedIO="false" filePattern="My_Logs_Path/C-%d{yyyy-MM-dd}-%i.log">
> 			<PatternLayout>
> 				<pattern>|%-5p|%d{yyyy-MM-dd|HH:mm:ss,SSS}|%X{InterfaceId}|%X{SeqNo}|%X{Ouid} %X{srch1} %X{BussRef}|${sys:hostname}|${sys:ApplicationComponent}|%X{ExternalRefSend}|%m||%C{6}:%L|%t%n</pattern>
> 			</PatternLayout>
> 			<Policies>
> 				<SizeBasedTriggeringPolicy size="1 MB" />
> 			</Policies>
> 			<DefaultRolloverStrategy max="5"/>
> 			<Filters>
> 				<ThresholdFilter level="FATAL" onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="ERROR" onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="WARN"  onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="INFO"  onMatch="ACCEPT"   onMismatch="NEUTRAL"/>
> 				<ThresholdFilter level="DEBUG" onMatch="ACCEPT"   onMismatch="NEUTRAL"/>						
> 			</Filters>
> 		</RollingFile>
> 		
> 		<RollingFile name="CHANNEL_STATUS" fileName="My_Logs_Path/D.log" append="true" immediateFlush="true" bufferedIO="false" filePattern="My_Logs_Path/D-%d{yyyy-MM-dd}-%i.log">
> 			<PatternLayout>
> 				<pattern>|%-5p|%d{yyyy-MM-dd|HH:mm:ss,SSS}|${sys:hostname}|${sys:ApplicationComponent}|%m||%C{6}:%L|%t%n</pattern>
> 			</PatternLayout>
> 			<Policies>
> 				<SizeBasedTriggeringPolicy size="1 MB" />
> 			</Policies>
> 			<DefaultRolloverStrategy max="5"/>
> 		</RollingFile>
> </Appenders>
> <loggers>
>     <logger name="TTTT" level="DEBUG">
> 		<appender-ref ref="Online"  level="DEBUG"/>
> 	</logger>
>     <logger name="AAAA" level="DEBUG">
> 		<appender-ref ref="abcd"  level="DEBUG"/>
> 	</logger>
> 	<logger name="BBBB" level="DEBUG" additivity="false">
> 		<appender-ref ref="efgh"/>
> 	</logger>
> 	<logger name="CHANNEL_LOGGER" level="DEBUG" additivity="false">
> 		<appender-ref ref="CHANNEL_STATUS" level="DEBUG"/>
> 	</logger>
> 	<logger name="org.springframework" level="OFF">
> 	</logger>
> </loggers>
> </Configuration>



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)