Advertisement
Guest User

Untitled

a guest
Aug 16th, 2011
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <log4php:configuration xmlns:log4php="http://logging.apache.org/log4php/">
  3. <appender name="myAppender" class="LoggerAppenderFile">
  4. <param name="file" value="myLog.log" />
  5. </appender>
  6. <root>
  7. <level value="WARN" />
  8. <appender_ref ref="myAppender" />
  9. </root>
  10. </log4php:configuration>
  11.  
  12.  
  13. <?php
  14. ini_set('error_reporting', E_ALL);
  15. ini_set('display_errors', 1);
  16.  
  17.  
  18.  
  19. // Insert the path where you unpacked log4php
  20. include('log4php/Logger.php');
  21.  
  22. // Tell log4php to use our configuration file.
  23. Logger::configure('log4php.xml');
  24.  
  25. // Fetch a logger, it will inherit settings from the root logger
  26. $log = Logger::getLogger('myLogger');
  27.  
  28. // Start logging
  29. $log->trace("My first message."); // Not logged because TRACE < WARN
  30. $log->debug("My second message."); // Not logged because DEBUG < WARN
  31. $log->info("My third message."); // Not logged because INFO < WARN
  32. $log->warn("My fourth message."); // Logged because WARN >= WARN
  33. $log->error("My fifth message."); // Logged because ERROR >= WARN
  34. $log->fatal("My sixth message."); // Logged because FATAL >= WARN
  35.  
  36.  
  37. echo "Testing loging! - 4";
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement