[jboss-as7-dev] Error logging / tracing log writer for resource adapters

Buerenheide, Christian christian.buerenheide at wincor-nixdorf.com
Tue Dec 6 05:09:57 EST 2011


Hi all,

we implemented a resource adapter which makes use of the PrintWriter instance injected to
the managed connection factory for error logging/tracing purposes. By searching for a way to
enable/disable tracing during runtime we found out that the JCA container of jboss-as-7.1.0.CR1
just injects a System.out printer during deployment time. If I this isn't right, please correct me.

The JCA (1.5) spec says the following:

"An application server manages the association of a log writer with a
ManagedConnectionFactory. When a ManagedConnectionFactory instance is
created, the log writer is initially null and logging is disabled. Associating a log
writer with a ManagedConnectionFactory instance enables logging and tracing
for the ManagedConnectionFactory instance."

This is exactly the behaviour that we would like to have :-)

In our opinion it would be a better idea to write to a specific JBoss logger rather than to System.out.

I checked out the sources from github and locally tested with a PrintWriter wrapper subclass which
prints out to a org.jboss.logging.Logger instance if trace is enabled for that particular logger.

It would be also nice if we could get notified about log level changes so that we could reset
the ManagedConnection.logWriter back to null if tracing gets disabled. If so, the log writer could be
null checked within the RA implementation so that the trace code (e.g. message formatting) doesn't
need to be executed if trace is disabled...
Is there a kind of callback mechanism implemented in jboss logging?

What's your opinion about a suitable solution? Do you have any proposals?

Best regards
Christian

WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-as7-dev/attachments/20111206/8db50eaa/attachment.html 


More information about the jboss-as7-dev mailing list