In previous versions of JBoss EAP 6 a `PrintWriter` object that passed through the `setLogWriter` method of a `ManagedConnectionFactory` would not output any log messages to standard output (stdout).
This was caused because the `PrintWriter` within the `AbstractResourceAdapterDeploymentService` class was not set to autoflush, and this has been fixed in this release.
Output messages of a `PrintWriter` object set by the `setLogWriter` method of a `ManagedConnectionFactory` now appear in stdout.
Created attachment 701010 [details]
Test mvn project with a deployable RAR
Description of problem:
ManagedConnectionFactory#setLogWriter() passes a PrintWriter object for logging use of the connector. It is supposed to output log messages to stdout but none of the messages are observed.
Steps to Reproduce:
1. Extract the attachment 'logwritertest.zip' which is a maven project with a deployable RAR file.
2. Deploy './target/logwritertest-0.1.rar'.
3. While the deployment, EAP sets a PrintWriter wrapping System.out via ManagedConnectionFactory#setLogWriter(). And the test connection factory should output message "*** Logging via PrintWriter ***" through it, as the code written like this.
public void setLogWriter(PrintWriter out) throws ResourceException
out.println("*** Logging via PrintWriter ***");
The message doesn't observed.
17:36:15,668 INFO [org.jboss.as.osgi] (MSC service thread 1-1) JBAS011907: Register module: Module "deployment.logwritertest-0.1.rar:main" from Service Module Loader
17:36:15,695 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-4) JBAS010406: Registered connection factory java:/eis/AcmeConnectionFactory
The message has been observed.
17:39:01,726 INFO [org.jboss.as.osgi] (MSC service thread 1-3) JBAS011907: Register module: Module "deployment.logwritertest-0.1.rar:main" from Service Module Loader
17:39:01,750 INFO [stdout] (MSC service thread 1-1) *** Logging via PrintWriter ***
17:39:01,751 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-1) JBAS010406: Registered connection factory java:/eis/AcmeConnectionFactory
AS7-6587  is going to revise the JCA logging system. And there is a proposed fix of AbstractResourceAdapterDeploymentService.java, which enables auto-flushing of the PrintWriter. I confirmed with a custom build with this change fixes the problem.
Sent a pull request to the upstream/master.
Sent pull requests to the EAP repository.
jaikiran pai <firstname.lastname@example.org> made a comment on jira WFLY-1630
Marking as resolved since the PR has been merged upstream.
Verified on EAP 6.1.1.ER3
Slightly modified the Doc Text.