diff --git a/bramble-core/src/main/java/org/briarproject/bramble/PoliteExecutor.java b/bramble-core/src/main/java/org/briarproject/bramble/PoliteExecutor.java index 32a3a7b32b8ad3255e70f9fd2926398c4403e793..518845953b125f3c91280e3c2b1d5384bea98dc5 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/PoliteExecutor.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/PoliteExecutor.java @@ -5,7 +5,6 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault; import java.util.LinkedList; import java.util.Queue; import java.util.concurrent.Executor; -import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.concurrent.GuardedBy; @@ -20,8 +19,6 @@ import static java.util.logging.Level.FINE; @NotNullByDefault public class PoliteExecutor implements Executor { - private static final Level LOG_LEVEL = FINE; - private final Object lock = new Object(); @GuardedBy("lock") private final Queue<Runnable> queue = new LinkedList<>(); @@ -51,9 +48,9 @@ public class PoliteExecutor implements Executor { public void execute(Runnable r) { long submitted = System.currentTimeMillis(); Runnable wrapped = () -> { - if (log.isLoggable(LOG_LEVEL)) { + if (log.isLoggable(FINE)) { long queued = System.currentTimeMillis() - submitted; - log.log(LOG_LEVEL, "Queue time " + queued + " ms"); + log.fine("Queue time " + queued + " ms"); } try { r.run(); diff --git a/bramble-core/src/main/java/org/briarproject/bramble/TimeLoggingExecutor.java b/bramble-core/src/main/java/org/briarproject/bramble/TimeLoggingExecutor.java index c81bf43a7aeb6e6569c624b2831f17ae0bee7f8e..e79b032142de22513052b495a312296722bbc968 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/TimeLoggingExecutor.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/TimeLoggingExecutor.java @@ -6,7 +6,6 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; import java.util.logging.Logger; import static java.util.logging.Level.FINE; @@ -14,8 +13,6 @@ import static java.util.logging.Level.FINE; @NotNullByDefault public class TimeLoggingExecutor extends ThreadPoolExecutor { - private static final Level LOG_LEVEL = FINE; - private final Logger log; public TimeLoggingExecutor(String tag, int corePoolSize, int maxPoolSize, @@ -29,15 +26,15 @@ public class TimeLoggingExecutor extends ThreadPoolExecutor { @Override public void execute(Runnable r) { - if (log.isLoggable(LOG_LEVEL)) { + if (log.isLoggable(FINE)) { long submitted = System.currentTimeMillis(); super.execute(() -> { long started = System.currentTimeMillis(); long queued = started - submitted; - log.log(LOG_LEVEL, "Queue time " + queued + " ms"); + log.fine("Queue time " + queued + " ms"); r.run(); long executing = System.currentTimeMillis() - started; - log.log(LOG_LEVEL, "Execution time " + executing + " ms"); + log.fine("Execution time " + executing + " ms"); }); } else { super.execute(r); diff --git a/bramble-core/src/main/java/org/briarproject/bramble/crypto/CryptoComponentImpl.java b/bramble-core/src/main/java/org/briarproject/bramble/crypto/CryptoComponentImpl.java index 83e759e3b945850fe9d46ad579ed954f09481460..e4e9e871139385c779a25463a3bd204a89799d13 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/crypto/CryptoComponentImpl.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/crypto/CryptoComponentImpl.java @@ -30,6 +30,7 @@ import java.util.logging.Logger; import javax.annotation.Nullable; import javax.inject.Inject; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.INFO; import static org.briarproject.bramble.util.ByteUtils.INT_32_BYTES; @@ -135,8 +136,8 @@ class CryptoComponentImpl implements CryptoComponent { for (byte b : secret) allZero |= b; if (allZero == 0) throw new GeneralSecurityException(); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Deriving shared secret took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Deriving shared secret took " + duration + " ms"); return secret; } diff --git a/bramble-core/src/main/java/org/briarproject/bramble/crypto/ScryptKdf.java b/bramble-core/src/main/java/org/briarproject/bramble/crypto/ScryptKdf.java index b3e567323aa4e6dfa8b1a48765bf802a3cae4aff..b3ece21ae1e0430a0b5a8ba2bea6e582cf35f838 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/crypto/ScryptKdf.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/crypto/ScryptKdf.java @@ -9,6 +9,7 @@ import java.util.logging.Logger; import javax.inject.Inject; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.INFO; class ScryptKdf implements PasswordBasedKdf { @@ -55,8 +56,8 @@ class ScryptKdf implements PasswordBasedKdf { SecretKey k = new SecretKey(SCrypt.generate(passwordBytes, salt, cost, BLOCK_SIZE, PARALLELIZATION, SecretKey.LENGTH)); long duration = System.currentTimeMillis() - start; - if (LOG.isLoggable(INFO)) - LOG.info("Deriving key from password took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Deriving key from password took " + duration + " ms"); return k; } } diff --git a/bramble-core/src/main/java/org/briarproject/bramble/crypto/Sec1KeyParser.java b/bramble-core/src/main/java/org/briarproject/bramble/crypto/Sec1KeyParser.java index edc36c6641fe02c737085994bf9ea05f7a22642c..2cfc47e4f00a804fb802fc6febc48ce7ccbec817 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/crypto/Sec1KeyParser.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/crypto/Sec1KeyParser.java @@ -16,7 +16,7 @@ import java.util.logging.Logger; import javax.annotation.concurrent.Immutable; -import static java.util.logging.Level.INFO; +import static java.util.logging.Level.FINE; /** * A key parser that uses the encoding defined in "SEC 1: Elliptic Curve @@ -81,8 +81,8 @@ class Sec1KeyParser implements KeyParser { ECPublicKeyParameters k = new ECPublicKeyParameters(pub, params); PublicKey p = new Sec1PublicKey(k); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Parsing public key took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Parsing public key took " + duration + " ms"); return p; } @@ -100,8 +100,8 @@ class Sec1KeyParser implements KeyParser { ECPrivateKeyParameters k = new ECPrivateKeyParameters(d, params); PrivateKey p = new Sec1PrivateKey(k, keyBits); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Parsing private key took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Parsing private key took " + duration + " ms"); return p; } } diff --git a/bramble-core/src/main/java/org/briarproject/bramble/lifecycle/LifecycleManagerImpl.java b/bramble-core/src/main/java/org/briarproject/bramble/lifecycle/LifecycleManagerImpl.java index 0f41cbf211676f5427b56591a24e872c085ecef9..8462f05844f106f7150ad5dfde02acaa4cc11306 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/lifecycle/LifecycleManagerImpl.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/lifecycle/LifecycleManagerImpl.java @@ -30,6 +30,7 @@ import javax.annotation.Nullable; import javax.annotation.concurrent.ThreadSafe; import javax.inject.Inject; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.INFO; import static java.util.logging.Level.WARNING; import static org.briarproject.bramble.api.lifecycle.LifecycleManager.LifecycleState.MIGRATING_DATABASE; @@ -108,8 +109,8 @@ class LifecycleManagerImpl implements LifecycleManager, MigrationListener { LocalAuthor localAuthor = authorFactory .createLocalAuthor(nickname, publicKey, privateKey); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Creating local author took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Creating local author took " + duration + " ms"); return localAuthor; } @@ -117,8 +118,8 @@ class LifecycleManagerImpl implements LifecycleManager, MigrationListener { long now = System.currentTimeMillis(); identityManager.registerLocalAuthor(author); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Registering local author took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Registering local author took " + duration + " ms"); } @Override @@ -133,10 +134,10 @@ class LifecycleManagerImpl implements LifecycleManager, MigrationListener { boolean reopened = db.open(this); long duration = System.currentTimeMillis() - start; - if (LOG.isLoggable(INFO)) { + if (LOG.isLoggable(FINE)) { if (reopened) - LOG.info("Reopening database took " + duration + " ms"); - else LOG.info("Creating database took " + duration + " ms"); + LOG.fine("Reopening database took " + duration + " ms"); + else LOG.fine("Creating database took " + duration + " ms"); } if (nickname != null) { @@ -153,8 +154,8 @@ class LifecycleManagerImpl implements LifecycleManager, MigrationListener { start = System.currentTimeMillis(); c.createLocalState(txn); duration = System.currentTimeMillis() - start; - if (LOG.isLoggable(INFO)) { - LOG.info("Starting client " + if (LOG.isLoggable(FINE)) { + LOG.fine("Starting client " + c.getClass().getSimpleName() + " took " + duration + " ms"); } @@ -167,8 +168,8 @@ class LifecycleManagerImpl implements LifecycleManager, MigrationListener { start = System.currentTimeMillis(); s.startService(); duration = System.currentTimeMillis() - start; - if (LOG.isLoggable(INFO)) { - LOG.info("Starting service " + s.getClass().getSimpleName() + if (LOG.isLoggable(FINE)) { + LOG.fine("Starting service " + s.getClass().getSimpleName() + " took " + duration + " ms"); } } @@ -216,14 +217,14 @@ class LifecycleManagerImpl implements LifecycleManager, MigrationListener { long start = System.currentTimeMillis(); s.stopService(); long duration = System.currentTimeMillis() - start; - if (LOG.isLoggable(INFO)) { - LOG.info("Stopping service " + s.getClass().getSimpleName() + if (LOG.isLoggable(FINE)) { + LOG.fine("Stopping service " + s.getClass().getSimpleName() + " took " + duration + " ms"); } } for (ExecutorService e : executors) { - if (LOG.isLoggable(INFO)) { - LOG.info("Stopping executor " + if (LOG.isLoggable(FINE)) { + LOG.fine("Stopping executor " + e.getClass().getSimpleName()); } e.shutdownNow(); @@ -231,8 +232,8 @@ class LifecycleManagerImpl implements LifecycleManager, MigrationListener { long start = System.currentTimeMillis(); db.close(); long duration = System.currentTimeMillis() - start; - if (LOG.isLoggable(INFO)) - LOG.info("Closing database took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Closing database took " + duration + " ms"); shutdownLatch.countDown(); } catch (DbException | ServiceException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); diff --git a/bramble-core/src/main/java/org/briarproject/bramble/plugin/PluginManagerImpl.java b/bramble-core/src/main/java/org/briarproject/bramble/plugin/PluginManagerImpl.java index 65f66345cee6dc05e3a369048977f976cfc85c6b..b79170d0ed2e2e62aa0a894e5b9ba21deb8e2330 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/plugin/PluginManagerImpl.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/plugin/PluginManagerImpl.java @@ -49,6 +49,7 @@ import java.util.logging.Logger; import javax.annotation.concurrent.ThreadSafe; import javax.inject.Inject; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.INFO; import static java.util.logging.Level.WARNING; @@ -208,8 +209,8 @@ class PluginManagerImpl implements PluginManager, Service { long start = System.currentTimeMillis(); plugin.start(); long duration = System.currentTimeMillis() - start; - if (LOG.isLoggable(INFO)) { - LOG.info("Starting plugin " + plugin.getId() + " took " + + if (LOG.isLoggable(FINE)) { + LOG.fine("Starting plugin " + plugin.getId() + " took " + duration + " ms"); } } catch (PluginException e) { @@ -246,8 +247,8 @@ class PluginManagerImpl implements PluginManager, Service { long start = System.currentTimeMillis(); plugin.stop(); long duration = System.currentTimeMillis() - start; - if (LOG.isLoggable(INFO)) { - LOG.info("Stopping plugin " + plugin.getId() + if (LOG.isLoggable(FINE)) { + LOG.fine("Stopping plugin " + plugin.getId() + " took " + duration + " ms"); } } catch (InterruptedException e) { diff --git a/briar-android/src/main/java/org/briarproject/briar/android/BriarApplicationImpl.java b/briar-android/src/main/java/org/briarproject/briar/android/BriarApplicationImpl.java index a2ff968a7e61c7df5f00bccc6c2325ad3411d404..bbb8a568cafb21ba2884ef9a1408dbfb541e1c53 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/BriarApplicationImpl.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/BriarApplicationImpl.java @@ -25,6 +25,7 @@ import java.util.logging.Handler; import java.util.logging.LogRecord; import java.util.logging.Logger; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.INFO; import static org.acra.ReportField.ANDROID_VERSION; import static org.acra.ReportField.APP_VERSION_CODE; @@ -101,7 +102,7 @@ public class BriarApplicationImpl extends Application } } rootLogger.addHandler(logHandler); - rootLogger.setLevel(INFO); + rootLogger.setLevel(IS_DEBUG_BUILD || IS_BETA_BUILD ? FINE : INFO); LOG.info("Created"); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/BaseControllerImpl.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/BaseControllerImpl.java index e2b588dfa00ff7c0ac9b50958efd0f164a1e94fa..77ba1bc583fdb13632ce90c2db5069656d1d7b0e 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/BaseControllerImpl.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/BaseControllerImpl.java @@ -32,7 +32,7 @@ import java.util.logging.Logger; import javax.annotation.Nullable; -import static java.util.logging.Level.INFO; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.WARNING; import static org.briarproject.briar.util.HtmlUtils.ARTICLE; @@ -113,8 +113,8 @@ abstract class BaseControllerImpl extends DbControllerImpl Collection<BlogPostHeader> headers = blogManager.getPostHeaders(groupId); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading headers took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading headers took " + duration + " ms"); Collection<BlogPostItem> items = new ArrayList<>(headers.size()); now = System.currentTimeMillis(); for (BlogPostHeader h : headers) { @@ -123,8 +123,8 @@ abstract class BaseControllerImpl extends DbControllerImpl items.add(item); } duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading bodies took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading bodies took " + duration + " ms"); return items; } @@ -143,8 +143,8 @@ abstract class BaseControllerImpl extends DbControllerImpl long now = System.currentTimeMillis(); BlogPostItem item = getItem(header); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading body took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading body took " + duration + " ms"); handler.onResult(item); } catch (DbException e) { if (LOG.isLoggable(WARNING)) @@ -170,8 +170,8 @@ abstract class BaseControllerImpl extends DbControllerImpl BlogPostHeader header1 = getPostHeader(g, m); BlogPostItem item = getItem(header1); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading post took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading post took " + duration + " ms"); handler.onResult(item); } catch (DbException e) { if (LOG.isLoggable(WARNING)) diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogControllerImpl.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogControllerImpl.java index be7b8ff2222cd4fc230f6393f7dbd193efc8bd87..5a0be438de5e9989585127820a2105bd63ed7082 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogControllerImpl.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/BlogControllerImpl.java @@ -35,7 +35,7 @@ import java.util.logging.Logger; import javax.inject.Inject; -import static java.util.logging.Level.INFO; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.WARNING; @MethodsNotNullByDefault @@ -161,8 +161,8 @@ class BlogControllerImpl extends BaseControllerImpl boolean removable = blogManager.canBeRemoved(b); BlogItem blog = new BlogItem(b, ours, removable); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading blog took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading blog took " + duration + " ms"); handler.onResult(blog); } catch (DbException e) { if (LOG.isLoggable(WARNING)) @@ -181,8 +181,8 @@ class BlogControllerImpl extends BaseControllerImpl Blog b = blogManager.getBlog(groupId); blogManager.removeBlog(b); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Removing blog took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Removing blog took " + duration + " ms"); handler.onResult(null); } catch (DbException e) { if (LOG.isLoggable(WARNING)) diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedControllerImpl.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedControllerImpl.java index 1118fe654da6c0fd0a44d32b04717dbdbedb9525..7cfc0ecb97bc85ead0c7b4cf6e63b03602c45a35 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedControllerImpl.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedControllerImpl.java @@ -26,7 +26,7 @@ import java.util.logging.Logger; import javax.inject.Inject; -import static java.util.logging.Level.INFO; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.WARNING; import static org.briarproject.briar.api.blog.BlogManager.CLIENT_ID; @@ -110,8 +110,8 @@ class FeedControllerImpl extends BaseControllerImpl } } long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading all posts took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading all posts took " + duration + " ms"); handler.onResult(posts); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); @@ -129,8 +129,8 @@ class FeedControllerImpl extends BaseControllerImpl Author a = identityManager.getLocalAuthor(); Blog b = blogManager.getPersonalBlog(a); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading blog took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading blog took " + duration + " ms"); handler.onResult(b); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java index d404ea47a40b6894aa481838c1b8b8790a1c65cf..fbf5247349c544eef4404c99cfcb8a383031a844 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java @@ -59,7 +59,7 @@ import javax.inject.Inject; import static android.support.v4.app.ActivityOptionsCompat.makeSceneTransitionAnimation; import static android.support.v4.view.ViewCompat.getTransitionName; -import static java.util.logging.Level.INFO; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.WARNING; import static org.briarproject.briar.android.contact.ConversationActivity.CONTACT_ID; @@ -209,8 +209,8 @@ public class ContactListFragment extends BaseFragment implements EventListener { } } long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Full load took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Full load took " + duration + " ms"); displayContacts(revision, contacts); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java index f926fe54d7daf59d4009d2a22979be87a2dde25e..71c7a9cbeb02204f5b157008ac43ed509967e589 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationActivity.java @@ -104,6 +104,7 @@ import uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt.PromptSt import static android.support.v4.view.ViewCompat.setTransitionName; import static android.support.v7.util.SortedList.INVALID_POSITION; import static android.widget.Toast.LENGTH_SHORT; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.INFO; import static java.util.logging.Level.WARNING; import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_INTRODUCTION; @@ -297,8 +298,8 @@ public class ConversationActivity extends BriarActivity contactAuthorId = contact.getAuthor().getId(); } long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading contact took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading contact took " + duration + " ms"); loadMessages(); displayContactDetails(); } catch (NoSuchContactException e) { @@ -358,8 +359,8 @@ public class ConversationActivity extends BriarActivity invitations.addAll(blogInvitations); invitations.addAll(groupInvitations); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading messages took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading messages took " + duration + " ms"); displayMessages(revision, headers, introductions, invitations); } catch (NoSuchContactException e) { finishOnUiThread(); @@ -441,8 +442,8 @@ public class ConversationActivity extends BriarActivity long now = System.currentTimeMillis(); String body = messagingManager.getMessageBody(m); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading body took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading body took " + duration + " ms"); displayMessageBody(m, body); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); @@ -692,8 +693,8 @@ public class ConversationActivity extends BriarActivity long now = System.currentTimeMillis(); messagingManager.addLocalMessage(m); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Storing message took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Storing message took " + duration + " ms"); Message message = m.getMessage(); PrivateMessageHeader h = new PrivateMessageHeader( message.getId(), message.getGroupId(), @@ -819,8 +820,8 @@ public class ConversationActivity extends BriarActivity long now = System.currentTimeMillis(); messagingManager.setReadFlag(g, m, true); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Marking read took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Marking read took " + duration + " ms"); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java index 2015be8db47c736b58688f8d763281eb79933d12..05224ef745b4baedd9541de7431c12d1d78fd738 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/forum/CreateForumActivity.java @@ -28,7 +28,7 @@ import javax.inject.Inject; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static android.widget.Toast.LENGTH_LONG; -import static java.util.logging.Level.INFO; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.WARNING; import static org.briarproject.briar.api.forum.ForumConstants.MAX_FORUM_NAME_LENGTH; @@ -125,8 +125,8 @@ public class CreateForumActivity extends BriarActivity { long now = System.currentTimeMillis(); Forum f = forumManager.addForum(name); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Storing forum took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Storing forum took " + duration + " ms"); displayForum(f); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java index af52ab94360633ef447ddf9028dbcb4f930ee773..e5cad06adae41b65d18aa3f4aa8735f9d07712ec 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java @@ -44,7 +44,7 @@ import javax.annotation.Nullable; import javax.inject.Inject; import static android.support.design.widget.Snackbar.LENGTH_INDEFINITE; -import static java.util.logging.Level.INFO; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.WARNING; import static org.briarproject.briar.api.forum.ForumManager.CLIENT_ID; @@ -169,8 +169,8 @@ public class ForumListFragment extends BaseEventFragment implements } } long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Full load took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Full load took " + duration + " ms"); displayForums(revision, forums); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); @@ -197,8 +197,8 @@ public class ForumListFragment extends BaseEventFragment implements long now = System.currentTimeMillis(); int available = forumSharingManager.getInvitations().size(); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading available took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading available took " + duration + " ms"); displayAvailableForums(available); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordControllerImpl.java b/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordControllerImpl.java index 121b7e119206f6e821db2bcd8868333f0420de49..dcee51a9dd23a3942eda846ebaf14390ce8be3de 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordControllerImpl.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/PasswordControllerImpl.java @@ -17,7 +17,7 @@ import java.util.logging.Logger; import javax.inject.Inject; -import static java.util.logging.Level.INFO; +import static java.util.logging.Level.FINE; @NotNullByDefault public class PasswordControllerImpl extends ConfigControllerImpl @@ -89,8 +89,8 @@ public class PasswordControllerImpl extends ConfigControllerImpl long now = System.currentTimeMillis(); byte[] encrypted = crypto.encryptWithPassword(key.getBytes(), password); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Key derivation took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Key derivation took " + duration + " ms"); return StringUtils.toHexString(encrypted); } } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListControllerImpl.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListControllerImpl.java index 8824923fb10ca92f6d8fda44804cd0010e0798ba..c632e64ee567434fedcfa60a31477176a9c53111 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListControllerImpl.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListControllerImpl.java @@ -36,7 +36,7 @@ import java.util.logging.Logger; import javax.inject.Inject; -import static java.util.logging.Level.INFO; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.WARNING; import static org.briarproject.briar.api.privategroup.PrivateGroupManager.CLIENT_ID; @@ -162,8 +162,8 @@ class GroupListControllerImpl extends DbControllerImpl } } long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading groups took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading groups took " + duration + " ms"); handler.onResult(items); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); @@ -179,8 +179,8 @@ class GroupListControllerImpl extends DbControllerImpl long now = System.currentTimeMillis(); groupManager.removePrivateGroup(g); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Removing group took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Removing group took " + duration + " ms"); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); handler.onException(e); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/settings/SettingsFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/settings/SettingsFragment.java index 00546afd47b83630ddd4c96573bcc014b1a24271..94f61f762d8e908deba0d04d86a65ff1365c14db 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/settings/SettingsFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/settings/SettingsFragment.java @@ -59,6 +59,7 @@ import static android.provider.Settings.EXTRA_CHANNEL_ID; import static android.provider.Settings.System.DEFAULT_NOTIFICATION_URI; import static android.support.v4.view.ViewCompat.LAYOUT_DIRECTION_LTR; import static android.widget.Toast.LENGTH_SHORT; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.INFO; import static java.util.logging.Level.WARNING; import static org.briarproject.bramble.api.plugin.BluetoothConstants.PREF_BT_ENABLE; @@ -248,8 +249,8 @@ public class SettingsFragment extends PreferenceFragmentCompat Settings torSettings = settingsManager.getSettings(TOR_NAMESPACE); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading settings took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading settings took " + duration + " ms"); boolean btSetting = btSettings.getBoolean(PREF_BT_ENABLE, false); int torSetting = torSettings.getInt(PREF_TOR_NETWORK, @@ -438,8 +439,8 @@ public class SettingsFragment extends PreferenceFragmentCompat long now = System.currentTimeMillis(); settingsManager.mergeSettings(s, TOR_NAMESPACE); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Merging settings took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Merging settings took " + duration + " ms"); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } @@ -454,8 +455,8 @@ public class SettingsFragment extends PreferenceFragmentCompat long now = System.currentTimeMillis(); settingsManager.mergeSettings(s, BT_NAMESPACE); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Merging settings took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Merging settings took " + duration + " ms"); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } @@ -468,8 +469,8 @@ public class SettingsFragment extends PreferenceFragmentCompat long now = System.currentTimeMillis(); settingsManager.mergeSettings(settings, SETTINGS_NAMESPACE); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Merging settings took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Merging settings took " + duration + " ms"); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationControllerImpl.java b/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationControllerImpl.java index ad584b03dab5172ab0623ec97d44b3b3217ff720..9d8ae48ed1981bbe9886e7838d88d6b169ab2370 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationControllerImpl.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/sharing/InvitationControllerImpl.java @@ -24,7 +24,7 @@ import java.util.Collection; import java.util.concurrent.Executor; import java.util.logging.Logger; -import static java.util.logging.Level.INFO; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.WARNING; @MethodsNotNullByDefault @@ -94,13 +94,12 @@ public abstract class InvitationControllerImpl<I extends InvitationItem> public void loadInvitations(boolean clear, ResultExceptionHandler<Collection<I>, DbException> handler) { runOnDbThread(() -> { - Collection<I> invitations = new ArrayList<>(); try { long now = System.currentTimeMillis(); - invitations.addAll(getInvitations()); + Collection<I> invitations = new ArrayList<>(getInvitations()); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading invitations took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading invitations took " + duration + " ms"); handler.onResult(invitations); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListControllerImpl.java b/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListControllerImpl.java index 11929640ed5008a11431051ca25584536221bd6b..f12b2ee18d38e526d33dd9a27555b059019fb27a 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListControllerImpl.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/threaded/ThreadListControllerImpl.java @@ -34,6 +34,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.logging.Logger; +import static java.util.logging.Level.FINE; import static java.util.logging.Level.INFO; import static java.util.logging.Level.WARNING; @@ -134,8 +135,8 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T long now = System.currentTimeMillis(); G groupItem = loadNamedGroup(); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading group took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading group took " + duration + " ms"); handler.onResult(groupItem); } catch (DbException e) { if (LOG.isLoggable(WARNING)) @@ -158,8 +159,8 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T long now = System.currentTimeMillis(); Collection<H> headers = loadHeaders(); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading headers took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading headers took " + duration + " ms"); // Load bodies into cache now = System.currentTimeMillis(); @@ -170,8 +171,8 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T } } duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Loading bodies took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Loading bodies took " + duration + " ms"); // Build and hand over items handler.onResult(buildItems(headers)); @@ -202,8 +203,8 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T markRead(i.getId()); } long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Marking read took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Marking read took " + duration + " ms"); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } @@ -221,8 +222,8 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T H header = addLocalMessage(msg); bodyCache.put(msg.getMessage().getId(), body); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Storing message took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Storing message took " + duration + " ms"); resultHandler.onResult(buildItem(header, body)); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); @@ -242,8 +243,8 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T G groupItem = loadNamedGroup(); deleteNamedGroup(groupItem); long duration = System.currentTimeMillis() - now; - if (LOG.isLoggable(INFO)) - LOG.info("Removing group took " + duration + " ms"); + if (LOG.isLoggable(FINE)) + LOG.fine("Removing group took " + duration + " ms"); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); handler.onException(e);