Skip to content

Commit

Permalink
fix log
Browse files Browse the repository at this point in the history
  • Loading branch information
vernedeng committed May 11, 2024
1 parent 4215fa7 commit 6242eeb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private static SortClusterConfigHolder get() {
instance.loader = (SortConfigLoader) loaderObject;
}
} catch (Throwable t) {
log.error("fail to init loader,loaderType:{},error:{}", loaderType, t.getMessage());
log.error("fail to init loader, loaderType={}", loaderType);
}
}
if (instance.loader == null) {
Expand Down Expand Up @@ -119,7 +119,7 @@ private void reload() {
this.config = newConfig;
}
} catch (Throwable e) {
log.error(e.getMessage(), e);
log.error("failed to reload sort config", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public SortConfig load() {
confString = confString.substring(index);
return objectMapper.readValue(confString, SortConfig.class);
} catch (Exception e) {
LOG.error("fail to load properties, file ={}, and e= {}", fileName, e);
LOG.error("fail to load properties, file ={}", fileName, e);
}
return SortConfig.builder().build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ public SortConfig load() {
// request with get
CloseableHttpResponse response = httpClient.execute(httpGet);
String returnStr = EntityUtils.toString(response.getEntity());
log.info("end to request {},result:{}", url, returnStr);
log.info("end to request {}, result={}", url, returnStr);
// get groupId <-> topic and m value.

SortConfigResponse clusterResponse = objectMapper.readValue(returnStr, SortConfigResponse.class);
int errCode = clusterResponse.getCode();
if (errCode != SortConfigResponse.SUCC && errCode != SortConfigResponse.NO_UPDATE) {
log.info("Fail to get config info from url:{}, error code is {}, msg is {}",
log.info("fail to get config info from url={}, error code={}, msg={}",
url, clusterResponse.getCode(), clusterResponse.getMsg());
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void start() {
}
//
Map<String, String> flumeConfiguration = FlumeConfigGenerator.generateFlumeConfiguration(config);
log.info("Start sort task:{},config:{}", taskName, flumeConfiguration);
log.info("start sort task={}, config={}", taskName, flumeConfiguration);
PropertiesConfigurationProvider configurationProvider = new PropertiesConfigurationProvider(
config.getSortTaskName(), flumeConfiguration);
this.handleConfigurationEvent(configurationProvider.getConfiguration());
Expand All @@ -71,7 +71,7 @@ public void handleConfigurationEvent(MaterializedConfiguration conf) {
stopAllComponents();
startAllComponents(conf);
} catch (InterruptedException e) {
log.error("Interrupted while trying to handle configuration event", e);
log.error("interrupted while trying to handle configuration event", e);
} finally {
// If interrupted while trying to lock, we don't own the lock, so must not attempt to unlock
if (lifecycleLock.isHeldByCurrentThread()) {
Expand All @@ -98,31 +98,31 @@ public void stop() {
*/
private void stopAllComponents() {
if (this.materializedConfiguration != null) {
log.info("Shutting down configuration: {}", this.materializedConfiguration);
log.info("shutting down configuration: {}", this.materializedConfiguration);
for (Map.Entry<String, SourceRunner> entry : this.materializedConfiguration.getSourceRunners().entrySet()) {
try {
log.info("Stopping Source " + entry.getKey());
log.info("stopping Source " + entry.getKey());
supervisor.unsupervise(entry.getValue());
} catch (Exception e) {
log.error("Error while stopping {}", entry.getValue(), e);
log.error("error while stopping {}", entry.getValue(), e);
}
}

for (Map.Entry<String, SinkRunner> entry : this.materializedConfiguration.getSinkRunners().entrySet()) {
try {
log.info("Stopping Sink " + entry.getKey());
log.info("stopping Sink " + entry.getKey());
supervisor.unsupervise(entry.getValue());
} catch (Exception e) {
log.error("Error while stopping {}", entry.getValue(), e);
log.error("error while stopping {}", entry.getValue(), e);
}
}

for (Map.Entry<String, Channel> entry : this.materializedConfiguration.getChannels().entrySet()) {
try {
log.info("Stopping Channel " + entry.getKey());
log.info("stopping Channel " + entry.getKey());
supervisor.unsupervise(entry.getValue());
} catch (Exception e) {
log.error("Error while stopping {}", entry.getValue(), e);
log.error("error while stopping {}", entry.getValue(), e);
}
}
}
Expand All @@ -134,17 +134,17 @@ private void stopAllComponents() {
* @param materializedConfiguration
*/
private void startAllComponents(MaterializedConfiguration materializedConfiguration) {
log.info("Starting new configuration:{}", materializedConfiguration);
log.info("starting new configuration:{}", materializedConfiguration);

this.materializedConfiguration = materializedConfiguration;

for (Map.Entry<String, Channel> entry : materializedConfiguration.getChannels().entrySet()) {
try {
log.info("Starting Channel " + entry.getKey());
log.info("starting Channel " + entry.getKey());
supervisor.supervise(entry.getValue(),
new LifecycleSupervisor.SupervisorPolicy.AlwaysRestartPolicy(), LifecycleState.START);
} catch (Exception e) {
log.error("Error while starting {}", entry.getValue(), e);
log.error("error while starting {}", entry.getValue(), e);
}
}

Expand All @@ -155,31 +155,31 @@ private void startAllComponents(MaterializedConfiguration materializedConfigurat
while (ch.getLifecycleState() != LifecycleState.START
&& !supervisor.isComponentInErrorState(ch)) {
try {
log.info("Waiting for channel: " + ch.getName() + " to start. Sleeping for 500 ms");
log.info("waiting for channel: " + ch.getName() + " to start. Sleeping for 500 ms");
Thread.sleep(500);
} catch (InterruptedException e) {
log.error("Interrupted while waiting for channel to start.", e);
log.error("interrupted while waiting for channel to start.", e);
}
}
}

for (Map.Entry<String, SinkRunner> entry : materializedConfiguration.getSinkRunners().entrySet()) {
try {
log.info("Starting Sink " + entry.getKey());
log.info("starting Sink " + entry.getKey());
supervisor.supervise(entry.getValue(),
new LifecycleSupervisor.SupervisorPolicy.AlwaysRestartPolicy(), LifecycleState.START);
} catch (Exception e) {
log.error("Error while starting {}", entry.getValue(), e);
log.error("error while starting {}", entry.getValue(), e);
}
}

for (Map.Entry<String, SourceRunner> entry : materializedConfiguration.getSourceRunners().entrySet()) {
try {
log.info("Starting Source " + entry.getKey());
log.info("starting Source " + entry.getKey());
supervisor.supervise(entry.getValue(),
new LifecycleSupervisor.SupervisorPolicy.AlwaysRestartPolicy(), LifecycleState.START);
} catch (Exception e) {
log.error("Error while starting {}", entry.getValue(), e);
log.error("error while starting {}", entry.getValue(), e);
}
}
}
Expand Down

0 comments on commit 6242eeb

Please sign in to comment.