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

Jeff Shaw updated LOG4J2-2360:
------------------------------
    Description: 
I learned there are two features of log4j2 and its official Scala API that 
could work together to improve performance with some API changes.

Log4j2's messages can include the source file name and line number by using a 
StackTraceElement.

Scala macros can be used to provide compile time file names and line numbers to 
runtime for the cost of allocating a StackTraceElement. However, there is 
currently not a good way to combine the two.

I created the changes we'd need to allow clients of log4j2 to manually provide 
StackTraceElement for a log message, and then I used the new methods to create 
StackTraceElement for Scala files at compile time. This will allow loggers to 
provide source location without having to create a stack trace.

 

For log4j2 see 
[https://github.com/shawjef3/logging-log4j2/commit/4f75053cdfe39614fc60ecc609f3658cdd4840db]
 and for an example use by the scala loggers see 
[https://github.com/shawjef3/logging-log4j-scala/commit/dd9a5dd2d6bef80ef4f0334c2ed7043299ddbad4].

  was:
I learned there are two features of log4j2 and its official Scala API that 
could work together to improve performance with some API changes.

Log4j2's messages can include the source file name and line number.

Scala macros can be used to provide compile time file names and line numbers to 
runtime for the cost of allocating a StackTraceElement. However, there is 
currently not a good way to combine the two.

I created the changes we'd need to allow clients of log4j2 to manually provide 
SourceLocation for a log message, and then I used the new methods to create 
SourceLocation for Scala files at compile time. This will allow loggers to 
provide source location without having to create a stack trace.

 

For log4j2 see 
[https://github.com/shawjef3/logging-log4j2/commit/4f75053cdfe39614fc60ecc609f3658cdd4840db]
 and for an example use by the scala loggers see 
[https://github.com/shawjef3/logging-log4j-scala/commit/dd9a5dd2d6bef80ef4f0334c2ed7043299ddbad4].


> Expose StackTraceElement to public API
> --------------------------------------
>
>                 Key: LOG4J2-2360
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2360
>             Project: Log4j 2
>          Issue Type: Improvement
>            Reporter: Jeff Shaw
>            Priority: Major
>
> I learned there are two features of log4j2 and its official Scala API that 
> could work together to improve performance with some API changes.
> Log4j2's messages can include the source file name and line number by using a 
> StackTraceElement.
> Scala macros can be used to provide compile time file names and line numbers 
> to runtime for the cost of allocating a StackTraceElement. However, there is 
> currently not a good way to combine the two.
> I created the changes we'd need to allow clients of log4j2 to manually 
> provide StackTraceElement for a log message, and then I used the new methods 
> to create StackTraceElement for Scala files at compile time. This will allow 
> loggers to provide source location without having to create a stack trace.
>  
> For log4j2 see 
> [https://github.com/shawjef3/logging-log4j2/commit/4f75053cdfe39614fc60ecc609f3658cdd4840db]
>  and for an example use by the scala loggers see 
> [https://github.com/shawjef3/logging-log4j-scala/commit/dd9a5dd2d6bef80ef4f0334c2ed7043299ddbad4].



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to