2

I have a strange problem whereby my log4j logging works when deployed on tcServer but not on WebSphere 6.1. The file name that I've specified in the log4j is created. However, it is not populated even though the other Websphere logs (SystemOut.log etc) are. I've checked my WebSphere's home directory's properties directory, and there are no conflicting log4j files located there.

The strangest thing is that it works fine on tcServer so it can't be a problem with the log4j file itself. It seems like some environmental issue. Has anyone any ideas on how to resolve this?

Thanks

DJ180
  • 18,724
  • 21
  • 66
  • 117
  • Are you including any libraries which use Commons Logging? Are you saying that your log4j statements *are* appearing in SystemOut.log? – dbreaux Sep 02 '11 at 13:51
  • @dbreaux - Yes for me, it is going to sysouts ,, but not to the file, what i am missing? – AngryJS May 26 '16 at 13:00
  • @AngryJS see if this helps: http://stackoverflow.com/a/8138477/796761 – dbreaux May 26 '16 at 21:10

2 Answers2

3

Log4j and WAS have worked for good way too many applications. So this combination is not new by any means. Do you use any wrapper for log4j (e.g Commons Logging)?

Turn on debugging for log4j.

-Dlog4j.debug=true to the WAS JVM Arguments.

This will provide information about what log4j is trying to do.

This should provide some clues to what is happening in the WAS environment.

HTH

Manglu

Manglu
  • 10,744
  • 12
  • 44
  • 57
1

We had an issue a while back when we installed a JCA connector in WebSphere that came packaged with it's own log4j lib. Since connectors gets loaded into the container classloader hierarchy, the log4j lib in the connector effectively overrode the log4j in our application. It also prevented our own log4j properties from being loaded, since log4j was already bootstrapped.

It would be that you, also, have some other library or resource loaded in your WAS stack that comes with log4j. The way we got around it was doing explicit log4j initialization (reading the log4j properties) programatically in our application.

pap
  • 27,064
  • 6
  • 41
  • 46