Changeset 89:247cbbb385de in AnnotationManagerN4J


Ignore:
Timestamp:
Feb 4, 2015, 6:37:02 PM (9 years ago)
Author:
casties
Branch:
default
Message:

improved logging.

Location:
src/main/java/de/mpiwg/itgroup/annotations/restlet
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java

    r88 r89  
    7373public abstract class AnnotatorResourceImpl extends ServerResource {
    7474
    75     protected static Logger logger = Logger.getLogger(AnnotatorResourceImpl.class.toString());
     75        protected static Logger logger = Logger.getLogger(AnnotatorResourceImpl.class.getCanonicalName());
    7676
    7777    private AnnotationStore store;
     
    171171        if (authToken == null) {
    172172            if (!((BaseRestlet) getApplication()).isAuthorizationMode()) {
     173                // no token, no-auth mode -> anonymous
    173174                return Person.getAnonymous();
    174175            }
     176            // no token, auth mode -> null
    175177            return null;
    176178        }
    177         Person user = null;
    178179                try {
    179180                        // decode token first to get consumer key
     
    198199            // userId is mandatory
    199200            String userId = payload.get("userId").getAsString();
    200             user = new Person(userId);
     201            Person user = new Person(userId);
    201202            // displayName is optional
    202203            if (payload.has("displayName")) {
     
    212213                user.groups = groups;
    213214            }
     215            logger.fine("auth OK! user=" + user);
     216            return user;
    214217        } catch (Exception e) {
    215218            logger.warning("Error checking auth token: "+e.toString());
    216             return null;
    217         }
    218         // must be ok then
    219         logger.fine("auth OK! user=" + user);
    220         return user;
     219        }
     220        return null;
    221221    }
    222222
  • src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorRestlet.java

    r88 r89  
    1 /**
    2  *
    3  */
    41package de.mpiwg.itgroup.annotations.restlet;
    52
  • src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorSearch.java

    r88 r89  
    120120        }
    121121
    122         logger.fine("sending:");
    123         logger.fine(result.toString());
     122        logger.fine("sending response");
     123        logger.finest(result.toString());
    124124        return new JsonRepresentation(result);
    125125    }
  • src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java

    r86 r89  
    5757public abstract class BaseRestlet extends Application {
    5858
    59     public static Logger logger = Logger.getLogger("de.mpiwg.itgroup.annotations.restlet.BaseRestlet");
     59    public static Logger logger = Logger.getLogger(BaseRestlet.class.getCanonicalName());
    6060
    6161    /**
     
    154154        ServletContext sc = (ServletContext) attrs.get("org.restlet.ext.servlet.ServletContext");
    155155        if (sc != null) {
    156             logger = context.getLogger();
    157             logger.info(getVersion() + " starting...");
     156           logger.info(getVersion() + " starting...");
    158157
    159158            /*
     
    241240                        consumerKeys.load(ps);
    242241                    } catch (IOException e) {
    243                         // TODO Auto-generated catch block
    244                         e.printStackTrace();
     242                        logger.fine("Error loading consumer keys: "+e);
    245243                    }
    246244                    logger.fine("consumer keys: " + consumerKeys);
Note: See TracChangeset for help on using the changeset viewer.