• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

log4j.properties insanity

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
Do Re Mi Fa So La Tiny Ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic