MATLAB: Do I see errors about NTLM in the logs if using log4j inside MATLAB 7.14 (R2012a)

MATLAB

I want to use log4j in my MATLAB functions to provide logging facilities. After loading and configuring log4j however, I sometimes see the following (or similar) messages appearing in my logs:
21 Aug 2012 07:11:07,830 INFO [pool-5-thread-3] auth.AuthChallengeProcessor - ntlm authentication scheme selected
21 Aug 2012 07:11:07,971 ERROR [pool-5-thread-3] httpclient.HttpMethodDirector - Credentials cannot be used for NTLM authentication: org.apache.commons.httpclient.UsernamePasswordCredentials
Where are these messages coming from and how can I suppress them?

Best Answer

By default MATLAB configures the following Java system properties:
org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog
Which specifies that SimpleLog should be used as logging facility. Note that by loading log4j you will override this setting and log4j will be used instead!
org.apache.commons.logging.simplelog.log.org.apache.axis2.transport.http = off
org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient = off
Which specify that SimpleLog should ignore messages from the "org.apache.axis2.transport.http" and "org.apache.commons.httpclient" packages. However, given that SimpleLog is not used anymore after loading log4j, these options no longer have any effect. And messages from these packages will show up in your log4j logs.
To prevent the messages from showing up in your log4j logs you will need to configure log4j to ignore the packages mentioned above. There are various ways to accomplish this. When working with a log4j properties-file, one way to accomplish this is to add the following two lines to the properties-file:
log4j.logger.org.apache.axis2.transport.http=OFF
log4j.logger.org.apache.commons.httpclient=OFF
Related Question