helloworld.c 530 B

123456789101112131415161718192021222324252627
  1. #ifdef HAVE_CONFIG_H
  2. #include "config.h"
  3. #endif
  4. #include <stdio.h>
  5. #include "log4c.h"
  6. int main(int argc, char** argv){
  7. int rc = 0;
  8. log4c_category_t* mycat = NULL;
  9. if (log4c_init()){
  10. printf("log4c_init() failed");
  11. rc = 1;
  12. }else{
  13. mycat = log4c_category_get("log4c.examples.helloworld");
  14. log4c_category_log(mycat, LOG4C_PRIORITY_ERROR, "Hello World!");
  15. /* Explicitly call the log4c cleanup routine */
  16. if ( log4c_fini()){
  17. printf("log4c_fini() failed");
  18. }
  19. }
  20. return rc;
  21. }