i am using log4php library log errors only to console (stdout). But when I run my code on browser, it outputs on the browser, which I don't want to happen.
I already referred and tried logs php error but not display it in browser, but none of those answers worked out for me my code is simple.
<?php
error_reporting(E_ERROR | E_PARSE);
error_reporting(0);ini_set('display_errors', 'Off');
require_once("log4php/Logger.php");
$logger = Logger::getLogger("main");
$logger->info("This is an informational message.");
$logger->warn("I'm not feeling so good...");
Configuration file:
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderConsole">
<layout class="LoggerLayoutSimple" />
</appender>
<root>
<appender_ref ref="default" />
</root>
This outputs on the browser,
INFO - This is an informational message. WARN - I'm not feeling so good...
I want it to be only on stdout. Please let me know if my understanding is wrong about stodut in this case
EDIT MY WORKING CODE AFTER THE ANSWER:
<?php
require_once("log4php/Logger.php");
Logger::configure("log4php/config.xml");
$logger = Logger::getLogger("default");
$logger->info("This is an informational message.");
$logger->warn("I'm not feeling so good...");