Hey Alex, You're at the right place to ask Log4j-related questions. Would you mind providing a little bit more information about your setup, please?
1. Which Log4j 2 version are you migrating to? 2. Which OS and JDK distribution are you using? 3. Is this a standalone or a JEE/Jakarta application? 4. I presume you converted your Log4j 1 configuration to Log4j 2. Could you share your Log4j configuration? (e.g., `log4j2.xml`) 5. Could you share your `pom.xml` file? 6. Could you share your application logs when you start the application with the `log4j2.debug` system property? Kind regards. On Fri, Feb 28, 2025 at 8:03 PM Alex Smith <a.sloni...@gmail.com> wrote: > I'm not sure I'm in the right place, but I've been working on migrating > from Log4j to Log4j 2 in a project I'm working on. > > In the pom.xml, I removed the log4j dependencies and added the log4j > compatibility API to hte dependencies. I think some of of the other > dependencies I'm using may still be on log4j 1.2, but am not 100% certain > of this. > > What I'm observing is that trying to add > import org.apache.logging.logj4.x is frequently throwing errors related to > ClassNotFoundException, and when attempt to build some of the services, I > get amongst others, the following errors > > "StatusLogger Log4j2 could not find a logging implementation please add > log4j-core to the classpath... " > and > "Invocation of init method failed; nested exception is > java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/logEvent" > > As mentioned above, log4j-core is listed as a dependency in the pom.xml > file, so I can't imagine why the files wouldn't be found in the classpath. > > I've been following the instructions from > https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html, and am > struggling to find any information as to why the errors listed above might > be caused. If anyone has any insight on this or how to potentially resolve > it, I'd be extremely grateful. > > I think I've supplied all the relevant information, but if there's anything > I'm missing I can easily look into it and provide whatever I find. > > Thanks, > Alex >