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.
This commit is contained in:
parent
86eb2c075a
commit
4e3cc523e4
1 changed files with 9 additions and 15 deletions
|
@ -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,7 +891,6 @@ 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;
|
||||
|
@ -899,11 +898,6 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IPat
|
|||
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);
|
||||
}
|
||||
return log;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue