From: Julio G. <ju...@us...> - 2004-05-21 19:35:27
|
Update of /cvsroot/smartfrog/core/components/logger/src/org/smartfrog/services/logger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31755/components/logger/src/org/smartfrog/services/logger Modified Files: SFLoggerImpl.java Log Message: Corrected use for .forName() Index: SFLoggerImpl.java =================================================================== RCS file: /cvsroot/smartfrog/core/components/logger/src/org/smartfrog/services/logger/SFLoggerImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SFLoggerImpl.java 15 Apr 2004 10:50:30 -0000 1.5 --- SFLoggerImpl.java 21 May 2004 19:35:17 -0000 1.6 *************** *** 38,50 **** /** ! * Default implementation of distributed logger. This logger is deployed as * a smartfrog component and uses RMI for distributed logging. It uses logging * APIs provided by JDK. * @Author Ashish Awasthi ! */ public class SFLoggerImpl extends PrimImpl implements Prim, SFLogger { //default values of the attributes ! private String logFile = "smartfrog.log"; ! private String logsDir = "logs"; private Handler fileHandler = null; private Logger logger = null; --- 38,50 ---- /** ! * Default implementation of distributed logger. This logger is deployed as * a smartfrog component and uses RMI for distributed logging. It uses logging * APIs provided by JDK. * @Author Ashish Awasthi ! */ public class SFLoggerImpl extends PrimImpl implements Prim, SFLogger { //default values of the attributes ! private String logFile = "smartfrog.log"; ! private String logsDir = "logs"; private Handler fileHandler = null; private Logger logger = null; *************** *** 53,57 **** private String loggerName = "default"; private String logFormatter = "SimpleFormatter"; ! /** --- 53,57 ---- private String loggerName = "default"; private String logFormatter = "SimpleFormatter"; ! /** *************** *** 68,96 **** * @throws SmartFrogException in case of error in deploying * @throws RemoteException in case of network/emi error ! */ ! public synchronized void sfDeploy() throws SmartFrogException, RemoteException { super.sfDeploy(); logger = Logger.getLogger(loggerName); ! //read logging handlers attributes logToConsole = sfResolve(CONSOLE_LOGGING, logToConsole, false); logToFile = sfResolve(FILE_LOGGING, logToFile, false); ! //add console handler ! if(logToConsole) { logger.addHandler(new ConsoleHandler()); } // add file handler ! if (logToFile) { try { logsDir = sfResolve(LOG_DIR, logsDir, false); logFile = sfResolve (LOG_FILE, logFile, false); ! logFormatter = sfResolve (LOG_FORMATTER, logFormatter, false); File dir = new File(logsDir); dir.mkdir(); fileHandler = new FileHandler(logsDir+File.separator+logFile); ! Class classFormatter = Class.forName(logFormatter); Formatter formatter = (Formatter) classFormatter.newInstance(); fileHandler.setFormatter(formatter); --- 68,96 ---- * @throws SmartFrogException in case of error in deploying * @throws RemoteException in case of network/emi error ! */ ! public synchronized void sfDeploy() throws SmartFrogException, RemoteException { super.sfDeploy(); logger = Logger.getLogger(loggerName); ! //read logging handlers attributes logToConsole = sfResolve(CONSOLE_LOGGING, logToConsole, false); logToFile = sfResolve(FILE_LOGGING, logToFile, false); ! //add console handler ! if(logToConsole) { logger.addHandler(new ConsoleHandler()); } // add file handler ! if (logToFile) { try { logsDir = sfResolve(LOG_DIR, logsDir, false); logFile = sfResolve (LOG_FILE, logFile, false); ! logFormatter = sfResolve (LOG_FORMATTER, logFormatter, false); File dir = new File(logsDir); dir.mkdir(); fileHandler = new FileHandler(logsDir+File.separator+logFile); ! Class classFormatter = org.smartfrog.sfcore.security.SFClassLoader.forName(logFormatter); Formatter formatter = (Formatter) classFormatter.newInstance(); fileHandler.setFormatter(formatter); *************** *** 101,109 **** } } ! /** * Closes all the handlers and terminates the logger component. * ! */ public synchronized void sfTerminateWith(TerminationRecord tr) { // close all the handlers --- 101,109 ---- } } ! /** * Closes all the handlers and terminates the logger component. * ! */ public synchronized void sfTerminateWith(TerminationRecord tr) { // close all the handlers *************** *** 119,126 **** } /** SmartFrog Components Life Cycle Methods End */ ! ! /** Logging Methods End */ ! /** * Logs Info message. --- 119,126 ---- } /** SmartFrog Components Life Cycle Methods End */ ! ! /** Logging Methods End */ ! /** * Logs Info message. |