Class Log4jLogger

  • All Implemented Interfaces:
    GraphHook

    public class Log4jLogger
    extends Object
    implements GraphHook
    A Log4jLogger is a simple GraphHook that sends logs of the original operation chains executed by users on a graph to a Logger.
    • Constructor Detail

      • Log4jLogger

        public Log4jLogger()
    • Method Detail

      • preExecute

        public void preExecute​(OperationChain<?> opChain,
                               Context context)
        Logs the operation chain and the user id.
        Specified by:
        preExecute in interface GraphHook
        Parameters:
        opChain - the operation chain being executed
        context - the Context executing the operation chain
      • postExecute

        public <T> T postExecute​(T result,
                                 OperationChain<?> operationChain,
                                 Context context)
        Description copied from interface: GraphHook
        Called from Graph after an OperationChain is executed.
        Specified by:
        postExecute in interface GraphHook
        Type Parameters:
        T - the result type
        Parameters:
        result - the result from the operation chain
        operationChain - the OperationChain that was executed. This can be modified/optimised in any GraphHook.
        context - the Context in which the operation chain was executed. The context also holds a reference to the original operation chain.
        Returns:
        result object
      • onFailure

        public <T> T onFailure​(T result,
                               OperationChain<?> opChain,
                               Context context,
                               Exception e)
        Description copied from interface: GraphHook
        Called from Graph if an error occurs whilst executing the OperationChain.
        Specified by:
        onFailure in interface GraphHook
        Type Parameters:
        T - the result type
        Parameters:
        result - the result from the operation chain - likely to be null.
        opChain - the OperationChain that was executed. This can be modified/optimised in any GraphHook.
        context - the Context in which the operation chain was executed. The context also holds a reference to the original operation chain.
        e - the exception
        Returns:
        result object