mirror of https://github.com/qos-ch/slf4j
Compare commits
12 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
b44fbd53cc | |
|
|
2a1374691f | |
|
|
4c6c574a7a | |
|
|
71291d97ba | |
|
|
bf50c49d10 | |
|
|
4e5ddca4ea | |
|
|
e69d4a9c73 | |
|
|
acb850d669 | |
|
|
179350d855 | |
|
|
7a35058597 | |
|
|
3cd3f3e5cc | |
|
|
918a055bdf |
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>integration</artifactId>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
@ -28,4 +28,5 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ Bundle-SymbolicName: jcl.over.slf4j
|
|||
Bundle-Name: jcl-over-slf4j
|
||||
Bundle-Vendor: SLF4J.ORG
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Automatic-Module-Name: org.apache.commons.logging
|
||||
Export-Package: org.apache.commons.logging;version=1.2,
|
||||
org.apache.commons.logging.impl;version=1.2
|
||||
Import-Package: org.slf4j;version=${parsedVersion.osgiVersion}, org.slf4j.spi;version=${parsedVersion.osgiVersion}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>jul-to-slf4j</artifactId>
|
||||
|
|
@ -30,5 +30,5 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
|
||||
|
|
@ -36,5 +36,5 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ Bundle-SymbolicName: log4j.over.slf4j
|
|||
Bundle-Name: log4j-over-slf4j
|
||||
Bundle-Vendor: SLF4J.ORG
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Automatic-Module-Name: org.apache.log4j
|
||||
Export-Package: org.apache.log4j;version=${log4j.version},
|
||||
org.apache.log4j.helpers;version=${log4j.version},
|
||||
org.apache.log4j.spi;version=${log4j.version},
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>osgi-over-slf4j</artifactId>
|
||||
|
|
@ -41,4 +41,6 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
|||
43
pom.xml
43
pom.xml
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<name>SLF4J</name>
|
||||
|
|
@ -46,7 +46,9 @@
|
|||
<logback.version>1.0.13</logback.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
<maven-site-plugin.version>3.3</maven-site-plugin.version>
|
||||
<javadoc.plugin.version>2.10.4</javadoc.plugin.version>
|
||||
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
|
||||
<javadoc.plugin.version>3.1.0</javadoc.plugin.version>
|
||||
<doclint>none</doclint>
|
||||
</properties>
|
||||
|
||||
<developers>
|
||||
|
|
@ -145,7 +147,7 @@
|
|||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
|
||||
|
|
@ -177,7 +179,21 @@
|
|||
<skipIfEmpty>true</skipIfEmpty>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${maven-source-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
|
@ -194,20 +210,6 @@
|
|||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
|
|
@ -262,6 +264,8 @@
|
|||
<version>${javadoc.plugin.version}</version>
|
||||
<configuration>
|
||||
<linksource>true</linksource>
|
||||
<doclint>none</doclint>
|
||||
|
||||
<!--<aggregate>true</aggregate>-->
|
||||
<excludePackageNames>org.slf4j.migrator:org.slf4j.migrator.*</excludePackageNames>
|
||||
<links>
|
||||
|
|
@ -323,6 +327,9 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>${javadoc.plugin.version}</version>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
#mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${VERSION_NUMBER}
|
||||
|
||||
MVN='/java/maven-3.5.2//bin/mvn'
|
||||
|
||||
PASS=$1
|
||||
echo $PASS
|
||||
|
||||
function checkExit(){
|
||||
if test "$?" != "0"; then
|
||||
echo Command $1 exited with abnormal status
|
||||
exit 1;
|
||||
else echo $?
|
||||
fi
|
||||
}
|
||||
|
||||
function echoThenRun () { # echo and then run the command
|
||||
echo $1
|
||||
$1
|
||||
ret=$?
|
||||
echo $ret
|
||||
return $ret
|
||||
}
|
||||
|
||||
$MVN clean
|
||||
checkExit "mvn clean"
|
||||
|
||||
|
||||
$MVN install
|
||||
checkExit "mvn install"
|
||||
|
||||
|
||||
$MVN site:site
|
||||
checkExit "mvn site:ste"
|
||||
|
||||
|
||||
$MVN assembly:single
|
||||
checkExit "mvn assembly:single"
|
||||
|
||||
|
||||
$MVN deploy -P javadocjar,sign-artifacts -Dgpg.passphrase=$PASS
|
||||
checkExit "mvn deploy -P javadocjar,sign-artifacts -Dgpg.passphrase=xxx"
|
||||
|
||||
#$MVN site:deploy -N # with Java 8!!!
|
||||
#checkExit "mvn site:deploy -N"
|
||||
|
||||
#git tag -m "tagging" -a v_${VERSION_NUMBER}
|
||||
#git push --tags
|
||||
|
||||
#release version and add next version on jira
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-android</artifactId>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
|
|
@ -117,4 +117,4 @@
|
|||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class EventRecodingLogger implements Logger {
|
|||
}
|
||||
|
||||
public void debug(String msg) {
|
||||
recordEvent(Level.TRACE, msg, null, null);
|
||||
recordEvent(Level.DEBUG, msg, null, null);
|
||||
}
|
||||
|
||||
public void debug(String format, Object arg) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ Bundle-SymbolicName: slf4j.api
|
|||
Bundle-Name: slf4j-api
|
||||
Bundle-Vendor: SLF4J.ORG
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Automatic-Module-Name: org.slf4j
|
||||
Export-Package: org.slf4j;version=${parsedVersion.osgiVersion},
|
||||
org.slf4j.spi;version=${parsedVersion.osgiVersion},
|
||||
org.slf4j.helpers;version=${parsedVersion.osgiVersion},
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-ext</artifactId>
|
||||
|
|
|
|||
|
|
@ -1,305 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2004-2011 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.ext;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.beans.XMLDecoder;
|
||||
import java.beans.XMLEncoder;
|
||||
import java.beans.ExceptionListener;
|
||||
|
||||
/**
|
||||
* Base class for Event Data. Event Data contains data to be logged about an
|
||||
* event. Users may extend this class for each EventType they want to log.
|
||||
*
|
||||
* @author Ralph Goers
|
||||
*/
|
||||
public class EventData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 153270778642103985L;
|
||||
|
||||
private Map<String, Object> eventData = new HashMap<String, Object>();
|
||||
public static final String EVENT_MESSAGE = "EventMessage";
|
||||
public static final String EVENT_TYPE = "EventType";
|
||||
public static final String EVENT_DATETIME = "EventDateTime";
|
||||
public static final String EVENT_ID = "EventId";
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
public EventData() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor to create event data from a Map.
|
||||
*
|
||||
* @param map
|
||||
* The event data.
|
||||
*/
|
||||
public EventData(Map<String, Object> map) {
|
||||
eventData.putAll(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct from a serialized form of the Map containing the RequestInfo
|
||||
* elements
|
||||
*
|
||||
* @param xml
|
||||
* The serialized form of the RequestInfo Map.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public EventData(String xml) {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
|
||||
try {
|
||||
XMLDecoder decoder = new XMLDecoder(bais);
|
||||
this.eventData = (Map<String, Object>) decoder.readObject();
|
||||
} catch (Exception e) {
|
||||
throw new EventException("Error decoding " + xml, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize all the EventData items into an XML representation.
|
||||
*
|
||||
* @return an XML String containing all the EventData items.
|
||||
*/
|
||||
public String toXML() {
|
||||
return toXML(eventData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize all the EventData items into an XML representation.
|
||||
*
|
||||
* @param map the Map to transform
|
||||
* @return an XML String containing all the EventData items.
|
||||
*/
|
||||
public static String toXML(Map<String, Object> map) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
XMLEncoder encoder = new XMLEncoder(baos);
|
||||
encoder.setExceptionListener(new ExceptionListener() {
|
||||
public void exceptionThrown(Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
});
|
||||
encoder.writeObject(map);
|
||||
encoder.close();
|
||||
return baos.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the event identifier.
|
||||
*
|
||||
* @return The event identifier
|
||||
*/
|
||||
public String getEventId() {
|
||||
return (String) this.eventData.get(EVENT_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the event identifier.
|
||||
*
|
||||
* @param eventId
|
||||
* The event identifier.
|
||||
*/
|
||||
public void setEventId(String eventId) {
|
||||
if (eventId == null) {
|
||||
throw new IllegalArgumentException("eventId cannot be null");
|
||||
}
|
||||
this.eventData.put(EVENT_ID, eventId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the message text associated with this event, if any.
|
||||
*
|
||||
* @return The message text associated with this event or null if there is
|
||||
* none.
|
||||
*/
|
||||
public String getMessage() {
|
||||
return (String) this.eventData.get(EVENT_MESSAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message text associated with this event.
|
||||
*
|
||||
* @param message
|
||||
* The message text.
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
this.eventData.put(EVENT_MESSAGE, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the date and time the event occurred.
|
||||
*
|
||||
* @return The Date associated with the event.
|
||||
*/
|
||||
public Date getEventDateTime() {
|
||||
return (Date) this.eventData.get(EVENT_DATETIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the date and time the event occurred in case it is not the same as when
|
||||
* the event was logged.
|
||||
*
|
||||
* @param eventDateTime
|
||||
* The event Date.
|
||||
*/
|
||||
public void setEventDateTime(Date eventDateTime) {
|
||||
this.eventData.put(EVENT_DATETIME, eventDateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the type of event that occurred.
|
||||
*
|
||||
* @param eventType
|
||||
* The type of the event.
|
||||
*/
|
||||
public void setEventType(String eventType) {
|
||||
this.eventData.put(EVENT_TYPE, eventType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the type of the event.
|
||||
*
|
||||
* @return The event type.
|
||||
*/
|
||||
public String getEventType() {
|
||||
return (String) this.eventData.get(EVENT_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add arbitrary attributes about the event.
|
||||
*
|
||||
* @param name
|
||||
* The attribute's key.
|
||||
* @param obj
|
||||
* The data associated with the key.
|
||||
*/
|
||||
public void put(String name, Serializable obj) {
|
||||
this.eventData.put(name, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve an event attribute.
|
||||
*
|
||||
* @param name
|
||||
* The attribute's key.
|
||||
* @return The value associated with the key or null if the key is not
|
||||
* present.
|
||||
*/
|
||||
public Serializable get(String name) {
|
||||
return (Serializable) this.eventData.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the event data from a Map.
|
||||
*
|
||||
* @param data
|
||||
* The Map to copy.
|
||||
*/
|
||||
public void putAll(Map<String, Object> data) {
|
||||
this.eventData.putAll(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of attributes in the EventData.
|
||||
*
|
||||
* @return the number of attributes in the EventData.
|
||||
*/
|
||||
public int getSize() {
|
||||
return this.eventData.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Iterator over all the entries in the EventData.
|
||||
*
|
||||
* @return an Iterator that can be used to access all the event attributes.
|
||||
*/
|
||||
public Iterator<Map.Entry<String, Object>> getEntrySetIterator() {
|
||||
return this.eventData.entrySet().iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all the attributes in the EventData as a Map. Changes to this map
|
||||
* will be reflected in the EventData.
|
||||
*
|
||||
* @return The Map of attributes in this EventData instance.
|
||||
*/
|
||||
public Map<String, Object> getEventMap() {
|
||||
return this.eventData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the EventData to a String.
|
||||
*
|
||||
* @return The EventData as a String.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return toXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two EventData objects for equality.
|
||||
*
|
||||
* @param o
|
||||
* The Object to compare.
|
||||
* @return true if the objects are the same instance or contain all the same
|
||||
* keys and their values.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof EventData || o instanceof Map)) {
|
||||
return false;
|
||||
}
|
||||
Map<String, Object> map = (o instanceof EventData) ? ((EventData) o).getEventMap() : (Map<String, Object>) o;
|
||||
|
||||
return this.eventData.equals(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the hashCode for this EventData instance.
|
||||
*
|
||||
* @return The hashcode for this EventData instance.
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.eventData.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2004-2011 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.ext;
|
||||
|
||||
/**
|
||||
* Exception used to identify issues related to an event that is being logged.
|
||||
*/
|
||||
public class EventException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -22873966112391992L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public EventException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that allows an exception message.
|
||||
* @param exceptionMessage The exception message.
|
||||
*/
|
||||
public EventException(String exceptionMessage) {
|
||||
super(exceptionMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that chains another Exception or Error.
|
||||
* @param originalException The original exception.
|
||||
*/
|
||||
public EventException(Throwable originalException) {
|
||||
super(originalException);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that chains another Exception or Error and also allows a message
|
||||
* to be specified.
|
||||
* @param exceptionMessage The exception message.
|
||||
* @param originalException The original exception.
|
||||
*/
|
||||
public EventException(String exceptionMessage, Throwable originalException) {
|
||||
super(exceptionMessage, originalException);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2004-2011 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.ext;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.Marker;
|
||||
import org.slf4j.MarkerFactory;
|
||||
import org.slf4j.spi.LocationAwareLogger;
|
||||
|
||||
/**
|
||||
* Simple Logger used to log events. All events are directed to a logger named "EventLogger"
|
||||
* with a level of INFO and with an Event marker.
|
||||
*
|
||||
* @author Ralph Goers
|
||||
*/
|
||||
public class EventLogger {
|
||||
|
||||
private static final String FQCN = EventLogger.class.getName();
|
||||
|
||||
static Marker EVENT_MARKER = MarkerFactory.getMarker("EVENT");
|
||||
|
||||
private static LoggerWrapper eventLogger = new LoggerWrapper(LoggerFactory.getLogger("EventLogger"), FQCN);
|
||||
|
||||
/**
|
||||
* There can only be a single EventLogger.
|
||||
*/
|
||||
private EventLogger() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the event.
|
||||
*
|
||||
* @param data The EventData.
|
||||
*/
|
||||
public static void logEvent(EventData data) {
|
||||
if (eventLogger.instanceofLAL) {
|
||||
((LocationAwareLogger) eventLogger.logger).log(EVENT_MARKER, FQCN, LocationAwareLogger.INFO_INT, data.toXML(), new Object[] { data }, null);
|
||||
} else {
|
||||
eventLogger.logger.info(EVENT_MARKER, data.toXML(), data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2004-2011 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.dummyExt;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.log4j.spi.LocationInfo;
|
||||
import org.apache.log4j.spi.LoggingEvent;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.MDC;
|
||||
import org.slf4j.ext.EventData;
|
||||
import org.slf4j.ext.EventLogger;
|
||||
|
||||
public class EventLoggerTest {
|
||||
|
||||
ListAppender listAppender;
|
||||
org.apache.log4j.Logger log4;
|
||||
|
||||
final static String EXPECTED_FILE_NAME = "EventLoggerTest.java";
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
// start from a clean slate for each test
|
||||
|
||||
listAppender = new ListAppender();
|
||||
listAppender.extractLocationInfo = true;
|
||||
org.apache.log4j.Logger eventLogger = org.apache.log4j.Logger.getLogger("EventLogger");
|
||||
eventLogger.addAppender(listAppender);
|
||||
eventLogger.setLevel(org.apache.log4j.Level.TRACE);
|
||||
eventLogger.setAdditivity(false);
|
||||
// Items that apply to any activity
|
||||
MDC.put("ipAddress", "192.168.1.110");
|
||||
MDC.put("login", "TestUSer");
|
||||
MDC.put("hostname", "localhost");
|
||||
MDC.put("productName", "SLF4J");
|
||||
MDC.put("locale", Locale.getDefault().getDisplayName());
|
||||
MDC.put("timezone", TimeZone.getDefault().getDisplayName());
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
MDC.clear();
|
||||
}
|
||||
|
||||
void verify(LoggingEvent le, String expectedMsg) {
|
||||
assertEquals(expectedMsg, le.getMessage());
|
||||
assertEquals(EXPECTED_FILE_NAME, le.getLocationInformation().getFileName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEventLogger() {
|
||||
EventData data[] = new EventData[2];
|
||||
data[0] = new EventData();
|
||||
data[0].setEventType("Login");
|
||||
data[0].setEventId("1");
|
||||
data[0].setEventDateTime(new Date());
|
||||
data[0].put("Userid", "TestUser");
|
||||
EventLogger.logEvent(data[0]);
|
||||
|
||||
data[1] = new EventData();
|
||||
data[1].setEventType("Update");
|
||||
data[1].setEventId("2");
|
||||
data[1].setEventDateTime(new Date());
|
||||
data[1].put("FileName", "/etc/hosts");
|
||||
EventLogger.logEvent(data[1]);
|
||||
|
||||
assertEquals(2, listAppender.list.size());
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
LoggingEvent event = listAppender.list.get(i);
|
||||
verify(event, data[i].toXML());
|
||||
LocationInfo li = event.getLocationInformation();
|
||||
assertEquals(this.getClass().getName(), li.getClassName());
|
||||
assertEquals(event.getMDC("hostname"), "localhost");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,6 @@ import org.junit.runners.Suite;
|
|||
import org.junit.runners.Suite.SuiteClasses;
|
||||
|
||||
@RunWith(Suite.class)
|
||||
@SuiteClasses({ MDCStrLookupTest.class, XLoggerTest.class, EventLoggerTest.class })
|
||||
@SuiteClasses({ MDCStrLookupTest.class, XLoggerTest.class })
|
||||
public class PackageTest {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-jcl</artifactId>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
|
|
@ -31,4 +31,5 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ Bundle-SymbolicName: slf4j.jdk14
|
|||
Bundle-Name: slf4j-jdk14
|
||||
Bundle-Vendor: SLF4J.ORG
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Automatic-Module-Name: org.slf4j.jul
|
||||
Export-Package: org.slf4j.impl;version=${parsedVersion.osgiVersion}
|
||||
Import-Package: org.slf4j;version=${parsedVersion.osgiVersion},
|
||||
org.slf4j.spi;version=${parsedVersion.osgiVersion},
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
|
|
@ -37,4 +37,5 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-migrator</artifactId>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-nop</artifactId>
|
||||
|
|
@ -24,4 +24,5 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ Bundle-SymbolicName: slf4j.nop
|
|||
Bundle-Name: slf4j-nop
|
||||
Bundle-Vendor: SLF4J.ORG
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Automatic-Module-Name: org.slf4j.nop
|
||||
Export-Package: org.slf4j.impl;version=${parsedVersion.osgiVersion}
|
||||
Import-Package: org.slf4j;version=${parsedVersion.osgiVersion},
|
||||
org.slf4j.spi;version=${parsedVersion.osgiVersion},
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
|
|
@ -31,4 +31,5 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ Bundle-Name: slf4j-simple
|
|||
Bundle-Vendor: SLF4J.ORG
|
||||
Require-Bundle: slf4j.api
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Automatic-Module-Name: org.slf4j.simple
|
||||
Export-Package: org.slf4j.impl;version=${parsedVersion.osgiVersion}
|
||||
Import-Package: org.slf4j;version=${parsedVersion.osgiVersion},
|
||||
org.slf4j.spi;version=${parsedVersion.osgiVersion},
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<version>1.7.28</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-site</artifactId>
|
||||
|
|
@ -30,6 +30,30 @@
|
|||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${maven-source-plugin.version}</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/META-INF/*</include>
|
||||
</includes>
|
||||
|
||||
<excludes>
|
||||
<exclude>x**</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
|
|
@ -41,4 +65,4 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
<ul>
|
||||
<li><a
|
||||
href="http://jira.qos.ch/issues/?jql=project%20%3D%20SLF4J">Search for
|
||||
href="https://jira.qos.ch/issues/?jql=project%3DSLF4J">Search for
|
||||
SLF4J bugs</a></li>
|
||||
</ul>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue