log4j logger writes to log when used in one class doesn't write when used in another class : Apache log4j2 logger prints to console, not to file when run in one class(Server side). The same logger if placed in other(client side) logs to file as expected.

the log4j2.xml is placed in the right folder(i.e src\main\resources) and works for other loggers in the project.I don't understand why logger behaves one way in one class(client side) and other way in another class(server side).

GameLogger.java

public class GameLogger {
	
	public static GameLogger INSTANCE = new GameLogger();
	public static final Logger logger = LogManager.getLogger("MyGame");
	@SubscribeEvent
	public synchronized void onPlayerTick(final TickEvent.PlayerTickEvent tick) {
		if (tick.phase == Phase.END) {
			if (tick.player.isEntityAlive()) {	
						logger.info("Logger is working");
					}
				}
			}
		}

log4j2.xml

    <RollingRandomAccessFile name="StatsFile" fileName="logs/StatsFile-latest.log" filePattern="logs/StatsFile/%d{yyyy-MM-dd-HH}{GMT}-%i.log.gz">
                <PatternLayout pattern="%d{yyyy/MM/dd HH:mm:ss}{GMT}%msg%n" />
                <Policies>
                    <TimeBasedTriggeringPolicy />
                    <OnStartupTriggeringPolicy />
                </Policies>
            </RollingRandomAccessFile>
    		
    <Logger level="info" name="MyGame" additivity="false">
                <AppenderRef ref="StatsFile" />
            </Logger>
            <Root level="all">
                <AppenderRef ref="FmlSysOut" level="INFO" />
                <AppenderRef ref="ServerGuiConsole" level="INFO" />
                <AppenderRef ref="FmlFile"/>
            </Root>