Error logging / tracing log writer for resource adapters

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error logging / tracing log writer for resource adapters

Buerenheide, Christian

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.

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Error logging / tracing log writer for resource adapters

James Perkins
Maybe someone more familiar with JCA will chime in, but as far as JBoss Logging I don't believe there are any listeners or callbacks. If you're going to use JBoss Logging you might as well just use a Logger rather than the ManagedConnection.getLogWriter(). You'd have more control over the configuration that way.

On 12/06/2011 02:09 AM, Buerenheide, Christian wrote:

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.


_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev

-- 
James R. Perkins
JBoss by Red Hat

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev