diff --git a/config-templates/config.php b/config-templates/config.php
index 9db884449ac301553c97d0058633db515f2ea583..71ad261a70850ed4875b4f3aa5bda1b0fc57092c 100644
--- a/config-templates/config.php
+++ b/config-templates/config.php
@@ -84,7 +84,7 @@ $config = array (
 	 * 
 	 * Choose logging handler.
 	 * 
-	 * Options: [syslog,file]
+	 * Options: [syslog,file,errorlog]
 	 * 
 	 */
 	'logging.level'         => LOG_NOTICE,
diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php
index b5c20d7df2a65da527f985055765b2d925fd536f..530469afdb534c9ab9335db38113c5d8b929ace4 100644
--- a/lib/SimpleSAML/Logger.php
+++ b/lib/SimpleSAML/Logger.php
@@ -133,6 +133,9 @@ class SimpleSAML_Logger {
 		} elseif ($handler === 'file')  {
 			require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Logger/LoggingHandlerFile.php');
 			$sh = new SimpleSAML_Logger_LoggingHandlerFile();
+		} elseif ($handler === 'errorlog')  {
+			require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Logger/LoggingHandlerErrorLog.php');
+			$sh = new SimpleSAML_Logger_LoggingHandlerErrorLog();
 		} else {
 			throw new Exception('Invalid value for the [logging.handler] configuration option. Unknown handler: ' . $handler);
 		}
diff --git a/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php b/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php
new file mode 100644
index 0000000000000000000000000000000000000000..bf52f864c51a4ab77aa48b6c124a7196a4753675
--- /dev/null
+++ b/lib/SimpleSAML/Logger/LoggingHandlerErrorLog.php
@@ -0,0 +1,42 @@
+<?php
+
+require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Logger.php');
+
+/**
+ * A class for logging to the default php error log.
+ *
+ * @author Lasse Birnbaum Jensen, SDU.
+ * @author Andreas Ă…kre Solberg, UNINETT AS. <andreas.solberg@uninett.no>
+ * @author Olav Morken, UNINETT AS.
+ * @package simpleSAMLphp
+ * @version $ID$
+ */
+class SimpleSAML_Logger_LoggingHandlerErrorLog implements SimpleSAML_Logger_LoggingHandler {
+
+	/**
+	 * This array contains the mappings from syslog loglevel to names.
+	 */
+	private static $levelNames = array(
+		LOG_EMERG => 'EMERG',
+		LOG_ALERT => 'ALERT',
+		LOG_CRIT => 'CRIT',
+		LOG_ERR => 'ERR',
+		LOG_WARNING => 'WARNING',
+		LOG_NOTICE => 'NOTICE',
+		LOG_INFO => 'INFO',
+		LOG_DEBUG => 'DEBUG',
+		);
+
+
+	function log_internal($level, $string) {
+		if(array_key_exists($level, self::$levelNames)) {
+			$levelName = self::$levelNames[$level];
+		} else {
+			$levelName = sprintf('UNKNOWN%d', $level);
+		}
+
+		error_log($levelName . ': ' . $string);
+	}
+}
+
+?>
\ No newline at end of file