Re: Issues Migrating Log4J 1.27 to Log4j2
Volkan Yazıcı <[email protected]> Sun, 2 Mar 2025 16:14:20 +0100
| Newsgroups | gmane.comp.jakarta.log4j.user |
|---|---|
| Message-ID | <CABDM8gB-moN8ofHMwhEF3KB_qHhnUyKoahTwQHuSPZAb=czNhQ@mail.gmail.com> |
--00000000000021dc72062f5d7f30 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=AFPM Alex Smith <[email protected]> w= rote: > 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 t= o > 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 migh= t > be caused. If anyone has any insight on this or how to potentially resolv= e > it, I'd be extremely grateful. > > I think I've supplied all the relevant information, but if there's anythi= ng > I'm missing I can easily look into it and provide whatever I find. > > Thanks, > Alex > --00000000000021dc72062f5d7f30--