我正在从log4j1迁移。由于最近的漏洞,x到log4j2。另一个依赖项似乎引用了旧的log4j1。x文件。
除了删除旧的log4j1. x文件之外,我还添加了log4j-core、log4j-api和log4j-1.2-api所有2.16版本。我查阅了迁移的留档https://logging.apache.org/log4j/2.x/manual/migration.html,并认为最后一个jar文件log4j-1.2-api可以解决依赖log4j1. x的不相关库的问题
我很难确定是否需要更新组织。玻璃鱼死亡。正如你从我的pom上看到的。xml文件我也尝试过更新jersey服务器jar,但没用。
pom.xml
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
<properties>
<jersey2.version>2.25.1</jersey2.version>
<jaxrs.version>2.0.1</jaxrs.version>
<bootstrap.version>3.3.5</bootstrap.version>
<angularjs.version>1.4.7</angularjs.version>
<angular-ui-bootstrap.version>0.14.0</angular-ui-bootstrap.version>
<ng-file-upload.version>9.0.12</ng-file-upload.version>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- JAX-RS -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>${jaxrs.version}</version>
</dependency>
<!-- Jersey 2.19 -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>${jersey2.version}</version>
</dependency>
<!-- <dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>3.0.3</version>
</dependency> -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey2.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey2.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>${jersey2.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-servlet-2.x</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>${bootstrap.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>angularjs</artifactId>
<version>${angularjs.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>angular-ui-bootstrap</artifactId>
<version>${angular-ui-bootstrap.version}</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>ng-file-upload</artifactId>
<version>${ng-file-upload.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.16.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.16.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.16.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
错误
Jan 10, 2022 7:04:14 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [REST] in context with path [/MyProject] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: org.apache.log4j.ConsoleAppender.<init>(Lorg/apache/log4j/Layout;)V] with root cause
java.lang.NoSuchMethodError: org.apache.log4j.ConsoleAppender.<init>(Lorg/apache/log4j/Layout;)V
at com.documentum.fc.common.impl.logging.LoggingConfigurator.configureLog4jWithSimpleDefault(LoggingConfigurator.java:154)
at com.documentum.fc.common.impl.logging.LoggingConfigurator.performInitialConfiguration(LoggingConfigurator.java:45)
at com.documentum.fc.common.DfLogger.<clinit>(DfLogger.java:624)
at com.documentum.fc.common.impl.logging.LoggingConfigurator.onPreferencesInitialized(LoggingConfigurator.java:178)
at com.documentum.fc.common.DfPreferences.initialize(DfPreferences.java:71)
at com.documentum.fc.common.DfPreferences.getInstance(DfPreferences.java:43)
at com.documentum.fc.client.DfSimpleDbor.getDefaultDbor(DfSimpleDbor.java:78)
at com.documentum.fc.client.DfSimpleDbor.<init>(DfSimpleDbor.java:66)
at com.documentum.fc.client.DfClient$ClientImpl.<init>(DfClient.java:350)
at com.documentum.fc.client.DfClient.<clinit>(DfClient.java:766)
at com.documentum.com.DfClientX.getLocalClient(DfClientX.java:43)
at dpaa.cms.dctm.DCTMUtility.createSessionManager(DCTMUtility.java:28)
at dpaa.cms.dctm.DCTMIntegration_Dental.getAMDentalRecords(DCTMIntegration_Dental.java:565)
at dpaa.cms.dctm.DCTMIntegration_Dental.getAMDentalRecords(DCTMIntegration_Dental.java:534)
at dpaa.cms.analytical_services.OdontologyService.getAMDentalRecords(OdontologyService.java:329)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Documentum DFC需要log4j(第一个版本),因此无法删除此依赖项。
声明 接受LoggerFactory的对org.apache.Log4j.logger.getLogger的调用必须删除org.apache.Log4j.spi.LoggerFactory并使用Log4J2的其他扩展机制之一。 log4j2中有哪些扩展机制,以及如何在log4j2中最好地迁移如下所示的方法
下面的方法已经使用了一段时间,当时我正在处理的系统有log4j。现在我们正在从Log4j转移到Log4j2,我会遇到编译问题。 Log4j2 jar:log4j-api-2.12.1.jar,log4j-core-2.12.1.jar 有没有人可以提供一些帮助,以解决上述问题的正确方法是什么?
我有一个使用log4j的java应用程序,配置如下。 log4j.properties 我想使用与上面相同的配置迁移到log4j2。尚未找到任何与log4j2属性配置文件相关的内容,因为最近包含了此支持。 谁能帮我弄清楚我的log4j2怎么样。属性文件是否具有上述相同的配置?
当出现此错误时,我没有记录任何内容。log的最后一行正确显示在其相应的日志中。 2015-04-02 13:58:51正在启动消息服务... ^[[?1;2C^[[?1;2C2015-04-02 13:59:06消息服务已成功启动。
我工作的应用程序,一直使用到现在,我想迁移到。我是使用的新手,参考了,但对于某些部分,我不清楚我的中的配置应该如何。 当前文件如下所示:
我们有一个使用ApacheAxis2在JBossOpenShift上运行的web服务应用程序。我们正在迁移到log4j2。然而,除了我们的应用程序日志之外,参考库的一些日志(如axis2日志)也使用log4j记录hazelcast日志。我们得出这个结论,因为他们仍然使用旧的log4。属性文件,而不是log4j2。xml文件。我们的应用程序使用log4j2。xml文件。因此将创建两个日志文件,一个用