From 8889712071c3f3ebed1f1273901e463aa2b527e1 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Wed, 2 Apr 2008 16:41:46 +0000 Subject: [PATCH] log4j fallback on basic configurator if no file access --- tools/cooja/java/se/sics/cooja/GUI.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/GUI.java b/tools/cooja/java/se/sics/cooja/GUI.java index f5fad17ac..7fe3ac11d 100644 --- a/tools/cooja/java/se/sics/cooja/GUI.java +++ b/tools/cooja/java/se/sics/cooja/GUI.java @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: GUI.java,v 1.74 2008/03/19 09:40:38 fros4943 Exp $ + * $Id: GUI.java,v 1.75 2008/04/02 16:41:46 fros4943 Exp $ */ package se.sics.cooja; @@ -45,6 +45,7 @@ import javax.swing.*; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; import javax.swing.filechooser.FileFilter; +import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; import org.apache.log4j.xml.DOMConfigurator; import org.jdom.Document; @@ -2916,16 +2917,17 @@ public class GUI { public static void main(String[] args) { try { - // Configure logger - if ((new File(LOG_CONFIG_FILE)).exists()) { - DOMConfigurator.configure(LOG_CONFIG_FILE); - } else { - // Used when starting from jar - DOMConfigurator.configure(GUI.class.getResource("/" + LOG_CONFIG_FILE)); - } + // Configure logger + if ((new File(LOG_CONFIG_FILE)).exists()) { + DOMConfigurator.configure(LOG_CONFIG_FILE); + } else { + // Used when starting from jar + DOMConfigurator.configure(GUI.class.getResource("/" + LOG_CONFIG_FILE)); + } - externalToolsUserSettingsFile = new File(System.getProperty("user.home"), EXTERNAL_TOOLS_USER_SETTINGS_FILENAME); + externalToolsUserSettingsFile = new File(System.getProperty("user.home"), EXTERNAL_TOOLS_USER_SETTINGS_FILENAME); } catch (AccessControlException e) { + BasicConfigurator.configure(); externalToolsUserSettingsFile = null; }