cleaned up logging
[org.ibex.mail.git] / src / org / ibex / mail / target / FileBasedMailbox.java
index 6b03810..d8849c7 100644 (file)
@@ -55,6 +55,7 @@ public class FileBasedMailbox extends Mailbox.Default {
 
         public void init(final Prevayler prevayler) throws IOException {
             dir.mkdirs();
+            long time = System.currentTimeMillis();
             Log.info(this, "initializing maildir " + dir.getParent());
 
             // Drop entries whose files have vanished
@@ -77,7 +78,8 @@ public class FileBasedMailbox extends Mailbox.Default {
             }
 
             // Take a snapshot for posterity
-            Log.info(this, "  done initializing maildir " + dir.getParent());
+            if (System.currentTimeMillis() - time > 1000 * 5)
+                Log.info(this, "  done initializing maildir " + dir.getParent());
             new Thread() { public void run() {
                 try { prevayler.takeSnapshot(); } catch (Exception e) { Log.error(this, e); } } }.start();
         }
@@ -115,7 +117,6 @@ public class FileBasedMailbox extends Mailbox.Default {
 
             public static Transaction create(File f) throws IOException {
                 final boolean seen = f.lastModified() == MAGIC_DATE;
-                Log.error(Entry.class, "create with seen = " + seen);
                 final String name = f.getName();
                 final byte[] header = new MIME.Headers(new Stream(new FileInputStream(f)), true).toString().getBytes();
                 return new Transaction() {
@@ -203,7 +204,6 @@ public class FileBasedMailbox extends Mailbox.Default {
 
     public int uidNext() { return cache.uidNext(); }
     public synchronized void add(Message message, int flags) {
-        Log.info(path, message.summary());
         try {
             String name, fullname; File target, f;
             for(int i = cache.uidNext(); ; i++) {
@@ -227,6 +227,7 @@ public class FileBasedMailbox extends Mailbox.Default {
             if ((flags & Mailbox.Flag.SEEN) == Mailbox.Flag.SEEN) f.setLastModified(MAGIC_DATE);
             prevayler.execute(Cache.Entry.create(f));
         } catch (IOException e) { throw new MailException.IOException(e); }
+        Log.info(this, path + " <= " + message.summary());
     }
 
     private class Iterator extends Mailbox.Default.Iterator {