In meiner Hauptklasse gibt der Logger nichts aus. Sieht jemand den Fehler?
private static final Logger LOGGER=Logger.getLogger(WebAccessCodeGenerator.class);
private static final ResourceBundle MESSAGES = ResourceBundleFactory.getBundle("messages");
private static Arguments arguments=null;
private WebAccessCodeGenerator(){
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
setUncaughtExceptionHandler();
try{
initializeLogging();
}catch(IOException ex){
java.util.logging.Logger log=java.util.logging.Logger.getLogger(WebAccessCodeGenerator.class.getName());
log.log(Level.SEVERE,"log4j.properties not found SHUTDOWN");
shutdown();
}
try{
arguments=parseConsoleArguments(args);
}catch(CmdLineException cex){
LOGGER.fatal(MESSAGES.getString("argsInc"));
shutdown();
}
try {
executeJob(arguments);
throw new SQLException();
} catch (JobException ex) {
LOGGER.fatal(ex.getMessage());
} catch (SQLException ex) {
**LOGGER.fatal(String.format(MESSAGES.getString("excSQLexJ"),arguments.getType().name()));**
} catch (IOException ex) {
LOGGER.fatal(String.format(MESSAGES.getString("excJobDBCon"),arguments.getType().name()));
}
}
private static void setUncaughtExceptionHandler(){
Thread.setDefaultUncaughtExceptionHandler(new WACGUncaughtExceptionHandler());
}
/**
* Initializes the logging with log4j
*/
private static void initializeLogging() throws IOException{
File f=new File(".","log4j.properties");
try ( InputStream is=new FileInputStream(f)){
PropertyConfigurator.configure(is);
}
}
/**
*
* @param args
* @return the cmd args in the spezific container class 'Arguments'
* @throws JobException
*/
private static Arguments parseConsoleArguments(String[] args) throws CmdLineException{
CommandLineInput cli=new CommandLineInput();
return cli.analyze(args);
}
/**
* generates a specific job for the arguments and excecutes the main functionality
* @param arguments
*/
private static void executeJob(Arguments arguments) throws JobException, SQLException, IOException{
Job job=JobFactory.getJob(arguments);
job.execute();
}
public static void shutdown(){
System.exit(0);
}
}```
Kann sich jemand dieses Mysterium erklären? Habe es auch mit dem rootLogger versucht, habe das 'final' an den Variablen entfernt....
Helft einen scheinbar Blinden das offensichtliche zu sehen:suspect:
PS. Wer's noch nicht gesehen hat, ich werfe an dieser Stelle vorsätzlich eine SQLException um den LOGGER zu testen. Beim DEBUGGEN läuft er auch über den Code, nur die Ausgabe bleibt aus.
…
executeJob(arguments);
throw new SQLException();
…