When the URL has characters like äöå and other non ISO-8859-1 characters, the insert throws an exception.
PDOException: in dblog_watchdog() (line 154 of C:\inetpub\wwwroot\Hevospiste\modules\dblog\dblog.module).
This can be solved by urlencoding the line before entering it to the database.
Working code:
function dblog_watchdog(array $log_entry) {
Database::getConnection('default', 'default')->insert('watchdog')
->fields(array(
'uid' => $log_entry['uid'],
'type' => substr($log_entry['type'], 0, 64),
'message' => $log_entry['message'],
'variables' => serialize($log_entry['variables']),
'severity' => $log_entry['severity'],
'link' => substr($log_entry['link'], 0, 255),
'location' => urlencode($log_entry['request_uri']),
'referer' => $log_entry['referer'],
'hostname' => substr($log_entry['ip'], 0, 128),
'timestamp' => $log_entry['timestamp'],
))
->execute();
}