Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3544

SizeBasedTriggeringPolicy is not working properly for log4j.xml

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.17.1
    • 2.17.1
    • None
    • None

    Description

      I have being try to get configuration for my Java App that have two different file to where one is for and  Core BootStrap Log files and also App log file which is responsable for logging all the app logs but it is not working for Core BootStrap Log files but only working for the app log file. the Core BootStrap Log files  keeps one logging the SizeBasedTriggeringPolicy it not working for this implementation. 

       

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration status="WARN">
          <Properties>
              <Property name="LOG_FOLDER">c:/logs</Property>
              <Property name="COREBOOTSTRAPLOG">./log/corelogs.log</Property>
              <Property name="APPLOGS">./log/applogs.log</Property>
          </Properties>

          <Appenders>
              <Console name="LogToConsole" target="SYSTEM_OUT">
                  <PatternLayout
                      pattern='%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n' />
              </Console>
              <RollingFile name="CoreBootStrapLogFile"
                  fileName='${COREBOOTSTRAPLOG}'
                  filePattern='${COREBOOTSTRAPLOG}.%d{yyyy-MM-dd}.%i'>
                  <PatternLayout>
                      <Pattern>${LOG_PATTERN}</Pattern>
                  </PatternLayout>            
                  <Policies>
                      <SizeBasedTriggeringPolicy size="500KB" />
                  </Policies>
                  <DefaultRolloverStrategy max="10"/> 
              </RollingFile>

          
              <RollingFile name="ApplogsFile"
                  fileName='${LOG_FOLDER}/${BOOTSTRAPLOG}'
                  filePattern='${CSVFILE}.%d{yyyy-MM-dd}'>
                  <PatternLayout>
                      <Pattern>${LOG_PATTERN}</Pattern>
                  </PatternLayout>
                  <Policies>
                          <TimeBasedTriggeringPolicy interval="1" modulate="true" />
                          <SizeBasedTriggeringPolicy size="50MB" />
                  </Policies>
              </RollingFile>
              
          
              
          </Appenders>
          <Loggers>
              <!-- avoid duplicated logs with additivity=false -->
              
              <Logger name="com.spacework.application.configs.SpaceBootStrapApp" 
                  level="debug" additivity="false">
                  <AppenderRef ref="CoreBootStrapLogFile" />
              </Logger>
              
              <Logger name="com.spacework.application.SpaceLoaderApp" 
                  level="debug" additivity="false">
                  <AppenderRef ref="ApplogsFile" />
              </Logger>
              <Root >
                  <AppenderRef ref="CoreBootStrapLogFile" level="info"/> 
                  <AppenderRef ref="ApplogsFile" level="info"/>
              
              </Root>
          </Loggers>
      </Configuration>

      Attachments

        Activity

          People

            Unassigned Unassigned
            netshiar2 Netshia Rendani
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: