Due to some reasons or some configuration error, the log4cpp that i am using for my application is not rolling the file after reaching the maxFileSize mentioned. I have tried to internally configure log4cpp. Following is the source file used for logging:

//logger.cpp
#include"logger.h"

int logInit(int prio){
log4cpp::Appender * appender2 = new log4cpp::RollingFileAppender("default","../logs/log.log", 300*1024*1024, 20);
log4cpp::PatternLayout *layout = new log4cpp::PatternLayout();
layout->setConversionPattern(std::string("%d [%t] %-5p %c - %m%n%n%n"));
appender2->setLayout(layout);
sub1.addAppender(appender2);

switch(prio){
case 0:
sub1.setPriority(0);
break;

case 1 :
sub1.setPriority(log4cpp::Priority::ERROR);
break;
case 2 :
sub1.setPriority(log4cpp::Priority::INFO);
break;
case 3 :
sub1.setPriority(log4cpp::Priority:EBUG);
break;
default :
sub1.setPriority(log4cpp::Priority::EMERG);
}
return 0;

}
And following is the header file corresponding to the source file:

//logger.h
#ifndef _LOGHNDL_H
#define _LOGHNDL_H

#include "log4cpp/Category.hh"
#include "log4cpp/Appender.hh"
#include "log4cpp/FileAppender.hh"
#include "log4cpp/OstreamAppender.hh"
#include "log4cpp/Layout.hh"
#include "log4cpp/BasicLayout.hh"
#include "log4cpp/Priority.hh"
#include "log4cpp/PropertyConfigurator.hh"
#include "log4cpp/RollingFileAppender.hh"
#include "log4cpp/PatternLayout.hh"


#define error log4cpp::Priority::ERROR
#define debug log4cpp::Priority:EBUG
#define info log4cpp::Priority::INFO
extern log4cpp::Category& sub1;

int logInit(int);
#endif
And following is the way in which the logger is initialized at application start:

//main.cpp
#include "logger.h"
log4cpp::Category& sub1=log4cpp::Category::getInstance(std::string("LOG"));
int main(){
logInit(3);
}
I am relatively new to programming in C++, can someone please help me? Thanks!