User: user57
Date: 02/03/04 16:46:05
Modified: src/main/org/jboss/logging Log4jService.java
Log:
o forgot to set lastConfigured
o uninstall/reinstall system adapters to avoid loops
Revision Changes Path
1.3 +29 -13 jboss-system/src/main/org/jboss/logging/Log4jService.java
Index: Log4jService.java
===================================================================
RCS file: /cvsroot/jboss/jboss-system/src/main/org/jboss/logging/Log4jService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Log4jService.java 5 Mar 2002 00:38:58 -0000 1.2
+++ Log4jService.java 5 Mar 2002 00:46:05 -0000 1.3
@@ -43,7 +43,7 @@
* <p>Installs CategoryStream adapters for System.out and System.err
* to catch and redirect calls to Log4j.
*
- * @version <tt>$Revision: 1.2 $</tt>
+ * @version <tt>$Revision: 1.3 $</tt>
* @author <a href="mailto:[EMAIL PROTECTED]">Fulco Muriglio</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Jencks</a>
@@ -183,6 +183,13 @@
ThrowableHandler.addThrowableListener(throwableAdapter);
log.debug("Added ThrowableListener: " + throwableAdapter);
+ log.info("Started");
+ }
+
+ private void installSystemAdapters()
+ {
+ Category category;
+
// Install catchers
if (CATCH_SYSTEM_OUT)
{
@@ -196,10 +203,21 @@
System.setErr(new CategoryStream(category, Priority.ERROR, err));
log.debug("Installed System.err adapter");
}
+ }
- log.info("Started");
+ private void uninstallSystemAdapters()
+ {
+ // Remove System adapters
+ if (out != null) {
+ System.out.flush();
+ System.setOut(out);
+ }
+ if (err != null) {
+ System.err.flush();
+ System.setErr(err);
+ }
}
-
+
/**
* Stops the log4j framework by calling the Category.shutdown() method.
*
@@ -210,16 +228,8 @@
// Remove throwable adapter
ThrowableHandler.removeThrowableListener(throwableAdapter);
- // Remove System adapters
- if (out != null) {
- System.out.flush();
- System.setOut(out);
- }
- if (err != null) {
- System.err.flush();
- System.setErr(err);
- }
-
+ uninstallSystemAdapters();
+
// Shutdown Log4j
Category.shutdown();
@@ -329,12 +339,18 @@
boolean xml = conn.getContentType().equals("text/xml");
log.debug("reconfiguring; xml=" + xml);
+ uninstallSystemAdapters();
+
if (xml) {
DOMConfigurator.configure(url);
}
else {
PropertyConfigurator.configure(url);
}
+
+ installSystemAdapters();
+
+ lastConfigured = System.currentTimeMillis();
}
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development