I'm trying to use logback as my logger in my simple program but it does not work fine! I put logback/logback.xml and logback/Logback.java in the source directory logback and run through this command line

which the %CLASSPATH% is an environment variable that has the path of .jar file that logback needs like:

This is my logback.xml file

<configuration>
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">

        <file>test.log</file>

        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <fileNamePattern>tests.%i.log</fileNamePattern>
            <minIndex>1</minIndex>
        </rollingPolicy>

        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <maxFileSize>2MB</maxFileSize>
        </triggeringPolicy>

        <encoder>
            <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
        </encoder>

    </appender>

    <root level="debug">
        <appender-ref ref="FILE" />
    </root>
</configuration>

and there is my simple program

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Logback{
    private final static Logger logger = LoggerFactory.getLogger(Logback.class);

    public static void main(String[] args){
        for(int i=0;i<1000000;i++)
            logger.debug("hello");
    }
}

but unfortunately i just receive log in the console instead of test.log files. it seems the logger object just use the default configuration!!!

If i set the -Dlogback.configurationFile=logback.xml variable as below, it works properly. but how to run without this variable?