JBoss logging for Java unit testing?

I inherited some java code explicitly implemented using JBoss logging I know this is usually configured as JBoss subsystem, and I can observe various log tuning operations while running on the server However, I did not get any log message output from the unit test I deleted several configuration files on the test classpath, including:

> logging. properties > log4j. xml > log4j2. xml

But I didn't see any results Can anyone configure the JBoss logging system so that they are visible outside the container during unit testing? Is this even possible? The logging configuration guide does not explain how to do this

Solution

You can make log4j XML works, but you need to ensure that there is a compatible version of vanilla log4j on the test classpath, such as 1.2 17, and you have not modified the version, log4j JBoss logmanager. On the classpath, it does not read log4j xml.

Details

see https://stackoverflow.com/a/18323126/1341535. I accept this:

It implies that it is basically impossible to configure JBoss log manager in the test, because there is no server subsystem configuration and nothing can parse it Maybe you can configure it programmatically, but it's too inconvenient

Therefore, this enables us to use JBoss logging facade and log4j as log managers, and log4j can be used XML easy configuration

Now, I think there is a logging in wildly The properties file, which configures logging before initializing the logging subsystem This means that you can use logging Properties to configure JBoss log manager, you only need to put the relevant jars on the test classpath, which may be JBoss logmanager and log4j JBoss logmanager

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>