You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by HJD <ha...@yahoo.com> on 2010/10/18 08:55:39 UTC

Could not instantiate appender named "console"

Hi all,
I'm running my program and I want to log program activities using log4j.
First, I set the log4j to DEBUG level and to write in the file, but what is
written in the file is just at INFO level.
Second, I set it to write on the console and I get these errors:

log4j:ERROR Could not find value for key log4j.appender.console
log4j:ERROR Could not instantiate appender named "console".

and this is my log4j.properties file content:

# Root logger option
log4j.rootLogger=debug, console, file

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.Threshold=DEBUG
log4j.appender.file.File=C:\\logfile.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
%m%n

# Direct log messages to stdout
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=DEBUG
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[%t:%p] %c: %m%n
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
%m%n


Does anyone have any idea?
Regards,
Hamed
-- 
View this message in context: http://old.nabble.com/Could-not-instantiate-appender-named-%22console%22-tp29987859p29987859.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: Could not instantiate appender named "console"

Posted by "GALLAGHER, RON (ATTSI)" <RG...@att.com>.
Hamed,

I believe this is the key message for you:

Could not find value for key log4j.appender.console

You've configured an appender named "CONSOLE", but you haven't
configured one named "console".  Case matters.

Change these three lines:

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[%t:%p] %c: %m%n

to this:

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=[%t:%p] %c: %m%n

and you should see better results.

Ron Gallagher

-----Original Message-----
From: HJD [mailto:hamed_hjd@yahoo.com] 
Sent: Monday, October 18, 2010 2:56 AM
To: log4j-user@logging.apache.org
Subject: Could not instantiate appender named "console"


Hi all,
I'm running my program and I want to log program activities using log4j.
First, I set the log4j to DEBUG level and to write in the file, but what
is
written in the file is just at INFO level.
Second, I set it to write on the console and I get these errors:

log4j:ERROR Could not find value for key log4j.appender.console
log4j:ERROR Could not instantiate appender named "console".

and this is my log4j.properties file content:

# Root logger option
log4j.rootLogger=debug, console, file

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.Threshold=DEBUG
log4j.appender.file.File=C:\\logfile.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
%m%n

# Direct log messages to stdout
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=DEBUG
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[%t:%p] %c: %m%n
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L
-
%m%n


Does anyone have any idea?
Regards,
Hamed
-- 
View this message in context:
http://old.nabble.com/Could-not-instantiate-appender-named-%22console%22
-tp29987859p29987859.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org