Migrated logging to SLF4J
This commit is contained in:
parent
536f926dcc
commit
6d5f05cf02
3 changed files with 17 additions and 7 deletions
|
@ -5,9 +5,6 @@
|
||||||
|
|
||||||
package org.rometools.certiorem.example;
|
package org.rometools.certiorem.example;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
@ -15,6 +12,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.rometools.certiorem.pub.NotificationException;
|
import org.rometools.certiorem.pub.NotificationException;
|
||||||
import org.rometools.certiorem.pub.Publisher;
|
import org.rometools.certiorem.pub.Publisher;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
@ -27,13 +26,15 @@ public class NotifyTest extends HttpServlet {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(NotifyTest.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
|
public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
|
||||||
final Publisher pub = new Publisher();
|
final Publisher pub = new Publisher();
|
||||||
try {
|
try {
|
||||||
pub.sendUpdateNotification("http://localhost/webapp/hub", "http://localhost/webapp/research-atom.xml");
|
pub.sendUpdateNotification("http://localhost/webapp/hub", "http://localhost/webapp/research-atom.xml");
|
||||||
} catch (final NotificationException ex) {
|
} catch (final NotificationException ex) {
|
||||||
Logger.getLogger(NotifyTest.class.getName()).log(Level.SEVERE, null, ex);
|
LOG.error(null, ex);
|
||||||
throw new ServletException(ex);
|
throw new ServletException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ import org.rometools.certiorem.sub.request.AsyncRequester;
|
||||||
import org.rometools.fetcher.FeedFetcher;
|
import org.rometools.fetcher.FeedFetcher;
|
||||||
import org.rometools.fetcher.impl.HashMapFeedInfoCache;
|
import org.rometools.fetcher.impl.HashMapFeedInfoCache;
|
||||||
import org.rometools.fetcher.impl.HttpURLFeedFetcher;
|
import org.rometools.fetcher.impl.HttpURLFeedFetcher;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
|
@ -28,6 +30,9 @@ import com.google.inject.servlet.ServletModule;
|
||||||
* @author robert.cooper
|
* @author robert.cooper
|
||||||
*/
|
*/
|
||||||
public class ServerModule extends GuiceServletContextListener {
|
public class ServerModule extends GuiceServletContextListener {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(ServerModule.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Injector getInjector() {
|
protected Injector getInjector() {
|
||||||
return Guice.createInjector(new AbstractModule() {
|
return Guice.createInjector(new AbstractModule() {
|
||||||
|
@ -47,7 +52,7 @@ public class ServerModule extends GuiceServletContextListener {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public Subscriptions buildSubs() {
|
public Subscriptions buildSubs() {
|
||||||
System.out.println("buildSubs");
|
LOG.debug("buildSubs");
|
||||||
final Subscriptions subs = new Subscriptions(new HashMapFeedInfoCache(), new AsyncRequester(), "http://localhost/webapp/subscriptions/",
|
final Subscriptions subs = new Subscriptions(new HashMapFeedInfoCache(), new AsyncRequester(), "http://localhost/webapp/subscriptions/",
|
||||||
new InMemorySubDAO());
|
new InMemorySubDAO());
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ import org.rometools.certiorem.sub.Subscriptions;
|
||||||
import org.rometools.certiorem.sub.data.Subscription;
|
import org.rometools.certiorem.sub.data.Subscription;
|
||||||
import org.rometools.certiorem.sub.data.SubscriptionCallback;
|
import org.rometools.certiorem.sub.data.SubscriptionCallback;
|
||||||
import org.rometools.fetcher.impl.SyndFeedInfo;
|
import org.rometools.fetcher.impl.SyndFeedInfo;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
@ -24,6 +26,8 @@ import com.google.inject.Singleton;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SubTest extends HttpServlet {
|
public class SubTest extends HttpServlet {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(SubTest.class);
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final Subscriptions subs;
|
private final Subscriptions subs;
|
||||||
|
@ -44,7 +48,7 @@ public class SubTest extends HttpServlet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(final Subscription subscribed) {
|
public void onSubscribe(final Subscription subscribed) {
|
||||||
System.out.println("Subscribed " + subscribed.getId() + " " + subscribed.getSourceUrl());
|
LOG.debug("Subscribed {} {}", subscribed.getId(), subscribed.getSourceUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue