Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Configuring Log4j
Configuring Log4j [message #771256] Mon, 26 December 2011 19:39 Go to next message
John Lussmyer is currently offline John LussmyerFriend
Messages: 100
Registered: December 2010
Senior Member
So, everytime I start up my product, I get log4j warnings about it not being initialized properly.
So, I added the org.apache.log4j bundle dependency.
I also created a "resources" folder, put a log4j.properties in it, and marked it as a Source folder for the project.

Still complains about not being initialized.

What else do I have to do?
Re: Configuring Log4j [message #771645 is a reply to message #771256] Tue, 27 December 2011 20:45 Go to previous messageGo to next message
John Lussmyer is currently offline John LussmyerFriend
Messages: 100
Registered: December 2010
Senior Member
Well, I gave up on doing it the "right" way, and ended up doing this in my Application source file:

	public Object start( IApplicationContext context) {
		File log4jprops = new File("log4j.properties");
		System.out.println("Log4j at: " + log4jprops.getAbsolutePath());
		if (log4jprops.exists())
			PropertyConfigurator.configure(log4jprops.getAbsolutePath());

It event tells me where I should put the file.

[Updated on: Tue, 27 December 2011 20:45]

Report message to a moderator

Re: Configuring Log4j [message #778782 is a reply to message #771645] Fri, 13 January 2012 20:24 Go to previous message
Martin Bradley is currently offline Martin BradleyFriend
Messages: 1
Registered: January 2012
Junior Member
You need to use a fragment project to hold your log4j configuration file, the fragment indicates that the host project is the bundle/plugin that contains the log4j jar. Your app depends on the log4j plugin, when the log4j plugin gets loaded it equinox pulls in the associated fragments automatically. Log4j initialises itself via the configuration file in the fragment and you've no explicit coding to do.

See stackoverflow.com/questions/5150415/log4j-under-osgi-eclipse-rcp
which explains about using a fragment.

thanks,
Martin
Previous Topic:Detect right click on tab?
Next Topic:How to access configuration directory
Goto Forum:
  


Current Time: Mon Nov 30 00:08:24 GMT 2020

Powered by FUDForum. Page generated in 0.05739 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top