Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <log4php:configuration xmlns:log4php="http://logging.apache.org/log4php/">
- <appender name="myAppender" class="LoggerAppenderFile">
- <param name="file" value="myLog.log" />
- </appender>
- <root>
- <level value="WARN" />
- <appender_ref ref="myAppender" />
- </root>
- </log4php:configuration>
- <?php
- ini_set('error_reporting', E_ALL);
- ini_set('display_errors', 1);
- // Insert the path where you unpacked log4php
- include('log4php/Logger.php');
- // Tell log4php to use our configuration file.
- Logger::configure('log4php.xml');
- // Fetch a logger, it will inherit settings from the root logger
- $log = Logger::getLogger('myLogger');
- // Start logging
- $log->trace("My first message."); // Not logged because TRACE < WARN
- $log->debug("My second message."); // Not logged because DEBUG < WARN
- $log->info("My third message."); // Not logged because INFO < WARN
- $log->warn("My fourth message."); // Logged because WARN >= WARN
- $log->error("My fifth message."); // Logged because ERROR >= WARN
- $log->fatal("My sixth message."); // Logged because FATAL >= WARN
- echo "Testing loging! - 4";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement