1

I am working on a Swing app that uses native code. Each time I run my project, I get the error message:

log4cplus:ERROR No appenders could be found for logger.

log4cplus:ERROR Please initialize the log4cplus system properly.

Since logging for log4cplus is not properly configured, when ever I get an error somewhere in native code, it's not logged.

I've searched the internet for a solution to this problem all to no avail.

The solution I found said to uninstall AutoDesk 360, but I don't have this installed.

I searched for a .jar file for log4cplus but found a zip instead with files that am not sure how to add to my project.

This can be found here on Github.

log4cplus

If I right-click on my project and go to find and type log4cplus, nothing with that name exists in my project. The same search for log4j brings up the log4j.properties file and a whole list of other usages

Ojonugwa Jude Ochalifu
  • 26,627
  • 26
  • 120
  • 132

1 Answers1

-2

The error means that you have not set up log4cplus. Make sure that you have you given it a configuration file, or used the API to configure it. For an example of the latter, see the following C++ example from the project page:

// Initialization and deinitialization.
log4cplus::Initializer initializer;

log4cplus::BasicConfigurator config;
config.configure();

log4cplus::Logger logger = log4cplus::Logger::getInstance(
    LOG4CPLUS_TEXT("main"));
LOG4CPLUS_WARN(logger, LOG4CPLUS_TEXT("Hello, World!"));
return 0;

But, unless there is a reason to use log4cplus, I'd recommend you to use log4j instead, a Java logger that log4cplus is a copy of.

raahlb
  • 195
  • 2
  • 10
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/19934293) – Jan B. Jun 05 '18 at 14:34
  • I did specify that the Error message was because he had not set it up, and should do it using a configuration file or the API. Should I rephrase it as a statement instead of a question? – raahlb Jun 05 '18 at 15:23
  • Yep. Try to get all the answers you still need to answer a question through comments. The answer should not contain any call backs or questions as this typically leads to posts that are continuously edited or amended until all facts are on the table. As you'd need 50 rep points to comment, it frequently misleads to misuse answers as comments. Then those posts are flagged and pushed to the review cycle. Best you try to reach the 50 rep with 2 or 3 well-received questions or answers. It's both a blessing and a curse at the same time :) – Jan B. Jun 05 '18 at 16:22
  • OK, I see. I've now removed all questions. Hope the answer is acceptable. Regardless, thanks. – raahlb Jun 06 '18 at 19:49