[
https://issues.apache.org/jira/browse/LOG4J2-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14071592#comment-14071592
]
Remko Popma commented on LOG4J2-737:
------------------------------------
You could use the Generate tool that is in core since 2.0 to generate a custom
logger.
This will use the correct FQCN for the calling method, not the wrapper.
The Generate tool was intended to help with custom log levels, but it may still
be useful to you. The 2.0 release did not include documentation for this tool.
Docs will be included in the 2.0.1 release. Meanwhile, a preview of the
documentation is available here: LOG4J2-710. (Feedback welcome.)
> 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: [email protected]
For additional commands, e-mail: [email protected]