Start · Sprachen · PHP · Referenz · error_log

error_log

Funktion

Schreibt eine Nachricht ins Error-Log — PHP-Standard-Log oder eigene Datei.

seit PHP 4.0.0 Kategorie: error

Signatur

error_log(string $message, int $message_type = 0, ?string $destination = null, ?string $additional_headers = null): bool

Beschreibung

In Frameworks meist durch strukturiertes Logging (Monolog, Laravel Log) ersetzt.

Parameter

Name Typ Default Beschreibung
$message Pflicht string Nachricht.
$message_type int 0 0=PHP-Log, 1=Mail, 3=Datei.
$destination ?string null Ziel bei type 1/3.

Rückgabewert

Typ
bool
Beschreibung
Erfolg.

Beispiele

Ins PHP-Log

<?php

error_log('[UserService] Registrierung: ' . $email);