/** * INTERNAL: * Each session owns its own session log because session is stored in the session log */ public Object clone() { // There is no special treatment required for cloning here // The state of this object is described by member variables sessionLogger and categoryLoggers. // This state depends on session. // If session for the clone is going to be the same as session for this there is no // need to do "deep" cloning. // If not, the session being cloned should call setSession() on its JavaLog object to initialize it correctly. JavaLog cloneLog = (JavaLog)super.clone(); return cloneLog; } }
/** * PUBLIC: * Set the session log to which an accessor logs messages and SQL. * If not set, this will default to a session log on a writer on System.out. * To enable logging, log level can not be OFF. * Also set a backpointer to this session in SessionLog. To avoid a sessionLog * being shared by more than one session, it needs to be cloned. * * @see #logMessage(String) */ public void setSessionLog(SessionLog sessionLog) { this.sessionLog = (SessionLog)((AbstractSessionLog)sessionLog).clone(); if (this.sessionLog != null) { this.sessionLog.setSession(this); } }