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 "Mikael Ståldal (JIRA)" <ji...@apache.org> on 2015/06/05 16:31:01 UTC

[jira] [Commented] (LOG4J2-1010) Possibility to set ThreadContext values in calls to Logger method

    [ https://issues.apache.org/jira/browse/LOG4J2-1010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14574553#comment-14574553 ] 

Mikael Ståldal commented on LOG4J2-1010:
----------------------------------------

I realize that it might be infeasible to do this in the Logger interface, since there are too many overloaded methods already. However, it would be nice to add this to logIfEnabled() and logMessage in the ExtendedLogger interface. Like this:

{code}
    /**
     * Always logs a message at the specified level. It is the responsibility of the caller to ensure the specified
     * level is enabled.
     * 
     * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
     *            method when location information needs to be logged.
     * @param level The logging Level to check.
     * @param marker A Marker or null.
     * @param message The Message.
     * @param t the exception to log, including its stack trace.
     * @param contextMap contextMap to include in the log event, or null.
     */
    void logMessage(String fqcn, Level level, Marker marker, Message message, Throwable t, Map<String, String> contextMap);
{code}

> Possibility to set ThreadContext values in calls to Logger method
> -----------------------------------------------------------------
>
>                 Key: LOG4J2-1010
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1010
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: 2.2
>            Reporter: Mikael Ståldal
>
> It would be useful to have some logging methods in the Logger interface to set ThreadContext values for a single log message only.
> In an asynchronous environment, using ThreadContext as currently defined is not so useful since JVM threads might not be coupled to the logical flow of the application.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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