Debug backtrace but only for 1 IP

How to set logCallStack

If this is only for a temporary debugging, I recommend you copy lib/Varien/Db/Adapter/Pdo/MySql.php to app/code/local/Varien/Db/Adapter/Pdo/Mysql.php and adjust the settings for $_logCallStack there.

You could then add an additional check before each log-output. Something like:

original:

if ($this->_logCallStack) {
    $code .= 'TRACE: ' . Varien_Debug::backtrace(true, false) . $nl;
}

adjust to:

if ($_SERVER['REMOTE_ADDR']=="111.112.113.114") { //your ip here
   $this->_logCallStack = true;
}
if ($this->_logCallStack) {
    $code .= 'TRACE: ' . Varien_Debug::backtrace(true, false) . $nl;
}

I would not recommend this way as a permanent way of implementing the debugging though. As it is a code pool override of the Mysql.php file you have to make sure updates from future versions or patches will be brought to this file manually.

How to output a backtrace for a specific IP

You can set the Developer IP in the Magento admin and use Magentos built in developer functions.

Set the developer IP

System > Configuration > Developer > Developer Client Restrictions

Check if the IP is allowed as developer IP

before logging debug information:

if(Mage::helper('core')->isDevAllowed()){
//your backtrace & log functions here
} 

I usually used the below code to enable logs for my IP only in index.php

$ip = $_SERVER['REMOTE_ADDR'];
$allowed = array('MY_IP_ADDRESS');
if (in_array($ip, $allowed)) {
    Mage::setIsDeveloperMode(true);
    ini_set('display_errors', 1);
    // other debugging code
}

Try it, may it is helpful for you as well.