logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Fester <afes...@apache.org>
Subject Re: Newbie Question: No appenders could be found
Date Sun, 26 Feb 2006 13:13:21 GMT
Yang Xiang wrote:
> I have a C++ app which was compiled and linked with log4cxx. I am using
> the default configuration
>  
> log4j.rootLogger = DEBUG, A1
> log4j.appender.A1 = org.apache.log4j.ConsoleAppender
> log4j.appender.A1.layout = org.apache.log4j.PatternLayout
> log4j.appender.A1.layout.ConversionPattern = t-%-60c%m%n

I used your configuration with the sample application "examples/trivial"
and it works quite well:

t-root                                                        debug message
t-root                                                        info message
t-root                                                        warn message
t-root                                                        error message
t-root                                                        fatal message

What I did is to remove the call to BasicConfigurator::configure() in the
trivial.cpp example, and created a file log4j.properties in the examples
directory which contains exactly your configuration.

If you do not call any Configurator, log4cxx looks for the files
log4cxx.properties, log4cxx.xml, log4j.properties and log4j.xml
in the current directory and uses them. Alternatively you can call
PropertyConfigurator::configure(LOG4CXX_FILE(PathToYourConfigFile))
to have better control over which file is used.

> But it gives me error on my app startup:
> No appenders could be found for logger
> (mrw.fn.__gnu_cxx.__common_pool_policy<__gnu_cxx.__pool,
> true>._S_get_pool).
> Please initialize the log4cxx system properly.
> Could not instantiate class [org.apache.log4j.ConsoleAppender].
> Class 'org.apache.log4j.ConsoleAppender' not found
> Could not instantiate appender named "A1".
>  
> Do I need to install log4j classes in order to instantiate a console
Definitely not :-)

> appender? All I need is for log4cxx to printout debug information to a
> file.

That should be simple, just start with the trivial.cpp example
shipped with log4cxx...

Best Regards,

	Andreas

Mime
View raw message