2

I added a bunch of logging to a specific class that's been giving me troubles, ramped up the log4j.properties file and expected to see a ton of debugging information.

While I do see more info the messages from one, specific class-- the one I was most interested in-- seems to be completely missing.

Oddly enough, I copied log4j.properties file from the test server-- where it was, indeed, outputting the right info-- over to the production server-- they're identical.

Here's the contents of the log4j.properties:

log4j.debug=false

log4j.rootLogger=INFO, S

log4j.category.com.communitect=DEBUG, F1, S
log4j.additivity.com.communitect=false

log4j.appender.F1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.F1.DatePattern='.'yyyy-MM-dd
log4j.appender.F1.File=${catalina.base}/logs/smilereminder_log
log4j.appender.F1.layout=org.apache.log4j.PatternLayout
log4j.appender.F1.layout.ConversionPattern=%d %5p [%t] (%c{2}) - %m%n

log4j.appender.S=org.apache.log4j.ConsoleAppender
log4j.appender.S.layout=org.apache.log4j.PatternLayout
log4j.appender.S.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n

That file is in the lib directory of my Tomcat install.

The package I see nothing from is this:

package com.communitect.business;

The way I declare the logger is this:

static private final Logger logger = Logger.getLogger( PersonalReminderRules.class );

All of the messages from this class show up on my test server so I know the log4j.properties file should work great.

I looked around for an additional log4j.properties file but there doesn't seem to be one. There isn't an .xml configuration file, either.

Something's eluding me. Any ideas?

8
  • If Test and Production have the same log4j.properties (and neither has a log4j.xml file), the difference should be in the code. Maybe there are some kind of "DEBUG_MODE" flags in the code? Nov 15, 2011 at 16:23
  • Stupid question but the PersonalReminderRules.class argument is correct, right? It isn't a cut-and-paste error right? Are you sure that there isn't a log4j.properties file hiding in your classpath?
    – Gray
    Nov 15, 2011 at 16:27
  • 1
    So it appears that the appVoice WebApp context had a log4j.jar in it. Removing it seems to have fixed the problem.
    – aimzies
    Nov 15, 2011 at 16:46
  • 2
    Can you please add the solution as an answer rather than as an edit to your question? You can then select yours as the correct answer and close out your question. It may seem strange, but it is the preferred way of dealing with situations like this.
    – user1228
    Nov 18, 2011 at 15:11
  • 1
    @amy_half you should post your solution as a real answer (which you can accept later).
    – oers
    Nov 18, 2011 at 15:11

1 Answer 1

1

@oers, good idea, thank you! :)

Here was the solution we found:

So it appears that the appVoice WebApp context had a log4j.jar in it. Removing it seems to have fixed the problem.

I'm assuming that classloading the webapps "overrode" the classes loaded originally and consequently with a brand new configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.