Browse code

Chore: get rid of some simple replication logs

Thomas Cataldo authored on 17/07/2019 12:37:40
Showing 3 changed files
... ...
@@ -155,11 +155,15 @@ public class BaseReplicatedMailboxesService implements IBaseMailboxFolders {
155 155
 				// because jutf7 does not honor onMalformedInput(REPLACE) and
156 156
 				// Charset.decode
157 157
 				// throws an Error in that case
158
-				logger.warn("{} looks like utf-7 but it is not", s);
158
+				if (logger.isDebugEnabled()) {
159
+					logger.debug("{} looks like utf-7 but it is not", s);
160
+				}
159 161
 				return s;
160 162
 			}
161 163
 		} else {
162
-			logger.warn("{} contains non-ascii chars, not decoding as utf7.", s);
164
+			if (logger.isDebugEnabled()) {
165
+				logger.debug("{} contains non-ascii chars, not decoding as utf7.", s);
166
+			}
163 167
 			return s;
164 168
 		}
165 169
 	}
... ...
@@ -96,7 +96,6 @@ public class ImapContext {
96 96
 
97 97
 		public PoolableStoreClient(String hostname, int port, String login, String password) {
98 98
 			super(hostname, port, login, password);
99
-			logger.info("Creating vertx imap client...");
100 99
 			this.fastFetch = VXStoreClient.create(hostname, port, login, password);
101 100
 		}
102 101
 
... ...
@@ -115,7 +114,6 @@ public class ImapContext {
115 114
 		if (imapClient.isPresent() && !imapClient.get().fastFetch.isClosed()) {
116 115
 			return imapClient.get();
117 116
 		} else {
118
-			logger.info("Start IMAP init for {}", latd);
119 117
 			PoolableStoreClient sc = new PoolableStoreClient(server, 1143, latd, sid);
120 118
 			CompletableFuture<Optional<PoolableStoreClient>> prom = sc.fastFetch.login()
121 119
 					.thenApply(resp -> Optional.of(sc));
... ...
@@ -124,9 +122,9 @@ public class ImapContext {
124 122
 				imapClient = prom.get(10, TimeUnit.SECONDS);
125 123
 				if (!minaClientOk) {
126 124
 					sc.closeImpl();
127
-					throw new ServerFault("Failed to establish both imap connections .");
125
+					throw new ServerFault("Failed to establish both imap connections for " + latd);
128 126
 				}
129
-				logger.info("Imap init of both clients is complete for {}.", latd);
127
+				logger.info("[{}] Imap init of both clients is complete.", latd);
130 128
 			} catch (Exception e) {
131 129
 				sc.closeImpl();
132 130
 				throw new ServerFault(e);
... ...
@@ -154,7 +152,9 @@ public class ImapContext {
154 152
 		String key = context.getSecurityContext().getSessionId();
155 153
 		ImapContext imapCtx = sidToCtxCache.getIfPresent(key);
156 154
 		if (imapCtx == null) {
157
-			logger.warn("ImapContext cache miss for key {}", key);
155
+			if (logger.isDebugEnabled()) {
156
+				logger.debug("ImapContext cache miss for key {}", key);
157
+			}
158 158
 			IServiceProvider srvProv = context.provider();
159 159
 			IAuthentication authApi = srvProv.instance(IAuthentication.class);
160 160
 			AuthUser curUser = authApi.getCurrentUser();
... ...
@@ -168,7 +168,7 @@ public class ImapContext {
168 168
 				imapCtx = new ImapContext(latd, partition, imapSrv, key, curUser);
169 169
 				sidToCtxCache.put(key, imapCtx);
170 170
 			} else {
171
-				throw new ServerFault("This is intended for users with a mailbox");
171
+				throw new ServerFault("ImapContext is intended for users with a mailbox");
172 172
 			}
173 173
 		}
174 174
 		return imapCtx;
... ...
@@ -94,8 +94,8 @@ public class ReplicatedMailboxesRootMgmtService implements IReplicatedMailboxesR
94 94
 		IContainers contApi = context.provider().instance(IContainers.class);
95 95
 		if (getRootContainer(containerUid, contApi) == null) {
96 96
 			createRootContainer(root, domainUid, containerUid, ownerUid, contApi);
97
-		} else {
98
-			logger.info("Container {} exists for {}", containerUid, root.fullName());
97
+		} else if (logger.isDebugEnabled()) {
98
+			logger.debug("Container {} exists for {}", containerUid, root.fullName());
99 99
 		}
100 100
 	}
101 101
 
... ...
@@ -104,13 +104,12 @@ public class ReplicatedMailboxesRootMgmtService implements IReplicatedMailboxesR
104 104
 		try {
105 105
 			lock.writeLock().lock();
106 106
 			if (getRootContainer(containerUid, contApi) == null) {
107
-				logger.info("Should create missing root {}", containerUid);
107
+				logger.info("Create missing root {}", containerUid);
108 108
 				ContainerDescriptor toCreate = ContainerDescriptor.create(containerUid, subtreeName(root), ownerUid,
109 109
 						IMailReplicaUids.REPLICATED_MBOXES, domainUid, true);
110 110
 				toCreate.domainUid = domainUid;
111 111
 
112 112
 				contApi.create(toCreate.uid, toCreate);
113
-				// FIXME set permissions
114 113
 				EmitReplicationEvents.mailboxRootCreated(root);
115 114
 			}
116 115
 		} finally {