Commit 8be07854 authored by Andre Freyssinet's avatar Andre Freyssinet
Browse files

Logging enhancements.

parent 10b05d74
......@@ -72,28 +72,24 @@ import fr.dyade.aaa.common.Debug;
@Path("/")
@Singleton
public class AdminService implements ContainerRequestFilter {
public static Logger logger = Debug.getLogger(AdminService.class.getName());
private static final String AUTHORIZATION_PROPERTY = "Authorization";
private static final String AUTHENTICATION_SCHEME = "Basic";
public static Logger logger = Debug.getLogger(AdminService.class.getName());
private final AdminHelper helper = AdminHelper.getInstance();
public static final String ADMIN = "admin";
public static void logLinks(Response.ResponseBuilder builder) {
if (builder == null)
if ((builder == null) || !logger.isLoggable(BasicLevel.DEBUG))
return;
Response response = builder.build();
if (response != null) {
Set<Link> links = response.getLinks();
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "links: ");
logger.log(BasicLevel.DEBUG, "links: ");
for (Link link : links) {
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "\t" + link.getRel() + ": " + link.getUri());
logger.log(BasicLevel.DEBUG, "\t" + link.getRel() + ": " + link.getUri());
}
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "");
}
}
......
......@@ -66,7 +66,6 @@ import fr.dyade.aaa.common.Debug;
@Path("/" + JmsContextService.CONTEXT)
public class JmsContextService {
public static Logger logger = Debug.getLogger(JmsContextService.class.getName());
private final Helper helper = Helper.getInstance();
......@@ -86,19 +85,15 @@ public class JmsContextService {
public static final String JMS_TYPE = "type";
public static void logLinks(Response.ResponseBuilder builder) {
if (builder == null)
if ((builder == null) || !logger.isLoggable(BasicLevel.DEBUG))
return;
Response response = builder.build();
if (response != null) {
Set<Link> links = response.getLinks();
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "links: ");
logger.log(BasicLevel.DEBUG, "links: ");
for (Link link : links) {
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "\t" + link.getRel() + ": " + link.getUri());
logger.log(BasicLevel.DEBUG, "\t" + link.getRel() + ": " + link.getUri());
}
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment