logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luke Woodward (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-873) WebLookup shouldn't require display-name element in web.xml
Date Mon, 28 Sep 2015 21:36:04 GMT

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

Luke Woodward commented on LOG4J2-873:
--------------------------------------

The missing display-name also appears to cause a memory leak. If a web app uses Log4j2 and
its web.xml file lacks a <display-name> (and also a <context-param> with name
{{log4jConfiguration}}), then JMX MBeans are not being deregistered when the web app is stopped.
 Essentially, the behaviour described in LOG4J2-578 comes back if there's no display-name.

I have run into this leak myself, in a web application that happened not to have a display-name.
 It wasn't at all obvious that supplying a display name was how you fix the leak.

I also believe this is the root cause of the memory leak in [this StackOverflow question|http://stackoverflow.com/questions/31211868].

> WebLookup shouldn't require display-name element in web.xml
> -----------------------------------------------------------
>
>                 Key: LOG4J2-873
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-873
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Web/Servlet
>    Affects Versions: 2.0.2
>            Reporter: Martin Dickins
>            Assignee: Ralph Goers
>            Priority: Minor
>             Fix For: 2.4.1
>
>
> The initializeNonJndi method in Log4jWebInitializerImpl uses servletContext.getServletContextName()
to get a context name (if the name hasn't been defined using log4jContextName). getServletContextName()
returns the name as specified in the <display-name> element in web.xml, but that is
optional.
> If neither <display-name> nor log4jContextName is defined, this results in the
servletContext not being set, so the WebLookup doesn't work.
> It should use some sort of default. Probably the name of the war file or context file,
if there's a generic way of getting that.



--
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


Mime
View raw message