Logging from Spring using Log4j under WebSphere


I'm using log4j in my WebSphere application. I need to debug class org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor, so I've created logger in my log4j.xml file:

<pre class="lang-xml prettyprint-override"><logger name="org.springframework"> <level value="INFO" /> </logger> <logger name="org.springframework.ejb.access"> <level value="TRACE" /> </logger>

I've created also commons-logging.properties in src/main/resources of the web project (in maven):




However, Spring is NOT logging using log4j. I see no springframework logs in my debug file, but I can see some of them (INFO) in the console. Therefore I assume, the apache commons logging used by Spring is NOT logging using log4j.

Is it possible (and how) to redirect logging used by Spring to Log4j engine under WebSphere?

WebSphere 7.0, Spring 3.1.2, log4j 1.2.6, commons-logging 1.1 provided in shared library.


Try the following:

<ol><li>Consider using slf4j for your logging. Add log4j to your dependencies in maven.</li> <li>Add jcl-over-slf4j to your maven dependencies. This redirectes each request from jcl to slf4j.</li> <li>Search for the dependency commons-logging inside your maven dependencies. Exclude it, so it does not get to your deployment archive.</li> <li>Delete the "commons-logging.properties"-file.</li> </ol>

I hope that everythings works out fine now.


<a href="https://stackoverflow.com/a/8138477/796761" rel="nofollow">This technique to route JCL (including Spring) logging to your log4j configuration</a> still works.

For the apps where we also have slf4j already (the Spring WebFlow ones), <a href="http://blog.espenberntsen.net/2010/06/06/slf4j-logging-with-log4j-and-jcl/" rel="nofollow">that can also be routed to your log4j configuration</a>.

However, if you just want to see the Spring log information, you can increase its level of logging to WebSphere's own logs (SystemOut.log) via the console's Troubleshooting > Logs and Trace > server-name > Change log level details.

Add something like : org.springframework.ejb.access.*=fine (colon is the separator).

I don't know what the exact WAS levels correspond to, but fine, finer, and finest are listed under the "Trace" levels if you expand the Components and Groups area just to see what is available.

(I don't think it matters that your particular Spring package is not listed under there, BTW. I believe it should still successfully control your logging.)


  • firebase unauth with google doesn't allow change of user
  • How to specify Data type in WSDL when exposed from CXF
  • System call time out?
  • Complex trait requirements on struct
  • What is the equivalent of Android permissions in iOS development? [duplicate]
  • Create registry key in 32-bit hive on x64 PC using Installshield 2012 LE - Avoid redirection
  • Configuring multiple DefaultJmslistenercontainerfactory
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • Are Richfaces and Primefaces compatible with each other?
  • Most efficient way to move table rows from one table to another
  • Does Apportable support to build library binary (.a/.so)?
  • Servlet stops working on Tomcat server after some hits or time
  • cordova is not defined - cordova.js has already been loaded :: Ionic
  • jQuery: add elements until a particular height is reached
  • JPA flush vs commit
  • Bash if statement with multiple conditions
  • Combining two different ActiveRecord collections into one
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • What is the purpose of TaskExecutor in spring?
  • JBoss External Properties Files in Classpath
  • onBackPressed() not being executed
  • How to use carriage return with multiple line?
  • Meteor: Do Something On Email Verification Confirmation
  • Switching to Release Build causes runtime error in Web Reference
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Q promise. Difference between .when and .then
  • Spring Data JPA custom method causing PropertyReferenceException
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • Volley JsonObjectRequest send headers in GET Request
  • Is there a amazon webstore API for customers?
  • How to get a value (ex: baseURL) in every Karate feature?
  • Perl system calls when running as another user using sudo
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Upload files with Ajax and Jquery
  • QuartzCore.framework for Mono Develop
  • How to pass list parameters for each object using Spring MVC?
  • Is there a mandatory requirement to switch app.yaml?
  • AngularJs get employee from factory
  • Proper way to use connect-multiparty with express.js?
  • UserPrincipal.Current returns apppool on IIS