From: pmarguerite Date: Thu, 14 Dec 2006 19:21:21 +0000 (+0000) Subject: Fix session constructor/initialisation if the session directory already exists X-Git-Tag: Release_0.2~219 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f36ec5e3c4177d19e01fd0e34169036d4a80650b;p=vamsas.git Fix session constructor/initialisation if the session directory already exists git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@301 be28352e-c001-0410-b1a7-c7978e42abec --- diff --git a/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java b/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java index a70fe54..34b69d7 100644 --- a/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java +++ b/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java @@ -117,7 +117,20 @@ public class VamsasSession { private void initLog() throws IOException { // LATER: make dedicated appender format for session log. Appender app = slog.getAppender("SESSION_LOG"); - slog.addAppender(new FileAppender(app.getLayout(), new File(sessionDir, SESSION_LOG).getAbsolutePath())); + // slog.addAppender(new FileAppender(app.getLayout(), new File(sessionDir, SESSION_LOG).getAbsolutePath())); + + //Appender app = slog.getAppender("SESSION_LOG"); + if (app == null) log.info("No appender for SESSION_LOG"); + + if (slog!= null && app != null) + { + if (app instanceof FileAppender) + { + File sessionLogFile = new File(this.sessionDir, ((FileAppender)app).getFile()); + slog.addAppender(new FileAppender(app.getLayout(), sessionLogFile.getAbsolutePath())); + } + // slog.removeAppender("SESSION_LOG"); + } } /** @@ -146,12 +159,14 @@ public class VamsasSession { if (!sessionDir.isDirectory() || !sessionDir.canWrite() || !sessionDir.canRead()) throw new IOException("Cannot access '"+sessionDir+"' as a read/writable Directory."); if (checkSessionFiles(sessionDir)) { + createSessionFiles(); + } // session files exist in the directory this.sessionDir = sessionDir; initSessionObjects(); slog.debug("Initialising additional VamsasSession instance"); log.debug("Attached to VamsasSession in "+sessionDir); - } + //} } else { // start from scratch if (!sessionDir.mkdir())