From template.php

It doesn't look like the $logo = image_style_url('logo', $file); is needed, and in fact it results in the path to the image not existing:

http://mysite.com/sites/default/files/styles/logo/public/mycustomlogo.png?itok=1ByTYADU

If I comment out the $logo = image_style_url('logo', $file); like this:

function datapublic_theme_preprocess_page(&$variables) {

  $logo = &$variables['logo'];
  $site_name = $variables['site_name'];
  drupal_set_message($logo);
  if (preg_match("|^.*/files/(.*)|", $logo, $m)) {
    $file = "public://" . $m[1];
    //$logo = image_style_url('logo', $file);
  }
  elseif ($logo == url(drupal_get_path('theme', 'datapublic_theme') . "/logo.png", array('absolute'=>TRUE))) {
    $logo = $logo;
  }
  else {
    $logo = $logo;
  }

}

The new path is: http://mysite.com/sites/default/files/mycustomlogo.png

Am I missing something further back as to why you are using the image_style_url() ?

This seems to diverge from the cogito base-theme in which they use:

function cogito_preprocess_page(&$variables){
  $root_d7 = getcwd();
  global $base_path;
  global $theme;
  $path_to_cogito = "/" . drupal_get_path('theme', 'cogito');
  $path_to_child = "/" . drupal_get_path('theme', $theme);

  //If it's not a user uploaded logo and it's not in the child root. look in the /images folder
  $logo = &$variables['logo'];
  if ($logo == url(drupal_get_path('theme', $theme) . "/logo.png", array('absolute'=>TRUE))) {

    if ( !is_file( $root_d7 . "/" . $path_to_child . "/logo.png") && 
          is_file( $root_d7 . "/" . $path_to_child . "/images/logo.png") ){

      $logo = url(drupal_get_path('theme', $theme) . "/images/logo.png");
 
    }
  }