我正在尝试使用log4j 2.11.1和Java编程地创建JMS附加程序(没有属性文件,对不起,老兄)。阿耳emi弥斯2.6.3。问题是它崩溃了,我的其他附加程序中也没有数据。
有人可以使用Java JMS追加器方法吗?我正在使用这个:
private void addJmsAppender() {
// LAYOUT
LayoutComponentBuilder jmsLayout = builder.newLayout("SerializedLayout");
// APPENDER
AppenderComponentBuilder jmsAppender = builder.newAppender(jmsAppenderName, "JMS");
jmsAppender.addAttribute("factoryBindingName", "ConnectionFactory");
jmsAppender.addAttribute("factoryName", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
jmsAppender.add(jmsLayout);
jmsAppender.addAttribute("name", jmsAppenderName);
jmsAppender.addAttribute("providerURL", "tcp://localhost:61616");
jmsAppender.addAttribute("destinationBindingName", "topic/loggertopic");
builder.add(jmsAppender);
}
这些行家:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.1</version>
</dependency>
<!-- Required to capture mongo default log -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-client</artifactId>
<version>2.6.3</version>
</dependency>
对不起,但我什至不知道如何获取更多数据...
谢谢!