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 "Joern Huxhorn (JIRA)" <ji...@apache.org> on 2012/09/09 15:27:07 UTC

[jira] [Created] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Joern Huxhorn created LOG4J2-85:
-----------------------------------

             Summary: Replace ThreadContext.push(String msg) with push(String msg, Object args...)
                 Key: LOG4J2-85
                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
             Project: Log4j 2
          Issue Type: New Feature
            Reporter: Joern Huxhorn


Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.

If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461581#comment-13461581 ] 

Ralph Goers commented on LOG4J2-85:
-----------------------------------

I'm not sure how to do this as it would require encapsulating the msg and args into another object on the stack. In that case, what would pop return?  Are you really wanting push(Message)?
                
> Replace ThreadContext.push(String msg) with push(String msg, Object args...)
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-85
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Joern Huxhorn
>
> Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.
> If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Reopened] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4J2-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers reopened LOG4J2-85:
-------------------------------

    
> Replace ThreadContext.push(String msg) with push(String msg, Object args...)
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-85
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Joern Huxhorn
>            Assignee: Ralph Goers
>             Fix For: 2.0-beta2
>
>
> Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.
> If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13451623#comment-13451623 ] 

Ralph Goers commented on LOG4J2-85:
-----------------------------------

As always, patches are welcome. And in your case, encouraged!
                
> Replace ThreadContext.push(String msg) with push(String msg, Object args...)
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-85
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Joern Huxhorn
>
> Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.
> If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461839#comment-13461839 ] 

Ralph Goers commented on LOG4J2-85:
-----------------------------------

OK - So push(String msg, Object args...) is just a wrapper around push(String msg).  As I said in LOG4J2-83 and LOG4J2-84, I am not convinced that disabling the NDC itself is a good idea.
                
> Replace ThreadContext.push(String msg) with push(String msg, Object args...)
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-85
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Joern Huxhorn
>
> Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.
> If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Resolved] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4J2-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers resolved LOG4J2-85.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0-beta2
         Assignee: Ralph Goers

I have added support for setting system properties named "disableThreadContext", "disableThreadContextMap" , and "disableThreadContextStack". If disableThreadContext is set to true, pushes and puts will be ignored and no HashMaps or ContextStacks will be created. Similarly, if disableThreadContextMap is set to true then puts to the ThreadContextMap will be ignored and no Map will be created. Finally, if disableThreadContextStack is set to true then pushes will be ignored and no ContextStack will be created.

When these properties are set the ThreadLocals will still be created but will never have any values in them.
                
> Replace ThreadContext.push(String msg) with push(String msg, Object args...)
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-85
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Joern Huxhorn
>            Assignee: Ralph Goers
>             Fix For: 2.0-beta2
>
>
> Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.
> If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Updated] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4J2-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers updated LOG4J2-85:
------------------------------

    Comment: was deleted

(was: I have added support for setting system properties named "disableThreadContext", "disableThreadContextMap" , and "disableThreadContextStack". If disableThreadContext is set to true, pushes and puts will be ignored and no HashMaps or ContextStacks will be created. Similarly, if disableThreadContextMap is set to true then puts to the ThreadContextMap will be ignored and no Map will be created. Finally, if disableThreadContextStack is set to true then pushes will be ignored and no ContextStack will be created.

When these properties are set the ThreadLocals will still be created but will never have any values in them.)
    
> Replace ThreadContext.push(String msg) with push(String msg, Object args...)
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-85
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Joern Huxhorn
>            Assignee: Ralph Goers
>             Fix For: 2.0-beta2
>
>
> Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.
> If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Resolved] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4J2-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers resolved LOG4J2-85.
-------------------------------

    Resolution: Fixed

I added a new push(String format, Object... args) method in revision 1403143. Please verify and close.
                
> Replace ThreadContext.push(String msg) with push(String msg, Object args...)
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-85
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Joern Huxhorn
>            Assignee: Ralph Goers
>             Fix For: 2.0-beta2
>
>
> Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.
> If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Posted by "Joern Huxhorn (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461785#comment-13461785 ] 

Joern Huxhorn commented on LOG4J2-85:
-------------------------------------

The evaluation/formatting of the message should be performed immediately before adding it as a String to the backend collection.

This is a convenience feature for the user since a message pattern with placeholders is nicer to write than a list of concatenated strings, especially if being accustomed to it by writing the same patterns in log messages.

Beside the added convenience this has a performance impact if the NDC is disabled entirely. In that case, no formatting would be performed at all.

I implemented an NDC like that over at https://github.com/huxi/lilith/blob/master/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java
(It keeps the message pattern and arguments in separate ThreadLocals to prevent a classloader leak. That way only standard java classes are put into a ThreadLocal.)

Pop (in your case) would always just return the formatted string.
                
> Replace ThreadContext.push(String msg) with push(String msg, Object args...)
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-85
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Joern Huxhorn
>
> Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.
> If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Updated] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Posted by "Joern Huxhorn (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4J2-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joern Huxhorn updated LOG4J2-85:
--------------------------------

    Issue Type: Improvement  (was: New Feature)
    
> Replace ThreadContext.push(String msg) with push(String msg, Object args...)
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-85
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Joern Huxhorn
>
> Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.
> If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Closed] (LOG4J2-85) Replace ThreadContext.push(String msg) with push(String msg, Object args...)

Posted by "Joern Huxhorn (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4J2-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joern Huxhorn closed LOG4J2-85.
-------------------------------


Fixed, thanks!
                
> Replace ThreadContext.push(String msg) with push(String msg, Object args...)
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-85
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-85
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Joern Huxhorn
>            Assignee: Ralph Goers
>             Fix For: 2.0-beta2
>
>
> Provide the option to use similar message formatting like the usual log methods. The API is still alpha so we can safely replace the method.
> If NDC functionality would be disabled (see LOG4J2-84) then message formatting wouldn't be performed at all, thus being significantly faster than always composing the message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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