Skip to content

Commit

Permalink
Merge pull request #145 from futures/logging-changes
Browse files Browse the repository at this point in the history
decrease logging level on some often-invoked statements to cut 3k lines ...
  • Loading branch information
Andrew Woods committed Nov 13, 2013
2 parents 3688fd9 + f15ecae commit 9d8e80d
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 39 deletions.
Expand Up @@ -295,7 +295,6 @@ public void testGetObjectGraphHtml() throws Exception {
assertEquals(OK.getStatusCode(), response.getStatusLine()
.getStatusCode());
final String content = EntityUtils.toString(response.getEntity());
logger.info(content);
}

@Test
Expand Down
Expand Up @@ -33,7 +33,7 @@ public void testGetSitemapIndex() throws Exception {

assertEquals(200, getStatus(httpGet));

logger.info(IOUtils.toString(execute(httpGet).getEntity().getContent()));
logger.trace(IOUtils.toString(execute(httpGet).getEntity().getContent()));

}

Expand All @@ -50,7 +50,7 @@ public void testGetSitemap() throws Exception {
final String s =
IOUtils.toString(execute(httpGet).getEntity().getContent());

logger.info("Got sitemap response: {}", s);
logger.trace("Got sitemap response: {}", s);
assertTrue(s.contains("/test:1</sitemap:loc>"));

}
Expand Down
Expand Up @@ -82,6 +82,5 @@ public void shouldDemonstratePathsAndWorkspaces() throws IOException,
assertEquals(200, profileResponse.getStatusLine().getStatusCode());
final GraphStore graphStore =
parseTriples(profileResponse.getEntity().getContent());
logger.info(graphStore.toString());
}
}
3 changes: 3 additions & 0 deletions fcrepo-http-api/src/test/resources/logback-test.xml
Expand Up @@ -13,6 +13,9 @@
<logger name="org.fcrepo" additivity="false" level="INFO">
<appender-ref ref="STDOUT"/>
</logger>
<logger name="com.gargoylesoftware.htmlunit" additivity="false" level="ERROR">
<appender-ref ref="STDOUT"/>
</logger>
<root additivity="false" level="WARN">
<appender-ref ref="STDOUT"/>
</root>
Expand Down
Expand Up @@ -44,7 +44,7 @@ public class WildcardExceptionMapper implements ExceptionMapper<Exception> {
public Response toResponse(final Exception e) {

if (WebApplicationException.class.isAssignableFrom(e.getClass())) {
logger.info(
logger.debug(
"WebApplicationException intercepted by WildcardExceptionMapper: \n",
e);
return ((WebApplicationException) e).getResponse();
Expand All @@ -66,7 +66,7 @@ public Response toResponse(final Exception e) {
.toResponse((TransactionMissingException) e.getCause());
}

logger.error("Exception intercepted by WildcardExceptionMapper: \n", e);
logger.info("Exception intercepted by WildcardExceptionMapper: \n", e);
return serverError().entity(
showStackTrace ? getStackTraceAsString(e) : null).build();
}
Expand Down
Expand Up @@ -155,7 +155,7 @@ public Date getCreatedDate() throws RepositoryException {
return new Date(node.getProperty(JCR_CREATED).getDate()
.getTimeInMillis());
} else {
LOGGER.info("Node {} does not have a createdDate", node);
LOGGER.debug("Node {} does not have a createdDate", node);
return null;
}
}
Expand All @@ -170,15 +170,15 @@ public Date getLastModifiedDate() throws RepositoryException {
return new Date(node.getProperty(JCR_LASTMODIFIED).getDate()
.getTimeInMillis());
} else {
LOGGER.info(
LOGGER.debug(
"Could not get last modified date property for node {}",
node);
}

final Date createdDate = getCreatedDate();

if (createdDate != null) {
LOGGER.info(
LOGGER.trace(
"Using created date for last modified date for node {}",
node);
return createdDate;
Expand Down
Expand Up @@ -70,7 +70,7 @@ public Resource getContext() {

@Override
public Resource getGraphSubject(final Node node) throws RepositoryException {
LOGGER.debug("Returning RDF subject for: {}", node);
LOGGER.trace("Returning RDF subject for: {}", node);
return getGraphSubject(node.getPath());
}

Expand Down
Expand Up @@ -73,12 +73,13 @@ public class HierarchyRdfContext extends NodeRdfContext {
* @throws RepositoryException
*/
public HierarchyRdfContext(final javax.jcr.Node node,
final GraphSubjects graphSubjects,
final LowLevelStorageService lowLevelStorageService)
final GraphSubjects graphSubjects,
final LowLevelStorageService lowLevelStorageService)
throws RepositoryException {

super(node, graphSubjects, lowLevelStorageService);
if (node.getDepth() > 0) {
LOGGER.debug("Determined that this node has a parent.");
LOGGER.trace("Determined that this node has a parent.");
concat(parentContext());
}
final Node pageContext = graphSubjects.getContext().asNode();
Expand All @@ -87,12 +88,12 @@ public HierarchyRdfContext(final javax.jcr.Node node,
create(pageContext, PAGE_OF.asNode(), subject())});

if (JcrRdfTools.isContainer(node)) {
LOGGER.debug("Determined that this node is a container.");
LOGGER.trace("Determined that this node is a container.");
concat(containerContext(pageContext));

}
if (node.hasNodes()) {
LOGGER.debug("Found children of this node.");
LOGGER.trace("Found children of this node.");
concat(childrenContext(pageContext));
}
}
Expand Down Expand Up @@ -145,7 +146,7 @@ public Iterator<Triple> apply(final javax.jcr.Node child) {
try {
final Node childSubject =
graphSubjects().getGraphSubject(child).asNode();
LOGGER.debug("Creating triples for child node: {}", child);
LOGGER.trace("Creating triples for child node: {}", child);
return new PropertiesRdfContext(child, graphSubjects(),
lowLevelStorageService()).concat(new Triple[] {
create(pageContext, INLINED_RESOURCE.asNode(),
Expand All @@ -169,7 +170,7 @@ public Iterator<Triple> apply(final javax.jcr.Node child) {

@Override
public boolean apply(final javax.jcr.Node n) {
LOGGER.debug("Testing child node {}", n);
LOGGER.trace("Testing child node {}", n);
try {
return (isInternalNode.apply(n) || n.getName().equals(
JCR_CONTENT));
Expand Down
Expand Up @@ -75,13 +75,13 @@ public NamespaceRdfContext(final Session session) throws RepositoryException {
if (prefix.equals("jcr")) {
prefix = "fcrepo";
}
LOGGER.debug(
LOGGER.trace(
"Discovered namespace prefix \"{}\" with URI \"{}\"",
prefix, nsURI);
final String rdfNsUri = getRDFNamespaceForJcrNamespace(nsURI);
// first, let's put the namespace in context
namespaces.put(prefix, rdfNsUri);
LOGGER.debug("Added namespace prefix \"{}\" with URI \"{}\"",
LOGGER.trace("Added namespace prefix \"{}\" with URI \"{}\"",
prefix, rdfNsUri);
final Node nsSubject = createURI(rdfNsUri);
// now, some triples describing this namespace
Expand Down
Expand Up @@ -127,15 +127,15 @@ private final Function<NodeType, Triple> nodetype2triple() {
public Triple apply(final NodeType nodeType) {
try {
final String fullTypeName = nodeType.getName();
LOGGER.debug("Translating JCR mixin name: {}", fullTypeName);
LOGGER.trace("Translating JCR mixin name: {}", fullTypeName);
final String prefix = fullTypeName.split(":")[0];
final String typeName = fullTypeName.split(":")[1];
final String namespace = getJcrUri(prefix);
LOGGER.debug("with JCR namespace: {}", namespace);
LOGGER.trace("with JCR namespace: {}", namespace);
final com.hp.hpl.jena.graph.Node rdfType =
createURI(getRDFNamespaceForJcrNamespace(namespace)
+ typeName);
LOGGER.debug("into RDF resource: {}", rdfType);
LOGGER.trace("into RDF resource: {}", rdfType);
return create(subject(), type.asNode(), rdfType);
} catch (final RepositoryException e) {
throw propagate(e);
Expand Down
Expand Up @@ -116,7 +116,7 @@ public NodeTypeRdfContext(final NodeType nodeType)
getResource((Namespaced) nodeType).asNode();
final String nodeTypeName = nodeType.getName();

LOGGER.debug("Adding triples for nodeType: {} with URI: {}",
LOGGER.trace("Adding triples for nodeType: {} with URI: {}",
nodeTypeName, nodeTypeResource.getURI());

nsTriples.add(create(nodeTypeResource, type.asNode(), Class
Expand Down
Expand Up @@ -75,7 +75,7 @@ public PropertiesRdfContext(final javax.jcr.Node node, final GraphSubjects graph

private void putPropertiesIntoContext() throws RepositoryException {

LOGGER.debug(
LOGGER.trace(
"Pushing RDF triples into context for properties of node: {}",
node());

Expand All @@ -92,7 +92,7 @@ private void putPropertiesIntoContext() throws RepositoryException {
contentNode = node().getNode(JCR_CONTENT);
}
} catch (final AccessControlException e) {
LOGGER.debug("Access denied to content node", e);
LOGGER.trace("Access denied to content node", e);
}
if (contentNode != null) {
final Node contentSubject =
Expand Down Expand Up @@ -132,7 +132,7 @@ public Triple apply(final LowLevelCacheEntry llce) {

private Iterator<Triple> triplesFromProperties(final javax.jcr.Node n)
throws RepositoryException {
LOGGER.debug("Creating triples for node: {}", n);
LOGGER.trace("Creating triples for node: {}", n);
final UnmodifiableIterator<Property> nonBinaryProperties =
Iterators.filter(new PropertyIterator(n.getProperties()),
not(isBinaryContentProperty));
Expand Down
Expand Up @@ -76,7 +76,7 @@ public RootRdfContext(final Node node, final GraphSubjects graphSubjects,

super(node, graphSubjects, llsService);

LOGGER.debug("Creating RDF triples for repository description");
LOGGER.trace("Creating RDF triples for repository description");
final Repository repository = node().getSession().getRepository();

final ImmutableSet.Builder<Triple> b = builder();
Expand Down
Expand Up @@ -114,12 +114,12 @@ public Triple apply(final Value v) {
* @return An RDF {@link Triple} representing that property.
*/
private Triple propertyvalue2triple(final Property p, final Value v) {
LOGGER.debug("Rendering triple for Property: {} with Value: {}", p, v);
LOGGER.trace("Rendering triple for Property: {} with Value: {}", p, v);
try {
final Triple triple =
create(getGraphSubject(p.getParent()), getPredicateForProperty
.apply(p).asNode(), propertyvalue2node(p, v));
LOGGER.debug("Created triple: {} ", triple);
LOGGER.trace("Created triple: {} ", triple);
return triple;
} catch (final RepositoryException e) {
throw propagate(e);
Expand Down Expand Up @@ -155,7 +155,7 @@ private Node propertyvalue2node(final Property p, final Value v) {

private static Node literal2node(final Object literal) {
final Node result = createTypedLiteral(literal).asNode();
LOGGER.debug("Converting {} into {}", literal, result);
LOGGER.trace("Converting {} into {}", literal, result);
return result;
}

Expand Down
Expand Up @@ -57,10 +57,10 @@ public ZippingIterator(final Iterator<FromType> from,
protected ToType computeNext() {
final boolean hasNext = (from.hasNext() && through.hasNext());
if (hasNext) {
LOGGER.debug("Found next element.");
LOGGER.trace("Found next element.");
final FromType f = from.next();
final Function<FromType, ToType> t = through.next();
LOGGER.debug("Supplying from next element {} through function {}",
LOGGER.trace("Supplying from next element {} through function {}",
f, t);
return t.apply(f);
} else {
Expand Down
Expand Up @@ -110,7 +110,7 @@ public Long getRepositorySize() {
try {

final Timer.Context context = objectSizeCalculationTimer.time();
logger.info("Calculating repository size from index");
logger.debug("Calculating repository size from index");

try {
return FedoraTypesUtils.getRepositorySize(repo);
Expand Down Expand Up @@ -344,10 +344,8 @@ public RdfStream getNodeTypes(final Session session) throws RepositoryException
* @throws IOException
*/
public void registerNodeTypes(final Session session,
final InputStream cndStream)
throws RepositoryException, IOException {
final NodeTypeManager nodeTypeManager = (NodeTypeManager) session.getWorkspace()
.getNodeTypeManager();
final InputStream cndStream) throws RepositoryException, IOException {
final NodeTypeManager nodeTypeManager = (NodeTypeManager) session.getWorkspace().getNodeTypeManager();
nodeTypeManager.registerNodeTypes(cndStream, true);
}
}
Expand Up @@ -73,7 +73,7 @@ public void loadSystemProperties() {
LOGGER.info("Loading properties");

if (getProperty("integration-test") == null) {
LOGGER.debug("Setting default properties, if necessary.");
LOGGER.trace("Setting default properties, if necessary.");

for (final PROPERTIES prop : PROPERTIES.values()) {
if (getProperty(prop.getValue()) == null) {
Expand All @@ -84,7 +84,7 @@ public void loadSystemProperties() {

for (final PROPERTIES prop : PROPERTIES.values()) {
final String val = prop.getValue();
LOGGER.debug("{} = {}", val, getProperty(val));
LOGGER.trace("{} = {}", val, getProperty(val));
}
}

Expand Down

0 comments on commit 9d8e80d

Please sign in to comment.