Cherry-picking some changes from PR #2425:

- Session events logging (debug)
- Bug fix for OCI8 method stored_procedure()
diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php
index 7174d63..d3d22d0 100644
--- a/system/libraries/Session/drivers/Session_cookie.php
+++ b/system/libraries/Session/drivers/Session_cookie.php
@@ -402,6 +402,7 @@
 		// Is the session data we unserialized an array with the correct format?
 		if ( ! is_array($session) OR ! isset($session['session_id'], $session['ip_address'], $session['user_agent'], $session['last_activity']))
 		{
+			log_message('debug', 'Session: Wrong cookie data format');
 			$this->sess_destroy();
 			return FALSE;
 		}
@@ -409,6 +410,7 @@
 		// Is the session current?
 		if (($session['last_activity'] + $this->sess_expiration) < $this->now OR $session['last_activity'] > $this->now)
 		{
+			log_message('debug', 'Session: Expired');
 			$this->sess_destroy();
 			return FALSE;
 		}
@@ -416,6 +418,7 @@
 		// Does the IP match?
 		if ($this->sess_match_ip === TRUE && $session['ip_address'] !== $this->CI->input->ip_address())
 		{
+			log_message('debug', 'Session: IP address mismatch');
 			$this->sess_destroy();
 			return FALSE;
 		}
@@ -424,6 +427,7 @@
 		if ($this->sess_match_useragent === TRUE &&
 			trim($session['user_agent']) !== trim(substr($this->CI->input->user_agent(), 0, 120)))
 		{
+			log_message('debug', 'Session: User Agent string mismatch');
 			$this->sess_destroy();
 			return FALSE;
 		}
@@ -459,6 +463,7 @@
 			// No result? Kill it!
 			if (empty($query) OR $query->num_rows() === 0)
 			{
+				log_message('debug', 'Session: No match found in our database');
 				$this->sess_destroy();
 				return FALSE;
 			}
@@ -498,6 +503,8 @@
 			'last_activity'	=> $this->now,
 		);
 
+		log_message('debug', 'Session: Creating new session ('.$this->userdata['session_id'].')');
+
 		// Check for database
 		if ($this->sess_use_database === TRUE)
 		{
@@ -536,6 +543,8 @@
 		{
 			// Get new id
 			$this->userdata['session_id'] = $this->_make_sess_id();
+
+			log_message('debug', 'Session: Regenerate ID');
 		}
 
 		// Check for database