From: Daniel M. <tub...@us...> - 2003-03-24 21:18:38
|
Update of /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0402/rtk In directory sc8-pr-cvs1:/tmp/cvs-serv11196/src/com/tucows/oxrs/epp0402/rtk Modified Files: RTKBase.java Log Message: updates to the RTKBase class in all EPP versions to use log4j for logging and added config for it in rtk.properties. upgraded ant jar to 1.5.2 because javadoc was failing (update license as well) added log4j jar and licence : Modified Files: : LICENSE.ANT build.bat build.sh build.xml run_example.bat : run_example.sh etc/rtk.properties lib/ant.jar : src/com/tucows/oxrs/epp02/rtk/RTKBase.java : src/com/tucows/oxrs/epp0402/rtk/RTKBase.java : src/com/tucows/oxrs/epp0503/rtk/RTKBase.java : src/com/tucows/oxrs/epp0604/rtk/RTKBase.java : src/com/tucows/oxrs/epp0705/rtk/RTKBase.java : Added Files: : LICENSE.LOG4J lib/log4j.jar Index: RTKBase.java =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/java/src/com/tucows/oxrs/epp0402/rtk/RTKBase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RTKBase.java 21 Mar 2003 16:35:34 -0000 1.1 --- RTKBase.java 24 Mar 2003 21:18:00 -0000 1.2 *************** *** 33,36 **** --- 33,37 ---- import java.util.*; import java.io.*; + import org.apache.log4j.*; /** *************** *** 82,85 **** --- 83,88 ---- private static Properties rtk_properties_ = null; + private static Logger logger_ = null; + /** * DateFormat for "yyyy-MM-dd'T'hh:mm:ss.0'Z'". *************** *** 116,120 **** try { ! String rtk_debuglevel_str = (String) RTKBase.getRTKProperties().getProperty("rtk.debuglevel"); rtk_debuglevel = Integer.parseInt(rtk_debuglevel_str); } --- 119,123 ---- try { ! String rtk_debuglevel_str = (String) RTKBase.getRTKProperties().getProperty("rtk.debug.level"); rtk_debuglevel = Integer.parseInt(rtk_debuglevel_str); } *************** *** 123,127 **** // Couldn't parse the debuglevel setting -- maybe it wasn't an integer // Anyhoo -- we'll just use the default of level 1. ! System.err.println("couldn't parse the rtk.debuglevel ... maybe it wasn't a number"); } --- 126,130 ---- // Couldn't parse the debuglevel setting -- maybe it wasn't an integer // Anyhoo -- we'll just use the default of level 1. ! System.err.println("couldn't parse the rtk.debug.level property ... maybe it wasn't a number"); } *************** *** 165,169 **** if ( debug_level_ >= level ) { ! debug_print_stream_.println(getClass().getName()+"."+method_name+" {"+new Date()+"}["+level+"] : "+message); } } --- 168,190 ---- if ( debug_level_ >= level ) { ! String advancedLogging; ! try ! { ! advancedLogging = RTKBase.getRTKProperties().getProperty("rtk.debug.advancedLogging"); ! } ! catch ( Exception prop_xcp ) ! { ! advancedLogging = "false"; ! } ! ! if ( advancedLogging.equalsIgnoreCase("false") || ! getLogger() == null ) ! { ! debug_print_stream_.println(getClass().getName()+"."+method_name+" {"+new Date()+"}["+level+"] : "+message); ! } ! else ! { ! getLogger().debug(getClass().getName()+"."+method_name+" {"+new Date()+"}["+level+"] : "+message); ! } } } *************** *** 185,190 **** if ( debug_level_ >= level ) { ! debug_print_stream_.println(getClass().getName()+"."+method_name+" {"+new Date()+"}["+level+"] : ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); ! xcp.printStackTrace(debug_print_stream_); } } --- 206,230 ---- if ( debug_level_ >= level ) { ! String advancedLogging; ! try ! { ! advancedLogging = RTKBase.getRTKProperties().getProperty("rtk.debug.advancedLogging"); ! } ! catch ( Exception prop_xcp ) ! { ! advancedLogging = "false"; ! } ! ! if ( advancedLogging.equalsIgnoreCase("false") || ! getLogger() == null ) ! { ! debug_print_stream_.println(getClass().getName()+"."+method_name+" {"+new Date()+"}["+level+"] : ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); ! xcp.printStackTrace(debug_print_stream_); ! } ! else ! { ! getLogger().error(getClass().getName()+"."+method_name+" {"+new Date()+"}["+level+"] : ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]"); ! getLogger().error(xcp); ! } } } *************** *** 231,233 **** --- 271,296 ---- } + private synchronized static Logger getLogger() + { + if (logger_ == null) + { + synchronized(RTK_VERSION) + { + try + { + PropertyConfigurator.configure(getRTKProperties()); + + logger_ = Logger.getRootLogger(); + } + catch(Exception xcp) + { + System.err.println("LOGGER: disabled using stderr"); + //xcp.printStackTrace(); + } + } + } + + return logger_; + } + } |