Hi Piotr,
Thanks for the reminder.
I did in fact do this, it had already been included in Thad’s solution.
The idea of my email was to describe changes I made to Thad’s code.
I now realize that it would have been smarter (and more useful to future
mailing list readers) if I had included the
Hi Piers,
On Sun, 31 Mar 2024 at 22:37, Piers Uso Walter wrote:
>
> Thad,
>
>
> Thanks so much. This looks exactly what I want to do.
> But somehow I never got your code to work.
>
> ...
>
> I made these changes to your code:
>
> 1.
> LogListener is now a subclass of Log4jServletContextListener,
Hi Piers,
On Wed, 20 Mar 2024 at 17:09, Piers Uso Walter wrote:
> Am I trying something unusual here when I attempt to make the app decide
> where the log4j configuration file is located?
> Is there any other way in which I can achieve this?
> Is there an API for this?
Sorry for the late
Hi Jeff,
Thanks for your suggestion.
I ended up doing it slightly different (see my response to Thad Humphries).
However, I’ll keep your idea in mind because the ability to both include a
standard configuration in the app and also optionally modifying this
configuration via an external config
Thad,
Thanks so much. This looks exactly what I want to do.
But somehow I never got your code to work.
I finally modified your approach a bit, and now it works for me.
I am now able to dynamically set the location of the log4j configuration file
in my app.
And this works not just when the app
Piers,
I've configured two webapps with the log4j2 configuration outside of the
*war files. The approach I'll describe is working in Tomcat 8.5 and Tomcat
9.
First I create a LogListener class for the webapp:
public class LogListener implements ServletContextListener {
private static final
Hi Piers,
I am not from Log4j Team - just a user like you :)
We have a similar situation with internal distribution configuration and
external "customer" configuration.
What we are now doing is programmatically creating a CompositeConfiguration
with the internal config and external config and
Hi Piotr,
Thanks for your email.
Here is what I’m trying to do:
The previous version of our app stores the log4j configuration within the war
file.
This works fine but is annoying if one wants to change any logging setting
(unpacking the war, changing the configuration, repacking the war,
Hi Piers,
On Thu, 14 Mar 2024 at 14:08, Piers Uso Walter wrote:
> However, what I was trying to achieve by using a servlet context listener was
> to be able to set the location of the log4j configuration file at run time.
> I’m trying to make the app compatible with different app servers where
Hi Piotr,
Thanks for your explanation.
Indeed, once I hard code the path to the log4j configuration file into web.xml,
logging works in both cases (app undeployment/deployment as well as Tomcat
shutdown/restart).
However, what I was trying to achieve by using a servlet context listener was
Hi Piers,
On Wed, 13 Mar 2024 at 22:29, Piers Uso Walter wrote:
> 2024-03-13T19:49:02.609143Z Catalina-utility-1 INFO
> Log4jServletContextListener triggered a Log4j context initialization.
>
> Case 2:
> However, if I stop and restart the Tomcat service (with the war file having
> been
Hi all,
I have a small web app that runs in Tomcat 9 and uses log4j 2 for logging.
This works in one case and does not work in another case:
Case 1:
When I deploy the war file to Tomcat (copying the war file to the Tomcat
webapps folder), everything works as expected.
The log file is created
12 matches
Mail list logo