You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by BUSCHART Rufus SGI <Ru...@framatome-anp.com> on 2005/02/08 15:00:33 UTC
Using log4cxx with std::cout under MFC
Hi Guys,
I would like to have log4cxx to send the logging-messages to std::cout. I'm
using log4cxx under MS VC++ and have cout redirected to a console window. I
do have the following lines in my .h file
[...]
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/helpers/exception.h>
[...]
using namespace std;
using namespace log4cxx;
using namespace log4cxx::helpers;
static LoggerPtr logger(Logger::getLogger("ATXImporteur"));
[...]
and in the corresponding .cpp file
[...]
BasicConfigurator::configure();
[...]
LOG4CXX_INFO(logger,"Test");
[...]
I was hoping this would log the message "Test" to the console but
unfortunately nothing happens. Do you have any ideas what to do? Of course
the program compiles and links well and cout << "Test" << endl; works fine
too.
Thanks and best regards,
Rufus Buschart
--------------------------------------------------------
Rufus J.W. Buschart Framatome ANP
Framatome ANP GmbH
SGI
Freyeslebenstraße 1
Gebäude 86 / 2014
91058 Erlangen S F
Tel.: + 49 9131 1892618
Fax.: + 49 9131 1894814
Mobil: + 49 178 5929315
e-mail: rufus.buschart@framatome-anp.com
Re: Using log4cxx with std::cout under MFC
Posted by Curt Arnold <ca...@houston.rr.com>.
You didn't mention if you were using the CVS HEAD or the 0.9.7 release.
If you are using the CVS HEAD, it is a problem that I have observed but
haven't had a chance to analyze. The Ant script runs the unit tests
which are all passing and then compile and run examples/trivial and
examples/stream which should resulting in log statements appearing in
the build log, but they don't. They fail on both Windows and Linux,
but in different ways and if you build from the Visual Studio IDE, the
programs work fine.
Since the unit tests pass, my assumption is that the problem is either
with the BasicConfigurator or ConsoleAppender which is rarely used
within the unit tests. You may be able to avoid the problem by using a
PropertyConfigurator.
I've logged this issue as http://issues.apache.org/jira/browse/LOGCXX-56
On Feb 8, 2005, at 8:00 AM, BUSCHART Rufus SGI wrote:
> Hi Guys,
>
> I would like to have log4cxx to send the logging-messages to
> std::cout. I'm
> using log4cxx under MS VC++ and have cout redirected to a console
> window. I
> do have the following lines in my .h file