If you want to stay out of configuration files completely, you can do simple configuration in few lines like this :
Properties props = new Properties();
props.setProperty("log4j.appender.CONSOLE",org.apache.log4j.ConsoleAppender");
props.setProperty("log4j.appender.CONSOLE.Threshold", "TRACE");
props.setProperty("log4j.appender.CONSOLE.layout,"org.apache.log4j.PatternLayout");
props.setProperty("log4j.appender.CONSOLE.layout.ConversionPattern","%-5p %d{HH:mm:ss} %-30C{1} | %m%n);"
props.setProperty("log4j.rootLogger", "TRACE, CONSOLE");
PropertyConfigurator.configure(props);