This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes log4j.properties insanity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j.properties insanity" Watch "log4j.properties insanity" New topic
Author

log4j.properties insanity

John Jackson
Greenhorn

Joined: Jul 09, 2008
Posts: 6
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

Joined: Jul 20, 2005
Posts: 10146
    
165

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:


[My Blog] [JavaRanch Journal]
John Jackson
Greenhorn

Joined: Jul 09, 2008
Posts: 6
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
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Jul 09, 2008
Posts: 6
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

Joined: Jul 20, 2005
Posts: 10146
    
165

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

Joined: Jul 22, 2008
Posts: 14
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

Joined: Jul 20, 2005
Posts: 10146
    
165

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:

 
GeeCON Prague 2014
 
subject: log4j.properties insanity