Tracing issues relating to serialized interfaces and ConnectionFactory objects

If you use the serializable interface to store your ConnectionFactory objects, the reference to your LogWriter is lost.

If you use a serializable interface to store your ConnectionFactory objects, when you deserialize the interface the ConnectionFactory does not contain a reference to the LogWriter. This is because LogWriters are not serializable.

In a nonmanaged environment, you can ensure that your LogWriters are stored on any connections created from the ConnectionFactory object by configuring the connection using the following code.
DefaultConnectionManager.setLogWriter(new java.io.PrintWriter(System.err));
Connection Conn = (Connection)cxf.getConnection();

The setLogWriter method on the DefaultConnectionManager, which is supplied with the resource adapters, is a static method. The example defines that the log is set to output to the System.err. Managed environments are unaffected because the trace level applied to the ManagedConnectionFactory remains.