Skip to content

Commit

Permalink
Merge pull request #2794 from atlanhq/startupTime
Browse files Browse the repository at this point in the history
Get logs in json format
  • Loading branch information
aarshi0301 authored Jan 29, 2024
2 parents 1ca2fd0 + b62424c commit 81c5ad5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 2 additions & 5 deletions common/src/main/java/org/apache/atlas/service/Services.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.atlas.service;

import org.apache.atlas.annotation.AtlasService;
import org.apache.atlas.type.AtlasType;
import org.apache.atlas.utils.AtlasPerfTracer;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.lang.StringUtils;
Expand Down Expand Up @@ -89,7 +90,6 @@ public void start() {
durationMap.putIfAbsent(svc.getClass().getName(),Duration.between(start, end).toMillis());
}

LOG.info("Capturing Service startup time");
printHashMapInTableFormatDescendingOrder(durationMap, "startupTime");

} catch (Exception e) {
Expand Down Expand Up @@ -158,9 +158,6 @@ public static void printHashMapInTableFormatDescendingOrder(Map<String, Long> ma
LOG.info(System.out.printf(rowFormat, "Key", value).toString());
LOG.info(new String(new char[maxKeyLength + 15]).replace('\0', '-'));

// Print each sorted entry
for (Map.Entry<String, Long> entry : list) {
LOG.info(System.out.printf(rowFormat, entry.getKey(), entry.getValue()).toString());
}
LOG.info("Capturing Service startup time {}", AtlasType.toJson(list));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.apache.atlas.repository.audit;

import org.apache.atlas.type.AtlasType;
import org.apache.atlas.utils.AtlasPerfTracer;
import org.apache.commons.logging.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
Expand All @@ -24,8 +26,6 @@ public StartupTimeLogger(StartupTimeLoggerBeanPostProcessor beanPostProcessor) {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
// Print the startup times after all beans are loaded

LOG.info("Capturing Bean creation time");
printHashMapInTableFormatDescendingOrder(beanPostProcessor.getDurationTimeMap(), "creationTime");
}

Expand All @@ -46,9 +46,6 @@ public static void printHashMapInTableFormatDescendingOrder(Map<String, Long> ma
LOG.info(System.out.printf(rowFormat, "Key", value).toString());
LOG.info(new String(new char[maxKeyLength + 1]).replace('\0', '-'));

// Print each sorted entry
for (Map.Entry<String, Long> entry : list) {
LOG.info(System.out.printf(rowFormat, entry.getKey(), entry.getValue()).toString());
}
LOG.info("Capturing Bean creation time {}", AtlasType.toJson(list));
}
}

0 comments on commit 81c5ad5

Please sign in to comment.