Reduced amount of logging.

Suppressed logging for the GetProcessesCommand, which gets ping'ed often while there is a long running operation being executed (e.g., reconciling, fetching URLs).

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2228 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2011-09-01 18:26:45 +00:00
parent b78d3f8bf4
commit a88ccd2c32
4 changed files with 20 additions and 2 deletions

View File

@ -164,14 +164,14 @@ public class RefineServlet extends Butterfly {
Command command = commands.get(commandKey); Command command = commands.get(commandKey);
if (command != null) { if (command != null) {
if (request.getMethod().equals("GET")) { if (request.getMethod().equals("GET")) {
if (!logger.isTraceEnabled()) { if (!logger.isTraceEnabled() && command.logRequests()) {
logger.info("GET {}", request.getPathInfo()); logger.info("GET {}", request.getPathInfo());
} }
logger.trace("> GET {}", commandKey); logger.trace("> GET {}", commandKey);
command.doGet(request, response); command.doGet(request, response);
logger.trace("< GET {}", commandKey); logger.trace("< GET {}", commandKey);
} else if (request.getMethod().equals("POST")) { } else if (request.getMethod().equals("POST")) {
if (!logger.isTraceEnabled()) { if (!logger.isTraceEnabled() && command.logRequests()) {
logger.info("POST {}", request.getPathInfo()); logger.info("POST {}", request.getPathInfo());
} }
logger.trace("> POST {}", commandKey); logger.trace("> POST {}", commandKey);

View File

@ -86,6 +86,15 @@ public abstract class Command {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
}; };
/**
* Whether each request to this command should be logged. For some commands
* that can get called too frequently, such as GetProcessesCommand, logging
* is very distracting.
*/
public boolean logRequests() {
return true;
}
/** /**
* Utility function to get the browsing engine's configuration as a JSON object * Utility function to get the browsing engine's configuration as a JSON object
* from the "engine" request parameter, most often in the POST body. * from the "engine" request parameter, most often in the POST body.

View File

@ -57,4 +57,9 @@ public class GetProcessesCommand extends Command {
respondException(response, e); respondException(response, e);
} }
} }
@Override
public boolean logRequests() {
return false;
}
} }

View File

@ -5,3 +5,7 @@ log4j.logger.velocity=WARN
log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=com.google.util.logging.IndentingLayout log4j.appender.console.layout=com.google.util.logging.IndentingLayout
log4j.logger.butterfly=ERROR
log4j.logger.refine=INFO
log4j.logger.FileProjectManager=WARN