• log4j2 test?

    From e.d.programmer@gmail.com@21:1/5 to All on Wed Dec 14 06:41:35 2022
    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andreas Leitgeb@21:1/5 to e.d.pro...@gmail.com on Fri Dec 16 19:02:11 2022
    e.d.pro...@gmail.com <e.d.programmer@gmail.com> 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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From e.d.programmer@gmail.com@21:1/5 to Andreas Leitgeb on Fri Dec 16 12:20:45 2022
    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Daniele Futtorovic@21:1/5 to e.d.pro...@gmail.com on Mon Dec 19 17:42:28 2022
    On 14/12/2022 15:41, e.d.pro...@gmail.com 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?

    I would recommend either logging to a fixed place, such as /var/log on a
    *NIX, or going relative, i.e. against the working directory.

    Either should fix your problem, as well as make things simpler.

    --
    DF.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From e.d.programmer@gmail.com@21:1/5 to Daniele Futtorovic on Mon Dec 19 11:37:04 2022
    On Monday, December 19, 2022 at 11:42:44 AM UTC-5, Daniele Futtorovic wrote:
    I would recommend either logging to a fixed place, such as /var/log on a *NIX, or going relative, i.e. against the working directory.

    Either should fix your problem, as well as make things simpler.

    --
    DF.

    I ran it with the filename="logs/..." path which should be relative to the build. I haven't looked for the log files from the jenkins build but it didn't crash.
    I was wondering if there was a standard convention for log4j2 writing to files from a maven jenkins build

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Daniele Futtorovic@21:1/5 to e.d.pro...@gmail.com on Tue Dec 20 02:17:10 2022
    On 19/12/2022 20:37, e.d.pro...@gmail.com wrote:
    On Monday, December 19, 2022 at 11:42:44 AM UTC-5, Daniele Futtorovic wrote:
    I would recommend either logging to a fixed place, such as /var/log on a
    *NIX, or going relative, i.e. against the working directory.

    Either should fix your problem, as well as make things simpler.

    I ran it with the filename="logs/..." path which should be relative to the build. I haven't looked for the log files from the jenkins build but it didn't crash.
    I was wondering if there was a standard convention for log4j2 writing to files from a maven jenkins build

    Something you see more and more these days, especially in containerized
    setups, is straight logging to STDOUT, with the task scheduling layer
    then taking care of digestion/redirection. This is a prime candidate for Jenkins builds, which will typically be executed on (often
    containerized) worker slaves, where retrieving files from the filesystem
    at a later date is non-trivial -- whereas consulting the build output, is.

    --
    DF.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)