You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by sd...@apache.org on 2004/12/07 10:35:00 UTC
cvs commit: logging-log4j/src/java/org/apache/log4j/varia LogFilePatternReceiver.java
sdeboy 2004/12/07 01:35:00
Modified: src/java/org/apache/log4j/chainsaw/version
VersionManager.java
src/java/org/apache/log4j/chainsaw LogPanel.java LogUI.java
src/java/org/apache/log4j/pattern DatePatternConverter.java
src/java/org/apache/log4j/chainsaw/prefs default.properties
src/java/org/apache/log4j/chainsaw/help release-notes.html
src/java/org/apache/log4j/varia LogFilePatternReceiver.java
Log:
- Changed the default order of columns in Chainsaw to first display ID, level, logger, message and exception
- Added default level expressions (example: LEVEL == DEBUG) to the 'refine focus' combobox
- Modified Chainsaw initialization logic to load Chainsaw-specified config when specified
NOTE: Chainsaw will load configurations from BOTH the log4j.configuration system property and Chainsaw's automatic configuration URL if the two are specified
- Corrected date pattern format bug (was displaying minutes where it should be displaying months)
Revision Changes Path
1.17 +1 -1 logging-log4j/src/java/org/apache/log4j/chainsaw/version/VersionManager.java
Index: VersionManager.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/version/VersionManager.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- VersionManager.java 1 Dec 2004 16:53:39 -0000 1.16
+++ VersionManager.java 7 Dec 2004 09:34:59 -0000 1.17
@@ -10,7 +10,7 @@
private static final VersionManager instance = new VersionManager();
- private static final String VERSION_INFO = "1.99.99 (1 December 2004)";
+ private static final String VERSION_INFO = "1.99.99 (7 December 2004)";
public static final VersionManager getInstance() {
return instance;
1.93 +10 -3 logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java
Index: LogPanel.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogPanel.java,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- LogPanel.java 5 Dec 2004 10:17:36 -0000 1.92
+++ LogPanel.java 7 Dec 2004 09:34:59 -0000 1.93
@@ -66,7 +66,6 @@
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
-
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
@@ -109,7 +108,6 @@
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.text.Document;
-
import org.apache.log4j.Layout;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
@@ -897,7 +895,16 @@
//hold a reference to the combobox model so that we can check to prevent duplicates
final Vector v = new Vector();
+ //add (hopefully useful) default filters
+ v.add("LEVEL == TRACE");
+ v.add("LEVEL == DEBUG");
+ v.add("LEVEL == INFO");
+ v.add("LEVEL == WARN");
+ v.add("LEVEL == ERROR");
+ v.add("LEVEL == FATAL");
+
final JComboBox filterCombo = new JComboBox(v);
+ filterCombo.setSelectedIndex(-1);
final JTextField filterText;
if (filterCombo.getEditor().getEditorComponent() instanceof JTextField) {
@@ -2449,7 +2456,7 @@
}
/**
- * Update refinement rule based on the entered expression
+ * Update refinement rule based on the entered expression.
*/
private void setFilter() {
if (filterText.getText().equals("")) {
1.113 +11 -9 logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java
Index: LogUI.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LogUI.java,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- LogUI.java 5 Dec 2004 10:17:36 -0000 1.112
+++ LogUI.java 7 Dec 2004 09:34:59 -0000 1.113
@@ -301,10 +301,6 @@
logUI.handler.addFilter(propFilter);
logUI.handler.addEventBatchListener(logUI.new NewTabEventBatchReceiver());
- //NOTE: this next line MUST be the first place where the logging framework is initialized
- //if started from the 'main' method
- LogManager.getRootLogger().setLevel(Level.TRACE);
- logger = LogManager.getLogger(LogUI.class);
/**
* TODO until we work out how JoranConfigurator might be able to have
* configurable class loader, if at all. For now we temporarily replace the
@@ -312,22 +308,28 @@
* the Plugins directory can find them (this is particularly
* important for the Web start version of Chainsaw
*/
+ //configuration initialized here
+ logUI.ensureChainsawAppenderHandlerAdded();
+ LogManager.getRootLogger().setLevel(Level.TRACE);
+ logger = LogManager.getLogger(LogUI.class);
String config = model.getConfigurationURL();
if(config!=null && (!(config.trim().equals("")))) {
config = config.trim();
- logger.info("Using '" + config + "' for auto-configuration");
try {
URL configURL = new URL(config);
logUI.loadConfigurationUsingPluginClassLoader(configURL);
}catch(MalformedURLException e) {
logger.error("Failed to convert config string to url", e);
}
- }else {
- logger.info("No auto-configuration file found within the ApplicationPreferenceModel");
- logUI.ensureChainsawAppenderHandlerAdded();
}
-
+
+ if (config == null) {
+ logger.info("No auto-configuration file found within the ApplicationPreferenceModel");
+ } else {
+ logger.info("Using '" + config + "' for auto-configuration");
+ }
+
logUI.activateViewer();
logUI.getApplicationPreferenceModel().apply(model);
1.8 +2 -2 logging-log4j/src/java/org/apache/log4j/pattern/DatePatternConverter.java
Index: DatePatternConverter.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/pattern/DatePatternConverter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DatePatternConverter.java 4 Nov 2004 15:44:56 -0000 1.7
+++ DatePatternConverter.java 7 Dec 2004 09:34:59 -0000 1.8
@@ -61,7 +61,7 @@
String pattern;
if (option == null) {
- pattern = "yyyy-mm-dd HH:mm:ss,SSS";
+ pattern = "yyyy-MM-dd HH:mm:ss,SSS";
} else if (
option.equalsIgnoreCase(AbsoluteTimeDateFormat.ISO8601_DATE_FORMAT)) {
pattern = "yyyy-MM-dd HH:mm:ss,SSS";
@@ -82,7 +82,7 @@
logger.warn(
"Could not instantiate SimpleDateFormat with pattern " + option, e);
// detault for the ISO8601 format
- df = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss,SSS");
+ df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
}
}
1.20 +4 -2 logging-log4j/src/java/org/apache/log4j/chainsaw/prefs/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/prefs/default.properties,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- default.properties 17 Jun 2004 00:17:55 -0000 1.19
+++ default.properties 7 Dec 2004 09:34:59 -0000 1.20
@@ -10,8 +10,10 @@
main.window.height=480
tabPlacement=3
Responsiveness=3
-table.columns.order=ID,Timestamp,Level,Logger,Thread,Message,NDC,Throwable,Class,Method,File,Line
-table.columns.widths=50,150,50,100,150,300,150,100,300,150,100,100
+
+table.columns.order=ID,Timestamp,Level,Logger,Message,Throwable,Thread,NDC,Class,Method,File,Line
+table.columns.widths=50,150,50,100,300,100,150,150,300,150,100,100
+
statusBar=true
receivers=true
toolbar=true
1.48 +8 -0 logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html
Index: release-notes.html
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- release-notes.html 5 Dec 2004 10:17:36 -0000 1.47
+++ release-notes.html 7 Dec 2004 09:35:00 -0000 1.48
@@ -9,6 +9,14 @@
<h1>1.99.99</h2>
+<h2>7 December 2004</h2>
+<ul>
+<li>Changed the default order of columns in Chainsaw to first display ID, level, logger, message and exception</li>
+<li>Added default level expressions (example: LEVEL == DEBUG) to the 'refine focus' combobox</li>
+<li>Modified Chainsaw initialization logic to load Chainsaw-specified config when specified. <b>NOTE:</b> Chainsaw will load configurations from BOTH the log4j.configuration system property and Chainsaw's automatic configuration URL if the two are specified</li>
+<li>Corrected date pattern format bug (was displaying minutes where it should be displaying months in the detail panel)</li>
+</ul>
+
<h2>5 December 2004</h2>
<ul>
<li>Added CustomSQLDBReceiver example to log4j-receiver-sample config file, Javadoc help menu and receiver panel.</li>
1.21 +14 -12 logging-log4j/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java
Index: LogFilePatternReceiver.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- LogFilePatternReceiver.java 20 Nov 2004 15:51:33 -0000 1.20
+++ LogFilePatternReceiver.java 7 Dec 2004 09:35:00 -0000 1.21
@@ -31,7 +31,6 @@
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.helpers.Constants;
@@ -373,11 +372,16 @@
* @return event
*/
private LoggingEvent buildEvent() {
- LoggingEvent event = null;
-
if (currentMap.size() == 0) {
- return event;
+ if (additionalLines.size() > 0) {
+ for (Iterator iter = additionalLines.iterator();iter.hasNext();) {
+ getLogger().info("found non-matching line: " + iter.next());
+ }
+ }
+ additionalLines.clear();
+ return null;
}
+ //the current map contains fields - build an event
int exceptionLine = getExceptionLine();
String[] exception = buildException(exceptionLine);
@@ -386,13 +390,9 @@
currentMap.put(MESSAGE, buildMessage((String) currentMap.get(MESSAGE),
exceptionLine));
}
-
- if (currentMap.size() > 0) {
- event = convertToEvent(currentMap, exception);
- }
+ LoggingEvent event = convertToEvent(currentMap, exception);
currentMap.clear();
additionalLines.clear();
-
return event;
}
@@ -422,6 +422,7 @@
do {
while ((line = bufferedReader.readLine()) != null) {
if (eventMatcher.matches(line, regexpPattern)) {
+ //build an event from the previous match (held in current map)
LoggingEvent event = buildEvent();
if (event != null) {
if (passesExpression(event)) {
@@ -430,6 +431,7 @@
}
currentMap.putAll(processEvent(eventMatcher.getMatch()));
} else {
+ //getLogger().debug("line doesn't match pattern - must be ")
//may be an exception or additional message lines
additionalLines.add(line);
}
@@ -494,7 +496,7 @@
* @return string
*/
private String convertTimestamp() {
- return util.substitute("s/"+VALID_DATEFORMAT_CHAR_PATTERN+"/\\\\w/g", timestampFormat);
+ return util.substitute("s/("+VALID_DATEFORMAT_CHAR_PATTERN+")+/\\\\w+/g", timestampFormat);
}
/**
@@ -746,14 +748,14 @@
try {
reader = new InputStreamReader(new URL(getFileURL()).openStream());
} catch (IOException ioe) {
- getLogger().debug("exception", ioe);
+ getLogger().warn("exception", ioe);
return;
}
try {
process(reader);
} catch (IOException ioe) {
//io exception - probably shut down
- getLogger().debug("stream closed");
+ getLogger().info("stream closed");
}
}
}).start();
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: cvs commit: logging-log4j/src/java/org/apache/log4j/varia
LogFilePatternReceiver.java
Posted by Ceki Gülcü <ce...@qos.ch>.
At 10:35 AM 12/7/2004, sdeboy@apache.org wrote:
>sdeboy 2004/12/07 01:35:00
>
> Modified: src/java/org/apache/log4j/chainsaw/version
> VersionManager.java
> src/java/org/apache/log4j/chainsaw LogPanel.java LogUI.java
> src/java/org/apache/log4j/pattern DatePatternConverter.java
> src/java/org/apache/log4j/chainsaw/prefs default.properties
> src/java/org/apache/log4j/chainsaw/help release-notes.html
> src/java/org/apache/log4j/varia LogFilePatternReceiver.java
> Log:
[cut]
> - Corrected date pattern format bug (was displaying minutes where it
> should be displaying months)
Silly me. Scott, thanks for catching this bugger. I hope you did not loose
too much time while tracking it.
--
Ceki Gülcü
The complete log4j manual: http://qos.ch/log4j/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org