Created
February 21, 2013 03:19
-
-
Save zerohours/5001768 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* log.cpp | |
* | |
* Copyright 2013 Julio Cesar Brizuela @zerohours | |
* | |
*/ | |
#include <iostream> | |
#include <log4cpp/Category.hh> | |
#include <log4cpp/FileAppender.hh> | |
#include <log4cpp/SimpleLayout.hh> | |
#define LOGFILE "/home/usuario/test.log" | |
int main() | |
{ | |
/*Setting up Appender, layout and Category*/ | |
log4cpp::Appender *appender = new log4cpp::FileAppender("FileAppender",LOGFILE); | |
log4cpp::Layout *layout = new log4cpp::SimpleLayout(); | |
log4cpp::Category& category = log4cpp::Category::getInstance("Category"); | |
appender->setLayout(layout); | |
category.setAppender(appender); | |
category.setPriority(log4cpp::Priority::INFO); | |
/*The actual logging*/ | |
category.info("Esto es para trazar el flujo de sistema"); | |
category.notice("Esto es para notificar determinados eventos"); | |
category.warn("Esto es para generar ciertas advertencias"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment