lilith-devel Mailing List for lilith (Page 18)
Brought to you by:
huxhorn
You can subscribe to this list here.
2009 |
Jan
(23) |
Feb
(29) |
Mar
(55) |
Apr
(26) |
May
(12) |
Jun
(18) |
Jul
(21) |
Aug
(19) |
Sep
(41) |
Oct
(63) |
Nov
(14) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
|
Feb
(2) |
Mar
(5) |
Apr
(12) |
May
(45) |
Jun
|
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
(3) |
Feb
(2) |
Mar
(1) |
Apr
(7) |
May
(12) |
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <hu...@us...> - 2009-01-31 14:22:29
|
Revision: 151 http://lilith.svn.sourceforge.net/lilith/?rev=151&view=rev Author: huxhorn Date: 2009-01-31 14:22:13 +0000 (Sat, 31 Jan 2009) Log Message: ----------- Ongoing work concerning ticket:28 and ticket:29. Modified Paths: -------------- trunk/lilith/src/main/java/de/huxhorn/lilith/appender/InternalLilithAppender.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/FileDumpEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/FileSplitterEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java trunk/lilith/src/main/resources/logback.xml trunk/lilith/src/main/resources/logbackVerbose.xml trunk/lilith-engine/pom.xml trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/FileBufferFactory.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/LogFileFactory.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/LogFileFactoryImpl.java Added Paths: ----------- trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/FileConstants.java Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/appender/InternalLilithAppender.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/appender/InternalLilithAppender.java 2009-01-29 06:58:19 UTC (rev 150) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/appender/InternalLilithAppender.java 2009-01-31 14:22:13 UTC (rev 151) @@ -21,15 +21,18 @@ import de.huxhorn.lilith.data.eventsource.SourceIdentifier; import de.huxhorn.lilith.data.logging.LoggingEvent; import de.huxhorn.lilith.data.logging.logback.LogbackLoggingAdapter; +import de.huxhorn.lilith.engine.FileBufferFactory; +import de.huxhorn.lilith.engine.FileConstants; import de.huxhorn.lilith.engine.impl.LogFileFactoryImpl; import de.huxhorn.lilith.swing.ApplicationPreferences; import de.huxhorn.sulky.buffers.Buffer; import de.huxhorn.sulky.buffers.FileBuffer; -import de.huxhorn.sulky.buffers.SerializingFileBuffer; import ch.qos.logback.core.AppenderBase; import java.io.File; +import java.util.HashMap; +import java.util.Map; /** * This class will always write into <user.home>/.lilith/sources/logs/Lilith.xxx. This s done so logging events during @@ -48,11 +51,17 @@ { sourceIdentifier = new SourceIdentifier("Lilith"); - LogFileFactoryImpl logFileFactory = new LogFileFactoryImpl(new File(ApplicationPreferences.DEFAULT_APPLICATION_PATH, "sources/logs"), "ljlogging"); - File dataFile = logFileFactory.getDataFile(sourceIdentifier); - File indexFile = logFileFactory.getIndexFile(sourceIdentifier); + LogFileFactoryImpl logFileFactory = + new LogFileFactoryImpl(new File(ApplicationPreferences.DEFAULT_APPLICATION_PATH, "sources/logs")); - fileBuffer = new SerializingFileBuffer<EventWrapper<LoggingEvent>>(dataFile, indexFile); + Map<String, String> loggingMetaData = new HashMap<String, String>(); + loggingMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_LOGGING); + loggingMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_XML); + loggingMetaData.put(FileConstants.COMPRESSED_KEY, "true"); + // TODO: configurable format and compressed + + FileBufferFactory<LoggingEvent> fileBufferFactory = new FileBufferFactory<LoggingEvent>(logFileFactory, loggingMetaData); + fileBuffer = fileBufferFactory.createActiveBuffer(sourceIdentifier); } public static Buffer<EventWrapper<LoggingEvent>> getBuffer() Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/FileDumpEventConsumer.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/FileDumpEventConsumer.java 2009-01-29 06:58:19 UTC (rev 150) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/FileDumpEventConsumer.java 2009-01-31 14:22:13 UTC (rev 151) @@ -18,15 +18,15 @@ package de.huxhorn.lilith.consumers; import de.huxhorn.lilith.data.eventsource.EventWrapper; +import de.huxhorn.lilith.data.eventsource.SourceIdentifier; import de.huxhorn.lilith.engine.EventConsumer; +import de.huxhorn.lilith.engine.FileBufferFactory; import de.huxhorn.sulky.buffers.Buffer; import de.huxhorn.sulky.buffers.FileBuffer; -import de.huxhorn.sulky.buffers.SerializingFileBuffer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; import java.io.Serializable; import java.util.List; @@ -35,41 +35,19 @@ { private final Logger logger = LoggerFactory.getLogger(FileDumpEventConsumer.class); - // private ApplicationPreferences applicationPreferences; private FileBuffer<EventWrapper<T>> fileBuffer; - public FileDumpEventConsumer(/*ApplicationPreferences applicationPreferences, */File dataFile, File indexFile) + public FileDumpEventConsumer(SourceIdentifier sourceIdentifier, FileBufferFactory<T> fileBufferFactory) { -// this.applicationPreferences=applicationPreferences; - fileBuffer = new SerializingFileBuffer<EventWrapper<T>>(dataFile, indexFile); + fileBuffer = fileBufferFactory.createActiveBuffer(sourceIdentifier); } public void consume(List<EventWrapper<T>> events) { -// events=filterEvents(events); fileBuffer.addAll(events); if(logger.isInfoEnabled()) logger.info("Wrote {} events to file.", events.size()); } - /* - List<EventWrapper<T>> filterEvents(List<EventWrapper<T>> events) - { - if(applicationPreferences.getSourceFiltering() == ApplicationPreferences.SourceFiltering.NONE) - { - return events; - } - List<EventWrapper<T>> result=new ArrayList<EventWrapper<T>>(); - for(EventWrapper<T> event:events) - { - String id=event.getSourceIdentifier().getIdentifier(); - if(applicationPreferences.isValidSource(id)) - { - result.add(event); - } - } - return result; - } - */ public Buffer<EventWrapper<T>> getBuffer() { return fileBuffer; Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/FileSplitterEventConsumer.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/FileSplitterEventConsumer.java 2009-01-29 06:58:19 UTC (rev 150) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/FileSplitterEventConsumer.java 2009-01-31 14:22:13 UTC (rev 151) @@ -42,19 +42,14 @@ { private final Logger logger = LoggerFactory.getLogger(FileSplitterEventConsumer.class); - //private File baseDirectory; private FileBufferFactory<T> fileBufferFactory; - //private LogFileFactory logFileFactory; private ConcurrentMap<SourceIdentifier, FileBuffer<EventWrapper<T>>> fileBuffers; private SourceManager<T> sourceManager; -// private ApplicationPreferences applicationPreferences; - public FileSplitterEventConsumer(/*ApplicationPreferences applicationPreferences, */FileBufferFactory<T> fileBufferFactory, SourceManager<T> sourceManager) + public FileSplitterEventConsumer(FileBufferFactory<T> fileBufferFactory, SourceManager<T> sourceManager) { -// this.applicationPreferences=applicationPreferences; this.fileBufferFactory = fileBufferFactory; fileBuffers = new ConcurrentHashMap<SourceIdentifier, FileBuffer<EventWrapper<T>>>(); - //this.baseDirectory=baseDirectory; this.sourceManager = sourceManager; } @@ -66,12 +61,6 @@ for(EventWrapper<T> wrapper : events) { SourceIdentifier si = wrapper.getSourceIdentifier(); -// String id=si.getIdentifier(); -// if(wrapper.getEvent()!= null/ && !applicationPreferences.isValidSource(id)) -// { -// // we must not ignore close events!! -// continue; -// } List<EventWrapper<T>> sourceList = splittedEvents.get(si); if(sourceList == null) { @@ -91,14 +80,10 @@ int valueCount = value.size(); // we know that valueCount is > 0 because otherwise it wouldn' exist. EventWrapper<T> lastEvent = value.get(valueCount - 1); -// String id=si.getIdentifier(); -// if(applicationPreferences.isValidSource(id)) -// { // only create view/add if valid FileBuffer<EventWrapper<T>> buffer = resolveBuffer(si); buffer.addAll(value); if(logger.isInfoEnabled()) logger.info("Wrote {} events for source '{}'.", valueCount, si); -// } if(lastEvent.getEvent() == null) { @@ -133,36 +118,4 @@ } return result; } - - /* - public FileBuffer<EventWrapper<T>> createBuffer(SourceIdentifier si) - { - //String baseName=getBaseFileName(baseDirectory, si); - //File dataFile = new File(baseName+DATA_FILE_EXTENSION); - //File indexFile = new File(baseName+INDEX_FILE_EXTENSION); - File dataFile = logFileFactory.getDataFile(si); - File indexFile = logFileFactory.getIndexFile(si); - if(logger.isInfoEnabled()) logger.info("Creating buffer for dataFile '{}'.", dataFile.getAbsolutePath()); - - return new SerializingFileBuffer<EventWrapper<T>>(dataFile, indexFile); - } - private FileBuffer<EventWrapper<T>> createNewBuffer(SourceIdentifier si) - { - //String baseName=getBaseFileName(baseDirectory, si); - FileBuffer<EventWrapper<T>> result = createBuffer(si); - //File activeFile=new File(baseName+ACTIVE_FILE_EXTENSION); - File activeFile=logFileFactory.getActiveFile(si); - try - { - activeFile.createNewFile(); - activeFile.deleteOnExit(); - } - catch (IOException e) - { - if(logger.isWarnEnabled()) logger.warn("Couldn't create active-file."); - } - return result; - } - */ - } Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java 2009-01-29 06:58:19 UTC (rev 150) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java 2009-01-31 14:22:13 UTC (rev 151) @@ -36,6 +36,7 @@ import de.huxhorn.lilith.engine.EventSource; import de.huxhorn.lilith.engine.EventSourceListener; import de.huxhorn.lilith.engine.FileBufferFactory; +import de.huxhorn.lilith.engine.FileConstants; import de.huxhorn.lilith.engine.LogFileFactory; import de.huxhorn.lilith.engine.SourceManager; import de.huxhorn.lilith.engine.impl.EventSourceImpl; @@ -198,7 +199,7 @@ public MainFrame(ApplicationPreferences applicationPreferences, SplashScreen splashScreen, String appName, boolean enableBonjour) { super(appName); - this.splashScreen=splashScreen; + this.splashScreen = splashScreen; setSplashStatusText("Creating main frame."); //colorsReferenceQueue=new ReferenceQueue<Colors>(); //colorsCache=new ConcurrentHashMap<EventIdentifier, SoftColorsReference>(); @@ -236,11 +237,25 @@ integerWorkManager = new SwingWorkManager<Integer>(); startupApplicationPath = applicationPreferences.getStartupApplicationPath(); - loggingFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, "sources/logs"), "ljlogging"); - accessFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, "sources/access"), "ljaccess"); - loggingFileBufferFactory = new FileBufferFactory<LoggingEvent>(loggingFileFactory); - accessFileBufferFactory = new FileBufferFactory<AccessEvent>(accessFileFactory); + loggingFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, "sources/logs")); + accessFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, "sources/access")); + Map<String, String> loggingMetaData = new HashMap<String, String>(); + loggingMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_LOGGING); + loggingMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_XML); + loggingMetaData.put(FileConstants.COMPRESSED_KEY, "true"); + // TODO: configurable format and compressed + + loggingFileBufferFactory = new FileBufferFactory<LoggingEvent>(loggingFileFactory, loggingMetaData); + + Map<String, String> accessMetaData = new HashMap<String, String>(); + accessMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_ACCESS); + accessMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_XML); + accessMetaData.put(FileConstants.COMPRESSED_KEY, "true"); + // TODO: configurable format and compressed + + accessFileBufferFactory = new FileBufferFactory<AccessEvent>(accessFileFactory, accessMetaData); + rrdFileFilter = new RrdFileFilter(); loggingEventViewManager = new LoggingEventViewManager(this); @@ -333,7 +348,7 @@ private void setSplashStatusText(String text) { - if(splashScreen!=null) + if(splashScreen != null) { splashScreen.setStatusText(text); } @@ -493,14 +508,11 @@ setSplashStatusText("Creating global views."); SourceIdentifier globalSourceIdentifier = new SourceIdentifier("global", null); - File globalLoggingDataFile = loggingFileFactory.getDataFile(globalSourceIdentifier); - File globalLoggingIndexFile = loggingFileFactory.getIndexFile(globalSourceIdentifier); - FileDumpEventConsumer<LoggingEvent> loggingFileDump = new FileDumpEventConsumer<LoggingEvent>(/*applicationPreferences, */globalLoggingDataFile, globalLoggingIndexFile); - File globalAccessDataFile = accessFileFactory.getDataFile(globalSourceIdentifier); - File globalAccessIndexFile = accessFileFactory.getIndexFile(globalSourceIdentifier); - FileDumpEventConsumer<AccessEvent> accessFileDump = new FileDumpEventConsumer<AccessEvent>(/*applicationPreferences, */globalAccessDataFile, globalAccessIndexFile); + FileDumpEventConsumer<LoggingEvent> loggingFileDump = new FileDumpEventConsumer<LoggingEvent>(globalSourceIdentifier, loggingFileBufferFactory); + FileDumpEventConsumer<AccessEvent> accessFileDump = new FileDumpEventConsumer<AccessEvent>(globalSourceIdentifier, accessFileBufferFactory); + BlockingCircularBuffer<EventWrapper<LoggingEvent>> loggingEventQueue = new LilithBuffer<LoggingEvent>(applicationPreferences, 1000); BlockingCircularBuffer<EventWrapper<AccessEvent>> accessEventQueue = new LilithBuffer<AccessEvent>(applicationPreferences, 1000); @@ -702,7 +714,7 @@ checkForUpdate(false); } updateConditions(); // to initialize active conditions. - setSplashStatusText("Finished."); + setSplashStatusText("Finished."); } public void goToSource(StackTraceElement ste) Modified: trunk/lilith/src/main/resources/logback.xml =================================================================== --- trunk/lilith/src/main/resources/logback.xml 2009-01-29 06:58:19 UTC (rev 150) +++ trunk/lilith/src/main/resources/logback.xml 2009-01-31 14:22:13 UTC (rev 151) @@ -7,7 +7,7 @@ </layout> </appender> - <appender name="Lilith" class="de.huxhorn.lilith.appender.InternalLilithAppender"></appender> + <appender name="Lilith" class="de.huxhorn.lilith.appender.InternalLilithAppender"/> <appender name="MultiplexClassicCompressed" class="de.huxhorn.lilith.logback.appender.ClassicMultiplexSocketAppender"> @@ -125,10 +125,6 @@ <level value="WARN"/> </logger> - <logger name="de.huxhorn.sulky.buffers.SerializingFileBuffer"> - <level value="WARN"/> - </logger> - <logger name="de.huxhorn.lilith.engine.xml.eventproducer.LilithXmlStreamLoggingEventProducer"> <level value="WARN"/> </logger> @@ -218,9 +214,6 @@ <logger name="de.huxhorn.lilith.services.sender"> <level value="WARN"/> </logger> - <logger name="de.huxhorn.sulky.buffers.SerializingFileBuffer"> - <level value="OFF"/> - </logger> <logger name="de.huxhorn.lilith.engine.impl.eventproducer.AbstractMessageBasedEventProducer"> <level value="WARN"/> </logger> Modified: trunk/lilith/src/main/resources/logbackVerbose.xml =================================================================== --- trunk/lilith/src/main/resources/logbackVerbose.xml 2009-01-29 06:58:19 UTC (rev 150) +++ trunk/lilith/src/main/resources/logbackVerbose.xml 2009-01-31 14:22:13 UTC (rev 151) @@ -7,7 +7,7 @@ </layout> </appender> - <appender name="Lilith" class="de.huxhorn.lilith.appender.InternalLilithAppender"></appender> + <appender name="Lilith" class="de.huxhorn.lilith.appender.InternalLilithAppender"/> <appender name="MultiplexClassicCompressed" class="de.huxhorn.lilith.logback.appender.ClassicMultiplexSocketAppender"> @@ -126,10 +126,6 @@ <level value="WARN"/> </logger> - <logger name="de.huxhorn.sulky.buffers.SerializingFileBuffer"> - <level value="WARN"/> - </logger> - <logger name="de.huxhorn.lilith.engine.xml.eventproducer.LilithXmlStreamLoggingEventProducer"> <level value="DEBUG"/> </logger> @@ -222,7 +218,4 @@ <logger name="de.huxhorn.lilith.services.sender"> <level value="DEBUG"/> </logger> - <logger name="de.huxhorn.sulky.buffers.SerializingFileBuffer"> - <level value="OFF"/> - </logger> </configuration> Modified: trunk/lilith-engine/pom.xml =================================================================== --- trunk/lilith-engine/pom.xml 2009-01-29 06:58:19 UTC (rev 150) +++ trunk/lilith-engine/pom.xml 2009-01-31 14:22:13 UTC (rev 151) @@ -37,6 +37,12 @@ </dependency> <dependency> + <groupId>de.huxhorn.lilith</groupId> + <artifactId>de.huxhorn.lilith.data.logging</artifactId> + <scope>compile</scope> + </dependency> + + <dependency> <groupId>de.huxhorn.sulky</groupId> <artifactId>de.huxhorn.sulky.buffers</artifactId> <scope>compile</scope> Modified: trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/FileBufferFactory.java =================================================================== --- trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/FileBufferFactory.java 2009-01-29 06:58:19 UTC (rev 150) +++ trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/FileBufferFactory.java 2009-01-31 14:22:13 UTC (rev 151) @@ -19,8 +19,15 @@ import de.huxhorn.lilith.data.eventsource.EventWrapper; import de.huxhorn.lilith.data.eventsource.SourceIdentifier; +import de.huxhorn.lilith.data.logging.LoggingEvent; +import de.huxhorn.sulky.buffers.ExtendedSerializingFileBuffer; import de.huxhorn.sulky.buffers.FileBuffer; -import de.huxhorn.sulky.buffers.SerializingFileBuffer; +import de.huxhorn.sulky.generics.io.Deserializer; +import de.huxhorn.sulky.generics.io.SerializableDeserializer; +import de.huxhorn.sulky.generics.io.SerializableSerializer; +import de.huxhorn.sulky.generics.io.Serializer; +import de.huxhorn.sulky.generics.io.XmlDeserializer; +import de.huxhorn.sulky.generics.io.XmlSerializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,16 +35,31 @@ import java.io.File; import java.io.IOException; import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; public class FileBufferFactory<T extends Serializable> { private final Logger logger = LoggerFactory.getLogger(FileBufferFactory.class); private LogFileFactory logFileFactory; + private Integer magicValue; + private Map<String, String> metaData; - public FileBufferFactory(LogFileFactory logFileFactory) + public FileBufferFactory(LogFileFactory logFileFactory, Map<String, String> metaData) { this.logFileFactory = logFileFactory; + this.magicValue = FileConstants.MAGIC_VALUE; + if(metaData == null) + { + metaData = new HashMap<String, String>(); + } + else + { + metaData = new HashMap<String, String>(metaData); + } + + this.metaData = metaData; } public LogFileFactory getLogFileFactory() @@ -47,21 +69,67 @@ public FileBuffer<EventWrapper<T>> createBuffer(SourceIdentifier si) { - //String baseName=getBaseFileName(baseDirectory, si); - //File dataFile = new File(baseName+DATA_FILE_EXTENSION); - //File indexFile = new File(baseName+INDEX_FILE_EXTENSION); File dataFile = logFileFactory.getDataFile(si); File indexFile = logFileFactory.getIndexFile(si); if(logger.isInfoEnabled()) logger.info("Creating buffer for dataFile '{}'.", dataFile.getAbsolutePath()); - return new SerializingFileBuffer<EventWrapper<T>>(dataFile, indexFile); + Map<String, String> usedMetaData = new HashMap<String, String>(metaData); + usedMetaData.put(FileConstants.IDENTIFIER_KEY, si.getIdentifier()); + if(si.getSecondaryIdentifier() != null) + { + usedMetaData.put(FileConstants.SECONDARY_IDENTIFIER_KEY, si.getSecondaryIdentifier()); + } + + + ExtendedSerializingFileBuffer<EventWrapper<T>> result = new ExtendedSerializingFileBuffer<EventWrapper<T>>(magicValue, usedMetaData, null, null, dataFile, indexFile); + + Map<String, String> actualMetaData = result.getMetaData(); + boolean compressed = false; + boolean useXml = false; + boolean isLogging = true; + + if(actualMetaData != null) + { + compressed = Boolean.getBoolean(actualMetaData.get(FileConstants.COMPRESSED_KEY)); + String format = actualMetaData.get(FileConstants.CONTENT_FORMAT_KEY); + if(FileConstants.CONTENT_FORMAT_VALUE_XML.equals(format)) + { + useXml = true; + } + String type = actualMetaData.get(FileConstants.CONTENT_TYPE_KEY); + if(FileConstants.CONTENT_TYPE_VALUE_ACCESS.equals(type)) + { + isLogging = false; + } + } + Serializer<EventWrapper<T>> serializer; + Deserializer<EventWrapper<T>> deserializer; + if(useXml) + { + if(isLogging) + { + serializer = new XmlSerializer<EventWrapper<T>>(compressed, LoggingEvent.Level.class); + } + else + { + serializer = new XmlSerializer<EventWrapper<T>>(compressed); + } + deserializer = new XmlDeserializer<EventWrapper<T>>(compressed); + } + else + { + serializer = new SerializableSerializer<EventWrapper<T>>(); + deserializer = new SerializableDeserializer<EventWrapper<T>>(); + } + result.setSerializer(serializer); + result.setDeserializer(deserializer); + + return result; } public FileBuffer<EventWrapper<T>> createActiveBuffer(SourceIdentifier si) { - //String baseName=getBaseFileName(baseDirectory, si); FileBuffer<EventWrapper<T>> result = createBuffer(si); - //File activeFile=new File(baseName+ACTIVE_FILE_EXTENSION); File activeFile = logFileFactory.getActiveFile(si); try { @@ -75,7 +143,6 @@ return result; } - public long getSizeOnDisk(SourceIdentifier sourceIdentifier) { File indexFile = logFileFactory.getIndexFile(sourceIdentifier); Added: trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/FileConstants.java =================================================================== --- trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/FileConstants.java (rev 0) +++ trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/FileConstants.java 2009-01-31 14:22:13 UTC (rev 151) @@ -0,0 +1,40 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package de.huxhorn.lilith.engine; + +/** + * Defining the constants in one place... + */ +public interface FileConstants +{ + Integer MAGIC_VALUE = 0x0b501e7e; + String FILE_EXTENSION = "lilith"; + + String IDENTIFIER_KEY = "primaryIdentifier"; + String SECONDARY_IDENTIFIER_KEY = "secondaryIdentifier"; + + String CONTENT_TYPE_KEY = "contentType"; + String CONTENT_TYPE_VALUE_LOGGING = "logging"; + String CONTENT_TYPE_VALUE_ACCESS = "access"; + + String CONTENT_FORMAT_KEY = "contentFormat"; + String CONTENT_FORMAT_VALUE_SERIALIZED = "serialized"; + String CONTENT_FORMAT_VALUE_XML = "XML"; + + String COMPRESSED_KEY = "compressed"; +} Modified: trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/LogFileFactory.java =================================================================== --- trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/LogFileFactory.java 2009-01-29 06:58:19 UTC (rev 150) +++ trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/LogFileFactory.java 2009-01-31 14:22:13 UTC (rev 151) @@ -23,7 +23,7 @@ public interface LogFileFactory { - String INDEX_FILE_EXTENSION = ".index"; + String INDEX_FILE_EXTENSION = ".idx"; String ACTIVE_FILE_EXTENSION = ".active"; File getBaseDir(); Modified: trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/LogFileFactoryImpl.java =================================================================== --- trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/LogFileFactoryImpl.java 2009-01-29 06:58:19 UTC (rev 150) +++ trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/LogFileFactoryImpl.java 2009-01-31 14:22:13 UTC (rev 151) @@ -18,6 +18,7 @@ package de.huxhorn.lilith.engine.impl; import de.huxhorn.lilith.data.eventsource.SourceIdentifier; +import de.huxhorn.lilith.engine.FileConstants; import de.huxhorn.lilith.engine.LogFileFactory; import java.io.File; @@ -28,11 +29,11 @@ private File baseDir; private String dataFileExtension; - public LogFileFactoryImpl(File baseDir, String extension) + public LogFileFactoryImpl(File baseDir) { this.baseDir = baseDir; - this.dataFileExtension = extension; - if(!extension.startsWith(".")) + this.dataFileExtension = FileConstants.FILE_EXTENSION; + if(!dataFileExtension.startsWith(".")) { this.dataFileExtension = "." + this.dataFileExtension; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-29 06:58:26
|
Revision: 150 http://lilith.svn.sourceforge.net/lilith/?rev=150&view=rev Author: huxhorn Date: 2009-01-29 06:58:19 +0000 (Thu, 29 Jan 2009) Log Message: ----------- Work in progress on making the splash screen optional.See ticket:25. Also enhanced the splash screen to make it more useful, i.e. more info on what's going on. Modified Paths: -------------- trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/SplashScreen.java Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java 2009-01-28 07:18:41 UTC (rev 149) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java 2009-01-29 06:58:19 UTC (rev 150) @@ -89,7 +89,6 @@ private static Thread.UncaughtExceptionHandler uncaughtExceptionHandler; - private static boolean splashScreenDisabled; static { @@ -462,7 +461,7 @@ } } - splashScreenDisabled = applicationPreferences.isSplashScreenDisabled(); + boolean splashScreenDisabled = applicationPreferences.isSplashScreenDisabled(); try { SplashScreen splashScreen = null; @@ -532,7 +531,7 @@ } updateSplashStatus(splashScreen, "Creating main window..."); - CreateMainFrameRunnable createMain = new CreateMainFrameRunnable(applicationPreferences, appTitle, enableBonjour); + CreateMainFrameRunnable createMain = new CreateMainFrameRunnable(applicationPreferences, splashScreen, appTitle, enableBonjour); SwingUtilities.invokeAndWait(createMain); final MainFrame frame = createMain.getMainFrame(); if(logger.isDebugEnabled()) logger.debug("After show..."); @@ -587,13 +586,15 @@ static class CreateMainFrameRunnable implements Runnable { + private SplashScreen splashScreen; private MainFrame mainFrame; private ApplicationPreferences applicationPreferences; private String appTitle; private boolean enableBonjour; - public CreateMainFrameRunnable(ApplicationPreferences applicationPreferences, String appTitle, boolean enableBonjour) + public CreateMainFrameRunnable(ApplicationPreferences applicationPreferences, SplashScreen splashScreen, String appTitle, boolean enableBonjour) { + this.splashScreen=splashScreen; this.enableBonjour = enableBonjour; this.appTitle = appTitle; this.applicationPreferences = applicationPreferences; @@ -601,7 +602,7 @@ public void run() { - mainFrame = new MainFrame(applicationPreferences, appTitle, enableBonjour); + mainFrame = new MainFrame(applicationPreferences, splashScreen, appTitle, enableBonjour); mainFrame.setSounds(new JLayerSounds()); mainFrame.setSize(1024, 768); Windows.showWindow(mainFrame, null, false); Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java 2009-01-28 07:18:41 UTC (rev 149) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java 2009-01-29 06:58:19 UTC (rev 150) @@ -1160,7 +1160,7 @@ public boolean isSplashScreenDisabled() { - return PREFERENCES.getBoolean(SPLASH_SCREEN_DISABLED_PROPERTY, true); + return PREFERENCES.getBoolean(SPLASH_SCREEN_DISABLED_PROPERTY, false); } public void setShowingFullCallstack(boolean showingFullCallstack) Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java 2009-01-28 07:18:41 UTC (rev 149) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java 2009-01-29 06:58:19 UTC (rev 150) @@ -163,6 +163,7 @@ private List<SavedCondition> activeConditions; private Map<LoggingEvent.Level, Colors> levelColors; private Map<HttpStatus.Type, Colors> statusColors; + private SplashScreen splashScreen; /* * Need to use ConcurrentMap because it's accessed by both the EventDispatchThread and the CleanupThread. */ @@ -194,9 +195,11 @@ return desktop; } - public MainFrame(ApplicationPreferences applicationPreferences, String appName, boolean enableBonjour) + public MainFrame(ApplicationPreferences applicationPreferences, SplashScreen splashScreen, String appName, boolean enableBonjour) { super(appName); + this.splashScreen=splashScreen; + setSplashStatusText("Creating main frame."); //colorsReferenceQueue=new ReferenceQueue<Colors>(); //colorsCache=new ConcurrentHashMap<EventIdentifier, SoftColorsReference>(); application = new DefaultApplication(); @@ -240,10 +243,6 @@ rrdFileFilter = new RrdFileFilter(); - if(logger.isDebugEnabled()) logger.debug("Before creation of statistics-dialog..."); - statisticsDialog = new StatisticsDialog(this); - if(logger.isDebugEnabled()) logger.debug("After creation of statistics-dialog..."); - loggingEventViewManager = new LoggingEventViewManager(this); accessEventViewManager = new AccessEventViewManager(this); this.applicationPreferences = applicationPreferences; @@ -283,14 +282,26 @@ add(desktop, BorderLayout.CENTER); add(statusBar, BorderLayout.SOUTH); + setSplashStatusText("Creating statistics dialog."); + if(logger.isDebugEnabled()) logger.debug("Before creation of statistics-dialog..."); + statisticsDialog = new StatisticsDialog(this); + if(logger.isDebugEnabled()) logger.debug("After creation of statistics-dialog..."); + + setSplashStatusText("Creating about dialog."); aboutDialog = new AboutDialog(this, "About " + appName + "...", appName); + setSplashStatusText("Creating debug dialog."); + debugDialog = new DebugDialog(this, this); - debugDialog = new DebugDialog(this, this); + setSplashStatusText("Creating preferences dialog."); if(logger.isDebugEnabled()) logger.debug("Before creation of preferences-dialog..."); preferencesDialog = new PreferencesDialog(this); if(logger.isDebugEnabled()) logger.debug("After creation of preferences-dialog..."); + + setSplashStatusText("Creating \"Open inactive\" dialog."); openInactiveLogsDialog = new OpenPreviousDialog(MainFrame.this); + + setSplashStatusText("Creating help frame."); helpFrame = new HelpFrame(this); helpFrame.setTitle("Help Topics"); @@ -320,6 +331,14 @@ helpUrl = MainFrame.class.getResource("/help/index.xhtml"); } + private void setSplashStatusText(String text) + { + if(splashScreen!=null) + { + splashScreen.setStatusText(text); + } + } + public Application getApplication() { return application; @@ -423,6 +442,7 @@ //referenceCollection.setDaemon(true); //referenceCollection.start(); + setSplashStatusText("Executing autostart items."); // Autostart { File autostartDir = new File(startupApplicationPath, "autostart"); @@ -471,6 +491,7 @@ //gotoSource.start() started when needed... } + setSplashStatusText("Creating global views."); SourceIdentifier globalSourceIdentifier = new SourceIdentifier("global", null); File globalLoggingDataFile = loggingFileFactory.getDataFile(globalSourceIdentifier); File globalLoggingIndexFile = loggingFileFactory.getIndexFile(globalSourceIdentifier); @@ -488,6 +509,7 @@ EventSource<LoggingEvent> globalLoggingEventSource = new EventSourceImpl<LoggingEvent>(globalSourceIdentifier, loggingFileDump.getBuffer(), true); lsm.addSource(globalLoggingEventSource); + setSplashStatusText("Creating internal view."); // add internal lilith logging EventSource<LoggingEvent> lilithLoggingEventSource = new EventSourceImpl<LoggingEvent>(InternalLilithAppender.getSourceIdentifier(), InternalLilithAppender.getBuffer(), false); lsm.addSource(lilithLoggingEventSource); @@ -509,6 +531,7 @@ if(logger.isWarnEnabled()) logger.warn("Exception while creating event producer!", ex); } + setSplashStatusText("Starting event receivers."); try { SerializingMessageBasedServerSocketEventSourceProducer<LoggingEvent> producer @@ -615,6 +638,8 @@ viewActions = new ViewActions(this, null); viewActions.getPopupMenu(); // initialize popup once in main frame only. + setSplashStatusText("Setting up event consumers."); + RrdLoggingEventConsumer rrdDb = new RrdLoggingEventConsumer(); rrdDb.setBasePath(new File(startupApplicationPath, "statistics")); AlarmSoundLoggingEventConsumer loggingEventAlarmSound = new AlarmSoundLoggingEventConsumer(); @@ -677,6 +702,7 @@ checkForUpdate(false); } updateConditions(); // to initialize active conditions. + setSplashStatusText("Finished."); } public void goToSource(StackTraceElement ste) Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/SplashScreen.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/SplashScreen.java 2009-01-28 07:18:41 UTC (rev 149) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/SplashScreen.java 2009-01-29 06:58:19 UTC (rev 150) @@ -34,6 +34,7 @@ private final Logger logger = LoggerFactory.getLogger(SplashScreen.class); private JLabel statusLabel; + private JPanel contentPane; public SplashScreen(String applicationTitle) { @@ -44,7 +45,7 @@ private void initUI(String applicationTitle) { - Container contentPane = new JPanel(true); + contentPane = new JPanel(true); contentPane.setLayout(new BorderLayout()); URL url = SplashScreen.class.getResource("/splash/splash.jpg"); if(url != null) @@ -64,7 +65,17 @@ } } statusLabel = new JLabel(); + statusLabel.setOpaque(true); + statusLabel.setForeground(Color.BLACK); + statusLabel.setBackground(Color.WHITE); + statusLabel.setHorizontalAlignment(SwingConstants.CENTER); + JLabel titleLabel = new JLabel(applicationTitle); + titleLabel.setOpaque(true); + titleLabel.setForeground(Color.BLACK); + titleLabel.setBackground(Color.WHITE); + titleLabel.setHorizontalAlignment(SwingConstants.CENTER); + contentPane.add(titleLabel, BorderLayout.NORTH); contentPane.add(statusLabel, BorderLayout.SOUTH); statusLabel.setText("Initializing..."); @@ -80,7 +91,11 @@ setVisible(true); } toFront(); - repaint(); + Rectangle bounds = contentPane.getBounds(); + int height=statusLabel.getHeight(); + contentPane.paintImmediately(0,bounds.height-height,bounds.width, height); + //statusLabel.paintImmediately(statusLabel.getBounds()); + //repaint(); } private class ImagePanel This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-28 07:18:50
|
Revision: 149 http://lilith.svn.sourceforge.net/lilith/?rev=149&view=rev Author: huxhorn Date: 2009-01-28 07:18:41 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Added ability to prevent splash screen. See ticket:25. Modified Paths: -------------- trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java 2009-01-26 21:42:20 UTC (rev 148) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java 2009-01-28 07:18:41 UTC (rev 149) @@ -89,6 +89,7 @@ private static Thread.UncaughtExceptionHandler uncaughtExceptionHandler; + private static boolean splashScreenDisabled; static { @@ -368,31 +369,37 @@ private static void updateSplashStatus(final SplashScreen splashScreen, final String status) throws InvocationTargetException, InterruptedException { - SwingUtilities.invokeAndWait(new Runnable() + if(splashScreen != null) { + SwingUtilities.invokeAndWait(new Runnable() + { - public void run() - { - if(!splashScreen.isVisible()) + public void run() { - Windows.showWindow(splashScreen, null, true); + if(!splashScreen.isVisible()) + { + Windows.showWindow(splashScreen, null, true); + } + splashScreen.toFront(); + splashScreen.setStatusText(status); } - splashScreen.toFront(); - splashScreen.setStatusText(status); - } - }); + }); + } } private static void hideSplashScreen(final SplashScreen splashScreen) throws InvocationTargetException, InterruptedException { - SwingUtilities.invokeAndWait(new Runnable() + if(splashScreen != null) { - public void run() + SwingUtilities.invokeAndWait(new Runnable() { - splashScreen.setVisible(false); - } - }); + public void run() + { + splashScreen.setVisible(false); + } + }); + } } public static void startUI(final String appTitle, boolean enableBonjour) @@ -455,13 +462,18 @@ } } + splashScreenDisabled = applicationPreferences.isSplashScreenDisabled(); try { - CreateSplashRunnable createRunnable = new CreateSplashRunnable(appTitle); - SwingUtilities.invokeAndWait(createRunnable); - SplashScreen splashScreen = createRunnable.getSplashScreen(); - Thread.sleep(500); // so the splash gets the chance to get displayed :( - updateSplashStatus(splashScreen, "Initialized application preferences..."); + SplashScreen splashScreen = null; + if(!splashScreenDisabled) + { + CreateSplashRunnable createRunnable = new CreateSplashRunnable(appTitle); + SwingUtilities.invokeAndWait(createRunnable); + splashScreen = createRunnable.getSplashScreen(); + Thread.sleep(500); // so the splash gets the chance to get displayed :( + updateSplashStatus(splashScreen, "Initialized application preferences..."); + } File startupApplicationPath = applicationPreferences.getStartupApplicationPath(); if(startupApplicationPath.mkdirs()) Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java 2009-01-26 21:42:20 UTC (rev 148) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java 2009-01-28 07:18:41 UTC (rev 149) @@ -108,6 +108,7 @@ public static final String BLACK_LIST_NAME_PROPERTY = "blackListName"; public static final String WHITE_LIST_NAME_PROPERTY = "whiteListName"; public static final String CONDITIONS_PROPERTY = "conditions"; + public static final String SPLASH_SCREEN_DISABLED_PROPERTY = "splashScreenDisabled"; public static final String LOGGING_LAYOUT_GLOBAL_XML_FILENAME = "loggingLayoutGlobal.xml"; public static final String LOGGING_LAYOUT_XML_FILENAME = "loggingLayout.xml"; @@ -1149,6 +1150,19 @@ return PREFERENCES.getBoolean(SHOWING_IDENTIFIER_PROPERTY, true); } + public void setSplashScreenDisabled(boolean splashScreenDisabled) + { + Object oldValue = isSplashScreenDisabled(); + PREFERENCES.putBoolean(SPLASH_SCREEN_DISABLED_PROPERTY, splashScreenDisabled); + Object newValue = isSplashScreenDisabled(); + propertyChangeSupport.firePropertyChange(SPLASH_SCREEN_DISABLED_PROPERTY, oldValue, newValue); + } + + public boolean isSplashScreenDisabled() + { + return PREFERENCES.getBoolean(SPLASH_SCREEN_DISABLED_PROPERTY, true); + } + public void setShowingFullCallstack(boolean showingFullCallstack) { Object oldValue = isShowingFullCallstack(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-26 22:49:01
|
Revision: 148 http://lilith.svn.sourceforge.net/lilith/?rev=148&view=rev Author: huxhorn Date: 2009-01-26 21:42:20 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Added "Copy MDC" and "Copy NDC" actions. See ticket:27. Added several serialVersionUIDs. Modified Paths: -------------- trunk/lilith/src/changes/changes.xml trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ViewActions.java Modified: trunk/lilith/src/changes/changes.xml =================================================================== --- trunk/lilith/src/changes/changes.xml 2009-01-26 20:37:19 UTC (rev 147) +++ trunk/lilith/src/changes/changes.xml 2009-01-26 21:42:20 UTC (rev 148) @@ -115,6 +115,9 @@ <action dev="jhux" type="update" issue="27"> Implemented XML I/O of NDC. </action> + <action dev="jhux" type="add" issue="27"> + Added "Copy MDC" and "Copy NDC" actions. + </action> <action dev="jhux" type="add"> TODO: Add transfer size statistics. </action> Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ViewActions.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ViewActions.java 2009-01-26 20:37:19 UTC (rev 147) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ViewActions.java 2009-01-26 21:42:20 UTC (rev 148) @@ -23,6 +23,7 @@ import de.huxhorn.lilith.data.logging.ExtendedStackTraceElement; import de.huxhorn.lilith.data.logging.LoggingEvent; import de.huxhorn.lilith.data.logging.Marker; +import de.huxhorn.lilith.data.logging.Message; import de.huxhorn.lilith.data.logging.ThrowableInfo; import de.huxhorn.lilith.engine.EventSource; import de.huxhorn.lilith.services.sender.EventSender; @@ -47,6 +48,7 @@ import java.util.List; import java.util.Map; import java.util.SortedMap; +import java.util.TreeMap; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -488,7 +490,6 @@ private FindMenuAction findMenuAction; private JMenu searchMenu; private JMenu viewMenu; - private JMenu layoutMenu; private JMenu showHideMenu; private ClearMenuAction clearMenuAction; private FocusMessageAction focusMessageAction; @@ -504,6 +505,8 @@ private CopyLoggingThrowableAction copyLoggingThrowableAction; private CopyLoggingCallStackAction copyLoggingCallStackAction; private CopyLoggingMarkerAction copyLoggingMarkerAction; + private CopyLoggingMdcAction copyLoggingMdcAction; + private CopyLoggingNdcAction copyLoggingNdcAction; private CopyLoggerNameAction copyLoggerNameAction; private CopyAccessUriAction copyAccessUriAction; private ShowUnfilteredEventAction showUnfilteredEventAction; @@ -577,6 +580,8 @@ copyLoggingThrowableAction = new CopyLoggingThrowableAction(); copyLoggingCallStackAction = new CopyLoggingCallStackAction(); copyLoggingMarkerAction = new CopyLoggingMarkerAction(); + copyLoggingMdcAction = new CopyLoggingMdcAction(); + copyLoggingNdcAction = new CopyLoggingNdcAction(); copyAccessUriAction = new CopyAccessUriAction(); @@ -700,6 +705,8 @@ editMenu.add(copyLoggingThrowableAction); editMenu.add(copyLoggingCallStackAction); editMenu.add(copyLoggingMarkerAction); + editMenu.add(copyLoggingMdcAction); + editMenu.add(copyLoggingNdcAction); editMenu.addSeparator(); editMenu.add(copyAccessUriAction); @@ -726,7 +733,7 @@ viewMenu.add(editSourceNameMenuAction); viewMenu.add(editConditionMenuAction); viewMenu.addSeparator(); - layoutMenu = new JMenu("Layout"); + JMenu layoutMenu = new JMenu("Layout"); showHideMenu = new JMenu("Show/Hide"); layoutMenu.add(showHideMenu); layoutMenu.addSeparator(); @@ -1276,6 +1283,8 @@ copyMenuItem.add(new JMenuItem(copyLoggingThrowableAction)); copyMenuItem.add(new JMenuItem(copyLoggingCallStackAction)); copyMenuItem.add(new JMenuItem(copyLoggingMarkerAction)); + copyMenuItem.add(new JMenuItem(copyLoggingMdcAction)); + copyMenuItem.add(new JMenuItem(copyLoggingNdcAction)); copyMenuItem.addSeparator(); copyMenuItem.add(new JMenuItem(copyAccessUriAction)); @@ -1297,6 +1306,8 @@ copyLoggingThrowableAction.setEventWrapper(wrapper); copyLoggingCallStackAction.setEventWrapper(wrapper); copyLoggingMarkerAction.setEventWrapper(wrapper); + copyLoggingMdcAction.setEventWrapper(wrapper); + copyLoggingNdcAction.setEventWrapper(wrapper); copyAccessUriAction.setEventWrapper(wrapper); } @@ -1340,6 +1351,7 @@ sendToMenuItem.setEnabled(true); for(Map.Entry<String, EventSender<LoggingEvent>> current : senders.entrySet()) { + @SuppressWarnings({"unchecked"}) SendAction<LoggingEvent> action = new SendAction<LoggingEvent>(current.getKey(), current.getValue(), eventWrapper); JMenuItem menuItem = new JMenuItem(action); sendToMenuItem.add(menuItem); @@ -1359,6 +1371,7 @@ sendToMenuItem.setEnabled(true); for(Map.Entry<String, EventSender<AccessEvent>> current : senders.entrySet()) { + @SuppressWarnings({"unchecked"}) SendAction<AccessEvent> action = new SendAction<AccessEvent>(current.getKey(), current.getValue(), eventWrapper); JMenuItem menuItem = new JMenuItem(action); sendToMenuItem.add(menuItem); @@ -1405,6 +1418,7 @@ private class RemoveInactiveAction extends AbstractAction { + private static final long serialVersionUID = -6662970580652310690L; public RemoveInactiveAction() { @@ -1426,6 +1440,7 @@ private class CloseAllAction extends AbstractAction { + private static final long serialVersionUID = -1587444647880660196L; public CloseAllAction() { @@ -1447,6 +1462,7 @@ private class CloseAllOtherAction extends AbstractAction { + private static final long serialVersionUID = -3031217070975763827L; public CloseAllOtherAction() { @@ -1468,6 +1484,7 @@ private class MinimizeAllAction extends AbstractAction { + private static final long serialVersionUID = -8828005158469519472L; public MinimizeAllAction() { @@ -1489,6 +1506,7 @@ private class MinimizeAllOtherAction extends AbstractAction { + private static final long serialVersionUID = -2357859864329239268L; public MinimizeAllOtherAction() { @@ -1510,6 +1528,7 @@ private class ClearToolBarAction extends AbstractAction { + private static final long serialVersionUID = -4713267797278778997L; public ClearToolBarAction() { @@ -1527,6 +1546,8 @@ private class ClearMenuAction extends AbstractAction { + private static final long serialVersionUID = 776175842981192877L; + public ClearMenuAction() { super("Clear"); @@ -1543,6 +1564,8 @@ private class EditConditionMenuAction extends AbstractAction { + private static final long serialVersionUID = -8380709624103338783L; + public EditConditionMenuAction() { super("Add condition..."); @@ -1580,6 +1603,8 @@ private class EditSourceNameMenuAction extends AbstractAction { + private static final long serialVersionUID = 2807692748192366344L; + public EditSourceNameMenuAction() { super("Edit source name..."); @@ -1620,6 +1645,8 @@ private class AttachMenuAction extends AbstractAction { + private static final long serialVersionUID = -6686061036755515933L; + private Icon attachIcon = ATTACH_MENU_ICON; private Icon detachIcon = DETACH_MENU_ICON; @@ -1663,6 +1690,8 @@ private class AttachToolBarAction extends AbstractAction { + private static final long serialVersionUID = -6338324258055926639L; + private Icon attachIcon = ATTACH_TOOLBAR_ICON; private Icon detachIcon = DETACH_TOOLBAR_ICON; @@ -1706,6 +1735,8 @@ private class PauseMenuAction extends AbstractAction { + private static final long serialVersionUID = -5242236903640590549L; + private Icon pausedIcon = PAUSED_MENU_ICON; private Icon unpausedIcon = UNPAUSED_MENU_ICON; @@ -1743,6 +1774,8 @@ private class PauseToolBarAction extends AbstractAction { + private static final long serialVersionUID = -5118623805829814815L; + private Icon pausedIcon = PAUSED_TOOLBAR_ICON; private Icon unpausedIcon = UNPAUSED_TOOLBAR_ICON; @@ -1780,6 +1813,8 @@ private class FindMenuAction extends AbstractAction { + private static final long serialVersionUID = 2241714830900044485L; + public FindMenuAction() { super("Find"); @@ -1799,6 +1834,8 @@ private class FindToolBarAction extends AbstractAction { + private static final long serialVersionUID = -4080152597948489206L; + public FindToolBarAction() { super(); @@ -1818,6 +1855,8 @@ private class StatisticsMenuAction extends AbstractAction { + private static final long serialVersionUID = -6336357605789928345L; + public StatisticsMenuAction() { super("Statistics"); @@ -1834,6 +1873,8 @@ private class StatisticsToolBarAction extends AbstractAction { + private static final long serialVersionUID = 2394035359331601001L; + public StatisticsToolBarAction() { super(); @@ -1850,6 +1891,8 @@ private class DisconnectMenuAction extends AbstractAction { + private static final long serialVersionUID = 8971640305824353589L; + public DisconnectMenuAction() { super("Disconnect"); @@ -1869,6 +1912,8 @@ private class DisconnectToolBarAction extends AbstractAction { + private static final long serialVersionUID = -8665004340745035737L; + public DisconnectToolBarAction() { super(); @@ -1885,6 +1930,8 @@ private class FocusMessageAction extends AbstractAction { + private static final long serialVersionUID = -421929316399318971L; + public FocusMessageAction() { super("Focus message"); @@ -1904,6 +1951,8 @@ private class FocusEventsAction extends AbstractAction { + private static final long serialVersionUID = 4207817900003297701L; + public FocusEventsAction() { super("Focus events"); @@ -1923,6 +1972,8 @@ private class FindNextAction extends AbstractAction { + private static final long serialVersionUID = 4771628062043742857L; + public FindNextAction() { super("Find next"); @@ -1943,6 +1994,8 @@ private class FindPreviousAction extends AbstractAction { + private static final long serialVersionUID = -284066693780808511L; + public FindPreviousAction() { super("Find previous"); @@ -1962,6 +2015,8 @@ private class ResetFindAction extends AbstractAction { + private static final long serialVersionUID = -1245378100755440576L; + public ResetFindAction() { super("Reset find"); @@ -1980,6 +2035,8 @@ private class ScrollToBottomMenuAction extends AbstractAction { + private static final long serialVersionUID = -6698886479454486019L; + private Icon selectedIcon = TAIL_MENU_ICON; private Icon unselectedIcon = EMPTY_16_ICON; @@ -2017,6 +2074,7 @@ private class ScrollToBottomToolBarAction extends AbstractAction { + private static final long serialVersionUID = -7793074053120455264L; public ScrollToBottomToolBarAction() { @@ -2040,6 +2098,8 @@ private class CloseFilterAction extends AbstractAction { + private static final long serialVersionUID = -842677137302613585L; + public CloseFilterAction() { super("Close this filter"); @@ -2080,6 +2140,8 @@ private class CloseOtherFiltersAction extends AbstractAction { + private static final long serialVersionUID = -6399148183817841417L; + public CloseOtherFiltersAction() { super("Close all other filters"); @@ -2121,6 +2183,8 @@ private class CloseAllFiltersAction extends AbstractAction { + private static final long serialVersionUID = 1212878326080544663L; + public CloseAllFiltersAction() { super("Close all filters"); @@ -2155,6 +2219,8 @@ class ViewLoggingAction extends AbstractAction { + private static final long serialVersionUID = 6967472316665780683L; + private EventSource<LoggingEvent> eventSource; public ViewLoggingAction(EventSource<LoggingEvent> eventSource) @@ -2190,6 +2256,8 @@ class ViewAccessAction extends AbstractAction { + private static final long serialVersionUID = 8054851261518410946L; + private EventSource<AccessEvent> eventSource; public ViewAccessAction(EventSource<AccessEvent> eventSource) @@ -2214,6 +2282,8 @@ class ViewStatisticsAction extends AbstractAction { + private static final long serialVersionUID = 4453230971326526165L; + private SourceIdentifier sourceIentifier; public ViewStatisticsAction(String name, SourceIdentifier sourceIdentifier) @@ -2231,6 +2301,7 @@ static class StatisticsSubMenuAction extends AbstractAction { + private static final long serialVersionUID = -8180660223848656769L; public StatisticsSubMenuAction() { @@ -2526,6 +2597,7 @@ class AboutAction extends AbstractAction { + private static final long serialVersionUID = -372250750198620913L; public AboutAction() { @@ -2542,6 +2614,7 @@ class SaveLayoutAction extends AbstractAction { + private static final long serialVersionUID = 6135867758474252484L; public SaveLayoutAction() { @@ -2569,6 +2642,7 @@ class ResetLayoutAction extends AbstractAction { + private static final long serialVersionUID = -8396518428359553649L; public ResetLayoutAction() { @@ -2596,6 +2670,7 @@ class CheckForUpdateAction extends AbstractAction { + private static final long serialVersionUID = 529742851501771901L; public CheckForUpdateAction() { @@ -2612,6 +2687,8 @@ class KeyboardHelpAction extends AbstractAction { + private static final long serialVersionUID = 6942092383339768508L; + public KeyboardHelpAction() { super("Help Topics"); @@ -2627,6 +2704,7 @@ class PreferencesMenuAction extends AbstractAction { + private static final long serialVersionUID = -196036112324455446L; public PreferencesMenuAction() { @@ -2647,6 +2725,7 @@ class PreferencesToolBarAction extends AbstractAction { + private static final long serialVersionUID = 8353604009441967874L; public PreferencesToolBarAction() { @@ -2668,6 +2747,7 @@ class DebugAction extends AbstractAction { + private static final long serialVersionUID = -1837786931224404611L; public DebugAction() { @@ -2684,6 +2764,7 @@ class ExitMenuAction extends AbstractAction { + private static final long serialVersionUID = 6693131597277483031L; public ExitMenuAction() { @@ -2704,6 +2785,8 @@ class OpenInactiveLogMenuAction extends AbstractAction { + private static final long serialVersionUID = 7500131416548647712L; + public OpenInactiveLogMenuAction() { super("Open inactive log..."); @@ -2723,6 +2806,7 @@ class CleanAllInactiveLogsMenuAction extends AbstractAction { + private static final long serialVersionUID = 626049491764655228L; public CleanAllInactiveLogsMenuAction() { @@ -2744,6 +2828,8 @@ private class PreviousTabAction extends AbstractAction { + private static final long serialVersionUID = 3841435361964210123L; + public PreviousTabAction() { super("Previous tab"); @@ -2782,6 +2868,8 @@ private class NextTabAction extends AbstractAction { + private static final long serialVersionUID = 6997026628818486446L; + public NextTabAction() { super("Next tab"); @@ -2821,6 +2909,8 @@ private class CopyEventAction extends AbstractAction { + private static final long serialVersionUID = -551520865313383753L; + private EventWrapper eventWrapper; public CopyEventAction() @@ -2860,6 +2950,8 @@ private class CopyLoggingMessageAction extends AbstractAction { + private static final long serialVersionUID = -1147972057354807369L; + private String message; public CopyLoggingMessageAction() @@ -2898,6 +2990,8 @@ private class CopyLoggerNameAction extends AbstractAction { + private static final long serialVersionUID = 6056521432357588113L; + private String loggerName; public CopyLoggerNameAction() @@ -2936,6 +3030,8 @@ private class CopyLoggingThrowableAction extends AbstractAction { + private static final long serialVersionUID = -2869680200462202650L; + private ThrowableInfo throwableInfo; public CopyLoggingThrowableAction() @@ -3001,6 +3097,8 @@ private class CopyLoggingCallStackAction extends AbstractAction { + private static final long serialVersionUID = -7271955597619779579L; + private ExtendedStackTraceElement[] callStack; public CopyLoggingCallStackAction() @@ -3057,6 +3155,8 @@ private class CopyLoggingMarkerAction extends AbstractAction { + private static final long serialVersionUID = -3523674814363899315L; + private Marker marker; public CopyLoggingMarkerAction() @@ -3125,9 +3225,106 @@ } } + private class CopyLoggingMdcAction + extends AbstractAction + { + private static final long serialVersionUID = 2453432319268833157L; + + private Map<String, String> mdc; + + public CopyLoggingMdcAction() + { + super("Copy MDC"); + putValue(Action.SHORT_DESCRIPTION, "Copies the Mapped Diagnostic Context of the logging event to the clipboard."); + } + + public void setEventWrapper(EventWrapper wrapper) + { + Map<String, String> mdc = null; + if(wrapper != null && wrapper.getEvent() != null) + { + Object eventObj = wrapper.getEvent(); + if(eventObj instanceof LoggingEvent) + { + LoggingEvent loggingEvent = (LoggingEvent) eventObj; + mdc = loggingEvent.getMdc(); + } + } + setMdc(mdc); + } + + private void setMdc(Map<String, String> mdc) + { + this.mdc = mdc; + setEnabled(mdc != null); + } + + public void actionPerformed(ActionEvent e) + { + StringBuilder text = new StringBuilder(); + if(mdc != null) + { + SortedMap<String, String> sorted = new TreeMap<String, String>(mdc); + for(Map.Entry<String, String> current : sorted.entrySet()) + { + text.append(current.getKey()).append("\t").append(current.getValue()).append("\n"); + } + } + mainFrame.copyText(text.toString()); + } + } + + private class CopyLoggingNdcAction + extends AbstractAction + { + private static final long serialVersionUID = -1530866703421390638L; + private Message[] ndc; + + public CopyLoggingNdcAction() + { + super("Copy NDC"); + putValue(Action.SHORT_DESCRIPTION, "Copies the Nested Diagnostic Context of the logging event to the clipboard."); + } + + public void setEventWrapper(EventWrapper wrapper) + { + Message[] ndc = null; + if(wrapper != null && wrapper.getEvent() != null) + { + Object eventObj = wrapper.getEvent(); + if(eventObj instanceof LoggingEvent) + { + LoggingEvent loggingEvent = (LoggingEvent) eventObj; + ndc = loggingEvent.getNdc(); + } + } + setNdc(ndc); + } + + private void setNdc(Message[] ndc) + { + this.ndc = ndc; + setEnabled(ndc != null); + } + + public void actionPerformed(ActionEvent e) + { + StringBuilder text = new StringBuilder(); + if(ndc != null) + { + for(Message current : ndc) + { + text.append(current.getMessage()).append("\n"); + } + } + mainFrame.copyText(text.toString()); + } + } + private class CopyAccessUriAction extends AbstractAction { + private static final long serialVersionUID = -3535746663619981434L; private String requestUri; public CopyAccessUriAction() @@ -3166,6 +3363,7 @@ private class ShowUnfilteredEventAction extends AbstractAction { + private static final long serialVersionUID = -3282222163767568550L; public ShowUnfilteredEventAction() { @@ -3183,6 +3381,7 @@ private class GotoSourceAction extends AbstractAction { + private static final long serialVersionUID = 4284532761807647658L; private ExtendedStackTraceElement stackTraceElement; public GotoSourceAction() @@ -3227,6 +3426,7 @@ protected class SendAction<T extends Serializable> extends AbstractAction { + private static final long serialVersionUID = 6612401555757959404L; private EventSender<T> sender; private T event; @@ -3250,6 +3450,7 @@ private class ShowHideAction extends AbstractAction { + private static final long serialVersionUID = 7775753128032553866L; private boolean visible; private String columnName; private PersistentTableColumnModel tableColumnModel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-26 20:37:27
|
Revision: 147 http://lilith.svn.sourceforge.net/lilith/?rev=147&view=rev Author: huxhorn Date: 2009-01-26 20:37:19 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Updated XML Schema to include NDC. Implemented XML I/O of NDC. See ticket:27. Modified Paths: -------------- trunk/lilith/src/changes/changes.xml trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventReader.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventSchemaConstants.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventWriter.java trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventIOTest.java trunk/lilith-data/xml-schema/examples/LoggingEvent.xml Added Paths: ----------- trunk/lilith-data/xml-schema/schema/logging/12/ trunk/lilith-data/xml-schema/schema/logging/12/LoggingEvent.xsd trunk/lilith-data/xml-schema/schema/logging/12/index.php Modified: trunk/lilith/src/changes/changes.xml =================================================================== --- trunk/lilith/src/changes/changes.xml 2009-01-26 20:35:32 UTC (rev 146) +++ trunk/lilith/src/changes/changes.xml 2009-01-26 20:37:19 UTC (rev 147) @@ -109,6 +109,12 @@ <action dev="jhux" type="add" issue="27"> NDC support in detailsView.groovy </action> + <action dev="jhux" type="update" issue="27"> + Updated XML Schema to include NDC. + </action> + <action dev="jhux" type="update" issue="27"> + Implemented XML I/O of NDC. + </action> <action dev="jhux" type="add"> TODO: Add transfer size statistics. </action> Modified: trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventReader.java =================================================================== --- trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventReader.java 2009-01-26 20:35:32 UTC (rev 146) +++ trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventReader.java 2009-01-26 20:37:19 UTC (rev 147) @@ -82,7 +82,13 @@ } reader.nextTag(); result.setMessagePattern(StaxUtilities.readSimpleTextNodeIfAvailable(reader, NAMESPACE_URI, MESSAGE_NODE)); - readArguments(reader, result); + + List<String> args = readArguments(reader); + if(args!=null) + { + result.setArguments(args.toArray(new String[args.size()])); + } + readThrowable(reader, result); result.setMdc(readMdc(reader)); result.setNdc(readNdc(reader)); @@ -245,10 +251,28 @@ return null; } - private List<Message> readNdc(XMLStreamReader reader) + private Message[] readNdc(XMLStreamReader reader) throws XMLStreamException { - // TODO: implement readNdc. + int type = reader.getEventType(); + if(XMLStreamConstants.START_ELEMENT == type && NDC_NODE.equals(reader.getLocalName()) && NAMESPACE_URI + .equals(reader.getNamespaceURI())) + { + List<Message> ndc = new ArrayList<Message>(); + reader.nextTag(); + for(; ;) + { + Message entry = readNdcEntry(reader); + if(entry == null) + { + break; + } + ndc.add(entry); + } + reader.require(XMLStreamConstants.END_ELEMENT, NAMESPACE_URI, NDC_NODE); + reader.nextTag(); + return ndc.toArray(new Message[ndc.size()]); + } return null; } @@ -269,6 +293,31 @@ return null; } + private Message readNdcEntry(XMLStreamReader reader) + throws XMLStreamException + { + int type = reader.getEventType(); + if(XMLStreamConstants.START_ELEMENT == type && NDC_ENTRY_NODE.equals(reader.getLocalName()) && NAMESPACE_URI + .equals(reader.getNamespaceURI())) + { + reader.nextTag(); + + Message entry = new Message(); + entry.setMessagePattern(StaxUtilities.readSimpleTextNodeIfAvailable(reader, NAMESPACE_URI, MESSAGE_NODE)); + + List<String> args = readArguments(reader); + if(args!=null) + { + entry.setArguments(args.toArray(new String[args.size()])); + } + + reader.require(XMLStreamConstants.END_ELEMENT, NAMESPACE_URI, NDC_ENTRY_NODE); + reader.nextTag(); + return entry; + } + return null; + } + private void readThrowable(XMLStreamReader reader, LoggingEvent event) throws XMLStreamException { @@ -313,7 +362,7 @@ return null; } - private void readArguments(XMLStreamReader reader, LoggingEvent event) + private List<String> readArguments(XMLStreamReader reader) throws XMLStreamException { int type = reader.getEventType(); @@ -334,8 +383,9 @@ String arg = readArgument(reader); args.add(arg); } - event.setArguments(args.toArray(new String[args.size()])); + return args; } + return null; } private String readArgument(XMLStreamReader reader) Modified: trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventSchemaConstants.java =================================================================== --- trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventSchemaConstants.java 2009-01-26 20:35:32 UTC (rev 146) +++ trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventSchemaConstants.java 2009-01-26 20:37:19 UTC (rev 147) @@ -19,8 +19,8 @@ public interface LoggingEventSchemaConstants { - String NAMESPACE_URI = "http://lilith.sf.net/schema/logging/11"; - String NAMESPACE_LOCATION = "http://lilith.sf.net/schema/logging/11/LoggingEvent.xsd"; + String NAMESPACE_URI = "http://lilith.sf.net/schema/logging/12"; + String NAMESPACE_LOCATION = "http://lilith.sf.net/schema/logging/12/LoggingEvent.xsd"; String DEFAULT_NAMESPACE_PREFIX = "log"; @@ -49,6 +49,9 @@ String MDC_ENTRY_NODE = "Entry"; String MDC_ENTRY_KEY_ATTRIBUTE = "key"; + String NDC_NODE = "NDC"; + String NDC_ENTRY_NODE = "Entry"; + String MARKER_NODE = "Marker"; String MARKER_NAME_ATTRIBUTE = "name"; String MARKER_REFERENCE_NODE = "MarkerReference"; Modified: trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventWriter.java =================================================================== --- trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventWriter.java 2009-01-26 20:35:32 UTC (rev 146) +++ trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventWriter.java 2009-01-26 20:37:19 UTC (rev 147) @@ -21,6 +21,7 @@ import de.huxhorn.lilith.data.logging.LoggingEvent; import de.huxhorn.lilith.data.logging.Marker; import de.huxhorn.lilith.data.logging.ThrowableInfo; +import de.huxhorn.lilith.data.logging.Message; import de.huxhorn.sulky.stax.DateTimeFormatter; import de.huxhorn.sulky.stax.GenericStreamWriter; import de.huxhorn.sulky.stax.StaxUtilities; @@ -120,7 +121,7 @@ .writeAttribute(writer, false, prefix, NAMESPACE_URI, TIMESTAMP_ATTRIBUTE, dateTimeFormatter.format(event.getTimeStamp())); StaxUtilities.writeSimpleTextNode(writer, prefix, NAMESPACE_URI, MESSAGE_NODE, event.getMessagePattern()); - writeArguments(writer, event); + writeArguments(writer, event.getArguments()); writeThrowable(writer, event); writeMdc(writer, event); writeNdc(writer, event); @@ -186,12 +187,6 @@ } - private void writeNdc(XMLStreamWriter writer, LoggingEvent event) - throws XMLStreamException - { - // TODO: implement writeNdc. - } - private void writeMdc(XMLStreamWriter writer, LoggingEvent event) throws XMLStreamException { @@ -217,10 +212,28 @@ } } - private void writeArguments(XMLStreamWriter writer, LoggingEvent event) + private void writeNdc(XMLStreamWriter writer, LoggingEvent event) throws XMLStreamException { - String[] arguments = event.getArguments(); + Message[] ndc = event.getNdc(); + if(ndc != null) + { + StaxUtilities.writeStartElement(writer, prefix, NAMESPACE_URI, NDC_NODE); + for(Message entry : ndc) + { + + StaxUtilities.writeStartElement(writer, prefix, NAMESPACE_URI, NDC_ENTRY_NODE); + StaxUtilities.writeSimpleTextNode(writer, prefix, NAMESPACE_URI, MESSAGE_NODE, entry.getMessagePattern()); + writeArguments(writer, entry.getArguments()); + writer.writeEndElement(); + } + writer.writeEndElement(); + } + } + + private void writeArguments(XMLStreamWriter writer, String[] arguments) + throws XMLStreamException + { if(arguments != null) { StaxUtilities.writeStartElement(writer, prefix, NAMESPACE_URI, ARGUMENTS_NODE); Modified: trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventIOTest.java =================================================================== --- trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventIOTest.java 2009-01-26 20:35:32 UTC (rev 146) +++ trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventIOTest.java 2009-01-26 20:37:19 UTC (rev 147) @@ -36,10 +36,8 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; -import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.List; import java.util.Map; import javax.xml.stream.XMLInputFactory; @@ -156,9 +154,10 @@ throws UnsupportedEncodingException, XMLStreamException { LoggingEvent event = createMinimalEvent(); - List<Message> ndc = new ArrayList<Message>(); - ndc.add(new Message("Pattern 1 {} {}", new String[]{"foo", "bar"})); - ndc.add(new Message("Pattern 2 {} {}", new String[]{"foo", "bar"})); + Message[] ndc = new Message[]{ + new Message("Pattern 1 {} {}", new String[]{"foo", "bar"}), + new Message("Pattern 2 {} {}", new String[]{"foo", "bar"}) + }; event.setNdc(ndc); check(event, true); } @@ -240,13 +239,11 @@ mdc.put("key3", "value3"); event.setMdc(mdc); - // TODO: set Ndc - /* - List<Message> ndc=new ArrayList<Message>(); - ndc.add(new Message("Pattern 1 {} {}", new String[]{"foo", "bar"})); - ndc.add(new Message("Pattern 2 {} {}", new String[]{"foo", "bar"})); - event.setNdc(ndc); - */ + Message[] ndc=new Message[]{ + new Message("Pattern 1 {} {}", new String[]{"foo", "bar"}), + new Message("Pattern 2 {} {}", new String[]{"foo", "bar"}) + }; + event.setNdc(ndc); Marker marker = new Marker("marker"); Marker marker2_1 = new Marker("marker2-1"); @@ -288,13 +285,11 @@ mdc.put("key3", "value3"); event.setMdc(mdc); - // TODO: set Ndc - /* - List<Message> ndc=new ArrayList<Message>(); - ndc.add(new Message("Pattern 1 {} {}", new String[]{"foo", "bar"})); - ndc.add(new Message("Pattern 2 {} {}", new String[]{"foo", "bar"})); - event.setNdc(ndc); - */ + Message[] ndc=new Message[]{ + new Message("Pattern 1 {} {}", new String[]{"foo", "bar"}), + new Message("Pattern 2 {} {}", new String[]{"foo", "bar"}) + }; + event.setNdc(ndc); Marker marker = new Marker("marker"); Marker marker2_1 = new Marker("marker2-1"); Modified: trunk/lilith-data/xml-schema/examples/LoggingEvent.xml =================================================================== --- trunk/lilith-data/xml-schema/examples/LoggingEvent.xml 2009-01-26 20:35:32 UTC (rev 146) +++ trunk/lilith-data/xml-schema/examples/LoggingEvent.xml 2009-01-26 20:37:19 UTC (rev 147) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<foo:LoggingEvent xmlns:foo="http://lilith.sf.net/schema/logging/10" +<foo:LoggingEvent xmlns:foo="http://lilith.sf.net/schema/logging/12" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://lilith.sf.net/schema/logging/10 http://lilith.sf.net/schema/logging/10/LoggingEvent.xsd" + xsi:schemaLocation="http://lilith.sf.net/schema/logging/12 http://lilith.sf.net/schema/logging/12/LoggingEvent.xsd" logger="Logger" level="INFO" threadName="Thread-Name" timeStamp="2008-03-19T11:40:24.843+01:00"> <foo:Message>EventMessage</foo:Message> <foo:Arguments> @@ -327,6 +327,16 @@ <foo:Entry key="key2">value2</foo:Entry> <foo:Entry key="key1">value1</foo:Entry> </foo:MDC> + <foo:NDC> + <foo:Entry> + <foo:Message>A Message {} {}</foo:Message> + <foo:Arguments> + <foo:Argument>arg1</foo:Argument> + <foo:null/> + <foo:Argument>arg3</foo:Argument> + </foo:Arguments> + </foo:Entry> + </foo:NDC> <foo:Marker name="marker"> <foo:Marker name="marker2-1"/> <foo:Marker name="marker2-2"> Added: trunk/lilith-data/xml-schema/schema/logging/12/LoggingEvent.xsd =================================================================== --- trunk/lilith-data/xml-schema/schema/logging/12/LoggingEvent.xsd (rev 0) +++ trunk/lilith-data/xml-schema/schema/logging/12/LoggingEvent.xsd 2009-01-26 20:37:19 UTC (rev 147) @@ -0,0 +1,392 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- +Lilith - a log event viewer. +Copyright (C) 2007-2009 Joern Huxhorn + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +--> +<!-- +Changes in 1.1: +Added CodeLocation, Version, Exact to StackTraceElement and omittedElements to Throwable. +StackTraceElement is now an xs:element so it's possible to create an xml document that contains only such an element. + +Changes in 1.2: +Added NDC and NDCEntry. +--> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://lilith.sf.net/schema/logging/12" xmlns:logging="http://lilith.sf.net/schema/logging/12" xmlns:es="http://lilith.sf.net/schema/eventsource/10" targetNamespace="http://lilith.sf.net/schema/logging/12" elementFormDefault="qualified"> + <xs:import namespace="http://lilith.sf.net/schema/eventsource/10" schemaLocation="http://lilith.sf.net/schema/eventsource/10/EventSource.xsd"/> + <xs:element name="LoggingEvents"> + <xs:annotation> + <xs:documentation xml:lang="en">A list of logging events.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element ref="es:SourceIdentifier"> + <xs:annotation> + <xs:documentation xml:lang="en">The source identifier of the contained events. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element ref="LoggingEvent" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="en">The logging events.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="startIndex" type="xs:nonNegativeInteger" use="optional" default="0"> + <xs:annotation> + <xs:documentation xml:lang="en">The index of the first event contained in this list of logging + events. It is only used if logging event lists are transfered partially. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element name="LoggingEvent"> + <xs:annotation> + <xs:documentation xml:lang="en">A single logging event.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="Message" type="WhitespacePreservingString"> + <xs:annotation> + <xs:documentation xml:lang="en">The (unformatted) message of the logging event. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Arguments" type="Arguments" minOccurs="0"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional arguments of the logging event.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Throwable" type="Throwable" minOccurs="0"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional Throwable of the logging event.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="MDC" type="MDC" minOccurs="0"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional MDC of the logging event.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="NDC" type="NDC" minOccurs="0"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional NDC of the logging event.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Marker" type="Marker" minOccurs="0"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional marker hierarchy of the logging event. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="CallStack" type="StackTrace" minOccurs="0"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional call stack trace of the logging event. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="logger" type="NonEmptyCollapsingString" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The name of the Logger that created this logging event. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="level" type="LoggingLevel" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The level of the logging event.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="threadName" type="WhitespacePreservingString" use="optional"> + <xs:annotation> + <xs:documentation xml:lang="en">The thread name of the logging event.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="timeStamp" type="xs:dateTime" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The timestamp of the logging event.</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + <xs:unique name="MdcKey"> + <xs:annotation> + <xs:documentation xml:lang="en">MDC entries must have unique keys.</xs:documentation> + </xs:annotation> + <xs:selector xpath="logging:MDC/logging:Entry"/> + <xs:field xpath="@key"/> + </xs:unique> + <xs:key name="MarkerName"> + <xs:annotation> + <xs:documentation xml:lang="en">Marker names in the same hierarchy must be unique.</xs:documentation> + </xs:annotation> + <xs:selector xpath=".//logging:Marker"/> + <xs:field xpath="@name"/> + </xs:key> + <xs:keyref name="MarkerReference" refer="MarkerName"> + <xs:annotation> + <xs:documentation xml:lang="en">Marker references must reference Markers of the same hierarchy + </xs:documentation> + </xs:annotation> + <xs:selector xpath=".//logging:MarkerReference"/> + <xs:field xpath="@ref"/> + </xs:keyref> + </xs:element> + <xs:simpleType name="LoggingLevel"> + <xs:annotation> + <xs:documentation xml:lang="en">The valid logging levels.</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:enumeration value="TRACE"/> + <xs:enumeration value="DEBUG"/> + <xs:enumeration value="INFO"/> + <xs:enumeration value="WARN"/> + <xs:enumeration value="ERROR"/> + </xs:restriction> + </xs:simpleType> + <xs:complexType name="Arguments"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional arguments of the logging event.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element name="Argument" type="WhitespacePreservingString"> + <xs:annotation> + <xs:documentation xml:lang="en">The list of arguments.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="null"> + <xs:complexType> + <xs:annotation> + <xs:documentation xml:lang="en">This element is used for null arguments. It must be empty. + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:restriction base="xs:anyType"/> + </xs:complexContent> + </xs:complexType> + </xs:element> + </xs:choice> + </xs:sequence> + </xs:complexType> + <xs:complexType name="Throwable"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional Throwable of the logging event.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Message" type="WhitespacePreservingString"> + <xs:annotation> + <xs:documentation xml:lang="en">The message of the Throwable.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="StackTrace" type="StackTrace"> + <xs:annotation> + <xs:documentation xml:lang="en">The stack trace of the Throwable.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Cause" type="Throwable" minOccurs="0"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional cause of the Throwable.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" type="NonEmptyCollapsingString" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The class name of the Throwable.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="omittedElements" type="xs:nonNegativeInteger" use="optional"> + <xs:annotation> + <xs:documentation xml:lang="en">The number of omitted common StackTraceElements</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + <!-- MDC --> + <xs:complexType name="MDC"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional MDC (Mapped Diagnostic Context) of the logging event.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Entry" type="MDCEntry" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="en">The entries of the MDC. Entries must have unique keys. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="MDCEntry"> + <xs:annotation> + <xs:documentation xml:lang="en">Represents a key-value pair.</xs:documentation> + </xs:annotation> + <xs:simpleContent> + <xs:extension base="WhitespacePreservingString"> + <xs:attribute name="key" type="WhitespacePreservingString" use="required"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + <!-- NDC --> + <xs:complexType name="NDC"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional NDC (Nested Diagnostic Context) of the logging event.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Entry" type="NDCEntry" minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="en">The entries of the NDC. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="NDCEntry"> + <xs:annotation> + <xs:documentation xml:lang="en">Represents a message with arguments.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="Message" type="WhitespacePreservingString" minOccurs="0"> + <xs:annotation> + <xs:documentation xml:lang="en">The (unformatted) message of the NDC entry. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Arguments" type="Arguments" minOccurs="0"> + <xs:annotation> + <xs:documentation xml:lang="en">The optional arguments of the NDC entry.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <!-- Marker --> + <xs:complexType name="Marker"> + <xs:annotation> + <xs:documentation xml:lang="en">A Marker hierarchy.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="en">The children of the Marker.</xs:documentation> + </xs:annotation> + <xs:element name="Marker" type="Marker"/> + <xs:element name="MarkerReference" type="MarkerReference"> + <xs:annotation> + <xs:documentation xml:lang="en">A MarkerReference references a Marker of the same hierarchy. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:choice> + </xs:sequence> + <xs:attribute name="name" type="WhitespacePreservingString" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The name of the Marker. Must be unique relative to it's hierarchy. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + <xs:complexType name="MarkerReference"> + <xs:annotation> + <xs:documentation xml:lang="en">This type references a Marker in the same hierarchy.</xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:restriction base="xs:anyType"> + <xs:attribute name="ref" type="WhitespacePreservingString" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">References the name of a Marker in the same hierarchy. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + <!-- StackTrace --> + <xs:complexType name="StackTrace"> + <xs:annotation> + <xs:documentation xml:lang="en">A stack trace.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="StackTraceElement" type="StackTraceElementType" maxOccurs="unbounded"> + <xs:annotation> + <xs:documentation xml:lang="en">The stack trace elements of the stack trace.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:element name="StackTraceElement" type="StackTraceElementType"/> + <xs:complexType name="StackTraceElementType"> + <xs:annotation> + <xs:documentation xml:lang="en">This type represents a java.lang.StackTraceElement.</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:choice minOccurs="0"> + <xs:element name="LineNumber" type="xs:nonNegativeInteger"> + <xs:annotation> + <xs:documentation xml:lang="en">The line number of the StackTraceElement.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="Native"> + <xs:complexType> + <xs:annotation> + <xs:documentation xml:lang="en">This type is used to tag a StackTraceElement as native. This + tag must be empty. + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:restriction base="xs:anyType"/> + </xs:complexContent> + </xs:complexType> + </xs:element> + </xs:choice> + <xs:element name="CodeLocation" minOccurs="0"/> + <xs:element name="Version" minOccurs="0"/> + <xs:element name="Exact" minOccurs="0"> + <xs:complexType> + <xs:annotation> + <xs:documentation xml:lang="en">This type is used to tag a StackTraceElement as native. This tag + must be empty. + </xs:documentation> + </xs:annotation> + <xs:complexContent> + <xs:restriction base="xs:anyType"/> + </xs:complexContent> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="className" type="NonEmptyCollapsingString" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The class name of the StackTraceElement.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="methodName" type="NonEmptyCollapsingString" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The method name of the StackTraceElement.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="fileName" type="NonEmptyCollapsingString" use="optional"> + <xs:annotation> + <xs:documentation xml:lang="en">The file name of the StackTraceElement.</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + <xs:simpleType name="NonEmptyCollapsingString"> + <xs:restriction base="xs:string"> + <xs:minLength value="1"/> + <xs:whiteSpace value="collapse"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType name="WhitespacePreservingString"> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + </xs:restriction> + </xs:simpleType> +</xs:schema> Added: trunk/lilith-data/xml-schema/schema/logging/12/index.php =================================================================== --- trunk/lilith-data/xml-schema/schema/logging/12/index.php (rev 0) +++ trunk/lilith-data/xml-schema/schema/logging/12/index.php 2009-01-26 20:37:19 UTC (rev 147) @@ -0,0 +1,4 @@ +<?php +header('Location:http://lilith.sf.net/schema/logging/12/LoggingEvent.xsd'); +?> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-26 20:35:36
|
Revision: 146 http://lilith.svn.sourceforge.net/lilith/?rev=146&view=rev Author: huxhorn Date: 2009-01-26 20:35:32 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Updated detailsView.groovy history. Modified Paths: -------------- trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/history.txt Added Paths: ----------- trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r145.md5 Modified: trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/history.txt =================================================================== --- trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/history.txt 2009-01-26 20:24:56 UTC (rev 145) +++ trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/history.txt 2009-01-26 20:35:32 UTC (rev 146) @@ -4,4 +4,5 @@ r55 r77 r110 -r137 \ No newline at end of file +r137 +r141 \ No newline at end of file Added: trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r145.md5 =================================================================== --- trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r145.md5 (rev 0) +++ trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r145.md5 2009-01-26 20:35:32 UTC (rev 146) @@ -0,0 +1 @@ +&\xDC\xCE8\xBE@\x81\x837͍\x9E(\xD762 \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-26 20:24:58
|
Revision: 145 http://lilith.svn.sourceforge.net/lilith/?rev=145&view=rev Author: huxhorn Date: 2009-01-26 20:24:56 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Changed NDC from List<Message> to Message[]. See ticket:27. Modified Paths: -------------- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/NdcRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/NdcTooltipGenerator.java trunk/lilith/src/main/resources/detailsView/detailsView.groovy trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/LoggingEvent.java trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventTest.java trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java trunk/logback/logging-adapter/src/test/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapterTest.java Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/NdcRenderer.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/NdcRenderer.java 2009-01-26 02:47:41 UTC (rev 144) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/NdcRenderer.java 2009-01-26 20:24:56 UTC (rev 145) @@ -24,7 +24,6 @@ import de.huxhorn.lilith.swing.table.ColorsProvider; import java.awt.*; -import java.util.List; import javax.swing.*; import javax.swing.table.TableCellRenderer; @@ -64,14 +63,14 @@ if(eventObj instanceof LoggingEvent) { LoggingEvent event = (LoggingEvent) eventObj; - List<Message> ndc = event.getNdc(); + Message[] ndc = event.getNdc(); if(ndc != null) { - int size = ndc.size(); + int size = ndc.length; if(size > 0) { - Message message = ndc.get(size - 1); + Message message = ndc[size - 1]; if(message != null) { text = message.getMessage(); Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/NdcTooltipGenerator.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/NdcTooltipGenerator.java 2009-01-26 02:47:41 UTC (rev 144) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/NdcTooltipGenerator.java 2009-01-26 20:24:56 UTC (rev 145) @@ -23,8 +23,6 @@ import de.huxhorn.lilith.swing.table.TooltipGenerator; import de.huxhorn.sulky.formatting.SimpleXml; -import java.util.List; - import javax.swing.*; public class NdcTooltipGenerator @@ -41,8 +39,8 @@ if(eventObj instanceof LoggingEvent) { LoggingEvent event = (LoggingEvent) eventObj; - List<Message> ndc = event.getNdc(); - if(ndc != null && ndc.size() > 0) + Message[] ndc = event.getNdc(); + if(ndc != null && ndc.length > 0) { StringBuilder buffer = new StringBuilder(); buffer.append("<html>"); @@ -55,9 +53,9 @@ return tooltip; } - public static void appendNdc(List<Message> ndc, StringBuilder buffer) + public static void appendNdc(Message[] ndc, StringBuilder buffer) { - if(ndc != null && ndc.size() > 0) + if(ndc != null && ndc.length > 0) { buffer.append("<ul>"); for(Message current : ndc) Modified: trunk/lilith/src/main/resources/detailsView/detailsView.groovy =================================================================== --- trunk/lilith/src/main/resources/detailsView/detailsView.groovy 2009-01-26 02:47:41 UTC (rev 144) +++ trunk/lilith/src/main/resources/detailsView/detailsView.groovy 2009-01-26 20:24:56 UTC (rev 145) @@ -497,7 +497,7 @@ } } -def buildNdc(element, List<Message> ndc) +def buildNdc(element, Message[] ndc) { element.ul { Modified: trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/LoggingEvent.java =================================================================== --- trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/LoggingEvent.java 2009-01-26 02:47:41 UTC (rev 144) +++ trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/LoggingEvent.java 2009-01-26 20:24:56 UTC (rev 145) @@ -20,7 +20,6 @@ import java.io.Serializable; import java.util.Arrays; import java.util.Date; -import java.util.List; import java.util.Map; /** @@ -56,7 +55,7 @@ private ThrowableInfo throwable; private Map<String, String> mdc; - private List<Message> ndc; + private Message[] ndc; private Marker marker; private ExtendedStackTraceElement[] callStack; private String applicationIdentifier; @@ -152,12 +151,12 @@ this.mdc = mdc; } - public List<Message> getNdc() + public Message[] getNdc() { return ndc; } - public void setNdc(List<Message> ndc) + public void setNdc(Message[] ndc) { this.ndc = ndc; } @@ -212,7 +211,7 @@ if(!Arrays.equals(callStack, event.callStack)) return false; if(marker != null ? !marker.equals(event.marker) : event.marker != null) return false; if(mdc != null ? !mdc.equals(event.mdc) : event.mdc != null) return false; - if(ndc != null ? !ndc.equals(event.ndc) : event.ndc != null) return false; + if(!Arrays.equals(ndc, event.ndc)) return false; if(throwable != null ? !throwable.equals(event.throwable) : event.throwable != null) return false; return true; Modified: trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventTest.java =================================================================== --- trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventTest.java 2009-01-26 02:47:41 UTC (rev 144) +++ trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventTest.java 2009-01-26 20:24:56 UTC (rev 145) @@ -25,10 +25,8 @@ import org.junit.Test; import java.io.IOException; -import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.List; import java.util.Map; public class LoggingEventTest @@ -292,19 +290,19 @@ { LoggingEvent instance = new LoggingEvent(); - List<Message> value = new ArrayList<Message>(); - value.add(new Message("pattern", new String[]{"foo", "bar"})); + Message[] value = new Message[]{ + new Message("pattern", new String[]{"foo", "bar"})}; instance.setNdc(value); { LoggingEvent obj = testSerialization(instance); - assertEquals(value, obj.getNdc()); + assertArrayEquals(value, obj.getNdc()); assertFalse(fresh.equals(obj)); } { LoggingEvent obj = testXmlSerialization(instance); - assertEquals(value, obj.getNdc()); + assertArrayEquals(value, obj.getNdc()); assertFalse(fresh.equals(obj)); } } Modified: trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java =================================================================== --- trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java 2009-01-26 02:47:41 UTC (rev 144) +++ trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java 2009-01-26 20:24:56 UTC (rev 145) @@ -20,7 +20,6 @@ import de.huxhorn.lilith.data.logging.ExtendedStackTraceElement; import de.huxhorn.lilith.data.logging.LoggingEvent; import de.huxhorn.lilith.data.logging.Marker; -import de.huxhorn.lilith.data.logging.Message; import de.huxhorn.lilith.data.logging.MessageFormatter; import de.huxhorn.lilith.data.logging.ThrowableInfo; import de.huxhorn.lilith.logback.classic.NDC; @@ -32,7 +31,6 @@ import ch.qos.logback.classic.spi.ThrowableProxy; import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.Iterator; @@ -107,9 +105,7 @@ if(!NDC.isEmpty()) { // TODO: configurable - Message[] contextStack = NDC.getContextStack(); - - result.setNdc(Arrays.asList(contextStack)); + result.setNdc(NDC.getContextStack()); } return result; Modified: trunk/logback/logging-adapter/src/test/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapterTest.java =================================================================== --- trunk/logback/logging-adapter/src/test/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapterTest.java 2009-01-26 02:47:41 UTC (rev 144) +++ trunk/logback/logging-adapter/src/test/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapterTest.java 2009-01-26 20:24:56 UTC (rev 145) @@ -107,6 +107,7 @@ public void testConvertEvent() { // LoggingEvent(String fqcn, Logger logger, Level level, String message, Throwable throwable, Object[] argArray) + @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"}) ch.qos.logback.classic.spi.LoggingEvent logbackEvent = new ch.qos.logback.classic.spi.LoggingEvent( "de.huxhorn.lilith.data.logging.logback.LogbackLoggingAdapterTest", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-26 02:47:47
|
Revision: 144 http://lilith.svn.sourceforge.net/lilith/?rev=144&view=rev Author: huxhorn Date: 2009-01-26 02:47:41 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Implemented getDepth() and setMaximumDepth(int). See ticket:27. Modified Paths: -------------- trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDC.java trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDCAdapter.java trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NoOpNDCAdapter.java trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java Modified: trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDC.java =================================================================== --- trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDC.java 2009-01-26 00:51:25 UTC (rev 143) +++ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDC.java 2009-01-26 02:47:41 UTC (rev 144) @@ -26,7 +26,7 @@ static { // TODO: configuration - ndcAdapter=new SimpleNDCAdapter(); + ndcAdapter = new SimpleNDCAdapter(); } private NDC() @@ -34,7 +34,7 @@ } - + public static void push(String message) { ndcAdapter.push(message); @@ -47,7 +47,7 @@ /** * Pops the last message from the stack. - * + * <p/> * This method does not return the popped message to discourage it's usage in application logic. */ public static void pop() @@ -55,6 +55,16 @@ ndcAdapter.pop(); } + public static int getDepth() + { + return ndcAdapter.getDepth(); + } + + public static void setMaximumDepth(int maximumDepth) + { + ndcAdapter.setMaximumDepth(maximumDepth); + } + public static boolean isEmpty() { return ndcAdapter.isEmpty(); @@ -67,7 +77,7 @@ /** * Returns an array containing all messages of the stack. - * + * <p/> * The messages from the NDC stack should not be used in application logic. * * @return an array containing all messages of the stack. @@ -76,5 +86,4 @@ { return ndcAdapter.getContextStack(); } - } Modified: trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDCAdapter.java =================================================================== --- trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDCAdapter.java 2009-01-26 00:51:25 UTC (rev 143) +++ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDCAdapter.java 2009-01-26 02:47:41 UTC (rev 144) @@ -23,14 +23,20 @@ public interface NDCAdapter { void push(String message); + void push(String messagePattern, Object[] arguments); void pop(); + int getDepth(); + + void setMaximumDepth(int maximumDepth); + boolean isEmpty(); + void clear(); Message[] getContextStack(); - Message[] NO_MESSAGES=new Message[0]; + Message[] NO_MESSAGES = new Message[0]; } Modified: trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NoOpNDCAdapter.java =================================================================== --- trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NoOpNDCAdapter.java 2009-01-26 00:51:25 UTC (rev 143) +++ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NoOpNDCAdapter.java 2009-01-26 02:47:41 UTC (rev 144) @@ -34,6 +34,15 @@ { } + public int getDepth() + { + return 0; + } + + public void setMaximumDepth(int maximumDepth) + { + } + public boolean isEmpty() { return true; Modified: trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java =================================================================== --- trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java 2009-01-26 00:51:25 UTC (rev 143) +++ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java 2009-01-26 02:47:41 UTC (rev 144) @@ -44,6 +44,16 @@ getNdcStack().pop(); } + public int getDepth() + { + return getNdcStack().getDepth(); + } + + public void setMaximumDepth(int maximumDepth) + { + getNdcStack().setMaximumDepth(maximumDepth); + } + public boolean isEmpty() { return getNdcStack().isEmpty(); @@ -62,9 +72,9 @@ private NdcStack getNdcStack() { NdcStack result = ndcStackThreadLocal.get(); - if(result==null) + if(result == null) { - result=new NdcStack(); + result = new NdcStack(); ndcStackThreadLocal.set(result); } return result; @@ -77,7 +87,7 @@ protected NdcStack childValue(NdcStack parentValue) { NdcStack result = null; - if(parentValue!=null) + if(parentValue != null) { // this method seems to get called only if parent // is not null but this isn't documented so I'll make sure... @@ -98,15 +108,26 @@ implements Cloneable { private List<Message> stackList; - private int overflowCounter; - // TODO: add support for MaxDepth private NdcStack() { - stackList=new ArrayList<Message>(); - overflowCounter=0; + stackList = new ArrayList<Message>(); } + public int getDepth() + { + return stackList.size(); + } + + public void setMaximumDepth(int maximumDepth) + { + int overflow = stackList.size() - maximumDepth; + for(int i = 0; i < overflow; i++) + { + pop(); + } + } + public void push(String message) { stackList.add(new Message(message)); Modified: trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java =================================================================== --- trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java 2009-01-26 00:51:25 UTC (rev 143) +++ trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java 2009-01-26 02:47:41 UTC (rev 144) @@ -19,9 +19,9 @@ import de.huxhorn.lilith.data.logging.Message; +import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,7 +34,7 @@ @Before public void setUp() { - instance=new SimpleNDCAdapter(); + instance = new SimpleNDCAdapter(); } @Test @@ -87,7 +87,7 @@ @Test public void getContextStackUsingPush() { - Message[] messages=new Message[] + Message[] messages = new Message[] { new Message("message1", new String[]{"foo", "bar"}), new Message("message2", new String[]{"foo", null}), @@ -97,7 +97,7 @@ }; - for(Message current:messages) + for(Message current : messages) { instance.push(current.getMessagePattern(), current.getArguments()); } @@ -107,5 +107,85 @@ assertArrayEquals(messages, stack); } - // TODO: ad tests for maxDepth and inheritance + @Test + public void inheritance() + throws InterruptedException + { + Thread parent = new Thread(new Level1Runnable()); + parent.start(); + parent.join(); + } + + @Test + public void depth() + { + assertEquals(0, instance.getDepth()); + instance.push("Foo"); + instance.push("Bar"); + assertEquals(2, instance.getDepth()); + instance.pop(); + assertEquals(1, instance.getDepth()); + instance.pop(); + assertEquals(0, instance.getDepth()); + instance.pop(); + assertEquals(0, instance.getDepth()); + } + + @Test + public void maximumDepthChange() + { + instance.push("Foo"); + instance.push("Bar"); + instance.setMaximumDepth(1); + assertEquals(1, instance.getDepth()); + instance.pop(); + assertEquals(0, instance.getDepth()); + } + + @Test + public void maximumDepthNoChange() + { + instance.push("Foo"); + instance.push("Bar"); + instance.setMaximumDepth(3); + assertEquals(2, instance.getDepth()); + } + + public class Level1Runnable + implements Runnable + { + + public void run() + { + instance.push("Foo"); + assertFalse(instance.isEmpty()); + Thread child = new Thread(new Level2Runnable()); + child.start(); + try + { + child.join(); + } + catch(InterruptedException e) + { + // ignore + } + assertFalse(instance.isEmpty()); + instance.pop(); + assertTrue(instance.isEmpty()); + } + } + + public class Level2Runnable + implements Runnable + { + + public void run() + { + instance.push("Bar"); + Message[] contextStack = instance.getContextStack(); + assertEquals(2, contextStack.length); + instance.pop(); + instance.pop(); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-26 00:51:32
|
Revision: 143 http://lilith.svn.sourceforge.net/lilith/?rev=143&view=rev Author: huxhorn Date: 2009-01-26 00:51:25 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Fixed inheritance of NDC. Modified Paths: -------------- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/debug/DebugDialog.java trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/debug/DebugDialog.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/debug/DebugDialog.java 2009-01-25 02:57:57 UTC (rev 142) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/debug/DebugDialog.java 2009-01-26 00:51:25 UTC (rev 143) @@ -93,6 +93,10 @@ button = new JButton(action); debugToolbar.add(button); + action = new LogNDCAction(); + button = new JButton(action); + debugToolbar.add(button); + action = new LogAllAction(); button = new JButton(action); debugToolbar.add(button); @@ -148,6 +152,7 @@ loggerEventEmitter.logSkull(); loggerEventEmitter.logTruth(); loggerEventEmitter.logAnonymous(); + loggerEventEmitter.logNDC(); } catch(InterruptedException ex) { @@ -234,6 +239,28 @@ } } + private class LogNDCAction + extends AbstractAction + { + public LogNDCAction() + { + super("Log NDC"); + } + + public void actionPerformed(ActionEvent e) + { + try + { + loggerEventEmitter.logNDC(); + } + catch(InterruptedException ex) + { + if(logger.isWarnEnabled()) logger.warn("Interrupted debug action...", ex); + } + } + } + + private class LogExceptionsAction extends AbstractAction { Modified: trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java =================================================================== --- trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java 2009-01-25 02:57:57 UTC (rev 142) +++ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java 2009-01-26 00:51:25 UTC (rev 143) @@ -20,89 +20,171 @@ import de.huxhorn.lilith.data.logging.Message; import de.huxhorn.lilith.data.logging.MessageFormatter; -import java.util.List; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class SimpleNDCAdapter implements NDCAdapter { - private InheritableThreadLocal<List<Message>> inheritableThreadLocal = new InheritableThreadLocal<List<Message>>(); + private CloningNdcStackThreadLocal ndcStackThreadLocal = new CloningNdcStackThreadLocal(); - private List<Message> getStackList() - { - List<Message> result=inheritableThreadLocal.get(); - if(result==null) - { - result=new ArrayList<Message>(); - inheritableThreadLocal.set(result); - } - return result; - } - public void push(String message) { - List<Message> stackList = getStackList(); - stackList.add(new Message(message)); + getNdcStack().push(message); } public void push(String messagePattern, Object[] arguments) { - if(arguments==null || arguments.length==0) - { - push(messagePattern); - return; - } - List<Message> stackList = getStackList(); - MessageFormatter.ArgumentResult argumentResults = MessageFormatter.evaluateArguments(messagePattern, arguments); - if(argumentResults==null) - { - System.out.println("messagePattern="+messagePattern+", arguments="+ Arrays.toString(arguments)); - } - else - stackList.add(new Message(messagePattern, argumentResults.getArguments())); + getNdcStack().push(messagePattern, arguments); } public void pop() { - List<Message> stackList = getStackList(); - int size=stackList.size(); - if(size>0) - { - stackList.remove(size-1); - } + getNdcStack().pop(); } public boolean isEmpty() { - return getStackList().isEmpty(); + return getNdcStack().isEmpty(); } public void clear() { - getStackList().clear(); + getNdcStack().clear(); } public Message[] getContextStack() { - List<Message> stackList = getStackList(); - if(stackList.isEmpty()) + return getNdcStack().getContextStack(); + } + + private NdcStack getNdcStack() + { + NdcStack result = ndcStackThreadLocal.get(); + if(result==null) { - return NO_MESSAGES; + result=new NdcStack(); + ndcStackThreadLocal.set(result); } + return result; + } - Message[] result=new Message[stackList.size()]; - try + private static class CloningNdcStackThreadLocal + extends InheritableThreadLocal<NdcStack> + { + @Override + protected NdcStack childValue(NdcStack parentValue) { - for(int i=0;i<stackList.size();i++) + NdcStack result = null; + if(parentValue!=null) { - result[i]=stackList.get(i).clone(); + // this method seems to get called only if parent + // is not null but this isn't documented so I'll make sure... + try + { + result = parentValue.clone(); + } + catch(CloneNotSupportedException e) + { + // can't happen, see above... + } } + return result; } - catch(CloneNotSupportedException e) + } + + private static class NdcStack + implements Cloneable + { + private List<Message> stackList; + private int overflowCounter; + // TODO: add support for MaxDepth + + private NdcStack() { - // can't happen... yeah, I know... it *will* happen one day :p + stackList=new ArrayList<Message>(); + overflowCounter=0; } - return result; + + public void push(String message) + { + stackList.add(new Message(message)); + } + + public void push(String messagePattern, Object[] arguments) + { + if(arguments == null || arguments.length == 0) + { + push(messagePattern); + return; + } + MessageFormatter.ArgumentResult argumentResults = MessageFormatter + .evaluateArguments(messagePattern, arguments); + if(argumentResults == null) + { + System.out.println("messagePattern=" + messagePattern + ", arguments=" + Arrays.toString(arguments)); + } + else + { + stackList.add(new Message(messagePattern, argumentResults.getArguments())); + } + } + + public void pop() + { + int size = stackList.size(); + if(size > 0) + { + stackList.remove(size - 1); + } + } + + public boolean isEmpty() + { + return stackList.isEmpty(); + } + + public void clear() + { + stackList.clear(); + } + + public Message[] getContextStack() + { + if(stackList.isEmpty()) + { + return NO_MESSAGES; + } + + Message[] result = new Message[stackList.size()]; + try + { + for(int i = 0; i < stackList.size(); i++) + { + result[i] = stackList.get(i).clone(); + } + } + catch(CloneNotSupportedException e) + { + // can't happen... yeah, I know... it *will* happen one day :p + } + return result; + } + + public NdcStack clone() + throws CloneNotSupportedException + { + NdcStack result = (NdcStack) super.clone(); + + ArrayList<Message> clonedStackList = new ArrayList<Message>(stackList.size()); + for(Message current : stackList) + { + clonedStackList.add(current.clone()); + } + result.stackList = clonedStackList; + + return result; + } } } Modified: trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java =================================================================== --- trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java 2009-01-25 02:57:57 UTC (rev 142) +++ trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java 2009-01-26 00:51:25 UTC (rev 143) @@ -106,4 +106,6 @@ if(logger.isDebugEnabled()) logger.debug("Retrieved contextStack={}.", new Object[]{stack}); assertArrayEquals(messages, stack); } + + // TODO: ad tests for maxDepth and inheritance } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-25 02:58:00
|
Revision: 142 http://lilith.svn.sourceforge.net/lilith/?rev=142&view=rev Author: huxhorn Date: 2009-01-25 02:57:57 +0000 (Sun, 25 Jan 2009) Log Message: ----------- Updated history of detailsView.groovy & .css. Modified Paths: -------------- trunk/lilith/src/main/resources/detailsView/history/detailsView.css/history.txt trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/history.txt Added Paths: ----------- trunk/lilith/src/main/resources/detailsView/history/detailsView.css/r137.md5 trunk/lilith/src/main/resources/detailsView/history/detailsView.css/r141.md5 trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r137.md5 trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r141.md5 Modified: trunk/lilith/src/main/resources/detailsView/history/detailsView.css/history.txt =================================================================== --- trunk/lilith/src/main/resources/detailsView/history/detailsView.css/history.txt 2009-01-25 02:54:00 UTC (rev 141) +++ trunk/lilith/src/main/resources/detailsView/history/detailsView.css/history.txt 2009-01-25 02:57:57 UTC (rev 142) @@ -1 +1,3 @@ -r1 \ No newline at end of file +r1 +r53 +r137 \ No newline at end of file Added: trunk/lilith/src/main/resources/detailsView/history/detailsView.css/r137.md5 =================================================================== --- trunk/lilith/src/main/resources/detailsView/history/detailsView.css/r137.md5 (rev 0) +++ trunk/lilith/src/main/resources/detailsView/history/detailsView.css/r137.md5 2009-01-25 02:57:57 UTC (rev 142) @@ -0,0 +1 @@ +(\xF3\xDDK\xE0\x9D\xA8.\xAE(_\xCD \ No newline at end of file Added: trunk/lilith/src/main/resources/detailsView/history/detailsView.css/r141.md5 =================================================================== --- trunk/lilith/src/main/resources/detailsView/history/detailsView.css/r141.md5 (rev 0) +++ trunk/lilith/src/main/resources/detailsView/history/detailsView.css/r141.md5 2009-01-25 02:57:57 UTC (rev 142) @@ -0,0 +1 @@ +n\xA5\xB0\xAC\xC8\xE5\xFFA\x86\xBA\x97Q\xC7I\xCC \ No newline at end of file Modified: trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/history.txt =================================================================== --- trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/history.txt 2009-01-25 02:54:00 UTC (rev 141) +++ trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/history.txt 2009-01-25 02:57:57 UTC (rev 142) @@ -2,4 +2,6 @@ r6 r31 r55 -r77 \ No newline at end of file +r77 +r110 +r137 \ No newline at end of file Added: trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r137.md5 =================================================================== (Binary files differ) Property changes on: trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r137.md5 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r141.md5 =================================================================== --- trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r141.md5 (rev 0) +++ trunk/lilith/src/main/resources/detailsView/history/detailsView.groovy/r141.md5 2009-01-25 02:57:57 UTC (rev 142) @@ -0,0 +1 @@ +4\xA2\xE8e,\xA6\x98\xCD۪&\xE0}\xD3\xFC \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-25 02:54:03
|
Revision: 141 http://lilith.svn.sourceforge.net/lilith/?rev=141&view=rev Author: huxhorn Date: 2009-01-25 02:54:00 +0000 (Sun, 25 Jan 2009) Log Message: ----------- NDC support in detailsView.groovy. See ticket:27. Modified Paths: -------------- trunk/lilith/src/changes/changes.xml trunk/lilith/src/main/resources/detailsView/detailsView.css trunk/lilith/src/main/resources/detailsView/detailsView.groovy trunk/lilith/src/main/resources/help/help.css Modified: trunk/lilith/src/changes/changes.xml =================================================================== --- trunk/lilith/src/changes/changes.xml 2009-01-25 02:11:32 UTC (rev 140) +++ trunk/lilith/src/changes/changes.xml 2009-01-25 02:54:00 UTC (rev 141) @@ -106,6 +106,9 @@ <action dev="jhux" type="add" issue="27"> Added new table row "NDC" to logging table. </action> + <action dev="jhux" type="add" issue="27"> + NDC support in detailsView.groovy + </action> <action dev="jhux" type="add"> TODO: Add transfer size statistics. </action> Modified: trunk/lilith/src/main/resources/detailsView/detailsView.css =================================================================== --- trunk/lilith/src/main/resources/detailsView/detailsView.css 2009-01-25 02:11:32 UTC (rev 140) +++ trunk/lilith/src/main/resources/detailsView/detailsView.css 2009-01-25 02:54:00 UTC (rev 141) @@ -1,38 +1,46 @@ -body { +body +{ margin: 0; padding: 0; /* background: #ffff00; */ } -table { +table +{ border-spacing: 0; } -tr.even { +tr.even +{ background: #e9edf2; } -tr.odd { +tr.odd +{ background: #ffffff; } -td { +td +{ border-top: none; border-right: 1px solid black; border-bottom: none; border-left: none; } -th { +th +{ border-top: none; border-right: 1px solid black; border-bottom: none; border-left: none; } -.throwable { +.throwable +{ background: #ffcccc; } -pre { +pre +{ white-space: pre-wrap; } Modified: trunk/lilith/src/main/resources/detailsView/detailsView.groovy =================================================================== --- trunk/lilith/src/main/resources/detailsView/detailsView.groovy 2009-01-25 02:11:32 UTC (rev 140) +++ trunk/lilith/src/main/resources/detailsView/detailsView.groovy 2009-01-25 02:54:00 UTC (rev 141) @@ -1,123 +1,32 @@ import de.huxhorn.lilith.data.access.AccessEvent import de.huxhorn.lilith.data.access.HttpStatus import de.huxhorn.lilith.data.logging.LoggingEvent +import de.huxhorn.lilith.data.logging.Message import java.text.SimpleDateFormat /* -* Lilith - a log event viewer. -* Copyright (C) 2007-2009 Joern Huxhorn -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ -//import de.huxhorn.lilith.data.eventsource.SourceIdentifier; -//import de.huxhorn.lilith.data.eventsource.EventWrapper; -//import de.huxhorn.lilith.data.logging.Marker; -//import de.huxhorn.lilith.data.logging.ThrowableInfo; - -//def si=new SourceIdentifier('identifier', 'secondaryIdentifier') - -//def eventWrapper=new EventWrapper(si, 1, event); - -/* -def event=eventWrapper.event; -event=new AccessEvent(); -event.requestURI='Request URI' -event.requestURL='Request URL' -event.statusCode=200 -event.remoteUser='user' -event.remoteHost='host' -event.remoteAddress='10.0.0.1' -event.requestParameters=[foo1: ['bar'], foo2: ['bar1', 'bar2']] -event.requestHeaders=[requestFoo1: 'bar', requestFoo2: 'bar'] -event.responseHeaders=[responseFoo1: 'bar', responseFoo2: 'bar'] -event.localPort=8080 -event.timeStamp=new Date() -event.applicationIdentifier='AppId' - -eventWrapper.event=event; -*/ - -/* -if(!event) -{ - even=new LoggingEvent(); -} -event.message = 'Huhu' -event.level = LoggingEvent.Level.INFO -event.logger = "Logger Name"; -event.threadName = "thread name"; -event.marker = new Marker('foo'); -def m1=new Marker('Hail Eris!!') -def m2=new Marker('All Hail Discordia!!!'); -m1.add(m2); -event.marker.add(m1); -event.marker.add(new Marker('bar')) -m2.add(event.marker) -event.timeStamp = new Date() -event.mdc = [foo: 'bar', 'Hail Eris!!':'All Hail Discordia!!!']; -event.callStack = [ -new StackTraceElement('class', '<methodName>', 'fileName', 17), -new StackTraceElement('class', '<methodName>', 'fileName', 18), -new StackTraceElement('class', '<methodName>', 'fileName', 19), -new StackTraceElement('class', '<methodName>', 'fileName', 20), -new StackTraceElement('class', '<methodName>', 'fileName', 21) -] - - -ThrowableInfo ti=new ThrowableInfo(); -ti.name='a.exception.Class'; -ti.message='A exeception message' -ti.stackTrace = [ -new StackTraceElement('class', '<methodName>', 'fileName', 1), -new StackTraceElement('class', '<methodName>', 'fileName', 2), -new StackTraceElement('class', '<methodName>', 'fileName', 3) -] - -ThrowableInfo cause=new ThrowableInfo(); -cause.name='another.exception.Class'; -cause.message='Another exeception message' -cause.stackTrace = [ -new StackTraceElement('class', '<methodName>', 'fileName', 1), -new StackTraceElement('class', '<methodName>', 'fileName', 2), -new StackTraceElement('class', '<methodName>', 'fileName', 3), -new StackTraceElement('class', '<methodName>', 'fileName', 4), -new StackTraceElement('class', '<methodName>', 'fileName', 5) -] - -ti.cause = cause; - -event.throwable = ti; -event.applicationIdentifier='AppId' - -eventWrapper.event=event; -*/ - - if(!binding.variables.'completeCallStack') { binding.setVariable('completeCallStack', false); } -//def completeCallStack=binding[completeCallStack]; -//println event; -//def writer = new StringWriter(); -//def builder = new groovy.xml.MarkupBuilder(writer); - -//def builder = new groovy.util.NodeBuilder(); -/*def node= */ - def dateFormat = new SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSSZ'); def builder = new groovy.xml.StreamingMarkupBuilder(); builder.encoding = "UTF-8"; @@ -446,6 +355,19 @@ } } + if(event.ndc) + { + evenOdd.toggle() + it.tr([class: "${evenOdd}"]) + { + th([title: 'Nested Diagnostic Context'], 'NDC') + td + { + buildNdc(it, event.ndc) + } + } + } + if(event.callStack) { if(completeCallStack) @@ -575,6 +497,19 @@ } } +def buildNdc(element, List<Message> ndc) +{ + element.ul + { + ulIt -> + ndc.each + { + message -> + ulIt.li(message.message) + } + } +} + def buildStringMap(element, Map<String, String> map) { element.table Modified: trunk/lilith/src/main/resources/help/help.css =================================================================== --- trunk/lilith/src/main/resources/help/help.css 2009-01-25 02:11:32 UTC (rev 140) +++ trunk/lilith/src/main/resources/help/help.css 2009-01-25 02:54:00 UTC (rev 141) @@ -1,3 +1,4 @@ -body { +body +{ background: #dddddd; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-25 02:11:40
|
Revision: 140 http://lilith.svn.sourceforge.net/lilith/?rev=140&view=rev Author: huxhorn Date: 2009-01-25 02:11:32 +0000 (Sun, 25 Jan 2009) Log Message: ----------- Added new table row "NDC" to logging table. See ticket:27. Better handling of malformed saved table layouts. Invalid column names are ignored, missing names added. Added debug action to test NDC. Modified Paths: -------------- trunk/lilith/src/changes/changes.xml trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LoggerEventEmitter.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/EventWrapperViewTable.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/LoggingEventViewTable.java Added Paths: ----------- trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogNdcRunnable.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/NdcRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/NdcTooltipGenerator.java Modified: trunk/lilith/src/changes/changes.xml =================================================================== --- trunk/lilith/src/changes/changes.xml 2009-01-25 00:41:44 UTC (rev 139) +++ trunk/lilith/src/changes/changes.xml 2009-01-25 02:11:32 UTC (rev 140) @@ -95,11 +95,17 @@ Added support for NDC to LoggingEvent datatype. </action> <action dev="jhux" type="add" issue="27"> - Created NDC for use with Lilith appenders. + Created NDC for use with Lilith appenders. </action> <action dev="jhux" type="update" issue="27"> Updated LogbackLoggingAdapter to use the NDC of events. </action> + <action dev="jhux" type="fix"> + Better handling of malformed saved table layouts. Invalid column names are ignored, missing names added. + </action> + <action dev="jhux" type="add" issue="27"> + Added new table row "NDC" to logging table. + </action> <action dev="jhux" type="add"> TODO: Add transfer size statistics. </action> Added: trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogNdcRunnable.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogNdcRunnable.java (rev 0) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogNdcRunnable.java 2009-01-25 02:11:32 UTC (rev 140) @@ -0,0 +1,40 @@ +package de.huxhorn.lilith.debug; + +import de.huxhorn.lilith.logback.classic.NDC; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LogNdcRunnable + extends AbstractDebugRunnable +{ + private final Logger logger = LoggerFactory.getLogger(LogStuffRunnable.class); + + public LogNdcRunnable(int delay) + { + super(delay); + } + + public void runIt() + throws InterruptedException + { + if(logger.isInfoEnabled()) logger.info("Message before pushing to NDC."); + sleep(); + + NDC.push("Message with parameters: {} {}", new String[]{"foo", "bar"}); + if(logger.isInfoEnabled()) logger.info("Message after pushing to NDC."); + sleep(); + + NDC.push("Another message with parameters: {} {}", new String[]{"foo", "bar"}); + if(logger.isInfoEnabled()) logger.info("Message after pushing to NDC again."); + sleep(); + + NDC.pop(); + if(logger.isInfoEnabled()) logger.info("Message after popping the NDC once."); + sleep(); + + NDC.pop(); + if(logger.isInfoEnabled()) logger.info("Message after popping the NDC twice."); + sleep(); + } +} Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LoggerEventEmitter.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LoggerEventEmitter.java 2009-01-25 00:41:44 UTC (rev 139) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LoggerEventEmitter.java 2009-01-25 02:11:32 UTC (rev 140) @@ -55,6 +55,12 @@ execute(new LogStuffRunnable(delay, null)); } + public void logNDC() + throws InterruptedException + { + execute(new LogNdcRunnable(delay)); + } + private void execute(Runnable runnable) { executor.execute(runnable); Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/EventWrapperViewTable.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/EventWrapperViewTable.java 2009-01-25 00:41:44 UTC (rev 139) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/EventWrapperViewTable.java 2009-01-25 02:11:32 UTC (rev 140) @@ -35,6 +35,7 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.Serializable; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -249,11 +250,59 @@ public void resetLayout() { - List<PersistentTableColumnModel.TableColumnLayoutInfo> infos = loadLayout(); - if(infos == null) + List<PersistentTableColumnModel.TableColumnLayoutInfo> loadedInfos = loadLayout(); + List<PersistentTableColumnModel.TableColumnLayoutInfo> defaults = getDefaultLayout(); + List<PersistentTableColumnModel.TableColumnLayoutInfo> infos; + if(loadedInfos == null) { infos = getDefaultLayout(); } + else + { + infos = new ArrayList<PersistentTableColumnModel.TableColumnLayoutInfo>(); + + // lets make sure that all columns exist. + for(PersistentTableColumnModel.TableColumnLayoutInfo current : loadedInfos) + { + if(current != null) + { + String currentName = current.getColumnName(); + if(currentName != null) + { + for(PersistentTableColumnModel.TableColumnLayoutInfo other : defaults) + { + if(currentName.equals(other.getColumnName())) + { + infos.add(current); + break; + } + } + } + } + } + + // lets add missing columns + for(PersistentTableColumnModel.TableColumnLayoutInfo current : defaults) + { + String currentName = current.getColumnName(); + if(currentName != null) + { + boolean found = false; + for(PersistentTableColumnModel.TableColumnLayoutInfo other : infos) + { + String otherName = other.getColumnName(); + if(currentName.equals(otherName)) + { + found = true; + } + } + if(!found) + { + infos.add(current); + } + } + } + } PersistentTableColumnModel newModel = new PersistentTableColumnModel(); for(PersistentTableColumnModel.TableColumnLayoutInfo current : infos) { @@ -262,9 +311,9 @@ if(col != null) { col.setPreferredWidth(current.getWidth()); + newModel.addColumn(col); + newModel.setColumnVisible(col, current.isVisible()); } - newModel.addColumn(col); - newModel.setColumnVisible(col, current.isVisible()); } setColumnModel(newModel); tableColumnModel = newModel; @@ -275,14 +324,9 @@ { if(logger.isDebugEnabled()) { - if(logger.isDebugEnabled()) - { - logger.debug("changeSelection({}, {}, {}, {})", new Object[]{rowIndex, columnIndex, toggle, extend}); - } - if(logger.isDebugEnabled()) //noinspection ThrowableInstanceNeverThrown - { - logger.debug("changeSelection-Stacktrace", new Throwable()); - } + logger.debug("changeSelection({}, {}, {}, {})", new Object[]{rowIndex, columnIndex, toggle, extend}); + //noinspection ThrowableInstanceNeverThrown + logger.debug("changeSelection-Stacktrace", new Throwable()); } if(isScrollingToBottom()) { Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/LoggingEventViewTable.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/LoggingEventViewTable.java 2009-01-25 00:41:44 UTC (rev 139) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/LoggingEventViewTable.java 2009-01-25 02:11:32 UTC (rev 140) @@ -27,6 +27,7 @@ import de.huxhorn.lilith.swing.table.renderer.LoggerNameRenderer; import de.huxhorn.lilith.swing.table.renderer.MarkerRenderer; import de.huxhorn.lilith.swing.table.renderer.MessageRenderer; +import de.huxhorn.lilith.swing.table.renderer.NdcRenderer; import de.huxhorn.lilith.swing.table.renderer.SourceRenderer; import de.huxhorn.lilith.swing.table.renderer.ThreadRenderer; import de.huxhorn.lilith.swing.table.renderer.ThrowableRenderer; @@ -35,6 +36,7 @@ import de.huxhorn.lilith.swing.table.tooltips.LoggerNameTooltipGenerator; import de.huxhorn.lilith.swing.table.tooltips.MarkerTooltipGenerator; import de.huxhorn.lilith.swing.table.tooltips.MessageTooltipGenerator; +import de.huxhorn.lilith.swing.table.tooltips.NdcTooltipGenerator; import de.huxhorn.lilith.swing.table.tooltips.SourceTooltipGenerator; import de.huxhorn.lilith.swing.table.tooltips.ThreadTooltipGenerator; import de.huxhorn.lilith.swing.table.tooltips.ThrowableTooltipGenerator; @@ -57,6 +59,7 @@ public static final String DEFAULT_COLUMN_NAME_THROWABLE = "Throwable"; public static final String DEFAULT_COLUMN_NAME_THREAD = "Thread"; public static final String DEFAULT_COLUMN_NAME_MARKER = "Marker"; + public static final String DEFAULT_COLUMN_NAME_NDC = "NDC"; public static final String DEFAULT_COLUMN_NAME_APPLICATIION = "Application"; public static final String DEFAULT_COLUMN_NAME_SOURCE = "Source"; @@ -72,6 +75,8 @@ new LoggerNameTooltipGenerator()); tooltipGenerators.put(DEFAULT_COLUMN_NAME_MARKER, new MarkerTooltipGenerator()); + tooltipGenerators.put(DEFAULT_COLUMN_NAME_NDC, + new NdcTooltipGenerator()); tooltipGenerators.put(DEFAULT_COLUMN_NAME_MESSAGE, new MessageTooltipGenerator()); tooltipGenerators.put(DEFAULT_COLUMN_NAME_THREAD, @@ -139,6 +144,12 @@ } { TableColumn col = new TableColumn(0); + col.setHeaderValue(DEFAULT_COLUMN_NAME_NDC); + col.setCellRenderer(new NdcRenderer()); + tableColumns.put(col.getHeaderValue(), col); + } + { + TableColumn col = new TableColumn(0); col.setHeaderValue(DEFAULT_COLUMN_NAME_APPLICATIION); col.setCellRenderer(new ApplicationRenderer()); tableColumns.put(col.getHeaderValue(), col); @@ -164,6 +175,7 @@ result.add(new PersistentTableColumnModel.TableColumnLayoutInfo(DEFAULT_COLUMN_NAME_THROWABLE, 75, true)); result.add(new PersistentTableColumnModel.TableColumnLayoutInfo(DEFAULT_COLUMN_NAME_THREAD, 75, true)); result.add(new PersistentTableColumnModel.TableColumnLayoutInfo(DEFAULT_COLUMN_NAME_MARKER, 75, true)); + result.add(new PersistentTableColumnModel.TableColumnLayoutInfo(DEFAULT_COLUMN_NAME_NDC, 75, true)); result.add(new PersistentTableColumnModel.TableColumnLayoutInfo(DEFAULT_COLUMN_NAME_APPLICATIION, 75, true)); result.add(new PersistentTableColumnModel.TableColumnLayoutInfo(DEFAULT_COLUMN_NAME_SOURCE, 75, isGlobal())); Added: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/NdcRenderer.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/NdcRenderer.java (rev 0) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/NdcRenderer.java 2009-01-25 02:11:32 UTC (rev 140) @@ -0,0 +1,129 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package de.huxhorn.lilith.swing.table.renderer; + +import de.huxhorn.lilith.data.eventsource.EventWrapper; +import de.huxhorn.lilith.data.logging.LoggingEvent; +import de.huxhorn.lilith.data.logging.Message; +import de.huxhorn.lilith.swing.table.Colors; +import de.huxhorn.lilith.swing.table.ColorsProvider; + +import java.awt.*; +import java.util.List; + +import javax.swing.*; +import javax.swing.table.TableCellRenderer; + +public class NdcRenderer + implements TableCellRenderer +{ + private LabelCellRenderer renderer; + + public NdcRenderer() + { + super(); + renderer = new LabelCellRenderer(); + renderer.setToolTipText(null); + renderer.setIcon(null); + } + + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) + { + if(!isSelected) + { + isSelected = rowIndex == LabelCellRenderer.getSelectedRow(table); + } + if(!hasFocus && isSelected) + { + hasFocus = table.isFocusOwner(); + } + renderer.setSelected(isSelected); + renderer.setFocused(hasFocus); + + Color foreground = Color.BLACK; + String text = ""; + if(value instanceof EventWrapper) + { + EventWrapper wrapper = (EventWrapper) value; + Object eventObj = wrapper.getEvent(); + if(eventObj instanceof LoggingEvent) + { + LoggingEvent event = (LoggingEvent) eventObj; + List<Message> ndc = event.getNdc(); + + if(ndc != null) + { + int size = ndc.size(); + if(size > 0) + { + Message message = ndc.get(size - 1); + if(message != null) + { + text = message.getMessage(); + } + } + } + if(text != null) + { + int newlineIndex = text.indexOf("\n"); + if(newlineIndex > -1) + { + int newlineCounter = 0; + for(int i = 0; i < text.length(); i++) + { + if(text.charAt(i) == '\n') + { + newlineCounter++; + } + } + text = text.substring(0, newlineIndex); + newlineCounter--; + if(newlineCounter > 0) + { + text = text + " [+" + newlineCounter + " lines]"; + } + } + } + } + } + renderer.setText(text); + + boolean colorsInitialized = false; + if(!hasFocus && !isSelected) + { + if(table instanceof ColorsProvider) + { + if(value instanceof EventWrapper) + { + EventWrapper wrapper = (EventWrapper) value; + ColorsProvider cp = (ColorsProvider) table; + Colors colors = cp.resolveColors(wrapper, rowIndex, vColIndex); + colorsInitialized = renderer.updateColors(colors); + } + } + } + if(!colorsInitialized) + { + renderer.setForeground(foreground); + } + + renderer.correctRowHeight(table); + + return renderer; + } +} \ No newline at end of file Added: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/NdcTooltipGenerator.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/NdcTooltipGenerator.java (rev 0) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/NdcTooltipGenerator.java 2009-01-25 02:11:32 UTC (rev 140) @@ -0,0 +1,73 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package de.huxhorn.lilith.swing.table.tooltips; + +import de.huxhorn.lilith.data.eventsource.EventWrapper; +import de.huxhorn.lilith.data.logging.LoggingEvent; +import de.huxhorn.lilith.data.logging.Message; +import de.huxhorn.lilith.swing.table.TooltipGenerator; +import de.huxhorn.sulky.formatting.SimpleXml; + +import java.util.List; + +import javax.swing.*; + +public class NdcTooltipGenerator + implements TooltipGenerator +{ + public String createTooltipText(JTable table, int row) + { + String tooltip = null; + Object value = table.getValueAt(row, 0); + if(value instanceof EventWrapper) + { + EventWrapper wrapper = (EventWrapper) value; + Object eventObj = wrapper.getEvent(); + if(eventObj instanceof LoggingEvent) + { + LoggingEvent event = (LoggingEvent) eventObj; + List<Message> ndc = event.getNdc(); + if(ndc != null && ndc.size() > 0) + { + StringBuilder buffer = new StringBuilder(); + buffer.append("<html>"); + appendNdc(ndc, buffer); + buffer.append("</html>"); + tooltip = buffer.toString(); + } + } + } + return tooltip; + } + + public static void appendNdc(List<Message> ndc, StringBuilder buffer) + { + if(ndc != null && ndc.size() > 0) + { + buffer.append("<ul>"); + for(Message current : ndc) + { + buffer.append("<li>"); + buffer.append(SimpleXml.escape(current.getMessage())); + buffer.append("</li>"); + } + buffer.append("</ul>"); + } + } + +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-25 00:41:54
|
Revision: 139 http://lilith.svn.sourceforge.net/lilith/?rev=139&view=rev Author: huxhorn Date: 2009-01-25 00:41:44 +0000 (Sun, 25 Jan 2009) Log Message: ----------- Updated LogbackLoggingAdapter to use the NDC of events. Seet ticket:27. Modified Paths: -------------- trunk/lilith/src/changes/changes.xml trunk/lilith-parent/pom.xml trunk/logback/logging-adapter/pom.xml trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java Modified: trunk/lilith/src/changes/changes.xml =================================================================== --- trunk/lilith/src/changes/changes.xml 2009-01-25 00:23:49 UTC (rev 138) +++ trunk/lilith/src/changes/changes.xml 2009-01-25 00:41:44 UTC (rev 139) @@ -97,6 +97,9 @@ <action dev="jhux" type="add" issue="27"> Created NDC for use with Lilith appenders. </action> + <action dev="jhux" type="update" issue="27"> + Updated LogbackLoggingAdapter to use the NDC of events. + </action> <action dev="jhux" type="add"> TODO: Add transfer size statistics. </action> Modified: trunk/lilith-parent/pom.xml =================================================================== --- trunk/lilith-parent/pom.xml 2009-01-25 00:23:49 UTC (rev 138) +++ trunk/lilith-parent/pom.xml 2009-01-25 00:41:44 UTC (rev 139) @@ -141,6 +141,12 @@ <dependency> <groupId>de.huxhorn.lilith</groupId> + <artifactId>de.huxhorn.lilith.logback.classic</artifactId> + <version>${lilithVersion}</version> + </dependency> + + <dependency> + <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.logback.appender.multiplex-core</artifactId> <version>${lilithVersion}</version> </dependency> Modified: trunk/logback/logging-adapter/pom.xml =================================================================== --- trunk/logback/logging-adapter/pom.xml 2009-01-25 00:23:49 UTC (rev 138) +++ trunk/logback/logging-adapter/pom.xml 2009-01-25 00:41:44 UTC (rev 139) @@ -37,11 +37,19 @@ <artifactId>de.huxhorn.lilith.data.logging</artifactId> <scope>compile</scope> </dependency> + <dependency> + <groupId>de.huxhorn.lilith</groupId> + <artifactId>de.huxhorn.lilith.logback.classic</artifactId> + <scope>compile</scope> + </dependency> + + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <scope>compile</scope> </dependency> + <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> @@ -53,6 +61,7 @@ <artifactId>logback-core</artifactId> <scope>test</scope> </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> Modified: trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java =================================================================== --- trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java 2009-01-25 00:23:49 UTC (rev 138) +++ trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java 2009-01-25 00:41:44 UTC (rev 139) @@ -20,8 +20,10 @@ import de.huxhorn.lilith.data.logging.ExtendedStackTraceElement; import de.huxhorn.lilith.data.logging.LoggingEvent; import de.huxhorn.lilith.data.logging.Marker; +import de.huxhorn.lilith.data.logging.Message; import de.huxhorn.lilith.data.logging.MessageFormatter; import de.huxhorn.lilith.data.logging.ThrowableInfo; +import de.huxhorn.lilith.logback.classic.NDC; import ch.qos.logback.classic.spi.CallerData; import ch.qos.logback.classic.spi.ClassPackagingData; @@ -30,6 +32,7 @@ import ch.qos.logback.classic.spi.ThrowableProxy; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.Iterator; @@ -100,6 +103,15 @@ result.setThreadName(event.getThreadName()); result.setTimeStamp(new Date(event.getTimeStamp())); + + if(!NDC.isEmpty()) + { + // TODO: configurable + Message[] contextStack = NDC.getContextStack(); + + result.setNdc(Arrays.asList(contextStack)); + } + return result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-25 00:23:54
|
Revision: 138 http://lilith.svn.sourceforge.net/lilith/?rev=138&view=rev Author: huxhorn Date: 2009-01-25 00:23:49 +0000 (Sun, 25 Jan 2009) Log Message: ----------- Created NDC for use with Lilith appenders. See ticket:27. Modified Paths: -------------- trunk/lilith/src/changes/changes.xml trunk/lilith-data/logging/src/test/resources/logback.xml trunk/logback/pom.xml Added Paths: ----------- trunk/logback/classic/ trunk/logback/classic/pom.xml trunk/logback/classic/src/ trunk/logback/classic/src/main/ trunk/logback/classic/src/main/java/ trunk/logback/classic/src/main/java/de/ trunk/logback/classic/src/main/java/de/huxhorn/ trunk/logback/classic/src/main/java/de/huxhorn/lilith/ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDC.java trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDCAdapter.java trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NoOpNDCAdapter.java trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java trunk/logback/classic/src/test/ trunk/logback/classic/src/test/java/ trunk/logback/classic/src/test/java/de/ trunk/logback/classic/src/test/java/de/huxhorn/ trunk/logback/classic/src/test/java/de/huxhorn/lilith/ trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/ trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/ trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java Modified: trunk/lilith/src/changes/changes.xml =================================================================== --- trunk/lilith/src/changes/changes.xml 2009-01-24 21:12:26 UTC (rev 137) +++ trunk/lilith/src/changes/changes.xml 2009-01-25 00:23:49 UTC (rev 138) @@ -91,6 +91,12 @@ <action dev="jhux" type="add" issue="1"> Install example groovy conditions if conditions folder is newly created. </action> + <action dev="jhux" type="add" issue="27"> + Added support for NDC to LoggingEvent datatype. + </action> + <action dev="jhux" type="add" issue="27"> + Created NDC for use with Lilith appenders. + </action> <action dev="jhux" type="add"> TODO: Add transfer size statistics. </action> @@ -352,7 +358,7 @@ <action dev="jhux" type="update"> Implemented own message formatting in MessageFormatter that does not rely on slf4j anymore. </action> - <action dev="jhux" type="add" issue="2034328"> + <action dev="jhux" type="add"> Added support for Exceptions in case of parameter array, i.e. log.debug("{} {}", new Object[]{"One", "Two", new Throwable()) will both evaluate the parameters in the message and the additional Throwable as the Throwable of the Modified: trunk/lilith-data/logging/src/test/resources/logback.xml =================================================================== --- trunk/lilith-data/logging/src/test/resources/logback.xml 2009-01-24 21:12:26 UTC (rev 137) +++ trunk/lilith-data/logging/src/test/resources/logback.xml 2009-01-25 00:23:49 UTC (rev 138) @@ -8,20 +8,20 @@ </appender> <!-- - <appender name="Localhorst" class="ch.qos.lilith.classic.net.SocketAppender"> - <RemoteHost>localhost</RemoteHost> - <Port>4445</Port> - <ReconnectionDelay>10000</ReconnectionDelay> - <IncludeCallerData>true</IncludeCallerData> - </appender> - --> + <appender name="Localhorst" class="ch.qos.lilith.classic.net.SocketAppender"> + <RemoteHost>localhost</RemoteHost> + <Port>4445</Port> + <ReconnectionDelay>10000</ReconnectionDelay> + <IncludeCallerData>true</IncludeCallerData> + </appender> + --> <root> - <level value="WARN"/> + <level value="ALL"/> <appender-ref ref="CONSOLE"/> <!-- - <appender-ref ref="Localhorst"/> - --> + <appender-ref ref="Localhorst"/> + --> </root> <logger name="class"> Added: trunk/logback/classic/pom.xml =================================================================== --- trunk/logback/classic/pom.xml (rev 0) +++ trunk/logback/classic/pom.xml 2009-01-25 00:23:49 UTC (rev 138) @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>de.huxhorn.lilith</groupId> + <artifactId>de.huxhorn.lilith.logback.classic</artifactId> + <version>${parent.version}</version> + <packaging>jar</packaging> + <name>Logback Classic Enhancements</name> + <description>This file is part of Lilith. It contains an NDC implementation that can be used in conjunction with the lilith appenders to get NDC functionality in Logback.</description> + <url>http://lilith.huxhorn.de/projects/${pom.artifactId}/</url> + + <scm> + <connection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/logback/classic</connection> + <developerConnection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/logback/classic</developerConnection> + <url>http://lilith.svn.sourceforge.net/viewvc/lilith/trunk/logback/classic/</url> + </scm> + + <parent> + <groupId>de.huxhorn.lilith</groupId> + <artifactId>de.huxhorn.lilith.parent</artifactId> + <version><!-- LV -->0.9.35-SNAPSHOT</version> + <relativePath>../../lilith-parent/pom.xml</relativePath> + </parent> + + <licenses> + <license> + <name>GNU Lesser General Public License v3 (LGPL)</name> + <url>http://www.gnu.org/copyleft/lesser.html</url> + <distribution>repo</distribution> + </license> + </licenses> + + <dependencies> + <dependency> + <groupId>de.huxhorn.lilith</groupId> + <artifactId>de.huxhorn.lilith.data.logging</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> Added: trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDC.java =================================================================== --- trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDC.java (rev 0) +++ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDC.java 2009-01-25 00:23:49 UTC (rev 138) @@ -0,0 +1,80 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package de.huxhorn.lilith.logback.classic; + +import de.huxhorn.lilith.data.logging.Message; + +public class NDC +{ + private static final NDCAdapter ndcAdapter; + + static + { + // TODO: configuration + ndcAdapter=new SimpleNDCAdapter(); + } + + private NDC() + { + + } + + + public static void push(String message) + { + ndcAdapter.push(message); + } + + public static void push(String messagePattern, Object[] arguments) + { + ndcAdapter.push(messagePattern, arguments); + } + + /** + * Pops the last message from the stack. + * + * This method does not return the popped message to discourage it's usage in application logic. + */ + public static void pop() + { + ndcAdapter.pop(); + } + + public static boolean isEmpty() + { + return ndcAdapter.isEmpty(); + } + + public static void clear() + { + ndcAdapter.clear(); + } + + /** + * Returns an array containing all messages of the stack. + * + * The messages from the NDC stack should not be used in application logic. + * + * @return an array containing all messages of the stack. + */ + public static Message[] getContextStack() + { + return ndcAdapter.getContextStack(); + } + +} Added: trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDCAdapter.java =================================================================== --- trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDCAdapter.java (rev 0) +++ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDCAdapter.java 2009-01-25 00:23:49 UTC (rev 138) @@ -0,0 +1,36 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package de.huxhorn.lilith.logback.classic; + +import de.huxhorn.lilith.data.logging.Message; + + +public interface NDCAdapter +{ + void push(String message); + void push(String messagePattern, Object[] arguments); + + void pop(); + + boolean isEmpty(); + void clear(); + + Message[] getContextStack(); + + Message[] NO_MESSAGES=new Message[0]; +} Added: trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NoOpNDCAdapter.java =================================================================== --- trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NoOpNDCAdapter.java (rev 0) +++ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NoOpNDCAdapter.java 2009-01-25 00:23:49 UTC (rev 138) @@ -0,0 +1,50 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package de.huxhorn.lilith.logback.classic; + +import de.huxhorn.lilith.data.logging.Message; + +public class NoOpNDCAdapter + implements NDCAdapter +{ + public void push(String message) + { + } + + public void push(String messagePattern, Object[] arguments) + { + } + + public void pop() + { + } + + public boolean isEmpty() + { + return true; + } + + public void clear() + { + } + + public Message[] getContextStack() + { + return NO_MESSAGES; + } +} Added: trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java =================================================================== --- trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java (rev 0) +++ trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapter.java 2009-01-25 00:23:49 UTC (rev 138) @@ -0,0 +1,108 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package de.huxhorn.lilith.logback.classic; + +import de.huxhorn.lilith.data.logging.Message; +import de.huxhorn.lilith.data.logging.MessageFormatter; + +import java.util.List; +import java.util.ArrayList; +import java.util.Arrays; + +public class SimpleNDCAdapter + implements NDCAdapter +{ + private InheritableThreadLocal<List<Message>> inheritableThreadLocal = new InheritableThreadLocal<List<Message>>(); + + private List<Message> getStackList() + { + List<Message> result=inheritableThreadLocal.get(); + if(result==null) + { + result=new ArrayList<Message>(); + inheritableThreadLocal.set(result); + } + return result; + } + + public void push(String message) + { + List<Message> stackList = getStackList(); + stackList.add(new Message(message)); + } + + public void push(String messagePattern, Object[] arguments) + { + if(arguments==null || arguments.length==0) + { + push(messagePattern); + return; + } + List<Message> stackList = getStackList(); + MessageFormatter.ArgumentResult argumentResults = MessageFormatter.evaluateArguments(messagePattern, arguments); + if(argumentResults==null) + { + System.out.println("messagePattern="+messagePattern+", arguments="+ Arrays.toString(arguments)); + } + else + stackList.add(new Message(messagePattern, argumentResults.getArguments())); + } + + public void pop() + { + List<Message> stackList = getStackList(); + int size=stackList.size(); + if(size>0) + { + stackList.remove(size-1); + } + } + + public boolean isEmpty() + { + return getStackList().isEmpty(); + } + + public void clear() + { + getStackList().clear(); + } + + public Message[] getContextStack() + { + List<Message> stackList = getStackList(); + if(stackList.isEmpty()) + { + return NO_MESSAGES; + } + + Message[] result=new Message[stackList.size()]; + try + { + for(int i=0;i<stackList.size();i++) + { + result[i]=stackList.get(i).clone(); + } + } + catch(CloneNotSupportedException e) + { + // can't happen... yeah, I know... it *will* happen one day :p + } + return result; + } +} Added: trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java =================================================================== --- trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java (rev 0) +++ trunk/logback/classic/src/test/java/de/huxhorn/lilith/logback/classic/SimpleNDCAdapterTest.java 2009-01-25 00:23:49 UTC (rev 138) @@ -0,0 +1,109 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package de.huxhorn.lilith.logback.classic; + +import de.huxhorn.lilith.data.logging.Message; + +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SimpleNDCAdapterTest +{ + private final Logger logger = LoggerFactory.getLogger(SimpleNDCAdapterTest.class); + + private SimpleNDCAdapter instance; + + @Before + public void setUp() + { + instance=new SimpleNDCAdapter(); + } + + @Test + public void isEmpty() + { + assertTrue(instance.isEmpty()); + + } + + @Test + public void pushMessageUsingIsEmpty() + { + instance.push("message"); + assertFalse(instance.isEmpty()); + } + + @Test + public void pushMessagePatternUsingIsEmpty() + { + instance.push("messagePattern", new String[]{"foo", "bar"}); + assertFalse(instance.isEmpty()); + } + + @Test + public void popUsingPushAndIsEmpty() + { + instance.push("message"); + assertFalse(instance.isEmpty()); + instance.pop(); + assertTrue(instance.isEmpty()); + } + + @Test + public void clearUsingPushAndIsEmpty() + { + instance.push("message"); + instance.push("message"); + assertFalse(instance.isEmpty()); + instance.clear(); + assertTrue(instance.isEmpty()); + } + + @Test + public void getContextStackEmpty() + { + Message[] stack = instance.getContextStack(); + assertArrayEquals(new Message[0], stack); + } + + @Test + public void getContextStackUsingPush() + { + Message[] messages=new Message[] + { + new Message("message1", new String[]{"foo", "bar"}), + new Message("message2", new String[]{"foo", null}), + new Message("message3"), + new Message(null), + new Message(null, new String[]{"foo", "bar"}), + }; + + + for(Message current:messages) + { + instance.push(current.getMessagePattern(), current.getArguments()); + } + + Message[] stack = instance.getContextStack(); + if(logger.isDebugEnabled()) logger.debug("Retrieved contextStack={}.", new Object[]{stack}); + assertArrayEquals(messages, stack); + } +} Modified: trunk/logback/pom.xml =================================================================== --- trunk/logback/pom.xml 2009-01-24 21:12:26 UTC (rev 137) +++ trunk/logback/pom.xml 2009-01-25 00:23:49 UTC (rev 138) @@ -37,6 +37,7 @@ </distributionManagement> <modules> + <module>classic</module> <module>logging-adapter</module> <module>access-adapter</module> <module>event-producers</module> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-24 21:12:34
|
Revision: 137 http://lilith.svn.sourceforge.net/lilith/?rev=137&view=rev Author: huxhorn Date: 2009-01-24 21:12:26 +0000 (Sat, 24 Jan 2009) Log Message: ----------- "Just" reformatting... Modified Paths: -------------- trunk/jul-slf4j-handler/pom.xml trunk/jul-slf4j-handler/src/main/java/de/huxhorn/lilith/handler/Slf4JHandler.java trunk/lilith/miscJars/flyingsaucer/fs-pom.xml trunk/lilith/miscJars/jmdns/jmdns-pom.xml trunk/lilith/miscJars/macify/macify-pom.xml trunk/lilith/miscJars/rrd4j/rrd4j-pom.xml trunk/lilith/pom.xml trunk/lilith/src/changes/changes.xml trunk/lilith/src/l4j/launch4j.xml trunk/lilith/src/main/assembly/bin.xml trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java trunk/lilith/src/main/java/de/huxhorn/lilith/LilithBuffer.java trunk/lilith/src/main/java/de/huxhorn/lilith/LilithSounds.java trunk/lilith/src/main/java/de/huxhorn/lilith/appender/InternalLilithAppender.java trunk/lilith/src/main/java/de/huxhorn/lilith/conditions/EventContainsCondition.java trunk/lilith/src/main/java/de/huxhorn/lilith/conditions/GroovyCondition.java trunk/lilith/src/main/java/de/huxhorn/lilith/conditions/LilithCondition.java trunk/lilith/src/main/java/de/huxhorn/lilith/conditions/LoggerEqualsCondition.java trunk/lilith/src/main/java/de/huxhorn/lilith/conditions/LoggerStartsWithCondition.java trunk/lilith/src/main/java/de/huxhorn/lilith/conditions/MessageContainsCondition.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/AlarmSoundAccessEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/AlarmSoundLoggingEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/FileDumpEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/FileSplitterEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/RrdLoggingEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/SocketEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/StdoutEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/UserNotificationAccessEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/consumers/UserNotificationLoggingEventConsumer.java trunk/lilith/src/main/java/de/huxhorn/lilith/debug/AbstractDebugRunnable.java trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogAnonymousRunnable.java trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogParamThrowableRunnable.java trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogSkullRunnable.java trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogStuffRunnable.java trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogStuffWithMdcRunnable.java trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogThrowableRunnable.java trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LogTruthRunnable.java trunk/lilith/src/main/java/de/huxhorn/lilith/debug/LoggerEventEmitter.java trunk/lilith/src/main/java/de/huxhorn/lilith/services/gotosrc/GoToSourceService.java trunk/lilith/src/main/java/de/huxhorn/lilith/services/sender/AbstractEventSender.java trunk/lilith/src/main/java/de/huxhorn/lilith/services/sender/AccessEventSender.java trunk/lilith/src/main/java/de/huxhorn/lilith/services/sender/EventSender.java trunk/lilith/src/main/java/de/huxhorn/lilith/services/sender/LoggingEventSender.java trunk/lilith/src/main/java/de/huxhorn/lilith/services/sender/SenderService.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/AboutDialog.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/AboutPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/AccessEventViewManager.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/AccessEventViewPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ColorIcon.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/EventWrapperViewPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/HelpFrame.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/HtmlTransferable.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/LicenseAgreementDialog.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/LoggingEventViewManager.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/LoggingEventViewPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/LoggingViewState.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/OpenPreviousDialog.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ProgressDialog.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ProgressGlassPane.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/SplashScreen.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/StatisticsDialog.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/TabbedAccessViewContainer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/TabbedLoggingViewContainer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/TabbedPaneViewContainer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ViewActions.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ViewContainer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ViewContainerFrame.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ViewContainerInternalFrame.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ViewManager.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ViewWindow.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/callables/IndexingCallable.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/debug/DebugDialog.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/filefilters/DirectoryFilter.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/filefilters/GroovyConditionFileFilter.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/filefilters/LogFileFilter.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/filefilters/Mp3FileFilter.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/filefilters/PngFileFilter.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/filefilters/RrdFileFilter.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/linklistener/OpenUrlLinkListener.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/linklistener/StackTraceElementLinkListener.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/ColorSchemeEditorPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/ConditionTableModel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/ConditionsPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/EditConditionDialog.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/EditSourceListDialog.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/EditSourceNameDialog.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/GeneralPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/GenericSortedListModel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/PreferencesDialog.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/SavedCondition.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/SoundLocationTableModel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/SoundsPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/Source.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/SourceCellRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/SourceFilteringPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/SourceListsPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/SourceNameTableModel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/SourcesPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/table/ColorSchemePreviewRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/table/ConditionActiveRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/table/ConditionIndexRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/table/ConditionNameRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/table/ConditionPreviewRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/preferences/table/ConditionTableColumnModel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/AbstractGraphImageProducer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/GraphImageProducer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/NinetyDaysProducer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/OneDayProducer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/OneYearProducer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/SevenDaysProducer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/StatisticsPanel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/TenHoursProducer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/ThirtyDaysProducer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/TwentyMinutesProducer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/statistics/TwoHoursProducer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/AccessEventViewTable.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/ColorScheme.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/Colors.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/ColorsProvider.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/EventWrapperViewTable.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/LoggingEventViewTable.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/TooltipGenerator.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/model/BufferTableModel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/model/EventWrapperTableModel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/model/PersistentTableColumnModel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/model/RowBasedTableModel.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/ApplicationRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/ConditionalBorder.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/IdRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/LabelCellRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/LevelRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/LoggerNameRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/MarkerRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/MessageRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/MethodRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/ProtocolRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/RemoteAddrRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/RequestUriRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/SourceRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/StatusCodeRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/ThreadRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/ThrowableRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/TimestampRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/renderer/ToStringRenderer.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/ApplicationTooltipGenerator.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/LoggerNameTooltipGenerator.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/MarkerTooltipGenerator.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/MessageTooltipGenerator.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/RequestUrlTooltipGenerator.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/SourceTooltipGenerator.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/StatusCodeTooltipGenerator.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/ThreadTooltipGenerator.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/ThrowableTooltipGenerator.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/table/tooltips/TimestampTooltipGenerator.java trunk/lilith/src/main/resources/detailsView/detailsView.css trunk/lilith/src/main/resources/detailsView/detailsView.groovy trunk/lilith/src/main/resources/help/access-appender.xhtml trunk/lilith/src/main/resources/help/classic-appender.xhtml trunk/lilith/src/main/resources/help/conditions.xhtml trunk/lilith/src/main/resources/help/detailsView.xhtml trunk/lilith/src/main/resources/help/faq.xhtml trunk/lilith/src/main/resources/help/help.css trunk/lilith/src/main/resources/help/idea.xhtml trunk/lilith/src/main/resources/help/index.xhtml trunk/lilith/src/main/resources/help/keyboard.xhtml trunk/lilith/src/main/resources/help/knownProblems.xhtml trunk/lilith/src/main/resources/help/producers.xhtml trunk/lilith/src/main/resources/help/sources.xhtml trunk/lilith/src/main/resources/help/story.xhtml trunk/lilith/src/main/resources/help/used-software.xhtml trunk/lilith/src/main/resources/licenses/gplv3.html trunk/lilith/src/main/resources/licenses/lgplv3.html trunk/lilith/src/main/resources/licenses/license.html trunk/lilith/src/main/resources/logback.xml trunk/lilith/src/main/resources/logbackVerbose.xml trunk/lilith/src/test/resources/logback.xml trunk/lilith-data/access/pom.xml trunk/lilith-data/access/src/main/java/de/huxhorn/lilith/data/access/AccessEvent.java trunk/lilith-data/access/src/main/java/de/huxhorn/lilith/data/access/AccessEvents.java trunk/lilith-data/access/src/main/java/de/huxhorn/lilith/data/access/HttpStatus.java trunk/lilith-data/access/src/test/java/de/huxhorn/lilith/data/access/AccessEventTest.java trunk/lilith-data/access/src/test/java/de/huxhorn/lilith/data/access/AccessEventsTest.java trunk/lilith-data/access/src/test/resources/logback.xml trunk/lilith-data/eventsource/pom.xml trunk/lilith-data/eventsource/src/main/java/de/huxhorn/lilith/data/eventsource/EventIdentifier.java trunk/lilith-data/eventsource/src/main/java/de/huxhorn/lilith/data/eventsource/EventWrapper.java trunk/lilith-data/eventsource/src/main/java/de/huxhorn/lilith/data/eventsource/SourceIdentifier.java trunk/lilith-data/eventsource/src/main/java/de/huxhorn/lilith/data/eventsource/SourceInfo.java trunk/lilith-data/eventsource/src/main/java/de/huxhorn/lilith/data/eventsource/TransferSizeInfo.java trunk/lilith-data/eventsource/src/test/java/de/huxhorn/lilith/data/eventsource/EventIdentifierTest.java trunk/lilith-data/eventsource/src/test/java/de/huxhorn/lilith/data/eventsource/EventWrapperTest.java trunk/lilith-data/eventsource/src/test/java/de/huxhorn/lilith/data/eventsource/SourceIdentifierTest.java trunk/lilith-data/eventsource/src/test/java/de/huxhorn/lilith/data/eventsource/SourceInfoTest.java trunk/lilith-data/eventsource/src/test/java/de/huxhorn/lilith/data/eventsource/TransferSizeInfoTest.java trunk/lilith-data/eventsource/src/test/resources/logback.xml trunk/lilith-data/eventsource-xml/pom.xml trunk/lilith-data/eventsource-xml/src/main/java/de/huxhorn/lilith/data/eventsource/xml/EventSourceSchemaConstants.java trunk/lilith-data/eventsource-xml/src/main/java/de/huxhorn/lilith/data/eventsource/xml/SourceIdentifierReader.java trunk/lilith-data/eventsource-xml/src/main/java/de/huxhorn/lilith/data/eventsource/xml/SourceIdentifierWriter.java trunk/lilith-data/eventsource-xml/src/main/java/de/huxhorn/lilith/data/eventsource/xml/SourceInfoReader.java trunk/lilith-data/eventsource-xml/src/main/java/de/huxhorn/lilith/data/eventsource/xml/SourceInfoWriter.java trunk/lilith-data/eventsource-xml/src/test/java/de/huxhorn/lilith/data/eventsource/xml/SourceIdentifierIOTest.java trunk/lilith-data/eventsource-xml/src/test/java/de/huxhorn/lilith/data/eventsource/xml/SourceInfoIOTest.java trunk/lilith-data/eventsource-xml/src/test/resources/logback.xml trunk/lilith-data/logging/pom.xml trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/ExtendedStackTraceElement.java trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/LoggingEvent.java trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/LoggingEvents.java trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/Marker.java trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/Message.java trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/MessageFormatter.java trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/ThrowableInfo.java trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/ExtendedStackTraceElementTest.java trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventTest.java trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventsTest.java trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/MarkerTest.java trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/MessageFormatterTest.java trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/MessageTest.java trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/ThrowableInfoTest.java trunk/lilith-data/logging/src/test/resources/logback.xml trunk/lilith-data/logging-xml/pom.xml trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventReader.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventSchemaConstants.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventWriter.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventsReader.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventsWriter.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementReader.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementWriter.java trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventIOTest.java trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventsIOTest.java trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementIOTest.java trunk/lilith-data/logging-xml/src/test/resources/logback.xml trunk/lilith-data/logging-xml-serializer/pom.xml trunk/lilith-data/logging-xml-serializer/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingXmlDeserializer.java trunk/lilith-data/logging-xml-serializer/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingXmlSerializer.java trunk/lilith-data/logging-xml-serializer/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventIOTest.java trunk/lilith-data/logging-xml-serializer/src/test/resources/logback.xml trunk/lilith-data/pom.xml trunk/lilith-data/xml-schema/examples/EventSourceInfo.xml trunk/lilith-data/xml-schema/examples/LoggingEvent.xml trunk/lilith-data/xml-schema/examples/LoggingEvents.xml trunk/lilith-data/xml-schema/examples/SourceIdentifier.xml trunk/lilith-data/xml-schema/examples/StackTraceElement.xml trunk/lilith-data/xml-schema/schema/eventsource/10/EventSource.xsd trunk/lilith-data/xml-schema/schema/logging/10/LoggingEvent.xsd trunk/lilith-data/xml-schema/schema/logging/11/LoggingEvent.xsd trunk/lilith-engine/pom.xml trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/EventConsumer.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/EventProducer.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/EventSource.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/EventSourceListener.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/EventSourceProducer.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/FileBufferFactory.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/LogFileFactory.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/SourceManager.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/EventSourceImpl.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/LogFileFactoryImpl.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/eventproducer/AbstractEventProducer.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/eventproducer/AbstractMessageBasedEventProducer.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/eventproducer/SerializingMessageBasedEventProducer.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/sourcemanager/EventPoller.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/sourcemanager/SourceManagerImpl.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/sourceproducer/AbstractServerSocketEventSourceProducer.java trunk/lilith-engine/src/main/java/de/huxhorn/lilith/engine/impl/sourceproducer/SerializingMessageBasedServerSocketEventSourceProducer.java trunk/lilith-engine/src/test/resources/logback.xml trunk/lilith-idea-plugin/META-INF/plugin.xml trunk/lilith-idea-plugin/src/de/huxhorn/lilith/idea/LilithPlugin.java trunk/lilith-parent/pom.xml trunk/lilith-sender/pom.xml trunk/lilith-sender/src/main/java/de/huxhorn/lilith/sender/ConnectionState.java trunk/lilith-sender/src/main/java/de/huxhorn/lilith/sender/DataOutputStreamFactory.java trunk/lilith-sender/src/main/java/de/huxhorn/lilith/sender/HeartbeatRunnable.java trunk/lilith-sender/src/main/java/de/huxhorn/lilith/sender/MessageWriteByteStrategy.java trunk/lilith-sender/src/main/java/de/huxhorn/lilith/sender/MultiplexSendBytesService.java trunk/lilith-sender/src/main/java/de/huxhorn/lilith/sender/SendBytesService.java trunk/lilith-sender/src/main/java/de/huxhorn/lilith/sender/SimpleSendBytesService.java trunk/lilith-sender/src/main/java/de/huxhorn/lilith/sender/SocketDataOutputStreamFactory.java trunk/lilith-sender/src/main/java/de/huxhorn/lilith/sender/WriteByteStrategy.java trunk/lilith-sounds/pom.xml trunk/lilith-xml-logging/pom.xml trunk/lilith-xml-logging/src/main/java/de/huxhorn/lilith/engine/xml/eventproducer/LilithXmlMessageLoggingEventProducer.java trunk/lilith-xml-logging/src/main/java/de/huxhorn/lilith/engine/xml/eventproducer/LilithXmlStreamLoggingEventProducer.java trunk/lilith-xml-logging/src/main/java/de/huxhorn/lilith/engine/xml/sourceproducer/LilithXmlMessageLoggingServerSocketEventSourceProducer.java trunk/lilith-xml-logging/src/main/java/de/huxhorn/lilith/engine/xml/sourceproducer/LilithXmlStreamLoggingServerSocketEventSourceProducer.java trunk/lilith-xml-logging/src/test/resources/logback.xml trunk/logback/access-adapter/pom.xml trunk/logback/access-adapter/src/main/java/de/huxhorn/lilith/data/access/logback/LogbackAccessAdapter.java trunk/logback/access-adapter/src/test/resources/logback.xml trunk/logback/event-producers/pom.xml trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/AbstractLogbackServerSocketEventSourceProducer.java trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/AbstractLogbackStreamEventProducer.java trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackAccessServerSocketEventSourceProducer.java trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackAccessStreamEventProducer.java trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackLoggingServerSocketEventSourceProducer.java trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackLoggingStreamEventProducer.java trunk/logback/event-producers/src/test/resources/logback.xml trunk/logback/logging-adapter/pom.xml trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java trunk/logback/logging-adapter/src/test/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapterTest.java trunk/logback/logging-adapter/src/test/resources/logback.xml trunk/logback/multiplex-appender-access/pom.xml trunk/logback/multiplex-appender-access/src/main/java/de/huxhorn/lilith/logback/appender/AccessMultiplexSocketAppender.java trunk/logback/multiplex-appender-classic/pom.xml trunk/logback/multiplex-appender-classic/src/main/java/de/huxhorn/lilith/logback/appender/ClassicMultiplexSocketAppender.java trunk/logback/multiplex-appender-classic-xml/pom.xml trunk/logback/multiplex-appender-classic-xml/src/main/java/de/huxhorn/lilith/logback/appender/ClassicXmlMultiplexSocketAppender.java trunk/logback/multiplex-appender-classic-xml/src/main/java/de/huxhorn/lilith/logback/appender/ZeroDelimitedClassicXmlMultiplexSocketAppender.java trunk/logback/multiplex-appender-classic-xml/src/main/java/de/huxhorn/lilith/logback/appender/ZeroDelimitedWriteByteStrategy.java trunk/logback/multiplex-appender-core/pom.xml trunk/logback/multiplex-appender-core/src/main/java/de/huxhorn/lilith/logback/appender/MultiplexSocketAppenderBase.java trunk/logback/pom.xml trunk/logback/shutdown-context-listener/pom.xml trunk/logback/shutdown-context-listener/src/main/java/de/huxhorn/lilith/logback/servlet/LogbackShutdownServletContextListener.java trunk/pom.xml Modified: trunk/jul-slf4j-handler/pom.xml =================================================================== --- trunk/jul-slf4j-handler/pom.xml 2009-01-24 05:28:01 UTC (rev 136) +++ trunk/jul-slf4j-handler/pom.xml 2009-01-24 21:12:26 UTC (rev 137) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.jul-slf4j-handler</artifactId> @@ -9,7 +9,7 @@ <name>java.util.logging Handler using SLF4J</name> <description>This file is part of Lilith. It's a java.util.logging to slf4j bridge handler.</description> <url>http://lilith.huxhorn.de/projects/${pom.artifactId}/</url> - + <scm> <connection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/jul-slf4j-handler</connection> <developerConnection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/jul-slf4j-handler</developerConnection> @@ -19,10 +19,10 @@ <parent> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.parent</artifactId> -<!-- LV --><version>0.9.35-SNAPSHOT</version> + <version><!-- LV -->0.9.35-SNAPSHOT</version> <relativePath>../lilith-parent/pom.xml</relativePath> </parent> - + <licenses> <license> <name>GNU Lesser General Public License v3 (LGPL)</name> Modified: trunk/jul-slf4j-handler/src/main/java/de/huxhorn/lilith/handler/Slf4JHandler.java =================================================================== --- trunk/jul-slf4j-handler/src/main/java/de/huxhorn/lilith/handler/Slf4JHandler.java 2009-01-24 05:28:01 UTC (rev 136) +++ trunk/jul-slf4j-handler/src/main/java/de/huxhorn/lilith/handler/Slf4JHandler.java 2009-01-24 21:12:26 UTC (rev 137) @@ -1,6 +1,6 @@ /* * Lilith - a log event viewer. - * Copyright (C) 2007-2008 Joern Huxhorn + * Copyright (C) 2007-2009 Joern Huxhorn * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -28,33 +28,32 @@ /** * <p>A java.util.logging.Handler that simply forwards LogRecords to the respective * org.slf4j.Logger.</p> - * + * <p/> * <p>Usage example:<br /> * <tt><pre> - { - // initialize java.util.logging to use slf4j... - Handler handler = new Slf4JHandler(); - java.util.logging.Logger rootLogger = java.util.logging.Logger.getLogger(""); - rootLogger.addHandler(handler); - rootLogger.setLevel(java.util.logging.Level.ALL); - } -</pre></tt></p> - * + * { + * // initialize java.util.logging to use slf4j... + * Handler handler = new Slf4JHandler(); + * java.util.logging.Logger rootLogger = java.util.logging.Logger.getLogger(""); + * rootLogger.addHandler(handler); + * rootLogger.setLevel(java.util.logging.Level.ALL); + * } + * </pre></tt></p> + * <p/> * <p><b>Keep in mind that the above code enables all logging, even for <tt>java.*</tt>, <tt>javax.*</tt> * and <tt>sun.*</tt>!</b></p> - * + * <p/> * <p>This means that you will most likely have to set the log level of those three packages to a sane value * like <tt>INFO</tt> or <tt>WARN</tt>.</p> - + * <p/> * <p>It's also possible to set those levels before the LogRecord reaches the Handler:<br/> * <tt><pre> - { - java.util.logging.Logger.getLogger("java").setLevel(java.util.logging.Level.WARNING); - java.util.logging.Logger.getLogger("javax").setLevel(java.util.logging.Level.WARNING); - java.util.logging.Logger.getLogger("sun").setLevel(java.util.logging.Level.WARNING); - } -</pre></tt></p> - * + * { + * java.util.logging.Logger.getLogger("java").setLevel(java.util.logging.Level.WARNING); + * java.util.logging.Logger.getLogger("javax").setLevel(java.util.logging.Level.WARNING); + * java.util.logging.Logger.getLogger("sun").setLevel(java.util.logging.Level.WARNING); + * } + * </pre></tt></p> */ public class Slf4JHandler extends Handler @@ -82,7 +81,7 @@ */ public void publish(LogRecord record) { - if(record!=null) + if(record != null) { logRecord(record); } @@ -107,27 +106,28 @@ * @throws SecurityException if a security manager exists and if * the caller does not have <tt>LoggingPermission("control")</tt>. */ - public void close() throws SecurityException + public void close() + throws SecurityException { } private void logRecord(LogRecord record) { Level julLevel = record.getLevel(); - int julLevelValue=julLevel.intValue(); - if(julLevelValue<=TRACE_LEVEL_THRESHOLD) + int julLevelValue = julLevel.intValue(); + if(julLevelValue <= TRACE_LEVEL_THRESHOLD) { logTrace(record); } - else if(julLevelValue<=DEBUG_LEVEL_THRESHOLD) + else if(julLevelValue <= DEBUG_LEVEL_THRESHOLD) { logDebug(record); } - else if(julLevelValue<=INFO_LEVEL_THRESHOLD) + else if(julLevelValue <= INFO_LEVEL_THRESHOLD) { logInfo(record); } - else if(julLevelValue<=WARN_LEVEL_THRESHOLD) + else if(julLevelValue <= WARN_LEVEL_THRESHOLD) { logWarn(record); } @@ -144,9 +144,9 @@ if(logger.isTraceEnabled()) { initMDC(record); - String message=record.getMessage(); + String message = record.getMessage(); Throwable throwable = record.getThrown(); - if(throwable!=null) + if(throwable != null) { logger.trace(message, throwable); } @@ -165,9 +165,9 @@ if(logger.isDebugEnabled()) { initMDC(record); - String message=record.getMessage(); + String message = record.getMessage(); Throwable throwable = record.getThrown(); - if(throwable!=null) + if(throwable != null) { logger.debug(message, throwable); } @@ -186,9 +186,9 @@ if(logger.isInfoEnabled()) { initMDC(record); - String message=record.getMessage(); + String message = record.getMessage(); Throwable throwable = record.getThrown(); - if(throwable!=null) + if(throwable != null) { logger.info(message, throwable); } @@ -207,9 +207,9 @@ if(logger.isWarnEnabled()) { initMDC(record); - String message=record.getMessage(); + String message = record.getMessage(); Throwable throwable = record.getThrown(); - if(throwable!=null) + if(throwable != null) { logger.warn(message, throwable); } @@ -228,9 +228,9 @@ if(logger.isErrorEnabled()) { initMDC(record); - String message=record.getMessage(); + String message = record.getMessage(); Throwable throwable = record.getThrown(); - if(throwable!=null) + if(throwable != null) { logger.error(message, throwable); } @@ -248,12 +248,12 @@ Level julLevel = record.getLevel(); MDC.put(LEVEL_MDC_KEY, julLevel.getName()); String sourceClassName = record.getSourceClassName(); - if(sourceClassName!=null) + if(sourceClassName != null) { MDC.put(SOURCE_CLASS_NAME_MDC_KEY, sourceClassName); } String sourceMethodName = record.getSourceMethodName(); - if(sourceMethodName!=null) + if(sourceMethodName != null) { MDC.put(SOURCE_METHOD_NAME_MDC_KEY, sourceMethodName); } Modified: trunk/lilith/miscJars/flyingsaucer/fs-pom.xml =================================================================== --- trunk/lilith/miscJars/flyingsaucer/fs-pom.xml 2009-01-24 05:28:01 UTC (rev 136) +++ trunk/lilith/miscJars/flyingsaucer/fs-pom.xml 2009-01-24 21:12:26 UTC (rev 137) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.3rdparty.flyingsaucer.core-renderer</artifactId> @@ -16,13 +16,12 @@ <distribution>repo</distribution> </license> </licenses> - + <scm> <connection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/lilith/miscJars/flyingsaucer</connection> <developerConnection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/lilith/miscJars/flyingsaucer</developerConnection> <url>http://lilith.svn.sourceforge.net/viewvc/lilith/trunk/lilith//miscJars/flyingsaucer/</url> </scm> - - <dependencies> - </dependencies> + + <dependencies></dependencies> </project> Modified: trunk/lilith/miscJars/jmdns/jmdns-pom.xml =================================================================== --- trunk/lilith/miscJars/jmdns/jmdns-pom.xml 2009-01-24 05:28:01 UTC (rev 136) +++ trunk/lilith/miscJars/jmdns/jmdns-pom.xml 2009-01-24 21:12:26 UTC (rev 137) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.3rdparty.jmdns</artifactId> @@ -21,13 +21,12 @@ <distribution>repo</distribution> </license> </licenses> - + <scm> <connection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/lilith/miscJars/jmdns</connection> <developerConnection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/lilith/miscJars/jmdns</developerConnection> <url>http://lilith.svn.sourceforge.net/viewvc/lilith/trunk/lilith//miscJars/jmdns/</url> </scm> - - <dependencies> - </dependencies> + + <dependencies></dependencies> </project> Modified: trunk/lilith/miscJars/macify/macify-pom.xml =================================================================== --- trunk/lilith/miscJars/macify/macify-pom.xml 2009-01-24 05:28:01 UTC (rev 136) +++ trunk/lilith/miscJars/macify/macify-pom.xml 2009-01-24 21:12:26 UTC (rev 137) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.3rdparty.macify</artifactId> @@ -16,13 +16,12 @@ <distribution>repo</distribution> </license> </licenses> - + <scm> <connection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/lilith/miscJars/macify</connection> <developerConnection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/lilith/miscJars/macify</developerConnection> <url>http://lilith.svn.sourceforge.net/viewvc/lilith/trunk/lilith//miscJars/macify/</url> </scm> - - <dependencies> - </dependencies> + + <dependencies></dependencies> </project> Modified: trunk/lilith/miscJars/rrd4j/rrd4j-pom.xml =================================================================== --- trunk/lilith/miscJars/rrd4j/rrd4j-pom.xml 2009-01-24 05:28:01 UTC (rev 136) +++ trunk/lilith/miscJars/rrd4j/rrd4j-pom.xml 2009-01-24 21:12:26 UTC (rev 137) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.3rdparty.rrd4j</artifactId> @@ -16,13 +16,12 @@ <distribution>repo</distribution> </license> </licenses> - + <scm> <connection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/lilith/miscJars/rrd4j</connection> <developerConnection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/lilith/miscJars/rrd4j</developerConnection> <url>http://lilith.svn.sourceforge.net/viewvc/lilith/trunk/lilith//miscJars/rrd4j/</url> </scm> - - <dependencies> - </dependencies> + + <dependencies></dependencies> </project> Modified: trunk/lilith/pom.xml =================================================================== --- trunk/lilith/pom.xml 2009-01-24 05:28:01 UTC (rev 136) +++ trunk/lilith/pom.xml 2009-01-24 21:12:26 UTC (rev 137) @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith</artifactId> @@ -8,7 +9,7 @@ <name>Lilith</name> <description>Lilith is a logging and access event viewer for the Logback logging framework. It has features comparable to Chainsaw, a logging event viewer for log4j. This means that it can receive logging events from remote applications using Logback as their logging backend. It uses files to buffer the received events locally, so it is possible to keep vast amounts of logging events at your fingertip while still being able to check only the ones you are really interested in by using filtering conditions.</description> <url>http://lilith.huxhorn.de/projects/${pom.artifactId}/</url> - + <scm> <connection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/lilith</connection> <developerConnection>scm:svn:https://lilith.svn.sourceforge.net/svnroot/lilith/trunk/lilith</developerConnection> @@ -18,7 +19,7 @@ <parent> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.parent</artifactId> -<!-- LV --><version>0.9.35-SNAPSHOT</version> + <version><!-- LV -->0.9.35-SNAPSHOT</version> <relativePath>../lilith-parent/pom.xml</relativePath> </parent> @@ -27,14 +28,14 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>osxappbundle-maven-plugin</artifactId> - <version>1.0-alpha-2</version> - <!-- - <version>1.0-alpha-1</version> - --> + <version>1.0-alpha-2</version> + <!-- + <version>1.0-alpha-1</version> + --> <configuration> <!-- - <dictionaryFile>${basedir}/src/main/mac-resources/Info.plist</dictionaryFile> - --> + <dictionaryFile>${basedir}/src/main/mac-resources/Info.plist</dictionaryFile> + --> <jvmVersion>1.5+</jvmVersion> <mainClass>de.huxhorn.lilith.Lilith</mainClass> <iconFile>${basedir}/src/main/mac-resources/Lilith.icns</iconFile> @@ -51,7 +52,7 @@ </execution> </executions> </plugin> - + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> @@ -106,42 +107,42 @@ </build> <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <scope>compile</scope> - </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <scope>compile</scope> + </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <scope>runtime</scope> - </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <scope>runtime</scope> + </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - <scope>compile</scope> - </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <scope>compile</scope> + </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <scope>compile</scope> - </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <scope>compile</scope> + </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-access</artifactId> - <scope>compile</scope> - </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-access</artifactId> + <scope>compile</scope> + </dependency> <dependency> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.logback.event-producers</artifactId> <scope>compile</scope> </dependency> - + <dependency> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.data.logging</artifactId> @@ -162,27 +163,27 @@ <artifactId>de.huxhorn.lilith.3rdparty.macify</artifactId> <version>1.1</version> <!-- - <groupId>org.simplericity.macify</groupId> - <artifactId>macify</artifactId> - <version>1.0</version> - --> + <groupId>org.simplericity.macify</groupId> + <artifactId>macify</artifactId> + <version>1.0</version> + --> <scope>compile</scope> </dependency> - <dependency> - <groupId>com.jgoodies</groupId> - <artifactId>looks</artifactId> - <version>2.2.0</version> - <scope>runtime</scope> - </dependency> <dependency> + <groupId>com.jgoodies</groupId> + <artifactId>looks</artifactId> + <version>2.2.0</version> + <scope>runtime</scope> + </dependency> + <dependency> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.3rdparty.jmdns</artifactId> <version>2.0-patched</version> <!-- - <groupId>jmdns</groupId> - <artifactId>jmdns</artifactId> - <version>2.1-SNAPSHOT</version> - --> + <groupId>jmdns</groupId> + <artifactId>jmdns</artifactId> + <version>2.1-SNAPSHOT</version> + --> <scope>compile</scope> </dependency> <dependency> @@ -190,7 +191,7 @@ <artifactId>de.huxhorn.lilith.jul-slf4j-handler</artifactId> <scope>compile</scope> </dependency> - + <dependency> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.logback.appender.multiplex-classic</artifactId> @@ -224,8 +225,8 @@ <groupId>org.codehaus.groovy</groupId> <artifactId>groovy</artifactId> <!-- - <version>1.5.7</version> - --> + <version>1.5.7</version> + --> <version>1.6-RC-1</version> <scope>compile</scope> </dependency> @@ -235,7 +236,7 @@ <artifactId>de.huxhorn.sulky.logging</artifactId> <scope>compile</scope> </dependency> - + <dependency> <groupId>de.huxhorn.sulky</groupId> <artifactId>de.huxhorn.sulky.sounds-impl-jlayer</artifactId> @@ -246,47 +247,47 @@ <artifactId>de.huxhorn.sulky.buffers</artifactId> <scope>compile</scope> </dependency> - + <dependency> <groupId>de.huxhorn.sulky</groupId> <artifactId>de.huxhorn.sulky.swing</artifactId> <scope>compile</scope> </dependency> - + <dependency> <groupId>de.huxhorn.sulky</groupId> <artifactId>de.huxhorn.sulky.io</artifactId> <scope>compile</scope> </dependency> - + <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <scope>compile</scope> </dependency> <!-- commons-lang dependency below is needed to override 1.0 dependency - from commons-cli --> + from commons-cli --> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <scope>compile</scope> </dependency> - + <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <scope>compile</scope> </dependency> - + <dependency> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.3rdparty.rrd4j</artifactId> <version>2.0.5</version> <!-- - <groupId>rrd4j</groupId> - <artifactId>rrd4j</artifactId> - <version>2.0.5</version> - --> + <groupId>rrd4j</groupId> + <artifactId>rrd4j</artifactId> + <version>2.0.5</version> + --> <scope>compile</scope> </dependency> @@ -295,21 +296,21 @@ <artifactId>commons-httpclient</artifactId> <scope>compile</scope> <!-- This will likely move to: - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.0</version> - --> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.0</version> + --> </dependency> <!-- + <dependency> + <groupId>svg-salamander</groupId> + <artifactId>svg-salamander-tiny</artifactId> + <version>1.0.0</version> + </dependency> + --> + <dependency> - <groupId>svg-salamander</groupId> - <artifactId>svg-salamander-tiny</artifactId> - <version>1.0.0</version> - </dependency> - --> - - <dependency> <groupId>de.huxhorn.lilith</groupId> <artifactId>de.huxhorn.lilith.sounds</artifactId> <scope>runtime</scope> @@ -327,20 +328,20 @@ <artifactId>de.huxhorn.lilith.3rdparty.flyingsaucer.core-renderer</artifactId> <version>8Pre2</version> <!-- - <groupId>flyingsaucer</groupId> - <artifactId>core-renderer</artifactId> - <version>8Pre2</version> - --> + <groupId>flyingsaucer</groupId> + <artifactId>core-renderer</artifactId> + <version>8Pre2</version> + --> <scope>compile</scope> </dependency> - <!-- - <dependency> - <groupId>org.swinglabs</groupId> - <artifactId>swingx</artifactId> - <version>0.9.2</version> - </dependency> - --> + <!-- + <dependency> + <groupId>org.swinglabs</groupId> + <artifactId>swingx</artifactId> + <version>0.9.2</version> + </dependency> + --> <dependency> <groupId>junit</groupId> Modified: trunk/lilith/src/changes/changes.xml =================================================================== --- trunk/lilith/src/changes/changes.xml 2009-01-24 05:28:01 UTC (rev 136) +++ trunk/lilith/src/changes/changes.xml 2009-01-24 21:12:26 UTC (rev 137) @@ -19,7 +19,7 @@ </action> <action dev="jhux" type="add"> TODO: "Save as" or "Export" logs. [*command*-S] This is only possible for inactive log views. - Support native Lilith, Lilith XML, log4j XML. + Support native Lilith, Lilith XML, log4j XML. </action> <action dev="jhux" type="add"> TODO: SVG Icons @@ -75,48 +75,48 @@ <action dev="jhux" type="add"> TODO: homemade multicast discovery of other Lilith instances on LAN. </action> - <action dev="jhux" type="update"> - TODO: Userfriendly and nice-looking preferences. - </action> + <action dev="jhux" type="update"> + TODO: Userfriendly and nice-looking preferences. + </action> </release> - <release version="0.9.35" date="TBD" description="Future release"> - <action dev="jhux" type="update" issue="8"> - Known problems and FAQ in help did not reflect the latest version. - </action> - <action dev="jhux" type="fix" issue="7"> - In case of #groovy#<scriptname> the script received that string as search string. - This has been fixed, now "" is used as search string. - </action> - <action dev="jhux" type="add" issue="1"> - Install example groovy conditions if conditions folder is newly created. - </action> - <action dev="jhux" type="add"> - TODO: Add transfer size statistics. - </action> - <action dev="jhux" type="add"> - TODO: Plugin interfaces (EventSender (e.g. Bonjour etc.), - EventReceiver, EventHandler (?, stuff like the fart on error, - RRD statistics, anything that's working directly on received events), GoToSource). + <release version="0.9.35" date="TBD" description="Future release"> + <action dev="jhux" type="update" issue="8"> + Known problems and FAQ in help did not reflect the latest version. + </action> + <action dev="jhux" type="fix" issue="7"> + In case of #groovy#<scriptname> the script received that string as search string. + This has been fixed, now "" is used as search string. + </action> + <action dev="jhux" type="add" issue="1"> + Install example groovy conditions if conditions folder is newly created. + </action> + <action dev="jhux" type="add"> + TODO: Add transfer size statistics. + </action> + <action dev="jhux" type="add"> + TODO: Plugin interfaces (EventSender (e.g. Bonjour etc.), + EventReceiver, EventHandler (?, stuff like the fart on error, + RRD statistics, anything that's working directly on received events), GoToSource). - Ability to add/remove/configure event receivers, make RRD optional (it's quite expensive) etc. - </action> - <action dev="jhux" type="add"> - TODO: Make color scheme of LoggingEvent.Level and HttpStatus.Type rendering configurable. - </action> - <action dev="jhux" type="update"> - TODO: Cleanup of duplicated code in actions, e.g. the new layout actions. - </action> - </release> + Ability to add/remove/configure event receivers, make RRD optional (it's quite expensive) etc. + </action> + <action dev="jhux" type="add"> + TODO: Make color scheme of LoggingEvent.Level and HttpStatus.Type rendering configurable. + </action> + <action dev="jhux" type="update"> + TODO: Cleanup of duplicated code in actions, e.g. the new layout actions. + </action> + </release> - <release version="0.9.34" date="2009-01-04" description="Release"> - <action dev="jhux" type="add"> - Added unit-tests for all datatypes. - </action> - <action dev="jhux" type="fix"> - Triple-fixed problem during auto-update of detailsView in case of malformed history.txt. - </action> - </release> + <release version="0.9.34" date="2009-01-04" description="Release"> + <action dev="jhux" type="add"> + Added unit-tests for all datatypes. + </action> + <action dev="jhux" type="fix"> + Triple-fixed problem during auto-update of detailsView in case of malformed history.txt. + </action> + </release> <release version="0.9.33" date="2009-01-03" description="Release"> <action dev="jhux" type="add"> @@ -131,113 +131,119 @@ <action dev="jhux" type="add"> new pre style as suggested by Alexander Kosenkov. Thanks a lot! </action> - <action dev="jhux" type="add"> - Support for Map and Collection containing Arrays in MessageFormatter. - </action> - <action dev="jhux" type="fix"> - Support for recursive Maps and Collections in MessageFormatter. This would previously throw a StackOverflowError. - </action> - <action dev="jhux" type="update"> - Better string representation for recursive Map, Collection and Object[]. It will now print - [...fully.qualified.ClassName@identityHash...]. - </action> - <action dev="jhux" type="add"> - Support for Exception during toString(). It will now result in [!!!fully.qualified.ClassName=>fully.qualified.Throwable:ThrowableMessage!!!]. - </action> + <action dev="jhux" type="add"> + Support for Map and Collection containing Arrays in MessageFormatter. + </action> <action dev="jhux" type="fix"> + Support for recursive Maps and Collections in MessageFormatter. This would previously throw a + StackOverflowError. + </action> + <action dev="jhux" type="update"> + Better string representation for recursive Map, Collection and Object[]. It will now print + [...fully.qualified.ClassName@identityHash...]. + </action> + <action dev="jhux" type="add"> + Support for Exception during toString(). It will now result in [!!!fully.qualified.ClassName=>fully.qualified.Throwable:ThrowableMessage!!!]. + </action> + <action dev="jhux" type="fix"> Don't reset prefs after accepting license. Also added -L option to flush licensed for easier debugging. </action> - <action dev="jhux" type="add"> - Ability to save and reset layout of the tables. There are 4 table layouts: logging, loggingGlobal, access and accessGlobal. - the global layouts are used in the global views "global (Logging)" and "global (Access)" while the non-global ones are used in ordinary - views, as well as in "Lilith (Logging)". - Functionality is available in View -> Layout and popup on table header. - </action> - <action dev="jhux" type="add"> - Ability to select look and feel in Preferences. Yes, the preferences dialog needs a lot of work :p - </action> - <action dev="jhux" type="add"> - JGoodies Looks added as a look and feel alternative. - </action> - <action dev="jhux" type="update"> - Improved general section of preferences dialog but I'm still not very happy about it. - </action> - <action dev="jhux" type="fix"> - Exceptions in SerializableDeserializer are now silently ignored. - </action> - <action dev="jhux" type="update"> - New class SaveCondition to serialize a condition together with a name, color infos and active setting. This - is a preparation for a proper (auto) filters. - </action> - <action dev="jhux" type="update"> - Refactored conditions. - </action> - <action dev="jhux" type="add"> - Added message.contains, logger.startsWith and logger.equals conditions as well as the ability to select - them in the find panel. - </action> - <action dev="jhux" type="update"> - GroovyCondition does now support a searchString. See help. - </action> - <action dev="jhux" type="update"> - Updated detailsView.groovy to prevent line-break in table headers so the width of the headers stays - the same. - </action> - <action dev="jhux" type="update"> - Show condition name in filtered tab if condition is a saved condition. - </action> - <action dev="jhux" type="add"> - Documentation of Sources and Source-Lists. - </action> - <action dev="jhux" type="update"> - Documentation Conditions. - </action> - <action dev="jhux" type="add"> - Ability to use saved conditions using #condition#<conditionName> in the text field of the search panel. - </action> - <action dev="jhux" type="update"> - Disabled "Clear" in case of a filtered buffer. Previous functionality was pretty useless. - </action> - <action dev="jhux" type="update"> - Adding all available groovy conditions to combo box. - </action> - <action dev="jhux" type="add"> - Added "!" (Not) toggle button to search panel that negates the current condition. - </action> - <action dev="jhux" type="update"> - Cropping the message popup to a sane sizes... - </action> - <action dev="jhux" type="update"> - Updated groovy dependency to 1.6-RC-1. - </action> - <action dev="jhux" type="update"> - Supporting conditions with empty argument. This is necessary because it might make sense for - groovy conditions. - </action> - <action dev="jhux" type="update"> - Added EventIdentifier that will be needed for caching of condition results. - Changed EventWrapper to use EventIdentifier instead of Source ID + localId. - Since this changes serialization anyway I took the opportunity to also add omittedElements to ThrowableInfo. - Updated xml IO accordingly. - </action> - <action dev="jhux" type="update"> - Updated and uploaded new logging schema. - </action> - <action dev="jhux" type="add"> - Implemented Conditions tab in Preferences. - </action> - <action dev="jhux" type="add"> - ... [truncated message content] |
From: <hu...@us...> - 2009-01-24 05:28:05
|
Revision: 136 http://lilith.svn.sourceforge.net/lilith/?rev=136&view=rev Author: huxhorn Date: 2009-01-24 05:28:01 +0000 (Sat, 24 Jan 2009) Log Message: ----------- Preparing to implement support for NDC. See ticket:27 . Tests updated to JUnit 4. Modified Paths: -------------- trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventReader.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventWriter.java trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventIOTest.java trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventsIOTest.java Modified: trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventReader.java =================================================================== --- trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventReader.java 2009-01-24 05:21:29 UTC (rev 135) +++ trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventReader.java 2009-01-24 05:28:01 UTC (rev 136) @@ -17,10 +17,7 @@ */ package de.huxhorn.lilith.data.logging.xml; -import de.huxhorn.lilith.data.logging.ExtendedStackTraceElement; -import de.huxhorn.lilith.data.logging.LoggingEvent; -import de.huxhorn.lilith.data.logging.Marker; -import de.huxhorn.lilith.data.logging.ThrowableInfo; +import de.huxhorn.lilith.data.logging.*; import de.huxhorn.sulky.stax.DateTimeFormatter; import de.huxhorn.sulky.stax.GenericStreamReader; import de.huxhorn.sulky.stax.StaxUtilities; @@ -80,6 +77,7 @@ readArguments(reader, result); readThrowable(reader, result); result.setMdc(readMdc(reader)); + result.setNdc(readNdc(reader)); readMarker(reader, result); readCallStack(reader, result); reader.require(XMLStreamConstants.END_ELEMENT, rootNamespace, LOGGING_EVENT_NODE); @@ -230,6 +228,12 @@ return null; } + private List<Message> readNdc(XMLStreamReader reader) throws XMLStreamException + { + // TODO: implement readNdc. + return null; + } + private MdcEntry readMdcEntry(XMLStreamReader reader) throws XMLStreamException { int type = reader.getEventType(); Modified: trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventWriter.java =================================================================== --- trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventWriter.java 2009-01-24 05:21:29 UTC (rev 135) +++ trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/LoggingEventWriter.java 2009-01-24 05:28:01 UTC (rev 136) @@ -117,6 +117,7 @@ writeArguments(writer, event); writeThrowable(writer, event); writeMdc(writer,event); + writeNdc(writer,event); writeMarker(writer, event); writeCallStack(writer, event); @@ -176,6 +177,11 @@ } + private void writeNdc(XMLStreamWriter writer, LoggingEvent event) throws XMLStreamException + { + // TODO: implement writeNdc. + } + private void writeMdc(XMLStreamWriter writer, LoggingEvent event) throws XMLStreamException { Map<String, String> mdc = event.getMdc(); Modified: trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventIOTest.java =================================================================== --- trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventIOTest.java 2009-01-24 05:21:29 UTC (rev 135) +++ trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventIOTest.java 2009-01-24 05:28:01 UTC (rev 136) @@ -17,23 +17,20 @@ */ package de.huxhorn.lilith.data.logging.xml; -import de.huxhorn.lilith.data.logging.ExtendedStackTraceElement; -import de.huxhorn.lilith.data.logging.LoggingEvent; -import de.huxhorn.lilith.data.logging.Marker; -import de.huxhorn.lilith.data.logging.ThrowableInfo; +import de.huxhorn.lilith.data.logging.*; import de.huxhorn.sulky.stax.IndentingXMLStreamWriter; -import junit.framework.TestCase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.junit.Before; +import org.junit.Test; +import org.junit.Ignore; +import static org.junit.Assert.assertEquals; import javax.xml.stream.*; import java.io.*; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; +import java.util.*; public class LoggingEventIOTest - extends TestCase { private final Logger logger = LoggerFactory.getLogger(LoggingEventIOTest.class); private XMLOutputFactory outputFactory; @@ -41,6 +38,7 @@ private XMLInputFactory inputFactory; private LoggingEventReader loggingEventReader; + @Before public void setUp() { outputFactory = XMLOutputFactory.newInstance(); @@ -50,37 +48,31 @@ loggingEventReader=new LoggingEventReader(); } - public LoggingEvent createMinimalEvent() + @Test + public void minimal() throws XMLStreamException, UnsupportedEncodingException { - LoggingEvent event=new LoggingEvent(); - event.setLogger("Logger"); - event.setLevel(LoggingEvent.Level.INFO); - event.setTimeStamp(new Date()); - event.setMessagePattern("EventMessage"); - return event; - } - - public void testMinimal() throws XMLStreamException, UnsupportedEncodingException - { LoggingEvent event=createMinimalEvent(); check(event, true); } - public void testAppId() throws XMLStreamException, UnsupportedEncodingException + @Test + public void applicationIdentifier() throws XMLStreamException, UnsupportedEncodingException { LoggingEvent event=createMinimalEvent(); event.setApplicationIdentifier("App"); check(event, true); } - public void testThreadName() throws XMLStreamException, UnsupportedEncodingException + @Test + public void threadName() throws XMLStreamException, UnsupportedEncodingException { LoggingEvent event=createMinimalEvent(); event.setThreadName("Thread-Name"); check(event, true); } - public void testArguments() throws XMLStreamException, UnsupportedEncodingException + @Test + public void arguments() throws XMLStreamException, UnsupportedEncodingException { LoggingEvent event=createMinimalEvent(); String[] arguments=new String[]{"arg1", "arg2"}; @@ -88,7 +80,8 @@ check(event, true); } - public void testNullArguments() throws XMLStreamException, UnsupportedEncodingException + @Test + public void nullArguments() throws XMLStreamException, UnsupportedEncodingException { LoggingEvent event=createMinimalEvent(); String[] arguments=new String[]{"arg1", null, "arg3"}; @@ -96,24 +89,17 @@ check(event, true); } - public ThrowableInfo createThrowableInfo(String className, String message) + @Test + public void singleThrowable() throws XMLStreamException, UnsupportedEncodingException { - ThrowableInfo ti=new ThrowableInfo(); - ti.setName(className); - ti.setMessage(message); - ti.setStackTrace(createStackTraceElements()); - return ti; - } - - public void testSingleThrowable() throws XMLStreamException, UnsupportedEncodingException - { LoggingEvent event=createMinimalEvent(); ThrowableInfo ti=createThrowableInfo("the.exception.class.Name", "Huhu! Exception Message"); event.setThrowable(ti); check(event, true); } - public void testMultiThrowable() throws XMLStreamException, UnsupportedEncodingException + @Test + public void multiThrowable() throws XMLStreamException, UnsupportedEncodingException { LoggingEvent event=createMinimalEvent(); ThrowableInfo ti=createThrowableInfo("the.exception.class.Name", "Huhu! Exception Message"); @@ -126,7 +112,8 @@ check(event, true); } - public void testMdc() throws XMLStreamException, UnsupportedEncodingException + @Test + public void mdc() throws XMLStreamException, UnsupportedEncodingException { LoggingEvent event=createMinimalEvent(); Map<String, String> mdc=new HashMap<String, String>(); @@ -137,7 +124,20 @@ check(event, true); } - public void testSingleMarker() throws XMLStreamException, UnsupportedEncodingException + @Ignore("Not running because writing NDC isn't implemented yet.") + @Test + public void ndc() throws UnsupportedEncodingException, XMLStreamException + { + LoggingEvent event=createMinimalEvent(); + List<Message> ndc=new ArrayList<Message>(); + ndc.add(new Message("Pattern 1 {} {}", new String[]{"foo", "bar"})); + ndc.add(new Message("Pattern 2 {} {}", new String[]{"foo", "bar"})); + event.setNdc(ndc); + check(event, true); + } + + @Test + public void singleMarker() throws XMLStreamException, UnsupportedEncodingException { LoggingEvent event=createMinimalEvent(); Marker marker = new Marker("marker"); @@ -145,7 +145,8 @@ check(event, true); } - public void testChildMarker() throws XMLStreamException, UnsupportedEncodingException + @Test + public void referenceMarker() throws XMLStreamException, UnsupportedEncodingException { LoggingEvent event=createMinimalEvent(); Marker marker = new Marker("marker"); @@ -157,7 +158,11 @@ check(event, true); } - public void testRecursiveMarker() throws XMLStreamException, UnsupportedEncodingException + /* + * This is not supported by SLF4J/Logback at the moment. + */ + @Test + public void recursiveMarker() throws XMLStreamException, UnsupportedEncodingException { LoggingEvent event=createMinimalEvent(); Marker marker = new Marker("marker"); @@ -172,45 +177,16 @@ check(event, true); } - public ExtendedStackTraceElement[] createStackTraceElements() + @Test + public void callStack() throws XMLStreamException, UnsupportedEncodingException { - //noinspection ThrowableInstanceNeverThrown - Throwable t=new Throwable(); - StackTraceElement[] original=t.getStackTrace(); - - ExtendedStackTraceElement[] result=new ExtendedStackTraceElement[original.length]; - for(int i=0;i<original.length;i++) - { - StackTraceElement current=original[i]; - result[i]=new ExtendedStackTraceElement(current); - - if(i==0) - { - // codeLocation, version and exact - result[i].setCodeLocation("CodeLocation"); - result[i].setVersion("Version"); - result[i].setExact(true); - } - else if(i==1) - { - // codeLocation, version and exact - result[i].setCodeLocation("CodeLocation"); - result[i].setVersion("Version"); - result[i].setExact(false); - } - } - - return result; - } - - public void testCallStack() throws XMLStreamException, UnsupportedEncodingException - { LoggingEvent event=createMinimalEvent(); event.setCallStack(createStackTraceElements()); check(event, true); } - public void testFull() throws XMLStreamException, UnsupportedEncodingException + @Test + public void full() throws XMLStreamException, UnsupportedEncodingException { LoggingEvent event=createMinimalEvent(); @@ -232,6 +208,14 @@ mdc.put("key3", "value3"); event.setMdc(mdc); + // TODO: set Ndc + /* + List<Message> ndc=new ArrayList<Message>(); + ndc.add(new Message("Pattern 1 {} {}", new String[]{"foo", "bar"})); + ndc.add(new Message("Pattern 2 {} {}", new String[]{"foo", "bar"})); + event.setNdc(ndc); + */ + Marker marker = new Marker("marker"); Marker marker2_1 = new Marker("marker2-1"); Marker marker2_2 = new Marker("marker2-2"); @@ -246,7 +230,8 @@ check(event, true); } - public void testFullPrefix() throws XMLStreamException, UnsupportedEncodingException + @Test + public void fullWithPrefix() throws XMLStreamException, UnsupportedEncodingException { loggingEventWriter.setPreferredPrefix("foo"); loggingEventWriter.setWritingSchemaLocation(true); @@ -270,6 +255,14 @@ mdc.put("key3", "value3"); event.setMdc(mdc); + // TODO: set Ndc + /* + List<Message> ndc=new ArrayList<Message>(); + ndc.add(new Message("Pattern 1 {} {}", new String[]{"foo", "bar"})); + ndc.add(new Message("Pattern 2 {} {}", new String[]{"foo", "bar"})); + event.setNdc(ndc); + */ + Marker marker = new Marker("marker"); Marker marker2_1 = new Marker("marker2-1"); Marker marker2_2 = new Marker("marker2-2"); @@ -284,7 +277,57 @@ check(event, true); } - public void check(LoggingEvent event, boolean indent) throws UnsupportedEncodingException, XMLStreamException + private LoggingEvent createMinimalEvent() + { + LoggingEvent event=new LoggingEvent(); + event.setLogger("Logger"); + event.setLevel(LoggingEvent.Level.INFO); + event.setTimeStamp(new Date()); + event.setMessagePattern("EventMessage"); + return event; + } + + private ExtendedStackTraceElement[] createStackTraceElements() + { + //noinspection ThrowableInstanceNeverThrown + Throwable t=new Throwable(); + StackTraceElement[] original=t.getStackTrace(); + + ExtendedStackTraceElement[] result=new ExtendedStackTraceElement[original.length]; + for(int i=0;i<original.length;i++) + { + StackTraceElement current=original[i]; + result[i]=new ExtendedStackTraceElement(current); + + if(i==0) + { + // codeLocation, version and exact + result[i].setCodeLocation("CodeLocation"); + result[i].setVersion("Version"); + result[i].setExact(true); + } + else if(i==1) + { + // codeLocation, version and exact + result[i].setCodeLocation("CodeLocation"); + result[i].setVersion("Version"); + result[i].setExact(false); + } + } + + return result; + } + + private ThrowableInfo createThrowableInfo(String className, String message) + { + ThrowableInfo ti=new ThrowableInfo(); + ti.setName(className); + ti.setMessage(message); + ti.setStackTrace(createStackTraceElements()); + return ti; + } + + private void check(LoggingEvent event, boolean indent) throws UnsupportedEncodingException, XMLStreamException { if(logger.isDebugEnabled()) logger.debug("Processing LoggingEvent:\n{}", event); byte[] bytes = write(event, indent); @@ -302,7 +345,7 @@ if(logger.isDebugEnabled()) logger.debug("LoggingEvents xml were equal."); } - public byte[] write(LoggingEvent event, boolean indent) throws XMLStreamException, UnsupportedEncodingException + private byte[] write(LoggingEvent event, boolean indent) throws XMLStreamException, UnsupportedEncodingException { ByteArrayOutputStream out=new ByteArrayOutputStream(); XMLStreamWriter writer=outputFactory.createXMLStreamWriter(new OutputStreamWriter(out,"utf-8")); @@ -321,14 +364,14 @@ return out.toByteArray(); } - public LoggingEvent read(byte[] bytes) throws XMLStreamException, UnsupportedEncodingException + private LoggingEvent read(byte[] bytes) throws XMLStreamException, UnsupportedEncodingException { ByteArrayInputStream in=new ByteArrayInputStream(bytes); XMLStreamReader reader=inputFactory.createXMLStreamReader(new InputStreamReader(in, "utf-8")); return loggingEventReader.read(reader); } - String toString(Marker marker) + private String toString(Marker marker) { if(marker==null) { @@ -372,10 +415,4 @@ result.append("]"); } } - -// public void testMulti() throws XMLStreamException, UnsupportedEncodingException -// { -// LoggingEvent event=createMinimalEvent(); -// check(event, true); -// } } Modified: trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventsIOTest.java =================================================================== --- trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventsIOTest.java 2009-01-24 05:21:29 UTC (rev 135) +++ trunk/lilith-data/logging-xml/src/test/java/de/huxhorn/lilith/data/logging/xml/LoggingEventsIOTest.java 2009-01-24 05:28:01 UTC (rev 136) @@ -21,9 +21,11 @@ import de.huxhorn.lilith.data.logging.LoggingEvent; import de.huxhorn.lilith.data.logging.LoggingEvents; import de.huxhorn.sulky.stax.IndentingXMLStreamWriter; -import junit.framework.TestCase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.assertEquals; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; @@ -40,7 +42,6 @@ import java.util.ArrayList; public class LoggingEventsIOTest - extends TestCase { private final Logger logger = LoggerFactory.getLogger(LoggingEventsIOTest.class); private XMLOutputFactory outputFactory; @@ -48,6 +49,7 @@ private XMLInputFactory inputFactory; private LoggingEventsReader loggingEventReader; + @Before public void setUp() { outputFactory = XMLOutputFactory.newInstance(); @@ -57,38 +59,15 @@ loggingEventReader=new LoggingEventsReader(); } - - public LoggingEvents createMinimalEvents() + @Test + public void minimal() throws XMLStreamException, UnsupportedEncodingException { - LoggingEvents events =new LoggingEvents(); - events.setSource(createMinimalEventSource()); - return events; - } - - public SourceIdentifier createMinimalEventSource() - { - SourceIdentifier result=new SourceIdentifier(); - result.setIdentifier("primary"); - return result; - } - - public LoggingEvent createMinimalEvent() - { - LoggingEvent event=new LoggingEvent(); - event.setLogger("Logger"); - event.setLevel(LoggingEvent.Level.INFO); - event.setTimeStamp(new Date()); - event.setMessagePattern("EventMessage"); - return event; - } - - public void testMinimal() throws XMLStreamException, UnsupportedEncodingException - { LoggingEvents events=createMinimalEvents(); check(events, true); } - public void testFull() throws XMLStreamException, UnsupportedEncodingException + @Test + public void full() throws XMLStreamException, UnsupportedEncodingException { LoggingEvents events=createMinimalEvents(); events.setStartIndex(17); @@ -100,7 +79,8 @@ check(events, true); } - public void testFullPrefix() throws XMLStreamException, UnsupportedEncodingException + @Test + public void fullPrefix() throws XMLStreamException, UnsupportedEncodingException { loggingEventWriter.setPreferredPrefix("foo"); LoggingEvents events=createMinimalEvents(); @@ -113,7 +93,8 @@ check(events, true); } - public void testFullPrefixInverted() throws XMLStreamException, UnsupportedEncodingException + @Test + public void fullPrefixInverted() throws XMLStreamException, UnsupportedEncodingException { loggingEventWriter.setPreferredPrefix("foo"); loggingEventWriter.setEventSourcePrefix(null); @@ -127,7 +108,7 @@ check(events, true); } - public void check(LoggingEvents event, boolean indent) throws UnsupportedEncodingException, XMLStreamException + private void check(LoggingEvents event, boolean indent) throws UnsupportedEncodingException, XMLStreamException { if(logger.isDebugEnabled()) logger.debug("Processing LoggingEvent:\n{}", event); byte[] bytes = write(event, indent); @@ -138,7 +119,32 @@ if(logger.isDebugEnabled()) logger.debug("LoggingEvents were equal."); } - public byte[] write(LoggingEvents event, boolean indent) throws XMLStreamException, UnsupportedEncodingException + + private LoggingEvents createMinimalEvents() + { + LoggingEvents events =new LoggingEvents(); + events.setSource(createMinimalEventSource()); + return events; + } + + private SourceIdentifier createMinimalEventSource() + { + SourceIdentifier result=new SourceIdentifier(); + result.setIdentifier("primary"); + return result; + } + + private LoggingEvent createMinimalEvent() + { + LoggingEvent event=new LoggingEvent(); + event.setLogger("Logger"); + event.setLevel(LoggingEvent.Level.INFO); + event.setTimeStamp(new Date()); + event.setMessagePattern("EventMessage"); + return event; + } + + private byte[] write(LoggingEvents event, boolean indent) throws XMLStreamException, UnsupportedEncodingException { ByteArrayOutputStream out=new ByteArrayOutputStream(); XMLStreamWriter writer=outputFactory.createXMLStreamWriter(new OutputStreamWriter(out,"utf-8")); @@ -157,7 +163,7 @@ return out.toByteArray(); } - public LoggingEvents read(byte[] bytes) throws XMLStreamException, UnsupportedEncodingException + private LoggingEvents read(byte[] bytes) throws XMLStreamException, UnsupportedEncodingException { ByteArrayInputStream in=new ByteArrayInputStream(bytes); XMLStreamReader reader=inputFactory.createXMLStreamReader(new InputStreamReader(in, "utf-8")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-24 05:21:36
|
Revision: 135 http://lilith.svn.sourceforge.net/lilith/?rev=135&view=rev Author: huxhorn Date: 2009-01-24 05:21:29 +0000 (Sat, 24 Jan 2009) Log Message: ----------- Implemented support for NDC. See ticket:27 . Modified Paths: -------------- trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/LoggingEvent.java trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventTest.java Added Paths: ----------- trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/Message.java trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/MessageTest.java Modified: trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/LoggingEvent.java =================================================================== --- trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/LoggingEvent.java 2009-01-20 22:12:08 UTC (rev 134) +++ trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/LoggingEvent.java 2009-01-24 05:21:29 UTC (rev 135) @@ -1,6 +1,6 @@ /* * Lilith - a log event viewer. - * Copyright (C) 2007-2008 Joern Huxhorn + * Copyright (C) 2007-2009 Joern Huxhorn * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Date; import java.util.Map; +import java.util.List; /** * <p>Replacement for ch.qos.logback.classic.spi.LoggingEvent</p> @@ -37,7 +38,7 @@ public class LoggingEvent implements Serializable { - private static final long serialVersionUID = -2716224578048229667L; + private static final long serialVersionUID = 2176672034350830417L; public enum Level { @@ -53,16 +54,19 @@ private String threadName; private Date timeStamp; - private String messagePattern; - - private String[] arguments; private ThrowableInfo throwable; private Map<String,String> mdc; + private List<Message> ndc; private Marker marker; private ExtendedStackTraceElement[] callStack; private String applicationIdentifier; - private transient String formattedMessage; + private Message message; + public LoggingEvent() + { + message=new Message(); + } + public String getLogger() { return logger; @@ -85,34 +89,27 @@ public String getMessagePattern() { - return messagePattern; + return message.getMessagePattern(); } public void setMessagePattern(String messagePattern) { - this.messagePattern = messagePattern; - this.formattedMessage=null; + message.setMessagePattern(messagePattern); } public String getMessage() { - if(this.formattedMessage==null) - { - // lazy init - this.formattedMessage=MessageFormatter.format(messagePattern, arguments); - } - return this.formattedMessage; + return message.getMessage(); } public String[] getArguments() { - return arguments; + return message.getArguments(); } public void setArguments(String[] arguments) { - this.arguments = arguments; - this.formattedMessage=null; + message.setArguments(arguments); } public Date getTimeStamp() @@ -155,7 +152,17 @@ this.mdc = mdc; } - public Marker getMarker() + public List<Message> getNdc() + { + return ndc; + } + + public void setNdc(List<Message> ndc) + { + this.ndc = ndc; + } + + public Marker getMarker() { return marker; } @@ -192,18 +199,18 @@ LoggingEvent event = (LoggingEvent) o; + if (level != event.level) return false; + if (timeStamp != null ? !timeStamp.equals(event.timeStamp) : event.timeStamp != null) return false; + if (logger != null ? !logger.equals(event.logger) : event.logger != null) return false; if (applicationIdentifier != null ? !applicationIdentifier.equals(event.applicationIdentifier) : event.applicationIdentifier != null) return false; - if (!Arrays.equals(arguments, event.arguments)) return false; + if (message != null ? !message.equals(event.message) : event.message != null) return false; + if (threadName != null ? !threadName.equals(event.threadName) : event.threadName != null) return false; if (!Arrays.equals(callStack, event.callStack)) return false; - if (level != event.level) return false; - if (logger != null ? !logger.equals(event.logger) : event.logger != null) return false; if (marker != null ? !marker.equals(event.marker) : event.marker != null) return false; if (mdc != null ? !mdc.equals(event.mdc) : event.mdc != null) return false; - if (messagePattern != null ? !messagePattern.equals(event.messagePattern) : event.messagePattern != null) return false; - if (threadName != null ? !threadName.equals(event.threadName) : event.threadName != null) return false; + if (ndc != null ? !ndc.equals(event.ndc) : event.ndc != null) return false; if (throwable != null ? !throwable.equals(event.throwable) : event.throwable != null) return false; - if (timeStamp != null ? !timeStamp.equals(event.timeStamp) : event.timeStamp != null) return false; return true; } @@ -213,14 +220,9 @@ int result; result = (logger != null ? logger.hashCode() : 0); result = 31 * result + (level != null ? level.hashCode() : 0); + result = 31 * result + (message != null ? message.hashCode() : 0); + result = 31 * result + (timeStamp != null ? timeStamp.hashCode() : 0); result = 31 * result + (threadName != null ? threadName.hashCode() : 0); - result = 31 * result + (timeStamp != null ? timeStamp.hashCode() : 0); - result = 31 * result + (messagePattern != null ? messagePattern.hashCode() : 0); - result = 31 * result + (arguments != null ? Arrays.hashCode(arguments) : 0); - result = 31 * result + (throwable != null ? throwable.hashCode() : 0); - result = 31 * result + (mdc != null ? mdc.hashCode() : 0); - result = 31 * result + (marker != null ? marker.hashCode() : 0); - result = 31 * result + (callStack != null ? Arrays.hashCode(callStack) : 0); result = 31 * result + (applicationIdentifier != null ? applicationIdentifier.hashCode() : 0); return result; } @@ -232,7 +234,7 @@ result.append("LoggingEvent["); result.append("logger=").append(logger).append(", "); result.append("level=").append(level).append(", "); - result.append("messagePattern=").append(messagePattern).append(", "); + result.append("message=").append(message).append(", "); result.append("threadName=").append(threadName).append(", "); result.append("applicationIdentifier=").append(applicationIdentifier).append(", "); result.append("timeStamp=").append(timeStamp); Added: trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/Message.java =================================================================== --- trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/Message.java (rev 0) +++ trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/Message.java 2009-01-24 05:21:29 UTC (rev 135) @@ -0,0 +1,126 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package de.huxhorn.lilith.data.logging; + +import java.util.Arrays; +import java.io.Serializable; + +/** + * This class encapsulates a parameterized message as used by LoggingEvent and NDC. + * + * The message is formatted lazily the first time it is actually retrieved using getMessage(). + */ +public final class Message + implements Serializable, Cloneable +{ + private static final long serialVersionUID = 5086167676879398378L; + + private String messagePattern; + private String[] arguments; + private transient String formattedMessage; + + public Message() + { + } + + public Message(String messagePattern) + { + this(messagePattern, null); + } + + public Message(String messagePattern, String[] arguments) + { + this.messagePattern = messagePattern; + this.arguments = arguments; + } + + public String getMessage() + { + if(this.formattedMessage==null) + { + // lazy init + this.formattedMessage=MessageFormatter.format(messagePattern, arguments); + } + return this.formattedMessage; + } + + public String getMessagePattern() + { + return messagePattern; + } + + public void setMessagePattern(String messagePattern) + { + this.messagePattern = messagePattern; + this.formattedMessage=null; + } + + public String[] getArguments() + { + return arguments; + } + + public void setArguments(String[] arguments) + { + this.arguments = arguments; + this.formattedMessage=null; + } + + @Override + public boolean equals(Object o) + { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Message message = (Message) o; + + if (messagePattern != null ? !messagePattern.equals(message.messagePattern) : message.messagePattern != null) + return false; + + if (!Arrays.equals(arguments, message.arguments)) return false; + + return true; + } + + @Override + public int hashCode() + { + int result = messagePattern != null ? messagePattern.hashCode() : 0; + result = 31 * result + (arguments != null ? Arrays.hashCode(arguments) : 0); + return result; + } + + public Message clone() + throws CloneNotSupportedException + { + Message result = (Message) super.clone(); + if(arguments != null) + { + int len=arguments.length; + result.arguments=new String[len]; + System.arraycopy(arguments, 0, result.arguments, 0, len); + } + return result; + } + + @Override + public String toString() + { + return "Message[messagePattern="+messagePattern+", arguments="+Arrays.toString(arguments)+"]"; + } +} Modified: trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventTest.java =================================================================== --- trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventTest.java 2009-01-20 22:12:08 UTC (rev 134) +++ trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventTest.java 2009-01-24 05:21:29 UTC (rev 135) @@ -27,9 +27,7 @@ import static de.huxhorn.sulky.junit.JUnitTools.testXmlSerialization; import java.io.IOException; -import java.util.Date; -import java.util.Map; -import java.util.HashMap; +import java.util.*; public class LoggingEventTest { @@ -273,4 +271,26 @@ assertFalse(fresh.equals(obj)); } } + + @Test + public void ndc() throws ClassNotFoundException, IOException + { + LoggingEvent instance=new LoggingEvent(); + + List<Message> value=new ArrayList<Message>(); + value.add(new Message("pattern", new String[]{"foo", "bar"})); + + instance.setNdc(value); + + { + LoggingEvent obj = testSerialization(instance); + assertEquals(value, obj.getNdc()); + assertFalse(fresh.equals(obj)); + } + { + LoggingEvent obj = testXmlSerialization(instance); + assertEquals(value, obj.getNdc()); + assertFalse(fresh.equals(obj)); + } + } } Copied: trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/MessageTest.java (from rev 125, trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/LoggingEventTest.java) =================================================================== --- trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/MessageTest.java (rev 0) +++ trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/MessageTest.java 2009-01-24 05:21:29 UTC (rev 135) @@ -0,0 +1,103 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package de.huxhorn.lilith.data.logging; + +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; +import static de.huxhorn.sulky.junit.JUnitTools.testSerialization; +import static de.huxhorn.sulky.junit.JUnitTools.testXmlSerialization; +import static de.huxhorn.sulky.junit.JUnitTools.testClone; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + +public class MessageTest +{ + private Message fresh; + + @Before + public void initFresh() + { + fresh = new Message(); + } + + @Test + public void defaultConstructor() throws ClassNotFoundException, IOException + { + Message instance=new Message(); + + testSerialization(instance); + testXmlSerialization(instance); + } + + @Test + public void messagePattern() throws ClassNotFoundException, IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException + { + Message instance=new Message(); + + String value="value"; + instance.setMessagePattern(value); + + { + Message obj = testSerialization(instance); + assertEquals(value, obj.getMessagePattern()); + assertFalse(fresh.equals(obj)); + } + { + Message obj = testXmlSerialization(instance); + assertEquals(value, obj.getMessagePattern()); + assertFalse(fresh.equals(obj)); + } + { + Message obj = testClone(instance); + assertEquals(value, obj.getMessagePattern()); + assertFalse(fresh.equals(obj)); + } + } + + @Test + public void arguments() throws ClassNotFoundException, IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException + { + Message instance=new Message(); + + String value[]=new String[]{"value1", "value2"}; + instance.setArguments(value); + + { + Message obj = testSerialization(instance); + assertArrayEquals(value, obj.getArguments()); + assertNotSame(value, obj.getArguments()); + assertFalse(fresh.equals(obj)); + } + { + Message obj = testXmlSerialization(instance); + assertArrayEquals(value, obj.getArguments()); + assertNotSame(value, obj.getArguments()); + assertFalse(fresh.equals(obj)); + } + { + Message obj = testClone(instance); + assertArrayEquals(value, obj.getArguments()); + assertNotSame(value, obj.getArguments()); + assertFalse(fresh.equals(obj)); + } + } + + +} \ No newline at end of file Property changes on: trunk/lilith-data/logging/src/test/java/de/huxhorn/lilith/data/logging/MessageTest.java ___________________________________________________________________ Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-20 22:29:32
|
Revision: 133 http://lilith.svn.sourceforge.net/lilith/?rev=133&view=rev Author: huxhorn Date: 2009-01-20 22:10:08 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Added missing license information. Modified Paths: -------------- trunk/lilith-data/eventsource/src/main/java/de/huxhorn/lilith/data/eventsource/TransferSizeInfo.java trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/ExtendedStackTraceElement.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementReader.java trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementWriter.java Modified: trunk/lilith-data/eventsource/src/main/java/de/huxhorn/lilith/data/eventsource/TransferSizeInfo.java =================================================================== --- trunk/lilith-data/eventsource/src/main/java/de/huxhorn/lilith/data/eventsource/TransferSizeInfo.java 2009-01-20 22:03:30 UTC (rev 132) +++ trunk/lilith-data/eventsource/src/main/java/de/huxhorn/lilith/data/eventsource/TransferSizeInfo.java 2009-01-20 22:10:08 UTC (rev 133) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.data.eventsource; /** Modified: trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/ExtendedStackTraceElement.java =================================================================== --- trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/ExtendedStackTraceElement.java 2009-01-20 22:03:30 UTC (rev 132) +++ trunk/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/ExtendedStackTraceElement.java 2009-01-20 22:10:08 UTC (rev 133) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.data.logging; import java.io.Serializable; Modified: trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementReader.java =================================================================== --- trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementReader.java 2009-01-20 22:03:30 UTC (rev 132) +++ trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementReader.java 2009-01-20 22:10:08 UTC (rev 133) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.data.logging.xml; import de.huxhorn.lilith.data.logging.ExtendedStackTraceElement; Modified: trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementWriter.java =================================================================== --- trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementWriter.java 2009-01-20 22:03:30 UTC (rev 132) +++ trunk/lilith-data/logging-xml/src/main/java/de/huxhorn/lilith/data/logging/xml/StackTraceElementWriter.java 2009-01-20 22:10:08 UTC (rev 133) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.data.logging.xml; import de.huxhorn.lilith.data.logging.ExtendedStackTraceElement; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-20 22:29:18
|
Revision: 134 http://lilith.svn.sourceforge.net/lilith/?rev=134&view=rev Author: huxhorn Date: 2009-01-20 22:12:08 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Changed license from GPLv3 to LGPLv3. GPL license was inherited from parent and not properly overwritten. Also added some missing license information. Modified Paths: -------------- trunk/logback/access-adapter/pom.xml trunk/logback/access-adapter/src/main/java/de/huxhorn/lilith/data/access/logback/LogbackAccessAdapter.java trunk/logback/event-producers/pom.xml trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/AbstractLogbackServerSocketEventSourceProducer.java trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/AbstractLogbackStreamEventProducer.java trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackAccessServerSocketEventSourceProducer.java trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackAccessStreamEventProducer.java trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackLoggingServerSocketEventSourceProducer.java trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackLoggingStreamEventProducer.java trunk/logback/logging-adapter/pom.xml trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java trunk/logback/logging-adapter/src/test/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapterTest.java trunk/logback/multiplex-appender-access/pom.xml trunk/logback/multiplex-appender-classic/pom.xml trunk/logback/multiplex-appender-classic-xml/pom.xml trunk/logback/multiplex-appender-classic-xml/src/main/java/de/huxhorn/lilith/logback/appender/ZeroDelimitedWriteByteStrategy.java trunk/logback/multiplex-appender-core/pom.xml trunk/logback/shutdown-context-listener/pom.xml trunk/logback/shutdown-context-listener/src/main/java/de/huxhorn/lilith/logback/servlet/LogbackShutdownServletContextListener.java Modified: trunk/logback/access-adapter/pom.xml =================================================================== --- trunk/logback/access-adapter/pom.xml 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/access-adapter/pom.xml 2009-01-20 22:12:08 UTC (rev 134) @@ -22,6 +22,14 @@ <relativePath>../../lilith-parent/pom.xml</relativePath> </parent> + <licenses> + <license> + <name>GNU Lesser General Public License v3 (LGPL)</name> + <url>http://www.gnu.org/copyleft/lesser.html</url> + <distribution>repo</distribution> + </license> + </licenses> + <dependencies> <dependency> <groupId>de.huxhorn.lilith</groupId> Modified: trunk/logback/access-adapter/src/main/java/de/huxhorn/lilith/data/access/logback/LogbackAccessAdapter.java =================================================================== --- trunk/logback/access-adapter/src/main/java/de/huxhorn/lilith/data/access/logback/LogbackAccessAdapter.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/access-adapter/src/main/java/de/huxhorn/lilith/data/access/logback/LogbackAccessAdapter.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.data.access.logback; import de.huxhorn.lilith.data.access.AccessEvent; Modified: trunk/logback/event-producers/pom.xml =================================================================== --- trunk/logback/event-producers/pom.xml 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/event-producers/pom.xml 2009-01-20 22:12:08 UTC (rev 134) @@ -22,6 +22,14 @@ <relativePath>../../lilith-parent/pom.xml</relativePath> </parent> + <licenses> + <license> + <name>GNU Lesser General Public License v3 (LGPL)</name> + <url>http://www.gnu.org/copyleft/lesser.html</url> + <distribution>repo</distribution> + </license> + </licenses> + <dependencies> <dependency> <groupId>ch.qos.logback</groupId> Modified: trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/AbstractLogbackServerSocketEventSourceProducer.java =================================================================== --- trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/AbstractLogbackServerSocketEventSourceProducer.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/AbstractLogbackServerSocketEventSourceProducer.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,18 +1,18 @@ /* * Lilith - a log event viewer. - * Copyright (C) 2007-2008 Joern Huxhorn + * Copyright (C) 2007-2009 Joern Huxhorn * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.huxhorn.lilith.logback.producer; Modified: trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/AbstractLogbackStreamEventProducer.java =================================================================== --- trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/AbstractLogbackStreamEventProducer.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/AbstractLogbackStreamEventProducer.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,18 +1,18 @@ /* * Lilith - a log event viewer. - * Copyright (C) 2007-2008 Joern Huxhorn + * Copyright (C) 2007-2009 Joern Huxhorn * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.huxhorn.lilith.logback.producer; Modified: trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackAccessServerSocketEventSourceProducer.java =================================================================== --- trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackAccessServerSocketEventSourceProducer.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackAccessServerSocketEventSourceProducer.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.logback.producer; import de.huxhorn.lilith.engine.EventProducer; Modified: trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackAccessStreamEventProducer.java =================================================================== --- trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackAccessStreamEventProducer.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackAccessStreamEventProducer.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.logback.producer; import de.huxhorn.lilith.data.eventsource.SourceIdentifier; Modified: trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackLoggingServerSocketEventSourceProducer.java =================================================================== --- trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackLoggingServerSocketEventSourceProducer.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackLoggingServerSocketEventSourceProducer.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.logback.producer; import de.huxhorn.lilith.engine.EventProducer; Modified: trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackLoggingStreamEventProducer.java =================================================================== --- trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackLoggingStreamEventProducer.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/event-producers/src/main/java/de/huxhorn/lilith/logback/producer/LogbackLoggingStreamEventProducer.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.logback.producer; import de.huxhorn.lilith.data.logging.LoggingEvent; Modified: trunk/logback/logging-adapter/pom.xml =================================================================== --- trunk/logback/logging-adapter/pom.xml 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/logging-adapter/pom.xml 2009-01-20 22:12:08 UTC (rev 134) @@ -22,6 +22,14 @@ <relativePath>../../lilith-parent/pom.xml</relativePath> </parent> + <licenses> + <license> + <name>GNU Lesser General Public License v3 (LGPL)</name> + <url>http://www.gnu.org/copyleft/lesser.html</url> + <distribution>repo</distribution> + </license> + </licenses> + <dependencies> <dependency> <groupId>de.huxhorn.lilith</groupId> Modified: trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java =================================================================== --- trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/logging-adapter/src/main/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapter.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.data.logging.logback; import ch.qos.logback.classic.spi.*; Modified: trunk/logback/logging-adapter/src/test/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapterTest.java =================================================================== --- trunk/logback/logging-adapter/src/test/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapterTest.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/logging-adapter/src/test/java/de/huxhorn/lilith/data/logging/logback/LogbackLoggingAdapterTest.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.data.logging.logback; import ch.qos.logback.classic.Level; Modified: trunk/logback/multiplex-appender-access/pom.xml =================================================================== --- trunk/logback/multiplex-appender-access/pom.xml 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/multiplex-appender-access/pom.xml 2009-01-20 22:12:08 UTC (rev 134) @@ -23,6 +23,14 @@ <relativePath>../../lilith-parent/pom.xml</relativePath> </parent> + <licenses> + <license> + <name>GNU Lesser General Public License v3 (LGPL)</name> + <url>http://www.gnu.org/copyleft/lesser.html</url> + <distribution>repo</distribution> + </license> + </licenses> + <dependencies> <dependency> <groupId>de.huxhorn.lilith</groupId> Modified: trunk/logback/multiplex-appender-classic/pom.xml =================================================================== --- trunk/logback/multiplex-appender-classic/pom.xml 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/multiplex-appender-classic/pom.xml 2009-01-20 22:12:08 UTC (rev 134) @@ -23,6 +23,14 @@ <relativePath>../../lilith-parent/pom.xml</relativePath> </parent> + <licenses> + <license> + <name>GNU Lesser General Public License v3 (LGPL)</name> + <url>http://www.gnu.org/copyleft/lesser.html</url> + <distribution>repo</distribution> + </license> + </licenses> + <dependencies> <dependency> <groupId>de.huxhorn.lilith</groupId> Modified: trunk/logback/multiplex-appender-classic-xml/pom.xml =================================================================== --- trunk/logback/multiplex-appender-classic-xml/pom.xml 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/multiplex-appender-classic-xml/pom.xml 2009-01-20 22:12:08 UTC (rev 134) @@ -22,6 +22,14 @@ <relativePath>../../lilith-parent/pom.xml</relativePath> </parent> + <licenses> + <license> + <name>GNU Lesser General Public License v3 (LGPL)</name> + <url>http://www.gnu.org/copyleft/lesser.html</url> + <distribution>repo</distribution> + </license> + </licenses> + <dependencies> <dependency> <groupId>de.huxhorn.lilith</groupId> Modified: trunk/logback/multiplex-appender-classic-xml/src/main/java/de/huxhorn/lilith/logback/appender/ZeroDelimitedWriteByteStrategy.java =================================================================== --- trunk/logback/multiplex-appender-classic-xml/src/main/java/de/huxhorn/lilith/logback/appender/ZeroDelimitedWriteByteStrategy.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/multiplex-appender-classic-xml/src/main/java/de/huxhorn/lilith/logback/appender/ZeroDelimitedWriteByteStrategy.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.logback.appender; import de.huxhorn.lilith.sender.WriteByteStrategy; Modified: trunk/logback/multiplex-appender-core/pom.xml =================================================================== --- trunk/logback/multiplex-appender-core/pom.xml 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/multiplex-appender-core/pom.xml 2009-01-20 22:12:08 UTC (rev 134) @@ -22,6 +22,14 @@ <relativePath>../../lilith-parent/pom.xml</relativePath> </parent> + <licenses> + <license> + <name>GNU Lesser General Public License v3 (LGPL)</name> + <url>http://www.gnu.org/copyleft/lesser.html</url> + <distribution>repo</distribution> + </license> + </licenses> + <dependencies> <dependency> <groupId>de.huxhorn.lilith</groupId> Modified: trunk/logback/shutdown-context-listener/pom.xml =================================================================== --- trunk/logback/shutdown-context-listener/pom.xml 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/shutdown-context-listener/pom.xml 2009-01-20 22:12:08 UTC (rev 134) @@ -22,6 +22,14 @@ <relativePath>../../lilith-parent/pom.xml</relativePath> </parent> + <licenses> + <license> + <name>GNU Lesser General Public License v3 (LGPL)</name> + <url>http://www.gnu.org/copyleft/lesser.html</url> + <distribution>repo</distribution> + </license> + </licenses> + <dependencies> <dependency> <groupId>javax.servlet</groupId> Modified: trunk/logback/shutdown-context-listener/src/main/java/de/huxhorn/lilith/logback/servlet/LogbackShutdownServletContextListener.java =================================================================== --- trunk/logback/shutdown-context-listener/src/main/java/de/huxhorn/lilith/logback/servlet/LogbackShutdownServletContextListener.java 2009-01-20 22:10:08 UTC (rev 133) +++ trunk/logback/shutdown-context-listener/src/main/java/de/huxhorn/lilith/logback/servlet/LogbackShutdownServletContextListener.java 2009-01-20 22:12:08 UTC (rev 134) @@ -1,3 +1,20 @@ +/* + * Lilith - a log event viewer. + * Copyright (C) 2007-2009 Joern Huxhorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package de.huxhorn.lilith.logback.servlet; import ch.qos.logback.classic.LoggerContext; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-20 22:28:31
|
Revision: 131 http://lilith.svn.sourceforge.net/lilith/?rev=131&view=rev Author: huxhorn Date: 2009-01-20 21:57:43 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Updated JUnit to 4.5. Modified Paths: -------------- trunk/lilith-parent/pom.xml Modified: trunk/lilith-parent/pom.xml =================================================================== --- trunk/lilith-parent/pom.xml 2009-01-20 21:14:25 UTC (rev 130) +++ trunk/lilith-parent/pom.xml 2009-01-20 21:57:43 UTC (rev 131) @@ -299,8 +299,8 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <!-- <version>4.5</version> --> - <version>4.4</version> + <!-- <version>4.4</version> --> + <version>4.5</version> </dependency> <dependency> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-20 22:28:06
|
Revision: 132 http://lilith.svn.sourceforge.net/lilith/?rev=132&view=rev Author: huxhorn Date: 2009-01-20 22:03:30 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Updated template copyright year. Modified Paths: -------------- trunk/licenseTemplateGPL.java trunk/licenseTemplateLGPL.java Modified: trunk/licenseTemplateGPL.java =================================================================== --- trunk/licenseTemplateGPL.java 2009-01-20 21:57:43 UTC (rev 131) +++ trunk/licenseTemplateGPL.java 2009-01-20 22:03:30 UTC (rev 132) @@ -1,6 +1,6 @@ /* * Lilith - a log event viewer. - * Copyright (C) 2007-2008 Joern Huxhorn + * Copyright (C) 2007-2009 Joern Huxhorn * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/licenseTemplateLGPL.java =================================================================== --- trunk/licenseTemplateLGPL.java 2009-01-20 21:57:43 UTC (rev 131) +++ trunk/licenseTemplateLGPL.java 2009-01-20 22:03:30 UTC (rev 132) @@ -1,6 +1,6 @@ /* * Lilith - a log event viewer. - * Copyright (C) 2007-2008 Joern Huxhorn + * Copyright (C) 2007-2009 Joern Huxhorn * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-20 21:14:31
|
Revision: 130 http://lilith.svn.sourceforge.net/lilith/?rev=130&view=rev Author: huxhorn Date: 2009-01-20 21:14:25 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Changed issue management to trac, added mailing lists and updated description of the lilith application pom. Modified Paths: -------------- trunk/lilith/pom.xml trunk/lilith/src/changes/changes.xml trunk/lilith-parent/pom.xml Modified: trunk/lilith/pom.xml =================================================================== --- trunk/lilith/pom.xml 2009-01-19 23:20:42 UTC (rev 129) +++ trunk/lilith/pom.xml 2009-01-20 21:14:25 UTC (rev 130) @@ -6,7 +6,7 @@ <version>${parent.version}</version> <packaging>jar</packaging> <name>Lilith</name> - <description>This file is part of Lilith. It's the Lilith application itself.</description> + <description>Lilith is a logging and access event viewer for the Logback logging framework. It has features comparable to Chainsaw, a logging event viewer for log4j. This means that it can receive logging events from remote applications using Logback as their logging backend. It uses files to buffer the received events locally, so it is possible to keep vast amounts of logging events at your fingertip while still being able to check only the ones you are really interested in by using filtering conditions.</description> <url>http://lilith.huxhorn.de/projects/${pom.artifactId}/</url> <scm> Modified: trunk/lilith/src/changes/changes.xml =================================================================== --- trunk/lilith/src/changes/changes.xml 2009-01-19 23:20:42 UTC (rev 129) +++ trunk/lilith/src/changes/changes.xml 2009-01-20 21:14:25 UTC (rev 130) @@ -81,14 +81,14 @@ </release> <release version="0.9.35" date="TBD" description="Future release"> - <action dev="jhux" type="update"> + <action dev="jhux" type="update" issue="8"> Known problems and FAQ in help did not reflect the latest version. </action> - <action dev="jhux" type="fix"> + <action dev="jhux" type="fix" issue="7"> In case of #groovy#<scriptname> the script received that string as search string. This has been fixed, now "" is used as search string. </action> - <action dev="jhux" type="add"> + <action dev="jhux" type="add" issue="1"> Install example groovy conditions if conditions folder is newly created. </action> <action dev="jhux" type="add"> @@ -109,7 +109,7 @@ </action> </release> - <release version="0.9.34" date="TBD" description="2009-01-04"> + <release version="0.9.34" date="2009-01-04" description="Release"> <action dev="jhux" type="add"> Added unit-tests for all datatypes. </action> @@ -118,7 +118,7 @@ </action> </release> - <release version="0.9.33" date="TBD" description="2009-01-03"> + <release version="0.9.33" date="2009-01-03" description="Release"> <action dev="jhux" type="add"> Added help about groovy filters. </action> @@ -320,7 +320,7 @@ Removed some debug logs from SerializingFileBuffer so basic initialization is guaranteed to *not* emit any logging events. </action> - <action dev="jhux" type="fix" issue="2044443"> + <action dev="jhux" type="fix"> XML appenders are now sending the message pattern instead of the formatted message. </action> <action dev="jhux" type="update"> Modified: trunk/lilith-parent/pom.xml =================================================================== --- trunk/lilith-parent/pom.xml 2009-01-19 23:20:42 UTC (rev 129) +++ trunk/lilith-parent/pom.xml 2009-01-20 21:14:25 UTC (rev 130) @@ -31,10 +31,34 @@ </licenses> <issueManagement> - <system>sourceforge</system> - <url>https://sourceforge.net/tracker/?group_id=219536</url> + <system>trac</system> + <url>http://apps.sourceforge.net/trac/lilith/</url> </issueManagement> + <mailingLists> + <mailingList> + <name>Announce List</name> + <subscribe>lil...@li...</subscribe> + <unsubscribe>lil...@li...</unsubscribe> + <post>lil...@li...</post> + <archive>http://sourceforge.net/mailarchive/forum.php?forum_name=lilith-announce</archive> + </mailingList> + <mailingList> + <name>User List</name> + <subscribe>lil...@li...</subscribe> + <unsubscribe>lil...@li...</unsubscribe> + <post>lil...@li...</post> + <archive>http://sourceforge.net/mailarchive/forum.php?forum_name=lilith-user</archive> + </mailingList> + <mailingList> + <name>Developer List</name> + <subscribe>lil...@li...</subscribe> + <unsubscribe>lil...@li...</unsubscribe> + <post>lil...@li...</post> + <archive>http://sourceforge.net/mailarchive/forum.php?forum_name=lilith-devel</archive> + </mailingList> + </mailingLists> + <distributionManagement> <site> <id>lilith.huxhorn.de</id> @@ -412,7 +436,7 @@ </reportSet> </reportSets> <configuration> - <issueLinkTemplate>http://sourceforge.net/support/tracker.php?aid=%ISSUE%</issueLinkTemplate> + <issueLinkTemplate>http://apps.sourceforge.net/trac/lilith/ticket/%ISSUE%</issueLinkTemplate> </configuration> </plugin> <plugin> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2009-01-19 23:20:50
|
Revision: 129 http://lilith.svn.sourceforge.net/lilith/?rev=129&view=rev Author: huxhorn Date: 2009-01-19 23:20:42 +0000 (Mon, 19 Jan 2009) Log Message: ----------- Fixed author email address *sigh* Added blurb about the origin of the splash screen. Modified Paths: -------------- trunk/lilith/pom.xml trunk/lilith/src/changes/changes.xml trunk/lilith/src/main/resources/help/used-software.xhtml trunk/lilith-parent/pom.xml Modified: trunk/lilith/pom.xml =================================================================== --- trunk/lilith/pom.xml 2009-01-10 15:30:31 UTC (rev 128) +++ trunk/lilith/pom.xml 2009-01-19 23:20:42 UTC (rev 129) @@ -334,6 +334,14 @@ <scope>compile</scope> </dependency> + <!-- + <dependency> + <groupId>org.swinglabs</groupId> + <artifactId>swingx</artifactId> + <version>0.9.2</version> + </dependency> + --> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> Modified: trunk/lilith/src/changes/changes.xml =================================================================== --- trunk/lilith/src/changes/changes.xml 2009-01-10 15:30:31 UTC (rev 128) +++ trunk/lilith/src/changes/changes.xml 2009-01-19 23:20:42 UTC (rev 129) @@ -1,7 +1,7 @@ <document> <properties> <title>Lilith</title> - <author email="hu...@so...">Joern Huxhorn</author> + <author email="hu...@us...">Joern Huxhorn</author> </properties> <body> <release version="1.x.x" date="TBD" description="Future release"> @@ -98,6 +98,7 @@ TODO: Plugin interfaces (EventSender (e.g. Bonjour etc.), EventReceiver, EventHandler (?, stuff like the fart on error, RRD statistics, anything that's working directly on received events), GoToSource). + Ability to add/remove/configure event receivers, make RRD optional (it's quite expensive) etc. </action> <action dev="jhux" type="add"> Modified: trunk/lilith/src/main/resources/help/used-software.xhtml =================================================================== --- trunk/lilith/src/main/resources/help/used-software.xhtml 2009-01-10 15:30:31 UTC (rev 128) +++ trunk/lilith/src/main/resources/help/used-software.xhtml 2009-01-19 23:20:42 UTC (rev 129) @@ -134,6 +134,9 @@ <p>If something is missing from the above list it's not a license breach but a bug ;-) and you should report it.</p> + <p>The <a href="http://en.wikipedia.org/wiki/File:Lilith_(John_Collier_painting).jpg">image</a> + used in the splash screen is a painting by John Collier. It's in the public + domain because the copyright has expired.</p> <p><a href="#top">Back to top.</a></p> </body> </html> \ No newline at end of file Modified: trunk/lilith-parent/pom.xml =================================================================== --- trunk/lilith-parent/pom.xml 2009-01-10 15:30:31 UTC (rev 128) +++ trunk/lilith-parent/pom.xml 2009-01-19 23:20:42 UTC (rev 129) @@ -317,7 +317,7 @@ <developers> <developer> <id>huxhorn</id> - <email>hu...@so...</email> + <email>hu...@us...</email> <name>Joern Huxhorn</name> <organization>Joern Huxhorn</organization> <organizationUrl>http://lilith.huxhorn.de</organizationUrl> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |