Bug 913804

Summary: LogWriter of ManagedConnectionFactory outputs nothing to stdout
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Osamu Nagano <onagano>
Component: JCAAssignee: Osamu Nagano <onagano>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 6.0.1CC: atangrin, cdewolf, jdoyle, jpederse, lcosti, myarboro, rdickens, vrastsel
Target Milestone: ER3   
Target Release: EAP 6.1.1   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-16 20:21:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test mvn project with a deployable RAR none

Description Osamu Nagano 2013-02-22 06:33:43 UTC
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.

./src/main/java/com/redhat/gss/logwritertest/AcmeManagedConnectionFactory.java
--
   public void setLogWriter(PrintWriter out) throws ResourceException
   {
      out.println("*** Logging via PrintWriter ***");
      ...
   }
--


Actual results:
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
1
--


Expected results:
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
--


Additional info:
AS7-6587 [1] 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.

[1] https://issues.jboss.org/browse/AS7-6587

Comment 4 Osamu Nagano 2013-07-03 06:09:40 UTC
Sent a pull request to the upstream/master.
https://github.com/wildfly/wildfly/pull/4729

Comment 5 Osamu Nagano 2013-07-05 05:07:46 UTC
Sent pull requests to the EAP repository.

6.x:   https://github.com/jbossas/jboss-eap/pull/219
6.1.x: https://github.com/jbossas/jboss-eap/pull/220

Comment 6 JBoss JIRA Server 2013-07-15 06:00:08 UTC
jaikiran pai <jpai> made a comment on jira WFLY-1630

Marking as resolved since the PR has been merged upstream.

Comment 7 Vladimir Rastseluev 2013-07-19 08:35:54 UTC
Verified on EAP 6.1.1.ER3

Comment 8 Osamu Nagano 2013-08-08 06:37:04 UTC
Slightly modified the Doc Text.