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=344b8190] 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 = (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 = context.getLogger("LOGGER_ACCESS");


What am I doing wrong?

Thanks,

Joan.


-----Original Message-----
From: Piotr P. Karwasz <pi...@mailing.copernik.eu> 
Sent: Tuesday, January 28, 2025 5:46 PM
To: log4j-user@logging.apache.org
Subject: Re: Trying log4j3 with java24 (virtual threads)

Hi Joan,

On 28.01.2025 17:31, joan.balagu...@ventusproxy.com wrote:
> Same error with 3.0.0-alpha1
>
> Joan.
>
> -----Original Message-----
> From: joan.balagu...@ventusproxy.com <joan.balagu...@ventusproxy.com>
> Sent: Tuesday, January 28, 2025 5:24 PM
> To: 'Log4J Users List' <log4j-user@logging.apache.org>
> 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.String)'
>          at 
> org.apache.logging.log4j.web.Log4jWebInitializerImpl.<clinit>(Log4jWebInitializerImpl.java:57)
>          at 
> org.apache.logging.log4j.web.WebLoggerContextUtils.getWebLifeCycle(WebLoggerContextUtils.java:84)
>          at 
> org.apache.logging.log4j.web.Log4jServletContainerInitializer.onStartup(Log4jServletContainerInitializer.java:56)
>          at 
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4426)
>          at 
> 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: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to