Showing results for 
Search instead for 
Did you mean: 

Using Log4j2 with AIM

Is Anet 1.9.9 SDK AIM compaitable with log4j2?


I have the logging set to where I want it using lig4j1 but I've upgraded to log4j2 and it doesn't seem like my settings are being recognized. I've included the following from the SDK resources in my  I've also tried replacing log4j with log4j2 below without success.  I still get warnings and info from the SDK even with the root level set to FATAL., R




Any help would be appreciated.



My full


rootLogger.level = fatal
rootLogger.appenderRefs = console, rolling
rootLogger.appenderRef.console.ref = STDOUT
rootLogger.appenderRef.rolling.ref = FILE

# Tell the root logger what appenders and level to use
appenders = console, rolling

##### Console Appender ##### = STDOUT
appender.console.type = Console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss z} %-5p %m%n

##### File Appender ##### = FILE
appender.rolling.type = RollingFile
appender.rolling.fileName = myfile.log
appender.rolling.filePattern = myfile.log
appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss z} %-5p %m%n
appender.rolling.layout.type = PatternLayout
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size = 5MB
#appender.rolling.strategy.type = DefaultRolloverStrategy

##### #####, STDOUT





I contacted support but they couldn't find any documentation on ANet SDK logging.  I cross posted to Stack Overflow with more details.  Any help on this would be appretiated.


It turns out that Authorize.Net is using commons-logging to abstract the logger implementation provided by log4j2.  commons-logging goes through a very specific process to determine which logger implementation to use and if one is not found the JDK's SimpleLogger is used.  In this specific case I was missing a critical log4j2 jar file that provided a String constructor needed by commons-logging, log4j-jcl.jar.  After including that on the classpath along with the api and core jars I am able to control's logging. 

For completeness, this is a log4j2.xml file that will allow you to control the log output of  There seems  to be a problem with using or specifying logger configs in a .properties file so use the new log4j2.xml format instead.

Tip: In the XML file you can specify a root name for a logger and the settings will apply to all sub-classed loggers. As an example

<Logger name="org.apache.http">

Will apply to any logger that has that root as in:

<Logger name="org.apache.http.wire">
            - and -
<Logger name="org.apache.http.headers">

Here is the working log4j2.xml file that suppresses all debug messages for Its a good example of overriding the root logger level:


<?xml version="1.0" encoding="UTF-8"?>


    <Console name="console">
      <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss z} %-5p %-5level %logger - %msg%n"/>

    <File name="file" fileName="mylogfile.log" append="true">
      <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss z} %-5p %-5level %logger - %msg%n"/>
    </File >

    <Root level="DEBUG">
      <AppenderRef ref="console"/>
      <AppenderRef ref="file"/>

    <Logger name="org.apache.http" level="WARN" additivity="false">
      <AppenderRef ref="console"/>
      <AppenderRef ref="file"/>

    <Logger name="net.authorize.util" level="WARN" additivity="false">
      <AppenderRef ref="console"/>
      <AppenderRef ref="file"/>

    <Logger name="net.authorize.api" level="WARN" additivity="false">
      <AppenderRef ref="console"/>
      <AppenderRef ref="file"/>