Author: nzamosenchuk
Date: 2011-09-22 05:01:22 -0400 (Thu, 22 Sep 2011)
New Revision: 4937
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandlerContext.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
Log:
EXOJCR-1493 : Improve logger output, to be more informative and human read. Added WS path
and name to some index logs.
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandlerContext.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandlerContext.java 2011-09-21
16:04:21 UTC (rev 4936)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandlerContext.java 2011-09-22
09:01:22 UTC (rev 4937)
@@ -93,6 +93,8 @@
private final String repositoryName;
+ private final String workspaceName;
+
/**
* Creates a new context instance.
*
@@ -124,7 +126,7 @@
NodeTypeDataManager nodeTypeDataManager, NamespaceRegistryImpl nsRegistry,
QueryHandler parentHandler,
String indexDirectory, DocumentReaderService extractor, boolean
createInitialIndex,
boolean useIndexRecoveryFilters, LuceneVirtualTableResolver virtualTableResolver,
IndexRecovery indexRecovery,
- RPCService rpcService, String repositoryName)
+ RPCService rpcService, String repositoryName, String workspaceName)
{
this.indexRecovery = indexRecovery;
this.container = container;
@@ -140,6 +142,7 @@
this.rpcService = rpcService;
this.parentHandler = parentHandler;
this.repositoryName = repositoryName;
+ this.workspaceName = workspaceName;
this.recoveryFilterUsed = useIndexRecoveryFilters;
((NodeTypeDataManagerImpl)this.nodeTypeDataManager).addListener(propRegistry);
}
@@ -278,4 +281,23 @@
return repositoryName;
}
+ /**
+ * @return
+ * The name of current workspace
+ */
+ public String getWorkspaceName()
+ {
+ return workspaceName;
+ }
+
+ /**
+ * @return
+ * The full path of workspace including information if current QueryHandler
is a System one.
+ * I.e. "repository/production[system]"
+ */
+ public String getWorkspacePath(boolean includeSystemMark)
+ {
+ return repositoryName + "/" + workspaceName + ((includeSystemMark
&& parentHandler == null) ? "[system]" : "");
+ }
+
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-09-21
16:04:21 UTC (rev 4936)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-09-22
09:01:22 UTC (rev 4937)
@@ -779,7 +779,7 @@
QueryHandlerContext context =
new QueryHandlerContext(container, itemMgr, indexingTree, nodeTypeDataManager,
nsReg, parentHandler,
PrivilegedFileHelper.getAbsolutePath(getIndexDirectory()), extractor, true,
recoveryFilterUsed,
- virtualTableResolver, indexRecovery, rpcService, repositoryName);
+ virtualTableResolver, indexRecovery, rpcService, repositoryName, wsId);
return context;
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-09-21
16:04:21 UTC (rev 4936)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-09-22
09:01:22 UTC (rev 4937)
@@ -437,7 +437,7 @@
if (doForceReindexing && !indexes.isEmpty())
{
- log.info("Removing stale indexes.");
+ log.info("Removing stale indexes (" +
handler.getContext().getWorkspacePath(true) + ").");
List<PersistentIndex> oldIndexes = new
ArrayList<PersistentIndex>(indexes);
for (PersistentIndex persistentIndex : oldIndexes)
@@ -458,7 +458,7 @@
&& handler.getContext().getIndexRecovery() != null &&
handler.getContext().getRPCService() != null
&& handler.getContext().getRPCService().isCoordinator() == false)
{
- log.info("Retrieving index from coordinator...");
+ log.info("Retrieving index from coordinator (" +
handler.getContext().getWorkspacePath(true) + ")...");
indexCreated = recoveryIndexFromCoordinator();
if (indexCreated)
@@ -512,14 +512,15 @@
}
executeAndLog(new Commit(getTransactionId()));
- log.info("Created initial index for {} nodes", new
Long(count));
+ log.info("Initial index for {} nodes created ({}).", new
Long(count), handler.getContext()
+ .getWorkspacePath(true));
releaseMultiReader();
scheduleFlushTask();
}
}
catch (Exception e)
{
- String msg = "Error indexing workspace";
+ String msg = "Error indexing workspace.";
IOException ex = new IOException(msg);
ex.initCause(e);
throw ex;
@@ -531,7 +532,7 @@
}
else
{
- throw new IllegalStateException("Index already present");
+ throw new IllegalStateException("Index already present.");
}
}
@@ -3385,7 +3386,7 @@
// switching to ONLINE
if (isOnline)
{
- log.info("Setting index back online");
+ log.info("Setting index ONLINE ({})",
handler.getContext().getWorkspacePath(true));
if (modeHandler.getMode() == IndexerIoMode.READ_WRITE)
{
offlineIndex.commit(true);
@@ -3410,7 +3411,7 @@
// switching to OFFLINE
else
{
- log.info("Setting index offline");
+ log.info("Setting index OFFLINE ({})",
handler.getContext().getWorkspacePath(true));
merger.dispose();
offlineIndex =
new OfflinePersistentIndex(handler.getTextAnalyzer(),
handler.getSimilarity(), cache, indexingQueue,