Skip to content

Instantly share code, notes, and snippets.

@zedtux
Created January 12, 2014 17:12
Show Gist options
  • Select an option

  • Save zedtux/8387547 to your computer and use it in GitHub Desktop.

Select an option

Save zedtux/8387547 to your computer and use it in GitHub Desktop.
C++: Créer des logs - Finir le main.cpp
#include
#include "classa.h"
#include "classb.h"
// 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, "Entering application.");
ClassA myClass;
ClassB myClass1;
LOG4CXX_INFO(logger, "Exiting application.");
} 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