Added a leetle bit of logging in a few places.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3328 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-07-15 17:55:18 +00:00
parent 6ac87efa5a
commit 1510998f69
6 changed files with 21 additions and 9 deletions

View File

@@ -7,3 +7,5 @@ log4j.appender.stdout.layout.ConversionPattern=%d %5p %c{1}:%m%n
### Set log levels. ### Set log levels.
log4j.rootLogger=warn, stdout log4j.rootLogger=warn, stdout
log4j.logger.org.hibernate=fatal log4j.logger.org.hibernate=fatal
log4j.logger.org.alfresco.repo.avm=info
log4j.logger.org.springframework=warn

View File

@@ -141,7 +141,6 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
} }
if (!(obj instanceof AVMNode)) if (!(obj instanceof AVMNode))
{ {
System.err.println("Failing AVMNodeImpl.equals");
return false; return false;
} }
return fID == ((AVMNode)obj).getId(); return fID == ((AVMNode)obj).getId();

View File

@@ -28,6 +28,7 @@ import java.util.List;
import java.util.SortedMap; import java.util.SortedMap;
import org.alfresco.repo.avm.SuperRepository; import org.alfresco.repo.avm.SuperRepository;
import org.apache.log4j.Logger;
/** /**
* Implements the AVMService. Stub. * Implements the AVMService. Stub.
@@ -35,6 +36,8 @@ import org.alfresco.repo.avm.SuperRepository;
*/ */
public class AVMServiceImpl implements AVMService public class AVMServiceImpl implements AVMService
{ {
private static Logger fgLogger = Logger.getLogger(AVMServiceImpl.class);
/** /**
* The RetryingTransaction. * The RetryingTransaction.
*/ */
@@ -103,15 +106,19 @@ public class AVMServiceImpl implements AVMService
fContentIssuer, fContentIssuer,
fLayerIssuer, fLayerIssuer,
fStorage); fStorage);
fgLogger.info("Initialized AVMService and SuperRepository");
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(System.err); fgLogger.fatal("Failed to initialize AVMService", e);
// TODO Log this and abort in some useful way. // TODO Abort in some useful way.
} }
if (fInitialize) if (fInitialize)
{ {
File storageDir = new File(fStorage);
storageDir.mkdirs();
createRepository("main"); createRepository("main");
fgLogger.info("Created new main repository");
} }
} }

View File

@@ -19,6 +19,9 @@ package org.alfresco.repo.avm;
import java.util.List; import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* This is the background thread for reaping no longer referenced nodes * This is the background thread for reaping no longer referenced nodes
* in the AVM repository. These orphans arise from purge operations. * in the AVM repository. These orphans arise from purge operations.
@@ -26,6 +29,7 @@ import java.util.List;
*/ */
public class OrphanReaper implements Runnable public class OrphanReaper implements Runnable
{ {
private Log fgLogger = LogFactory.getLog(OrphanReaper.class);
/** /**
* The HibernateTxn instance. * The HibernateTxn instance.
*/ */
@@ -274,8 +278,7 @@ public class OrphanReaper implements Runnable
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(System.err); fgLogger.error("Garbage collector error", e);
// TODO Log this properly.
} }
} }
} }

View File

@@ -27,7 +27,6 @@ import org.alfresco.repo.avm.AVMNodeUnwrapper;
import org.alfresco.repo.avm.DirectoryNode; import org.alfresco.repo.avm.DirectoryNode;
import org.alfresco.repo.avm.Repository; import org.alfresco.repo.avm.Repository;
import org.hibernate.Query; import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/** /**

View File

@@ -23,6 +23,7 @@ import org.alfresco.repo.avm.AVMException;
import org.alfresco.repo.avm.AVMNotFoundException; import org.alfresco.repo.avm.AVMNotFoundException;
import org.alfresco.repo.avm.RetryingTransactionCallback; import org.alfresco.repo.avm.RetryingTransactionCallback;
import org.alfresco.repo.avm.RetryingTransaction; import org.alfresco.repo.avm.RetryingTransaction;
import org.apache.log4j.Logger;
import org.springframework.dao.DataRetrievalFailureException; import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.dao.DeadlockLoserDataAccessException; import org.springframework.dao.DeadlockLoserDataAccessException;
import org.springframework.dao.OptimisticLockingFailureException; import org.springframework.dao.OptimisticLockingFailureException;
@@ -38,6 +39,7 @@ import org.springframework.transaction.TransactionStatus;
*/ */
public class HibernateTxn extends HibernateTemplate implements RetryingTransaction public class HibernateTxn extends HibernateTemplate implements RetryingTransaction
{ {
private static Logger fgLogger = Logger.getLogger(HibernateTxn.class);
/** /**
* The transaction manager. * The transaction manager.
*/ */
@@ -99,7 +101,7 @@ public class HibernateTxn extends HibernateTemplate implements RetryingTransacti
// If we've lost a race or we've deadlocked, retry. // If we've lost a race or we've deadlocked, retry.
if (t instanceof DeadlockLoserDataAccessException) if (t instanceof DeadlockLoserDataAccessException)
{ {
System.err.println("Deadlock."); fgLogger.info("Deadlock");
try try
{ {
long interval; long interval;
@@ -117,7 +119,7 @@ public class HibernateTxn extends HibernateTemplate implements RetryingTransacti
} }
if (t instanceof OptimisticLockingFailureException) if (t instanceof OptimisticLockingFailureException)
{ {
System.err.println("Lost Race."); fgLogger.info("Lost Race");
continue; continue;
} }
if (t instanceof AVMException) if (t instanceof AVMException)