Bug 913804 - LogWriter of ManagedConnectionFactory outputs nothing to stdout
Summary: LogWriter of ManagedConnectionFactory outputs nothing to stdout
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: JCA   
(Show other bugs)
Version: 6.0.1
Hardware: All
OS: All
Target Milestone: ER3
: EAP 6.1.1
Assignee: Osamu Nagano
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2013-02-22 06:33 UTC by Osamu Nagano
Modified: 2018-11-30 19:31 UTC (History)
8 users (show)

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:
Last Closed: 2013-09-16 20:21:43 UTC
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Test mvn project with a deployable RAR (41.05 KB, application/zip)
2013-02-22 06:33 UTC, Osamu Nagano
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker AS7-6587 Major Resolved Use JBoss Logging for resource adapter LogWriter 2015-09-15 20:06:14 UTC
JBoss Issue Tracker WFLY-1630 Major Resolved LogWriter of ManagedConnectionFactory outputs nothing to stdout 2015-09-15 20:06:14 UTC

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.

   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

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.

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@redhat.com> 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.

Note You need to log in before you can comment on or make changes to this bug.