mcatan 2004/04/18 00:26:30
Modified: docs introduction.dox
Log:
fixed examples source code
Revision Changes Path
1.4 +29 -7 logging-log4cxx/docs/introduction.dox
Index: introduction.dox
===================================================================
RCS file: /home/cvs/logging-log4cxx/docs/introduction.dox,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- introduction.dox 10 Apr 2004 21:50:00 -0000 1.3
+++ introduction.dox 18 Apr 2004 07:26:30 -0000 1.4
@@ -454,7 +454,10 @@
// include log4cxx header files.
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
+#include <log4cxx/helpers/exception.h>
+
using namespace log4cxx;
+using namespace log4cxx::helpers;
// Define a static logger variable so that it references the
// Logger instance named "MyApp".
@@ -488,7 +491,7 @@
class.
<code>MyApp</code> uses the <code>Bar</code> class defined in the
-header file <code>com/foo/bar.h</code>.
+header file <code>com/foo/bar.h</code> and the source file
<code>bar.cpp</code>.
@code
// file <com/foo/bar.h>
@@ -501,18 +504,32 @@
{
class Bar
{
- static Logger logger =
Logger::getLogger(_T("com.foo.bar"));
+ static log4cxx::LoggerPtr logger;
public:
- void doIt()
- {
- logger->debug(_T("Did it again!"));
- }
+ void doIt();
};
};
};
@endcode
[EMAIL PROTECTED]
+// file <bar.cpp>
+
+#include "com/foo/bar.h"
+
+using namespace com::foo;
+using namespace log4cxx;
+
+LoggerPtr Bar::logger = Logger::getLogger(_T("com.foo.bar"));
+
+void Bar::doIt()
+{
+ logger->debug(_T("Did it again!"));
+}
[EMAIL PROTECTED]
+
+
The invocation of the [EMAIL PROTECTED] log4cxx::BasicConfigurator::configure
BasicConfigurator::configure} method creates a rather simple log4cxx setup.
This method is hardwired to add to the root logger [EMAIL PROTECTED]
@@ -555,7 +572,10 @@
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/propertyconfigurator.h>
+#include <log4cxx/helpers/exception.h>
+
using namespace log4cxx;
+using namespace log4cxx::helpers;
// Define a static logger variable so that it references the
// Logger instance named "MyApp".
@@ -569,7 +589,9 @@
if (argc > 1)
{
// BasicConfigurator replaced with PropertyConfigurator.
- PropertyConfigurator::configure(argv[1]);
+ USES_CONVERSION;
+ String propertyFileName = A2W(argv[1]);
+ PropertyConfigurator::configure(propertyFileName);
}
else
{