Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Integrate log4J Logging
Integrate log4J Logging [message #543503] Tue, 29 June 2010 15:40 Go to next message
budili Missing name is currently offline budili Missing nameFriend
Messages: 64
Registered: May 2010

i use in my RCP application log4j as Logger and want now integrate the logging information in the console, inside the application.

The console integration was successful and very easy,
ich have paste the following code in the perspecitve:
final MessageConsole myConsole = new MessageConsole("Console", null); 
        ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { myConsole });
        final MessageConsoleStream stream = myConsole.newMessageStream();

        final PrintStream myS = new PrintStream(stream);

If i use in my code "System.out.println" then i see the logg information in my integrated console. But i dont see the log4j logging. Is here an Appender needed??
Or is my file wrong?
heres the input:
log4j.rootCategory=debug, stdout, R

# Print only messages of priority WARN or higher for your category
# Specifically inherit the priority level

#### First appender writes to console

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} Time:%-4r %-5p [%t] %M (%F:%L) - %m%n
#%5p [%t] (%F:%L) - %m%n

#### Second appender writes to a file

# Control the maximum log file size
# Archive log files (one backup file here)

log4j.appender.R.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} Time:%-4r %-5p [%t] %M (%F:%L) - %m%n

It would be nice, if someone could help me.
Re: Integrate log4J Logging [message #543989 is a reply to message #543503] Thu, 01 July 2010 09:46 Go to previous messageGo to next message
Christophe Fondacci is currently offline Christophe FondacciFriend
Messages: 95
Registered: July 2009
Location: Paris

You definitely need to implement a custom appender skeleton which needs to extend AppenderSkeleton.

Then in your append method, you need to have this kind of code :
		protected void append(LoggingEvent arg0) {
			// If you want to bufferize logs before console creation
			if(console==null) {
			try {
				if(stream==null) {
					stream = console.newMessageStream();
				if(stream!=null && !stream.isClosed()) {
			} catch(IOException e) {
				// Only debugging as this might append when disposing workbench

Re: Integrate log4J Logging [message #547641 is a reply to message #543989] Mon, 19 July 2010 09:00 Go to previous message
budili Missing name is currently offline budili Missing nameFriend
Messages: 64
Registered: May 2010
I have try it, but not successful.

I have wrote the log4j skeleton appender, without success.
Are there some constraints which i have to attend?
Maybe the
The console integration works fine, if i use the System.out.println, i get the logs in my console, but not if i use log.4 - logging.
Previous Topic:Can I put a view into the editor area?
Next Topic:autosave snapshot
Goto Forum:

Current Time: Thu Feb 09 07:13:58 GMT 2023

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

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

Back to the top