You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Bruce Wen <cr...@gmail.com> on 2017/06/29 20:36:01 UTC
Why LogManager load log4j.properties from target/test-classes when
run TestNG in Eclipse
Hi All,
I am wondering how classpath is decided when run TestNG suite xml file in Eclipse. Why it add target/test-classes in classpath and LogManager load log4j.properties from there rather than target/classes folder.
I hope somebody can help clarify the root reason for that. Thanks!
Bruce Wen
Re: Why LogManager load log4j.properties from target/test-classes
when run TestNG in Eclipse
Posted by Bruce Wen <cr...@gmail.com>.
Hi Ralph,
Thanks for your reply!
I am confused about it because my class file located in src/main/java rather than src/test/java. To raise this in Log4j, I just want to check if somebody has the same confusion and already know the root cause of it.
You are right. I will try to ask Eclipse community for clarification.
Bruce Wen
On Thursday, June 29, 2017 11:17 PM, Ralph Goers <ra...@dslextreme.com> wrote:
If Eclipse (or any other test environment) didn’t add test-classes to the class path how would it find your test classes. They would normally be first in the class path so that files you want to override for testing are picked up. I suspect this is why it is picking up a log4j.properties there instead of the classes directory. In any case, this has little, if anything, to do with Log4j.
Ralph
> On Jun 29, 2017, at 1:36 PM, Bruce Wen <cr...@gmail.com> wrote:
>
> Hi All,
> I am wondering how classpath is decided when run TestNG suite xml file in Eclipse. Why it add target/test-classes in classpath and LogManager load log4j.properties from there rather than target/classes folder.
> I hope somebody can help clarify the root reason for that. Thanks!
> Bruce Wen
Re: Why LogManager load log4j.properties from target/test-classes
when run TestNG in Eclipse
Posted by Ralph Goers <ra...@dslextreme.com>.
If Eclipse (or any other test environment) didn’t add test-classes to the class path how would it find your test classes. They would normally be first in the class path so that files you want to override for testing are picked up. I suspect this is why it is picking up a log4j.properties there instead of the classes directory. In any case, this has little, if anything, to do with Log4j.
Ralph
> On Jun 29, 2017, at 1:36 PM, Bruce Wen <cr...@gmail.com> wrote:
>
> Hi All,
> I am wondering how classpath is decided when run TestNG suite xml file in Eclipse. Why it add target/test-classes in classpath and LogManager load log4j.properties from there rather than target/classes folder.
> I hope somebody can help clarify the root reason for that. Thanks!
> Bruce Wen
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org