As described above, if you use the serializable interface to store your
ConnectionFactory then you lose the reference to your LogWriter. This is because
LogWriters are not serializable and cannot be stored. When you deserialize
your ConnectionFactory it will not contain a reference to the LogWriter. To
ensure that your LogWriters are stored on any connections created from this
ConnectionFactory you must do the following. This only applies in a nonmanaged
environment.
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 above shows how to set the log to output the System.err.
The trace level applied to the ManagedConnectionFactory remains.