Skip to content

Commit

Permalink
Support for java.util.logging SocketHandler.
Browse files Browse the repository at this point in the history
- Moved JulImportCallable into separate jul-xml-import module.
- Implemented jul-xml-receiver.
- Added jul and log4j help.
- Added jul-receiver listening on port 11020.
- Added SocketHandler to jul-sandbox.
  • Loading branch information
huxi committed Sep 10, 2010
1 parent 5f37c5a commit 2c988e1
Show file tree
Hide file tree
Showing 22 changed files with 656 additions and 35 deletions.
29 changes: 29 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,19 @@ project(':log4j:log4j-producer').dependencies {
project(':jul:jul-xml').dependencies {
compile project(':lilith-data:logging')
compile libraries.'sulky-stax'
compile libraries.'slf4j-api'
compile libraries.'commons-io'
compile libraries.'sulky-io'
compile libraries.'stax-api'
testRuntime libraries.'stax'
testCompile project(':lilith-data:eventsource')
}


project(':jul:jul-xml-import').dependencies {
compile project(':lilith-data:logging')
compile project(':jul:jul-xml')
compile libraries.'sulky-stax'
compile libraries.'sulky-tasks'
compile libraries.'sulky-buffers'
compile libraries.'slf4j-api'
Expand All @@ -269,6 +282,20 @@ project(':jul:jul-xml').dependencies {
testCompile project(':lilith-data:eventsource')
}

project(':jul:jul-xml-receiver').dependencies {
compile project(':lilith-data:logging')
compile project(':jul:jul-xml')
compile project(':lilith-engine')
compile libraries.'sulky-stax'
compile libraries.'sulky-buffers'
compile libraries.'slf4j-api'
compile libraries.'commons-io'
compile libraries.'sulky-io'
compile libraries.'stax-api'
testRuntime libraries.'stax'
testCompile project(':lilith-data:eventsource')
}

project(':jul:jul-slf4j-handler').dependencies {
compile libraries.'slf4j-api'
}
Expand Down Expand Up @@ -315,6 +342,8 @@ project(':lilith').dependencies {
compile project(':logback:logging-adapter')
compile project(':log4j:log4j-xml')
compile project(':jul:jul-xml')
compile project(':jul:jul-xml-import')
compile project(':jul:jul-xml-receiver')
compile project(':lilith-prefs')
compile libraries.'servlet-api'
compile libraries.'groovy'
Expand Down
2 changes: 2 additions & 0 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ artifactMapping = [
'log4j-producer': 'de.huxhorn.lilith.log4j.producer',
'jul': 'jul', // ignore
'jul-xml': 'de.huxhorn.lilith.jul.xml',
'jul-xml-import': 'de.huxhorn.lilith.jul.xml-import',
'jul-xml-receiver': 'de.huxhorn.lilith.jul.xml.receiver',
'jul-slf4j-handler': 'de.huxhorn.lilith.jul-slf4j-handler',
'lilith-sounds': 'de.huxhorn.lilith.sounds',
'lilith-prefs': 'de.huxhorn.lilith.prefs',
Expand Down
112 changes: 112 additions & 0 deletions jul/jul-xml-import/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?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.jul.xml-import</artifactId>
<version>${parent.version}</version>
<packaging>jar</packaging>
<name>Lilith - java.util.logging - XML-Import</name>
<description>This file is part of Lilith. It contains java.util.logging XML-Import.</description>
<url>http://lilith.huxhorn.de/projects/${pom.artifactId}/</url>

<parent>
<groupId>de.huxhorn.lilith</groupId>
<artifactId>de.huxhorn.lilith.parent</artifactId>
<version><!-- LV -->0.9.40-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>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</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>de.huxhorn.lilith</groupId>
<artifactId>de.huxhorn.lilith.jul.xml</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>de.huxhorn.sulky</groupId>
<artifactId>de.huxhorn.sulky.stax</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>de.huxhorn.sulky</groupId>
<artifactId>de.huxhorn.sulky.tasks</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>de.huxhorn.sulky</groupId>
<artifactId>de.huxhorn.sulky.buffers</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>de.huxhorn.sulky</groupId>
<artifactId>de.huxhorn.sulky.io</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>stax</groupId>
<artifactId>stax</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>

Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,16 @@ public class JulImportCallable
{
private final Logger logger = LoggerFactory.getLogger(JulImportCallable.class);

public static final String CLOSING_LOG4J_EVENT_TAG = "</log4j:event>";
public static final String LOG4J_NAMESPACE = "xmlns:log4j=\"http://jakarta.apache.org/log4j/\"";
public static final String OPENING_LOG4J_EVENT_TAG_EXCL_NS = "<log4j:event ";
public static final String OPENING_LOG4J_EVENT_TAG_INCL_NS = OPENING_LOG4J_EVENT_TAG_EXCL_NS + LOG4J_NAMESPACE + " ";

private File inputFile;
private AppendOperation<EventWrapper<LoggingEvent>> buffer;
private LoggingEventReader instance;
private LoggingEventReader loggingEventReader;
private long result;

public JulImportCallable(File inputFile, AppendOperation<EventWrapper<LoggingEvent>> buffer)
{
this.buffer = buffer;
this.inputFile = inputFile;
instance = new LoggingEventReader();
loggingEventReader = new LoggingEventReader();
}

public AppendOperation<EventWrapper<LoggingEvent>> getBuffer()
Expand Down Expand Up @@ -73,7 +68,7 @@ public Long call()
{
try
{
LoggingEvent event = instance.read(reader);
LoggingEvent event = loggingEventReader.read(reader);
setCurrentStep(cis.getByteCount());
if(event == null)
{
Expand Down
26 changes: 26 additions & 0 deletions jul/jul-xml-import/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level - %d{HH:mm:ss.SSS} [%thread] - %file:%line - %msg%n%ex{full}</pattern>
</encoder>
</appender>

<!--
<appender name="Localhorst" class="ch.qos.logback.classic.net.SocketAppender">
<RemoteHost>localhost</RemoteHost>
<Port>4445</Port>
<ReconnectionDelay>1</ReconnectionDelay>
<IncludeCallerData>true</IncludeCallerData>
</appender>
-->

<root level="WARN">
<appender-ref ref="CONSOLE"/>
<!--
<appender-ref ref="Localhorst"/>
-->
</root>

</configuration>
101 changes: 101 additions & 0 deletions jul/jul-xml-receiver/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?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.jul.xml.receiver</artifactId>
<version>${parent.version}</version>
<packaging>jar</packaging>
<name>Lilith - java.util.logging - XML Receiver</name>
<description>This file is part of Lilith. It contains java.util.logging XML I/O.</description>
<url>http://lilith.huxhorn.de/projects/${pom.artifactId}/</url>

<parent>
<groupId>de.huxhorn.lilith</groupId>
<artifactId>de.huxhorn.lilith.parent</artifactId>
<version><!-- LV -->0.9.40-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>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</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>de.huxhorn.lilith</groupId>
<artifactId>de.huxhorn.lilith.jul.xml</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>de.huxhorn.lilith</groupId>
<artifactId>de.huxhorn.lilith.engine</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>de.huxhorn.sulky</groupId>
<artifactId>de.huxhorn.sulky.stax</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>de.huxhorn.sulky</groupId>
<artifactId>de.huxhorn.sulky.io</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>stax</groupId>
<artifactId>stax</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>

Loading

0 comments on commit 2c988e1

Please sign in to comment.