2009-08-17 3 views
0

Lorsque j'exécute les messages du journal de classe TestJcLLoggingService arrivent à la console mais aucun fichier journal n'est créé, aidez-moi si vous connaissez la réponse.Le fichier journal n'est pas créé à l'aide de la journalisation JDK avec Commons-logging

Deux fichiers sources sont collés ci-dessous.

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 

Merci à l'avance.

Répondre

0

réponse à votre question dans un fil connexe: Java util logging

Fondamentalement, vous devez définir le chemin du fichier de configuration (logging.properties) soit dans args java ou en code lui-même puis regardez dans le bon dossier. (La valeur par défaut est la maison de l'utilisateur)

Questions connexes