You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by cr...@apache.org on 2002/01/21 22:26:28 UTC
cvs commit: jakarta-commons-sandbox/services/src/java/org/apache/commons/services LogService.java ServiceManager.java
craigmcc 02/01/21 13:26:28
Modified: services/src/java/org/apache/commons/services
LogService.java ServiceManager.java
Log:
Avoid compile errors from the latest (and likely last) changes in the
commons-logging APIs.
Revision Changes Path
1.3 +18 -12 jakarta-commons-sandbox/services/src/java/org/apache/commons/services/LogService.java
Index: LogService.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/services/src/java/org/apache/commons/services/LogService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LogService.java 19 Dec 2001 16:21:55 -0000 1.2
+++ LogService.java 21 Jan 2002 21:26:28 -0000 1.3
@@ -10,26 +10,30 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogSource;
+import org.apache.commons.logging.SimpleLog;
-/** LogService uses inversal logging bridge from commons-logging.
+/** LogService uses universal logging bridge from commons-logging.
*
- * @version $Id: LogService.java,v 1.2 2001/12/19 16:21:55 oalexeev Exp $
+ * @version $Id: LogService.java,v 1.3 2002/01/21 21:26:28 craigmcc Exp $
* @author Oleg V Alexeev
*/
public class LogService extends Service {
- public static int DEFAULT_LOG_LEVEL = org.apache.commons.logging.Log.OFF;
+ public static int DEFAULT_LOG_LEVEL =
+ org.apache.commons.logging.SimpleLog.LOG_LEVEL_OFF;
protected Log log = null;
protected void initLog() {
- try {
- LogSource.setLogImplementation( "org.apache.commons.logging.SimpleLog" );
- log = LogSource.makeNewLogInstance( "org.apache.commons.service.logging.SimpleLog" );
- } catch ( Exception _e ) {
- }
- log = LogSource.makeNewLogInstance( "org.apache.commons.service.logging.default" );
- log.setLevel( DEFAULT_LOG_LEVEL );
+ try {
+ LogSource.setLogImplementation( "org.apache.commons.logging.SimpleLog" );
+ log = LogSource.makeNewLogInstance( "org.apache.commons.service.logging.SimpleLog" );
+ } catch ( Exception _e ) {
+ }
+ log = LogSource.makeNewLogInstance( "org.apache.commons.service.logging.default" );
+ if (log instanceof SimpleLog) {
+ ((SimpleLog) log).setLevel( DEFAULT_LOG_LEVEL );
+ }
}
public LogService() {
@@ -38,7 +42,9 @@
public void init() {
super.init();
- log.setLevel( DEFAULT_LOG_LEVEL );
+ if (log instanceof SimpleLog) {
+ ((SimpleLog) log).setLevel( DEFAULT_LOG_LEVEL );
+ }
}
public void destroy() {
@@ -65,4 +71,4 @@
return null;
}
-}
\ No newline at end of file
+}
1.4 +14 -10 jakarta-commons-sandbox/services/src/java/org/apache/commons/services/ServiceManager.java
Index: ServiceManager.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/services/src/java/org/apache/commons/services/ServiceManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServiceManager.java 19 Dec 2001 16:58:53 -0000 1.3
+++ ServiceManager.java 21 Jan 2002 21:26:28 -0000 1.4
@@ -11,16 +11,18 @@
import java.io.Serializable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogSource;
+import org.apache.commons.logging.SimpleLog;
/**
* Core class in package.
*
- * @version $Id: ServiceManager.java,v 1.3 2001/12/19 16:58:53 oalexeev Exp $
+ * @version $Id: ServiceManager.java,v 1.4 2002/01/21 21:26:28 craigmcc Exp $
* @author Oleg V Alexeev
*/
public class ServiceManager implements Serializable {
- public static int DEFAULT_LOG_LEVEL = org.apache.commons.logging.Log.OFF;
+ public static int DEFAULT_LOG_LEVEL =
+ org.apache.commons.logging.SimpleLog.LOG_LEVEL_OFF;
protected EventModule eventModule = null;
@@ -34,13 +36,15 @@
// FIXME - make it more flexible
static {
- try {
- LogSource.setLogImplementation( "org.apache.commons.logging.SimpleLog" );
- log = LogSource.makeNewLogInstance( "org.apache.commons.service.logging.SimpleLog" );
- } catch ( Exception _e ) {
- }
- log = LogSource.makeNewLogInstance( "org.apache.commons.service.logging.default" );
- log.setLevel( DEFAULT_LOG_LEVEL );
+ try {
+ LogSource.setLogImplementation( "org.apache.commons.logging.SimpleLog" );
+ log = LogSource.makeNewLogInstance( "org.apache.commons.service.logging.SimpleLog" );
+ } catch ( Exception _e ) {
+ }
+ log = LogSource.makeNewLogInstance( "org.apache.commons.service.logging.default" );
+ if (log instanceof SimpleLog) {
+ ((SimpleLog) log).setLevel( DEFAULT_LOG_LEVEL );
+ }
}
public Log getLog() {
@@ -118,4 +122,4 @@
}
}
-}
\ No newline at end of file
+}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>