Open benjaminwunder opened 6 years ago
A few findings. This appears to be something to do with differing classloaders.
The System.setProperty() calls in LogsServer.java appear to not be transferred to the child process when JBrowserDriver is forked to its own thread, making the log properties disappear. However, setting those properties again in the execution of JBrowserDriver.launchProcess
in the ProcessExecutor() when "ready on ports" is received sets these system properties for the child process, but does not seem to fix the issue. I suspect other classloader issues are in play here but haven't yet been able to determine specifically where the wires are getting lost.
When LogHandler.java was modified so that publish(LogRecord record)
was redirected to a file, the wire logs show up in that file. This indicates to me that the wire logs are being processed since LogHandler is designated as a handler for defaultLogger
in Settings.java. But the wire logs are not being sent to WireLog.appender, which is where I would expect them to show up. WireLog.debug is never called.
I haven't put the same debug commands into the single package though, so I'm not sure if I'm even following the right path here.
Edit: Further digging confirms that WireLog.java
is, for some reason, not being set as the Logger for the wirelogs as specified in the System.setProperty() calls in LogsServer should dictate. However, the LogHandler is getting called. I still don't see how to trace this down. I'm trying to understand the RMI portion but am having a little bit of a time with it.
Edit2: Switched over to using an application context in Tomcat so that all of the jar files are loaded with the same classloader. Class A is now not loaded with Tomcat's shared loader but rather with the war file's app context definition. Same results. It does not appear to be related to class loaders.
https://stackoverflow.com/questions/47596291/selenium-wire-logs-empty
Basically when deploying a jar with tomcat outside of a typical deployment the wire logs are lost.
Class A is deployed as a jar file as a shared object in Tomcat using
shared.loader
Class B is deployed as a web app in Tomcat
If class B calls Class A, and Class A instantiates jbrowserdriver, then the wire logs expected from/catalina.out. If Class A and Class B are packaged together in the webapp, this behavior does not occur.
driver.manage().logs().get("wire")
has no entries, despite the wires spamming the apache log file in /