Created
January 12, 2014 17:12
-
-
Save zedtux/8387547 to your computer and use it in GitHub Desktop.
C++: Créer des logs - Finir le main.cpp
This file contains hidden or 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 "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