geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r549950 - in /geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system: logging/log4j/Log4jService.java sharedlib/SharedLib.java
Date Fri, 22 Jun 2007 20:32:13 GMT
Author: dwoods
Date: Fri Jun 22 13:32:12 2007
New Revision: 549950

URL: http://svn.apache.org/viewvc?view=rev&rev=549950
Log:
GERONIMO-3256 Minor logging improvements to help with debugging - Part 1

Modified:
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/sharedlib/SharedLib.java

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java?view=diff&rev=549950&r1=549949&r2=549950
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/log4j/Log4jService.java
Fri Jun 22 13:32:12 2007
@@ -84,6 +84,7 @@
     // Pattern that matches a single line  (used to calculate line numbers and check for
follow-on stack traces)
     private final static Pattern FULL_LINE_PATTERN = Pattern.compile("^.*", Pattern.MULTILINE);
 
+    private final static Log log = LogFactory.getLog(Log4jService.class);
 
     /**
      * The URL to the configuration file.
@@ -212,6 +213,7 @@
             throw new IllegalArgumentException("level is null");
         }
 
+        log.info("Setting logger level: logger=" + logger + ", level=" + level);
         Logger.getLogger(logger).setLevel(XLevel.toLevel(level));
     }
 
@@ -228,11 +230,11 @@
      * Set the refresh period.
      *
      * @param period the refresh period (in seconds)
-     * @throws IllegalArgumentException if refresh period is <= 0
+     * @throws IllegalArgumentException if refresh period is < 5
      */
     public synchronized void setRefreshPeriodSeconds(final int period) {
-        if (period < 1) {
-            throw new IllegalArgumentException("Refresh period must be > 0");
+        if (period < 5) {
+            throw new IllegalArgumentException("Refresh period must be at least 5 seconds");
         }
 
         if (this.refreshPeriod != period) {
@@ -256,6 +258,7 @@
      * @param configurationFile the logging configuration file
      */
     public synchronized void setConfigFileName(final String configurationFile) {
+        log.debug("setConfigFileName() called with configurationFile=" + configurationFile);
         if (configurationFile == null) {
             throw new IllegalArgumentException("configurationFile is null");
         }
@@ -264,6 +267,7 @@
         if (!this.configurationFile.equals(configurationFile)) {
             this.configurationFile = configurationFile;
             lastChanged = -1;
+            reconfigure();
         }
     }
 
@@ -331,6 +335,7 @@
         try {
             out = new FileOutputStream(file);
             out.write(configuration.getBytes());
+            log.info("Updated configuration file=" + file.toString());
         } finally {
             if (out != null) {
                 try {
@@ -361,7 +366,7 @@
             RandomAccessFile raf = new RandomAccessFile(file, "r");
             FileChannel fc = raf.getChannel();
             MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
-            CharBuffer cb = Charset.forName("US-ASCII").decode(bb); //todo: does Log4J use
a different charset on a foreign PC?
+            CharBuffer cb = Charset.forName(System.getProperty("file.encoding")).decode(bb);
             Matcher target = null;
             Matcher any = null;
             Matcher lines = FULL_LINE_PATTERN.matcher(cb);
@@ -513,6 +518,7 @@
         if (file == null || !file.exists()) {
             return;
         } else {
+            log.debug("reconfigure() using configurationFile=" + configurationFile);
             lastChanged = file.lastModified();
         }
 

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/sharedlib/SharedLib.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/sharedlib/SharedLib.java?view=diff&rev=549950&r1=549949&r2=549950
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/sharedlib/SharedLib.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/sharedlib/SharedLib.java
Fri Jun 22 13:32:12 2007
@@ -53,7 +53,7 @@
                     }
                 }
                 if (!dir.isDirectory()) {
-                    throw new IllegalArgumentException("Classes dir is not a directory: "
+ dir);
+                    throw new IllegalArgumentException("Shared classes dir is not a directory:
" + dir);
                 }
                 URL location = dir.toURL();
                 if (!currentUrls.contains(location)) {
@@ -72,7 +72,7 @@
                     }
                 }
                 if (!dir.isDirectory()) {
-                    throw new IllegalArgumentException("Lib dir is not a directory: " + dir);
+                    throw new IllegalArgumentException("Shared lib dir is not a directory:
" + dir);
                 }
 
                 File[] files = dir.listFiles();



Mime
View raw message