log4cpp-29/10

709 views

Published on

log4cpp-29/10

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
709
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

log4cpp-29/10

  1. 1. Log4cpp in auction Angus Chen March 9, 2007
  2. 2. Why and when writing logs <ul><li>debug message. </li></ul><ul><li>error handle. </li></ul><ul><li>system monitor. </li></ul>
  3. 3. History <ul><li>v1. cerr, cout to standard output or error, or directly open and write into file </li></ul><ul><li>v2. YAX_YLOG, define DEBUG level. </li></ul><ul><li>v3. log4cpp, full configurable. </li></ul>
  4. 4. log4cpp concept <ul><li>logger a.b.c.d.e=>logger category. </li></ul><ul><li>log appender=> output log writer. </li></ul><ul><li>use configuration file to define which logger uses which kind of appender. </li></ul>
  5. 5. Usage <ul><li>step1. </li></ul><ul><li>#include <auctions/log/yapLogcpp.h> </li></ul><ul><li>class xxx{ </li></ul><ul><li>static LoggerPtr logger; </li></ul><ul><li>} </li></ul><ul><li>step2. </li></ul><ul><li>LoggerPtr xxx::logger=getLogger(&quot;myauc.UserWatchingBO&quot;); </li></ul><ul><li>step3. </li></ul><ul><li>if(DEBUG_ENABLE){ </li></ul><ul><li>logdebug(logger)<< &quot;from is &quot;<<from; </li></ul><ul><li>} </li></ul>
  6. 6. Writing a testcase <ul><li>void setUp(){ Yahoo::Taiwan::Auction::yapLogcpp::test(); </li></ul><ul><li>} </li></ul>
  7. 7. Configuration <ul><li>default show message > debug level. </li></ul><ul><li>else read all files in /home/y/conf/yap_logcpp/ </li></ul><ul><li>log file and reference http://twiki.corp.yahoo.com/view/Devel/log4cpp_y </li></ul>
  8. 8. Q&A

×