You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Nelson MELINA (JIRA)" <ji...@apache.org> on 2014/07/23 11:47:38 UTC

[jira] [Updated] (LOG4J2-737) Is is possible to use the Flow Tracing features without giving access to the Log4J2 logger directly to devs ?

     [ https://issues.apache.org/jira/browse/LOG4J2-737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nelson MELINA updated LOG4J2-737:
---------------------------------

    Description: 
The devs would only have access to a custom made Logging class (this class will use Log4J 2.x).


This class would implement something like this :
{code:title=CustomLogger.java|borderStyle=solid}
public interface CustomLogger {

    /**
     * Log an Error event and trigger the action assigned to it.
     *
     * @param name
     * @param level
     * @param type
     * @param timestamp
     * @param stackTraceElement
     * @param walletID
     * @param widgetID
     * @param userID
     * @param contextualData
     * @param customData
     */
    void logErrorEvent(String name, Level level, int type, int timestamp, StackTraceElement stackTraceElement,
                              int walletID, int widgetID, int userID, Object contextualData, Object customData);

    /**
     * Log a simple Object.
     *
     * @param o
     */
    void logSimpleEvent(Object o);

    /**
     * Log a Business Intelligence Event.
     *
     * @param name
     * @param level
     * @param type
     * @param timestamp
     * @param stackTraceElement
     * @param walletID
     * @param widgetID
     * @param userID
     * @param contextualData
     * @param customData
     */
    void logBIEvent(String name, Level level, int type, int timestamp, StackTraceElement stackTraceElement,
                           int walletID, int widgetID, int userID, Object contextualData, Object customData);

    /**
     *
     * @param t
     */
    void catching(Throwable t);

    /**
     *
     */
    void entry();

    /**
     *
     * @param params
     */
    void entry(Object... params);

    /**
     *
     * @param result
     */
    void exit(R result);

    /**
     *
     */
    void exit();

    /**
     *
     * @param level
     * @param t
     * @param <T>
     * @return
     */
    <T extends Throwable> T throwing(Level level, Throwable t);

    /**
     *
     * @param t
     * @param <T>
     * @return
     */
    <T extends Throwable> T throwing(T t);
}
{code}

If i understand correctly if in CustomLogger.entry() i use the log4j2 logger.entry() it'll record the start of the CustomLogger.entry() method and not the method calling it.

Is there a way to do what i want in a (not so) simple fashion ?

  was:
The devs would only have access to a custom made Logging class (this class will use Log4J 2.x).


This class would implement something like this :
{code:title=CustomLogger.java|borderStyle=solid}
public interface CustomLogger {

    /**
     * Log an Error event and trigger the action assigned to it.
     *
     * @param name
     * @param level
     * @param type
     * @param timestamp
     * @param stackTraceElement
     * @param walletID
     * @param widgetID
     * @param userID
     * @param contextualData
     * @param customData
     */
    void logErrorEvent(String name, Level level, int type, int timestamp, StackTraceElement stackTraceElement,
                              int walletID, int widgetID, int userID, Object contextualData, Object customData);

    /**
     * Log a simple Object.
     *
     * @param o
     */
    void logSimpleEvent(Object o);

    /**
     * Log a Business Intelligence Event.
     *
     * @param name
     * @param level
     * @param type
     * @param timestamp
     * @param stackTraceElement
     * @param walletID
     * @param widgetID
     * @param userID
     * @param contextualData
     * @param customData
     */
    void logBIEvent(String name, Level level, int type, int timestamp, StackTraceElement stackTraceElement,
                           int walletID, int widgetID, int userID, Object contextualData, Object customData);

    /**
     *
     * @param t
     */
    void catching(Throwable t);

    /**
     *
     */
    void entry();

    /**
     *
     * @param params
     */
    void entry(Object... params);

    /**
     *
     * @param result
     */
    void exit(R result);

    /**
     *
     */
    void exit();

    /**
     *
     * @param level
     * @param t
     * @param <T>
     * @return
     */
    <T extends Throwable> T throwing(Level level, Throwable t);

    /**
     *
     * @param t
     * @param <T>
     * @return
     */
    <T extends Throwable> T throwing(T t);
}
{code}

If i understand correctly if in CustomLogger.entry() i use the log4j2 logger.entry() it'll record the entry of CustomLogger.entry() method and not the one calling it.

Is there a way to do what i want in a (not so) simple fashion ?


> Is is possible to use the Flow Tracing features without giving access to the Log4J2 logger directly to devs ?
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-737
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-737
>             Project: Log4j 2
>          Issue Type: Question
>         Environment: Android
>            Reporter: Nelson MELINA
>            Priority: Minor
>
> The devs would only have access to a custom made Logging class (this class will use Log4J 2.x).
> This class would implement something like this :
> {code:title=CustomLogger.java|borderStyle=solid}
> public interface CustomLogger {
>     /**
>      * Log an Error event and trigger the action assigned to it.
>      *
>      * @param name
>      * @param level
>      * @param type
>      * @param timestamp
>      * @param stackTraceElement
>      * @param walletID
>      * @param widgetID
>      * @param userID
>      * @param contextualData
>      * @param customData
>      */
>     void logErrorEvent(String name, Level level, int type, int timestamp, StackTraceElement stackTraceElement,
>                               int walletID, int widgetID, int userID, Object contextualData, Object customData);
>     /**
>      * Log a simple Object.
>      *
>      * @param o
>      */
>     void logSimpleEvent(Object o);
>     /**
>      * Log a Business Intelligence Event.
>      *
>      * @param name
>      * @param level
>      * @param type
>      * @param timestamp
>      * @param stackTraceElement
>      * @param walletID
>      * @param widgetID
>      * @param userID
>      * @param contextualData
>      * @param customData
>      */
>     void logBIEvent(String name, Level level, int type, int timestamp, StackTraceElement stackTraceElement,
>                            int walletID, int widgetID, int userID, Object contextualData, Object customData);
>     /**
>      *
>      * @param t
>      */
>     void catching(Throwable t);
>     /**
>      *
>      */
>     void entry();
>     /**
>      *
>      * @param params
>      */
>     void entry(Object... params);
>     /**
>      *
>      * @param result
>      */
>     void exit(R result);
>     /**
>      *
>      */
>     void exit();
>     /**
>      *
>      * @param level
>      * @param t
>      * @param <T>
>      * @return
>      */
>     <T extends Throwable> T throwing(Level level, Throwable t);
>     /**
>      *
>      * @param t
>      * @param <T>
>      * @return
>      */
>     <T extends Throwable> T throwing(T t);
> }
> {code}
> If i understand correctly if in CustomLogger.entry() i use the log4j2 logger.entry() it'll record the start of the CustomLogger.entry() method and not the method calling it.
> Is there a way to do what i want in a (not so) simple fashion ?



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org