log4j log does not work in Websphere when the class loader parameter is parent first

advertisements

I am having two problems. In my application we are using custom email functionality with javax.mail api. Mails are going fine with out any error when the class loader setting is kept as Parent First but custom logs are not getting generated with that class loader setting.

When I update the class loader to Parent Last then logs are getting generated but the custom email functionality is not working, its getting freezed at message.saveChanges(); line and server is throwing time out error.

I have mail.jar & log4j.jar included in the WEB-INF/lib of the application and the log4j.properties file is present in the classes folder

Could any one please let me know what is causing this issue and Is there a way to make both logging and email functionality work with a single class loader setting.

Thanks.


This most likely is caused because Log4J doesn't load the configuration file (log4j.xml or log4j.properties) that you think it does.

Add the log4j.debug=true system property, restart the server and watch the logs. The logs (in SystemOut.log or SystemErr.log) will tell you exactly which configuration file was loaded.