Created
January 12, 2014 17:10
-
-
Save zedtux/8387522 to your computer and use it in GitHub Desktop.
C++: Créer des logs - Créer un premier log !
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
#include | |
// include log4cxx header files. | |
#include "log4cxx/logger.h" | |
#include "log4cxx/basicconfigurator.h" | |
#include "log4cxx/propertyconfigurator.h" | |
#include "log4cxx/helpers/exception.h" | |
using namespace log4cxx; | |
using namespace log4cxx::helpers; | |
LoggerPtr logger(Logger::getLogger("Main")); | |
int main(int argc, char **argv) | |
{ | |
try | |
{ | |
if ( argc == 0 ) | |
{ | |
BasicConfigurator::configure(); | |
} else { | |
PropertyConfigurator::configure( argv[1] ); | |
} | |
LOG4CXX_INFO(logger, "Ma première ligne de log avec log4cxx !"); | |
} catch(Exception&) | |
{ | |
return EXIT_FAILURE; | |
} | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment