This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j.properties insanity

 
John Jackson
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I'm currently running into an insane issue that's making me question my sanity.

The issue with the log4j.properties file and the property key log4j.appender.<logname>.ConversionPattern

Here's the issue. For one particular java project I am working on, log4j refuses to recognize that the 'C' in ConversionPattern is capitalized.

This results in me getting the following error upon startup:

log4j:WARN No such property [conversionPattern] in org.apache.log4j.ConsoleAppender.

I have used -log4j.debug and can confirm that log4j is definitely reading the right property file. And I have tried changing that property key to something insane like:
log4j.appender.<logname>.DonversionPattern which results in the error: log4j:WARN No such property [donversionPattern] in org.apache.log4j.ConsoleAppender.

I have also tried deleting the log4j.properties file and recreating it, with the same issue. I'm using 1.2.15 and I have never had problems with log4j before. This is driving me nuts.

Any suggestions?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,

Welcome to JavaRanch

The issue with the log4j.properties file and the property key log4j.appender.<logname>.ConversionPattern


This should be log4j.appender.<appenderName>.layout.ConversionPattern

Here's an example:
 
John Jackson
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My bad, I should've used <appenderName> (the technical term), but it doesn't solve my issue.

As you can see in my post above my appender name is stdout and I'm almost positive my properties are setup correctly. Log4j certainly isn't complaining about anything other than the fact that there's no such property as conversionPattern, which is perfectly correct except that I never made the 'c' lower case.

For some reason it insists that first character in ConversionPattern is a lower case character and refuses to recognize the property.

I've used this exact same configuration in another project and it works perfect, I've even gone as far as copy the log4j.properties file from another project to this one and it still does the same thing.

I am totally stumped by this.
 
Paul Clapham
Sheriff
Pie
Posts: 20948
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to agree with Jaikiran here. The first example of a log4j.properties file that I grabbed out of my source code has a line like this:
 
John Jackson
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edit:

Ok, problem fixed, thanks to you both.

Here's a question though, how come the same properties file work for another project without the layout additional property?
[ July 10, 2008: Message edited by: John Jackson ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Jackson:

Here's a question though, how come the same properties file work for another project without the layout additional property?



Not sure, but maybe that log4j configuration file is actually not being read and instead some other file is being picked up by log4j.
 
John Norris
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a similar problem in that I'm trying to use the SMTPAppender property set as
log4j.appender.E.SMPTHost=smtp.test.com and with the following error messagelog4j:WARN No such property [SMPTHost] in org.apache.log4j.net.SMTPAppender.

All references I've seen also use SMPTHost, so not sure yet why it won't except it.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
log4j:WARN No such property [SMPTHost] in org.apache.log4j.net.SMTPAppender.


Looks like typo in your properties file. It should be SMTPHost and not SMPTHost. Change it to:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic