Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39874

Re: log4j2 test?

Newsgroups comp.lang.java.programmer
Date 2022-12-16 12:20 -0800
References <948bfc5a-7db1-468f-a8de-6f0786c5514fn@googlegroups.com> <slrntppg5j.21q.avl@logic.at>
Message-ID <cd62ede2-9514-43cb-b1da-22dc070678e8n@googlegroups.com> (permalink)
Subject Re: log4j2 test?
From "e.d.pro...@gmail.com" <e.d.programmer@gmail.com>

Show all headers | View raw


On Friday, December 16, 2022 at 2:02:25 PM UTC-5, Andreas Leitgeb wrote:
> > log4j2.xml defines RollingFile with fileName="${sys:catalina.base}/logs/${application.name}.application.log" 
> > This works when I run the app. This gets an error when I run mvn install in the test phase. Test works if I remove the catalina.base variable. How do I get this to resolve, or what is the normal log path for maven test phase platform independent, as in to run from my eclipse workspace path as well as the jenkins build?
> Based on this, either the property catalina.base wasn't really removed, 
> or the test pulled a different logging config. 
> 
> With an undefined property, and an entity using that property, I wouldn't 
> have expected any behaviour other than maybe a default-logger to console.

fileName="${sys:catalina.base}/logs/${application.name}.application.log" is for running on tomcat
I changed the xml path to fileName="logs/${application.name}.application.log" for printing to a log file in my maven build.
The catalina.base variable should be part of the path when it's running on tomcat. Shouldn't it also be able to use log4j2 in the maven build, unit tests?
Maven build doesn't have a value for the variable, so how do I assign it, or what is normal for a log path?

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

log4j2 test? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2022-12-14 06:41 -0800
  Re: log4j2 test? Andreas Leitgeb <avl@logic.at> - 2022-12-16 19:02 +0000
    Re: log4j2 test? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2022-12-16 12:20 -0800
  Re: log4j2 test? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2022-12-19 17:42 +0100
    Re: log4j2 test? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2022-12-19 11:37 -0800
      Re: log4j2 test? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2022-12-20 02:17 +0100

csiph-web