Skip to content
Snippets Groups Projects
Verified Commit bf26e45e authored by BIGARET Sebastien's avatar BIGARET Sebastien
Browse files

Fix: app. crashed if no logging.properties can be found

parent d8b9f6fb
No related branches found
No related tags found
No related merge requests found
- Fix a bug causing an application to crash if no logging.properties
could be found (*sigh*)
v3.0.1
------
......
......@@ -95,7 +95,12 @@ public final class Configuration
}
catch (Throwable e) // catch all, yes we mean it!
{
Log.log.log(Level.SEVERE, "Could not load the configuration file, exiting", e);
final String err = "Could not load the configuration file, exiting";
Log.log.log(Level.SEVERE, err, e);
// it is severe enough to print it on the stderr as well
System.err.println(err);
e.printStackTrace(System.err);
System.exit(-1);
}
}
......@@ -652,10 +657,11 @@ public final class Configuration
try
{
// is there a logging.properties in the current directory?
if (new File("logging.properties").isFile())
final String loggingPropertiesPathname = "logging.properties";
if (new File(loggingPropertiesPathname).isFile())
try
{
loggingProperties = new FileInputStream(new File("logging.properties"));
loggingProperties = new FileInputStream(new File(loggingPropertiesPathname));
}
catch (FileNotFoundException e)
{
......@@ -667,7 +673,7 @@ public final class Configuration
// nothing in the current dir, let's search our class path
try
{
final URL url = FileResources.url("logging.properties");
final URL url = FileResources.url(loggingPropertiesPathname);
loggingProperties = url.openStream();
}
......@@ -678,9 +684,16 @@ public final class Configuration
}
try
{
Log.log.info("Reinitializing the logging properties");
if ( loggingProperties != null )
{
Log.log.info("Resetting the log manager");
LogManager.getLogManager().readConfiguration(loggingProperties);
}
else
{
Log.log.info(()->"No need to reset the log manager, file "+loggingPropertiesPathname+" not found");
}
}
catch (SecurityException e)
{
error="Could not reinitialize the logging properties (SecurityException)";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment