mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
logging tweaks
This commit is contained in:
@@ -90,8 +90,6 @@ public class CommaFeedModule extends AbstractModule {
|
|||||||
.filter(MetricFilter.ALL)
|
.filter(MetricFilter.ALL)
|
||||||
.build(graphite);
|
.build(graphite);
|
||||||
reporter.start(graphiteInterval, TimeUnit.SECONDS);
|
reporter.start(graphiteInterval, TimeUnit.SECONDS);
|
||||||
} else {
|
|
||||||
log.info("Graphite Metrics Disabled. Metrics will not be sent.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,15 +33,17 @@ public class DatabaseStartupService implements Managed {
|
|||||||
private final CommaFeedConfiguration config;
|
private final CommaFeedConfiguration config;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() throws Exception {
|
public void start() {
|
||||||
updateSchema();
|
updateSchema();
|
||||||
long count = UnitOfWork.call(sessionFactory, () -> userDAO.count());
|
long count = UnitOfWork.call(sessionFactory, userDAO::count);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
UnitOfWork.run(sessionFactory, this::initialData);
|
UnitOfWork.run(sessionFactory, this::initialData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSchema() {
|
private void updateSchema() {
|
||||||
|
log.info("checking if database schema needs updating");
|
||||||
|
|
||||||
Session session = sessionFactory.openSession();
|
Session session = sessionFactory.openSession();
|
||||||
session.doWork(connection -> {
|
session.doWork(connection -> {
|
||||||
try {
|
try {
|
||||||
@@ -68,10 +70,12 @@ public class DatabaseStartupService implements Managed {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
session.close();
|
session.close();
|
||||||
|
|
||||||
|
log.info("database schema is up to date");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialData() {
|
private void initialData() {
|
||||||
log.info("Populating database with default values");
|
log.info("populating database with default values");
|
||||||
try {
|
try {
|
||||||
userService.createAdminUser();
|
userService.createAdminUser();
|
||||||
if (config.getApplicationSettings().getCreateDemoAccount()) {
|
if (config.getApplicationSettings().getCreateDemoAccount()) {
|
||||||
@@ -82,8 +86,4 @@ public class DatabaseStartupService implements Managed {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() throws Exception {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user