Hi,
Indeed, you cann add a "magic" to link command in order to precise that all symbols of the log4cxx library must be imported in your sample :
g++ -o sample sample.cpp -Wl,--whole-archive,-llog4cxx,--no-whole-archive -llibxml2
this trick is specific to the static lib. If you compile the log4cxx dynamic library (using Jwahar Bammi trick, I have no other solution for the moment), all symbols are automatically loaded at runtime.
Regards,
Maarten Boekhold wrote:
Hi,
I'm trying to link a program against the static log4cxx library (liblog4cxx.a, under cygwin). The linking itself succeeds, but executing the resulting program fails with:
Could not instantiate class [org.apache.log4j.ConsoleAppender]. Class 'org.apache.log4j.ConsoleAppender' not found Could not instantiate appender named "Console".
Is static linking supported at all? If so, is there any magic required in the link command?
Kind regards, Maarten
ps. I'm initializing log4cxx in this program with:
Properties props; string s_log_pattern = "%d{yyyy/MM/dd HH:mm:ss.SSS} %-5p : %m%n";
props.setProperty(string("log4j.appender.Console"),
string("org.apache.log4j.ConsoleAppender"));
props.setProperty(string("log4j.appender.Console.layout"),
string("org.apache.log4j.PatternLayout"));
props.setProperty(string("log4j.appender.Console.layout.ConversionPattern"),
s_log_pattern);
props.setProperty(string("log4j.rootLogger"),
string("ALL,Console"));
LogManager::resetConfiguration(); PropertyConfigurator::configure(props);
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
-- Micha�l CATANZARITI log4cxx project manager
log4cxx user mailing list:
mailto:[EMAIL PROTECTED] log4cxx developer mailing list:
mailto:[EMAIL PROTECTED]
