reportportal / agent-java-junit

Report Portal agent for JUnit 4
Apache License 2.0
11 stars 17 forks source link

Can't send logs to ReportPortal because com.epam.reportportal.service.LoggingContext.init is not called #13

Closed RPMiller closed 5 years ago

RPMiller commented 5 years ago

Not sure if this is the right place for the issue since it could be fixed in a few repos.

agent-java-junit does not set the logging context

The log4j2 appender gets invoked

https://github.com/reportportal/logger-java-log4j/blob/master/src/main/java/com/epam/ta/reportportal/log4j/appender/ReportPortalLog4j2Appender.java#L90

But then ignores the log because the logging context was never set.

https://github.com/reportportal/client-java/blob/master/src/main/java/com/epam/reportportal/service/ReportPortal.java#L146

I can send logs when using testNG because then logging context is set from

https://github.com/reportportal/agent-java-testNG/blob/master/src/main/java/com/epam/reportportal/testng/TestNGService.java#L109

then

https://github.com/reportportal/client-java/blob/bb58bb0f5ee1913fa7ba5f724d372eb1db9360fd/src/main/java/com/epam/reportportal/service/LaunchImpl.java#L197

I know almost nothing about this code base, but I'm curious as to why the testNG agent uses Launch and the junit agent uses ReportPortalService.

DzmitryHumianiuk commented 5 years ago

@RPMiller TestNG adapter was done by team. jUnit4 adapter was done by various contributors.

most probably junit should be updated. BUT at the moment, we do test new version of junit adapter, based on 3rd-party library, which utilize biteBuddy.

plz check it from v4 branch for this.

DzmitryHumianiuk commented 5 years ago

@avarabyeu

I'm curious as to why the testNG agent uses Launch and the junit agent uses ReportPortalService.

avarabyeu commented 5 years ago

@RPMiller hi. JUnit agent uses pretty old version of client-java dependency which is basically ReportPortal client. Other frameworks (including TestNG) use fresh/latest client-java. The main different between "old" and "new" ReportPortal client is that new version sends requests asynchronously and as the result, doesn't influence your test execution time so much as "old" version does

DzmitryHumianiuk commented 5 years ago

@RPMiller @sbabcoc does this update right now in v4 branch. it will be switched to Launch service object

sbabcoc commented 5 years ago

@RPMiller https://github.com/reportportal/agent-java-junit/pull/19 This PR switches the back-end service connector from BatchedReportPortalService to Launch. This appears to resolve the logging context problem.