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

Matt Sicker resolved LOG4J2-248.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 2.6

Fixed in master. Please verify and close.

> Log4jWebInitializerImpl: Use Thread instead of Class for fallback classloader
> -----------------------------------------------------------------------------
>
>                 Key: LOG4J2-248
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-248
>             Project: Log4j 2
>          Issue Type: Improvement
>    Affects Versions: 2.0-beta5
>            Reporter: Tim Tucker
>            Assignee: Matt Sicker
>            Priority: Minor
>             Fix For: 2.6
>
>
> I was experimenting with creating my own context listener based on 
> Log4jContextListener and noticed that the call in getClassLoader to get the 
> class's classloader was triggering a PMD warning.
> The rule's notes indicate that Thread.currentThread().getContextClassLoader() 
> might return more reliable results than Object.class.getClassLoader().
> The code in question is as follows:
> try {
>     // if container is Servlet 3.0, use its getClassLoader method
>     return 
> (ClassLoader)context.getClass().getMethod("getClassLoader").invoke(context);
> } catch (Exception ignore) {
>     // otherwise, use this class's class loader
>     return Log4jContextListener.class.getClassLoader();
> }



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to