From 4e3cc523e40a8b2ca325c7112fac462c837aadb8 Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 26 Apr 2002 12:48:51 +0000 Subject: [PATCH] Logger.getLogger(...) doesn't throw an IOException anymore if it can't open the requested log file. Instead it displays an error message and sees if the file becomes writable. So there's no use in catching the Exception and getting a Logger to std out/err anymore. --- src/helma/framework/core/Application.java | 24 +++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/helma/framework/core/Application.java b/src/helma/framework/core/Application.java index c58abe8c..41e06b8a 100644 --- a/src/helma/framework/core/Application.java +++ b/src/helma/framework/core/Application.java @@ -866,7 +866,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IPat * Get the logger object for logging generic events */ public void logEvent (String msg) { - if (eventLog == null) + if (eventLog == null || eventLog.isClosed ()) eventLog = getLogger ("event"); eventLog.log (msg); } @@ -875,7 +875,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IPat * Get the logger object for logging access events */ public void logAccess (String msg) { - if (accessLog == null) + if (accessLog == null || accessLog.isClosed ()) accessLog = getLogger ("access"); accessLog.log (msg); } @@ -891,19 +891,13 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IPat // allow log to be redirected to System.out by setting logdir to "console" if ("console".equalsIgnoreCase (logDir)) return new Logger (System.out); - try { - File helper = new File (logDir); - // construct the fully qualified log name - String fullLogname = name +"_"+logname; - if (home != null && !helper.isAbsolute ()) - helper = new File (home, logDir); - logDir = helper.getAbsolutePath (); - log = Logger.getLogger (logDir, fullLogname); - } catch (IOException iox) { - System.err.println ("Could not create log "+logname+" for application "+name+": "+iox); - // fallback to System.out - log = new Logger (System.out); - } + File helper = new File (logDir); + // construct the fully qualified log name + String fullLogname = name +"_"+logname; + if (home != null && !helper.isAbsolute ()) + helper = new File (home, logDir); + logDir = helper.getAbsolutePath (); + log = Logger.getLogger (logDir, fullLogname); return log; }