Class TransformerDebug
java.lang.Object
org.alfresco.repo.content.transform.TransformerDebug
- Direct Known Subclasses:
AdminUiTransformerDebug
Debugs transformers selection and activity.
As transformations are frequently composed of lower level transformations, log
messages include a prefix to identify the transformation. A numeric dot notation
is used (such as 123.1.2 indicating the second third level transformation
of the 123rd top level transformation).
- Author:
- Alan Davis
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumprotected static classprotected static classprotected classDeprecated. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected org.apache.commons.logging.Logprotected MimetypeServiceprotected static final Stringprotected NodeServiceprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidLog a message prefixed with the current transformation reference.voiddebug(String sourceMimetype, String targetMimetype, NodeRef sourceNodeRef, long sourceSize, Map<String, String> options, String renditionName, String message) voidLog a message prefixed with the current transformation reference and include a exception, suppressing the stack trace if repeated as we return up the stack of transformers.intdebugTransformServiceRequest(String sourceMimetype, long sourceSize, NodeRef sourceNodeRef, int contentHashcode, String fileName, String targetMimetype, Map<String, String> options, String renditionName) Debugs a request to the Transform ServicevoiddebugTransformServiceResponse(NodeRef sourceNodeRef, int contentHashcode, long requested, int id, String sourceExt, String targetExt, String msg) Debugs a response to the Transform ServicevoiddebugUsingPreviousReference(String message) Log a message prefixed with the previous transformation reference, used by this Thread.fileSize(long size) getFileName(NodeRef sourceNodeRef, boolean firstLevel, long sourceSize) protected StringgetMimetypeExt(String mimetype) protected StringgetSourceAndTargetExt(String sourceMimetype, String targetMimetype) Returns the current StringBuilder (if any) being used to capture debug information for the current Thread.booleanIndicates if any logging is required.protected voidprotected voidprotected voidlogBasicDetails(TransformerDebug.Frame frame, long sourceSize, Map<String, String> options, String renditionName, String message, boolean firstLevel) ms(long time) protected intpop(TransformerDebug.Call callType, boolean suppressFinish, boolean suppressChecking) voidpopMisc()Removes a frame from the stack.voidCalled after performing a transform.voidpushMisc()Adds a new level to the stack to get a new request number or nesting number.voidpushTransform(String transformerName, String fromUrl, String sourceMimetype, String targetMimetype, long sourceSize, Map<String, String> options, String renditionName, NodeRef sourceNodeRef) <T extends Throwable>
TsetCause(T t) Sets the cause of a transformation failure, so that only the message of the Throwable is reported later rather than the full stack trace over and over.static booleansetDebugOutput(boolean debugOutput) Enable or disable debug log output.voidsetMimetypeService(MimetypeService mimetypeService) voidsetNodeService(NodeService nodeService) voidsetPreviousTransformId(int id) voidSets the StringBuilder to be used to capture debug information for the current Thread.voidsetTransformerDebugLog(org.apache.commons.logging.Log transformerDebugLog) voidsetTransformerLog(org.apache.commons.logging.Log transformerLog) protected Stringspaces(int i) static StringObtains a String for log messages.
-
Field Details
-
FINISHED_IN
- See Also:
-
NO_TRANSFORMERS
- See Also:
-
TRANSFORM_SERVICE_NAME
- See Also:
-
logger
protected org.apache.commons.logging.Log logger -
nodeService
-
mimetypeService
-
-
Constructor Details
-
TransformerDebug
public TransformerDebug()
-
-
Method Details
-
setTransformerLog
public void setTransformerLog(org.apache.commons.logging.Log transformerLog) -
setTransformerDebugLog
public void setTransformerDebugLog(org.apache.commons.logging.Log transformerDebugLog) -
setNodeService
-
setMimetypeService
-
setPreviousTransformId
public void setPreviousTransformId(int id) -
afterPropertiesSet
- Throws:
Exception
-
pushTransform
-
pushMisc
public void pushMisc()Adds a new level to the stack to get a new request number or nesting number. Called prior to working out what transformers are active and prior to listing the supported mimetypes for an active transformer. -
logBasicDetails
-
debug
-
popTransform
public void popTransform()Called after performing a transform. -
popMisc
public void popMisc()Removes a frame from the stack. Called prior to working out what transformers are active and prior to listing the supported mimetypes for an active transformer. -
pop
-
isEnabled
public boolean isEnabled()Indicates if any logging is required. -
setDebugOutput
public static boolean setDebugOutput(boolean debugOutput) Enable or disable debug log output. Normally used to hide calls to getTransformer as trace rather than debug level log messages. There are lots of these and it makes it hard to see what is going on.- Parameters:
debugOutput- iftrueboth debug and trace is generated. Otherwise all output is trace.- Returns:
- the original value.
-
debug
Log a message prefixed with the current transformation reference.- Parameters:
message-
-
debugUsingPreviousReference
Log a message prefixed with the previous transformation reference, used by this Thread.- Parameters:
message-
-
debug
Log a message prefixed with the current transformation reference and include a exception, suppressing the stack trace if repeated as we return up the stack of transformers.- Parameters:
message-
-
log
-
log
-
setCause
Sets the cause of a transformation failure, so that only the message of the Throwable is reported later rather than the full stack trace over and over. -
getStringBuilder
Returns the current StringBuilder (if any) being used to capture debug information for the current Thread. -
setStringBuilder
Sets the StringBuilder to be used to capture debug information for the current Thread. -
getFileName
-
getSourceAndTargetExt
-
getMimetypeExt
-
spaces
-
ms
-
fileSize
-
debugTransformServiceRequest
public int debugTransformServiceRequest(String sourceMimetype, long sourceSize, NodeRef sourceNodeRef, int contentHashcode, String fileName, String targetMimetype, Map<String, String> options, String renditionName) Debugs a request to the Transform Service -
debugTransformServiceResponse
public void debugTransformServiceResponse(NodeRef sourceNodeRef, int contentHashcode, long requested, int id, String sourceExt, String targetExt, String msg) Debugs a response to the Transform Service -
toString
Obtains a String for log messages.- Parameters:
options- to be turned into a string.- Returns:
- a string of options that may be included in debug messages.
-