Skip to content

Instantly share code, notes, and snippets.

@zedtux
Created January 12, 2014 17:10
Show Gist options
  • Save zedtux/8387522 to your computer and use it in GitHub Desktop.
Save zedtux/8387522 to your computer and use it in GitHub Desktop.
C++: Créer des logs - Créer un premier log !
#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