log file is not getting created using JDK logging with Commons-logging

Posted by Saida Dhanavath on Stack Overflow See other posts from Stack Overflow or by Saida Dhanavath
Published on 2009-08-17T09:13:29Z Indexed on 2010/03/25 14:03 UTC
Read the original article Hit count: 1086

When I run the TestJcLLoggingService class log messages are coming to Console but no log file is created, please help me if you know the answer.

two source files are pasted below.

TestJcLLoggingService.java

package com.amadeus.psp.pasd.logging;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

@Service
public class TestJCLLoggingService {
    private static Log psp_log = LogFactory.getLog(TestJCLLoggingService.class);
    public static String testJCLLoggingServiceMethod(){
    	psp_log.info("start of method testJCLLoggingServiceMethod class TestJCLLoggingService");

    	psp_log.info("start of method testJCLLoggingServiceMethod class TestJCLLoggingService");
    	return "This is a test string for JCLLogging";

    }

    public static void main(String[] args){

    	testJCLLoggingServiceMethod();

    }

}

logging.properties

handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
.level = ALL
com.amadeus.psp.pasd.level=ALL
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter


java.util.logging.FileHandler.pattern = %h/java%u.log 
java.util.logging.FileHandler.level=ALL
java.util.logging.FileHandler.limit=50000
java.util.logging.FileHandler.count=1
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.append=true

Thanks in advance.

© Stack Overflow or respective owner

Related posts about java

Related posts about apache-commons-logging