HDDS-282. Consolidate logging in scm/container-service. Contributed by Elek Marton.

This commit is contained in:
Xiaoyu Yao 2018-07-24 10:16:53 -07:00
parent 35ce6eb1f5
commit cd0b9f1380
5 changed files with 13 additions and 11 deletions

View File

@ -203,11 +203,11 @@ public class EndpointStateMachine
this.incMissed(); this.incMissed();
if (this.getMissedCount() % getLogWarnInterval(conf) == if (this.getMissedCount() % getLogWarnInterval(conf) ==
0) { 0) {
LOG.warn("Unable to communicate to SCM server at {}. We have not been " + LOG.error("Unable to communicate to SCM server at {}. We have not been " +
"able to communicate to this SCM server for past {} seconds.", "able to communicate to this SCM server for past {} seconds.",
this.getAddress().getHostString() + ":" + this.getAddress().getPort(), this.getAddress().getHostString() + ":" + this.getAddress().getPort(),
this.getMissedCount() * getScmHeartbeatInterval( this.getMissedCount() * getScmHeartbeatInterval(
this.conf)); this.conf), ex);
} }
} }

View File

@ -125,8 +125,7 @@ public final class RegisterEndpointTask implements
rpcEndPoint.setState(nextState); rpcEndPoint.setState(nextState);
rpcEndPoint.zeroMissedCount(); rpcEndPoint.zeroMissedCount();
} catch (IOException ex) { } catch (IOException ex) {
rpcEndPoint.logIfNeeded(ex rpcEndPoint.logIfNeeded(ex);
);
} finally { } finally {
rpcEndPoint.unlock(); rpcEndPoint.unlock();
} }

View File

@ -119,9 +119,11 @@ public class BlockDeletingService extends BackgroundService{
// configured. // configured.
containers = containerSet.chooseContainerForBlockDeletion( containers = containerSet.chooseContainerForBlockDeletion(
containerLimitPerInterval, containerDeletionPolicy); containerLimitPerInterval, containerDeletionPolicy);
if (containers.size() > 0) {
LOG.info("Plan to choose {} containers for block deletion, " LOG.info("Plan to choose {} containers for block deletion, "
+ "actually returns {} valid containers.", + "actually returns {} valid containers.",
containerLimitPerInterval, containers.size()); containerLimitPerInterval, containers.size());
}
for(ContainerData container : containers) { for(ContainerData container : containers) {
BlockDeletingTask containerTask = BlockDeletingTask containerTask =

View File

@ -155,8 +155,7 @@ public class EventQueue implements EventPublisher, AutoCloseable {
} }
} else { } else {
throw new IllegalArgumentException( LOG.warn("No event handler registered for event " + event);
"No event handler registered for event " + event);
} }
} }

View File

@ -50,7 +50,9 @@ public class TypedEvent<T> implements Event<T> {
@Override @Override
public String toString() { public String toString() {
return "TypedEvent{" + "payloadType=" + payloadType + ", name='" + name return "TypedEvent{" +
+ '\'' + '}'; "payloadType=" + payloadType.getSimpleName() +
", name='" + name + '\'' +
'}';
} }
} }