logging tweaks

This commit is contained in:
Athou
2023-05-24 08:14:59 +02:00
parent 5939f845b3
commit b86ff2a32f
2 changed files with 7 additions and 9 deletions

View File

@@ -90,8 +90,6 @@ public class CommaFeedModule extends AbstractModule {
.filter(MetricFilter.ALL)
.build(graphite);
reporter.start(graphiteInterval, TimeUnit.SECONDS);
} else {
log.info("Graphite Metrics Disabled. Metrics will not be sent.");
}
}
}

View File

@@ -33,15 +33,17 @@ public class DatabaseStartupService implements Managed {
private final CommaFeedConfiguration config;
@Override
public void start() throws Exception {
public void start() {
updateSchema();
long count = UnitOfWork.call(sessionFactory, () -> userDAO.count());
long count = UnitOfWork.call(sessionFactory, userDAO::count);
if (count == 0) {
UnitOfWork.run(sessionFactory, this::initialData);
}
}
private void updateSchema() {
log.info("checking if database schema needs updating");
Session session = sessionFactory.openSession();
session.doWork(connection -> {
try {
@@ -68,10 +70,12 @@ public class DatabaseStartupService implements Managed {
}
});
session.close();
log.info("database schema is up to date");
}
private void initialData() {
log.info("Populating database with default values");
log.info("populating database with default values");
try {
userService.createAdminUser();
if (config.getApplicationSettings().getCreateDemoAccount()) {
@@ -82,8 +86,4 @@ public class DatabaseStartupService implements Managed {
}
}
@Override
public void stop() throws Exception {
}
}