added logging to tags command builder

This commit is contained in:
Sebastian Sdorra
2012-07-05 19:47:35 +02:00
parent 1671124827
commit e5ee84cebe

View File

@@ -35,6 +35,9 @@ package sonia.scm.repository.api;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.cache.Cache; import sonia.scm.cache.Cache;
import sonia.scm.cache.CacheManager; import sonia.scm.cache.CacheManager;
import sonia.scm.repository.Repository; import sonia.scm.repository.Repository;
@@ -69,6 +72,12 @@ public final class TagsCommandBuilder
/** name of the cache */ /** name of the cache */
static final String CACHE_NAME = "sonia.cache.cmd.tags"; static final String CACHE_NAME = "sonia.cache.cmd.tags";
/**
* the logger for TagsCommandBuilder
*/
private static final Logger logger =
LoggerFactory.getLogger(TagsCommandBuilder.class);
//~--- constructors --------------------------------------------------------- //~--- constructors ---------------------------------------------------------
/** /**
@@ -105,6 +114,12 @@ public final class TagsCommandBuilder
if (disableCache) if (disableCache)
{ {
if (logger.isDebugEnabled())
{
logger.debug("get tags for repository {} with disabled cache",
repository.getName());
}
tags = getTagsFromCommand(); tags = getTagsFromCommand();
} }
else else
@@ -115,6 +130,11 @@ public final class TagsCommandBuilder
if (tags == null) if (tags == null)
{ {
if (logger.isDebugEnabled())
{
logger.debug("get tags for repository {}", repository.getName());
}
tags = getTagsFromCommand(); tags = getTagsFromCommand();
if (tags != null) if (tags != null)
@@ -122,6 +142,11 @@ public final class TagsCommandBuilder
cache.put(key, tags); cache.put(key, tags);
} }
} }
else if (logger.isDebugEnabled())
{
logger.debug("get tags for repository {} from cache",
repository.getName());
}
} }
return tags; return tags;