comparison src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java @ 89:247cbbb385de

improved logging.
author casties
date Wed, 04 Feb 2015 19:37:02 +0100
parents e3f0613b2f2d
children fcb6fe10e08c
comparison
equal deleted inserted replaced
88:b406507a953d 89:247cbbb385de
54 54
55 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore; 55 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
56 56
57 public abstract class BaseRestlet extends Application { 57 public abstract class BaseRestlet extends Application {
58 58
59 public static Logger logger = Logger.getLogger("de.mpiwg.itgroup.annotations.restlet.BaseRestlet"); 59 public static Logger logger = Logger.getLogger(BaseRestlet.class.getCanonicalName());
60 60
61 /** 61 /**
62 * Properties holding consumer keys and secrets. 62 * Properties holding consumer keys and secrets.
63 */ 63 */
64 protected Properties consumerKeys; 64 protected Properties consumerKeys;
151 */ 151 */
152 protected void configure(Context context) { 152 protected void configure(Context context) {
153 ConcurrentMap<String, Object> attrs = context.getAttributes(); 153 ConcurrentMap<String, Object> attrs = context.getAttributes();
154 ServletContext sc = (ServletContext) attrs.get("org.restlet.ext.servlet.ServletContext"); 154 ServletContext sc = (ServletContext) attrs.get("org.restlet.ext.servlet.ServletContext");
155 if (sc != null) { 155 if (sc != null) {
156 logger = context.getLogger(); 156 logger.info(getVersion() + " starting...");
157 logger.info(getVersion() + " starting...");
158 157
159 /* 158 /*
160 * read config from webapp 159 * read config from webapp
161 */ 160 */
162 serverConfig = (Properties) sc.getAttribute(SERVERCONFIG_KEY); 161 serverConfig = (Properties) sc.getAttribute(SERVERCONFIG_KEY);
238 if (ps != null) { 237 if (ps != null) {
239 logger.fine("loading consumer keys from " + CONSUMER_KEYS_PATH); 238 logger.fine("loading consumer keys from " + CONSUMER_KEYS_PATH);
240 try { 239 try {
241 consumerKeys.load(ps); 240 consumerKeys.load(ps);
242 } catch (IOException e) { 241 } catch (IOException e) {
243 // TODO Auto-generated catch block 242 logger.fine("Error loading consumer keys: "+e);
244 e.printStackTrace();
245 } 243 }
246 logger.fine("consumer keys: " + consumerKeys); 244 logger.fine("consumer keys: " + consumerKeys);
247 } else { 245 } else {
248 logger.severe("Unable to get resource " + CONSUMER_KEYS_PATH); 246 logger.severe("Unable to get resource " + CONSUMER_KEYS_PATH);
249 } 247 }