RE: Trying log4j3 with java24 (virtual threads)
<[email protected]> Wed, 29 Jan 2025 11:18:32 +0100
| Newsgroups | gmane.comp.jakarta.log4j.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Piotr,
Ok, with this version the error is gone, but now using the ' =
log4j-jakarta-web' I can' t log anything ... This is the log4j2 debug =
log:
First it seems the log4j2.xml file is found:
INFO: 2025-01-29T10:04:08.083865584Z main DEBUG getConfigURI found =
resource paths [/WEB-INF/log4j2.xml] in servletContext at [/WEB-INF/]
INFO: 2025-01-29T10:04:08.085089121Z main DEBUG getConfigURI found =
resource [file:/opt/ventusproxy/app/proxy-war/ROOT/WEB-INF/log4j2.xml] =
in servletContext at [/WEB-INF/log4j2.xml]
But, after several lines, this message says the opposite:
INFO: 2025-01-29T10:04:08.606930494Z main TRACE Trying to find =
[log4j2.xml] using ClassLoader.getSystemResource().
INFO: 2025-01-29T10:04:08.607054706Z main WARN No Log4j 2 configuration =
file found. Using default configuration (logging only errors to the =
console), or user programmatically provided configurations. Set system =
property 'log4j2.debug' to show Log4j 2 internal initialization logging. =
See https://logging.apache
.org/log4j/2.x/manual/configuration.html for instructions on how to =
configure Log4j 2
INFO: 2025-01-29T10:04:08.614842658Z main DEBUG Starting =
OutputStreamManager SYSTEM_OUT.false.false-2
INFO: 2025-01-29T10:04:08.615839040Z main INFO Starting =
LoggerContext[name=3D344b8190] with configuration =
DefaultConfiguration...
On our code:
System.setProperty("log.dir", dirLogs);
System.setProperty("log4j.loggerContext.selector", =
"org.apache.logging.log4j.core.selector.BasicContextSelector");
LoggerContext context =3D (LoggerContext) LogManager.getContext(false);
//context.setConfigLocation(log4j2Path.toUri()); <-- I'm not specifying =
the path to log4j2 programmatically in this case, that's the only =
difference
this.accessLog =3D context.getLogger("LOGGER_ACCESS");
What am I doing wrong?
Thanks,
Joan.
-----Original Message-----
From: Piotr P. Karwasz <[email protected]>=20
Sent: Tuesday, January 28, 2025 5:46 PM
To: [email protected]
Subject: Re: Trying log4j3 with java24 (virtual threads)
Hi Joan,
On 28.01.2025 17:31, [email protected] wrote:
> Same error with 3.0.0-alpha1
>
> Joan.
>
> -----Original Message-----
> From: [email protected] <[email protected]>
> Sent: Tuesday, January 28, 2025 5:24 PM
> To: 'Log4J Users List' <[email protected]>
> Subject: RE: Trying log4j3 with java24 (virtual threads)
>
> ...
>
> But when I start my application, this error occurs:
>
> Caused by: java.lang.NoSuchMethodError: 'boolean =
org.apache.logging.log4j.core.util.Loader.isClassAvailable(java.lang.Stri=
ng)'
> at =
org.apache.logging.log4j.web.Log4jWebInitializerImpl.<clinit>(Log4jWebIni=
tializerImpl.java:57)
> at =
org.apache.logging.log4j.web.WebLoggerContextUtils.getWebLifeCycle(WebLog=
gerContextUtils.java:84)
> at =
org.apache.logging.log4j.web.Log4jServletContainerInitializer.onStartup(L=
og4jServletContainerInitializer.java:56)
> at =
org.apache.catalina.core.StandardContext.startInternal(StandardContext.ja=
va:4426)
> at=20
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
I was afraid that might happen. A small breaking change between Log4j =
Core 2 and 3 broke both artifacts.
I have freshly compiled a new `3.0.0-SNAPSHOT` version of =
`log4j-jakarta-web`, which should work. You just need to add our =
snapshot releases repo:
<repositories>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>https://repository.apache.org/snapshots</url>
</repository>
</repositories>
The release process for a beta release is not long, but we have a =
documentation backlog that we need to address before performing a =
release, so it might take some time before we publish a `beta1`.
On the other hand the code of the Jakarta artifacts is pretty stable and =
has not changed in years. It should be safe to use it in a test =
environment.
Piotr
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]