replace sysout with logger
This commit is contained in:
@@ -29,8 +29,12 @@ import org.lucares.pdb.plot.api.PlotSettings;
|
|||||||
import org.lucares.performance.db.FileUtils;
|
import org.lucares.performance.db.FileUtils;
|
||||||
import org.lucares.performance.db.Grouping;
|
import org.lucares.performance.db.Grouping;
|
||||||
import org.lucares.performance.db.PerformanceDb;
|
import org.lucares.performance.db.PerformanceDb;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class Plotter {
|
public class Plotter {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(Plotter.class);
|
||||||
|
private static final Logger METRICS_LOGGER = LoggerFactory.getLogger("org.lucares.metrics.plotter");
|
||||||
|
|
||||||
private final PerformanceDb db;
|
private final PerformanceDb db;
|
||||||
private final Path tmpBaseDir;
|
private final Path tmpBaseDir;
|
||||||
@@ -134,6 +138,8 @@ public class Plotter {
|
|||||||
while (dataSeries.size() > plotSettings.getLimit()) {
|
while (dataSeries.size() > plotSettings.getLimit()) {
|
||||||
dataSeries.remove(plotSettings.getLimit());
|
dataSeries.remove(plotSettings.getLimit());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
dataSeries.sort(getDataSeriesComparator(Limit.MOST_VALUES));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -184,7 +190,7 @@ public class Plotter {
|
|||||||
plotSettings.setGroupBy(Grouping.NO_GROUPING);
|
plotSettings.setGroupBy(Grouping.NO_GROUPING);
|
||||||
|
|
||||||
final File image = plotter.plot(plotSettings);
|
final File image = plotter.plot(plotSettings);
|
||||||
System.out.println("plotted image: " + image);
|
LOGGER.trace("plotted image: {}", image);
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
@@ -225,7 +231,7 @@ public class Plotter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("wrote " + count + " values to csv in: " + (System.nanoTime() - start) / 1_000_000.0 + "ms");
|
METRICS_LOGGER.debug("wrote {} values to csv in: {}ms", count, (System.nanoTime() - start) / 1_000_000.0);
|
||||||
return new CsvSummary(count, maxDate, minDate);
|
return new CsvSummary(count, maxDate, minDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import org.lucares.pdbui.domain.PlotResponse;
|
|||||||
import org.lucares.performance.db.CollectionUtils;
|
import org.lucares.performance.db.CollectionUtils;
|
||||||
import org.lucares.recommind.logs.InternalPlottingException;
|
import org.lucares.recommind.logs.InternalPlottingException;
|
||||||
import org.lucares.recommind.logs.Plotter;
|
import org.lucares.recommind.logs.Plotter;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -31,6 +33,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
public class PdbController implements HardcodedValues, CollectionUtils {
|
public class PdbController implements HardcodedValues, CollectionUtils {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(PdbController.class);
|
||||||
|
|
||||||
private final Plotter plotter;
|
private final Plotter plotter;
|
||||||
private final PdbRepository db;
|
private final PdbRepository db;
|
||||||
|
|
||||||
@@ -53,7 +57,9 @@ public class PdbController implements HardcodedValues, CollectionUtils {
|
|||||||
|
|
||||||
final Path relativeImagePath = plotter.getOutputDir().relativize(image.toPath());
|
final Path relativeImagePath = plotter.getOutputDir().relativize(image.toPath());
|
||||||
final String relativeImgUrl = relativeImagePath.toString().replace('\\', '/');
|
final String relativeImgUrl = relativeImagePath.toString().replace('\\', '/');
|
||||||
return new PlotResponse(WEB_IMAGE_OUTPUT_PATH + "/" + relativeImgUrl);
|
final String imageUrl = WEB_IMAGE_OUTPUT_PATH + "/" + relativeImgUrl;
|
||||||
|
LOGGER.trace("image url: {}", imageUrl);
|
||||||
|
return new PlotResponse(imageUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(path = "/autocomplete", //
|
@RequestMapping(path = "/autocomplete", //
|
||||||
|
|||||||
Reference in New Issue
Block a user