https://issues.apache.org/bugzilla/show_bug.cgi?id=49421
Summary: Chainsaw don't show Logger for SocketReceiver and
SocketHubReceiver
Product: Log4j
Version: 1.2
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: chainsaw
AssignedTo: [email protected]
ReportedBy: [email protected]
I had build the newest version of Chainsaw from the SVN with maven. (revision:
953286)
Problem now ist that the column for the Logger is empty if i get LoggingEvents
from a SocketReceiver or SocketHubReceiver
the following exceptions are shown in the chainsaw log:
Level: ERROR
Logger: org.apache.log4j.chainsaw.LogUI
Time: 2010-06-10 13:48:22,364
Thread: AWT-EventQueue-0
Message: Uncaught exception in thread Thread[AWT-EventQueue-0,6,main]
Marker:
Throwable:java.lang.NullPointerException
at java.util.StringTokenizer. (Unknown Source)
at java.util.StringTokenizer. (Unknown Source)
at
org.apache.log4j.chainsaw.LogPanelLoggerTreeModel.tokenize(LogPanelLoggerTreeModel.java:161)
at
org.apache.log4j.chainsaw.LogPanelLoggerTreeModel.addLoggerNameInDispatchThread(LogPanelLoggerTreeModel.java:66)
at
org.apache.log4j.chainsaw.LogPanelLoggerTreeModel.access$100(LogPanelLoggerTreeModel.java:44)
at
org.apache.log4j.chainsaw.LogPanelLoggerTreeModel$1.run(LogPanelLoggerTreeModel.java:60)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
And if i klick on a event in the table the following Error is thrown:
Level: ERROR
Logger: org.apache.log4j.chainsaw.LogUI
Time: 2010-06-10 13:50:23,236
Thread: AWT-EventQueue-0
Message: Uncaught exception in thread Thread[AWT-EventQueue-0,6,main]
Marker:
Throwable: java.lang.NullPointerException
at org.apache.log4j.CategoryKey. (CategoryKey.java:32)
at org.apache.log4j.Hierarchy.getLogger(Hierarchy.java:266)
at org.apache.log4j.Hierarchy.getLogger(Hierarchy.java:247)
at
org.apache.log4j.LoggerRepositoryExImpl.getLogger(LoggerRepositoryExImpl.java:383)
at org.apache.log4j.LogManager.getLogger(LogManager.java:228)
at org.apache.log4j.Logger.getLogger(Logger.java:104)
at
org.apache.log4j.chainsaw.layout.EventDetailLayout.copyForHTML(EventDetailLayout.java:181)
at
org.apache.log4j.chainsaw.layout.EventDetailLayout.format(EventDetailLayout.java:269)
at
org.apache.log4j.chainsaw.LogPanel$DetailPaneUpdater.updateDetailPane(LogPanel.java:3062)
at
org.apache.log4j.chainsaw.LogPanel$DetailPaneUpdater.setAndUpdateSelectedRow(LogPanel.java:3037)
at
org.apache.log4j.chainsaw.LogPanel$DetailPaneUpdater.access$3100(LogPanel.java:3019)
at org.apache.log4j.chainsaw.LogPanel$44.tableChanged(LogPanel.java:1121)
at javax.swing.table.AbstractTableModel.fireTableChanged(Unknown Source)
at javax.swing.table.AbstractTableModel.fireTableRowsUpdated(Unknown
Source)
at
org.apache.log4j.chainsaw.ChainsawCyclicBufferTableModel.fireRowUpdated(ChainsawCyclicBufferTableModel.java:669)
at
org.apache.log4j.chainsaw.LogPanel$MarkerCellEditor.stopCellEditing(LogPanel.java:3142)
at javax.swing.plaf.basic.BasicTableUI$Handler.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I spend some time and watched in the Source what is going wrong.
i found the following problem
After the LoggingEvent is deseriazabled the Field logger is null because this
field is set transident and is not restored in the "writeObject" method.
if now Chainsaw use this LoggingEvent to create a ExtendedLoggingEvent there is
no Logger in this event.
the construktor of the ExtendedLoggingEvent calls the super-construktor of
LoggingEvent with e.getFQNOfLoggerClass() for the LoggerName and e.getLogger()
for the logger both returnvalues will be null.
the construktor of LoggingEvent will now call categoryName = logger.getName();
for set the LoggerName. -> all null
So i changed the construktor for the ExtendedLoggingEvent from
public ExtendedLoggingEvent(LoggingEvent e) {
super(e.getFQNOfLoggerClass(), e.getLogger(), e.getTimeStamp(),
e.getLevel(), e.getMessage(), e.getThreadName(), e.getThrowableInformation(),
e.getNDC(), e.getLocationInformation(), e.getProperties());
}
to:
//copy constructor
public ExtendedLoggingEvent(LoggingEvent e) {
super(e.getLoggerName(), e.getLogger()!=null?e.getLogger():
Logger.getLogger(e.getLoggerName()), e.getTimeStamp(), e.getLevel(),
e.getMessage(), e.getThreadName(), e.getThrowableInformation(), e.getNDC(),
e.getLocationInformation(), e.getProperties());
}
with this change i see now all Loggers in the column and no errors are thrown
anymore.
i don't know if it is the best way to fix this problem but it may help you to
fix it.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]