[
https://issues.apache.org/jira/browse/LOG4J2-484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13866566#comment-13866566
]
Giovanni Mondo commented on LOG4J2-484:
---------------------------------------
Many thanks for your example, but to have a separate log file is not exactly
what I expected.
I try to state differently my problem.
First of all log4j misconfiguration problems can cause logs to go lost.
To avoid this I use the same WEB-INF/classes/log4j2.xml in different web
projects so that I always know that lost logs are in a
/tmp/default_MavenWeb.log file.
Then I configure where to send my logs by means of a
Log4jServletContextListener and in fact I retrieve the logs of my servlets
where I want (in /tmp/MavenWeb.log), but not the logs of my
ServletContextListeners (that I find in default log). Is this what you expect ?
Is this due to the ServletContextListeners loading order ?
To change the log4j2.xml to address the ServletContextListeners is surely a
solution but a misconfiguration problem can avoid me to find lost logs.
Moreover the Log4jServletContextListener refers to an external property file
that allows me to configure different log paths in different environments and
the WEB-INF/classes/log4j2.xml could not let me to do this.
Keeping a log4j2.xml default log helped me many times, but could be a wrong
approach and maybe makes difficult to have Servlet and ServletContextListeners
logs together. Do you have a different point of view to suggest, possibly
letting Servlet and ServletContextListener logs together easily ?
> log4j2 and ServletContextListeners
> ----------------------------------
>
> Key: LOG4J2-484
> URL: https://issues.apache.org/jira/browse/LOG4J2-484
> Project: Log4j 2
> Issue Type: Question
> Components: Configurators
> Affects Versions: 2.0-beta9
> Environment: java 1.7.0_11-b21, tomcat-7.0.14
> Reporter: Giovanni Mondo
> Priority: Trivial
> Labels: newbie
> Fix For: 2.0-rc1
>
> Attachments: MavenWeb2.zip
>
>
> Logging configuration is done by two config file:
> WEB-INF/classes/log4j2.xml logging in /tmp/default_MavenWeb.log
> and
>
> /tmp/final_log4j2.xml as log4jConfiguration of a Log4jServletContextListener
> logging in /tmp/MavenWeb.log
>
> Is it possible to log HelloWorldServletContextListener in /tmp/MavenWeb.log
> as HelloWorldServlet does ?
> A minimal maven project with full details can be found in attachment.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]