-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
187 changed files
with
4,014 additions
and
9,459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
<!-- | ||
~ JBoss, Home of Professional Open Source. | ||
~ | ||
~ Copyright 2014 Red Hat, Inc., and individual contributors | ||
~ as indicated by the @author tags. | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<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/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<name>JBoss Log Manager (Core)</name> | ||
<description>An implementation of java.util.logging.LogManager</description> | ||
|
||
<artifactId>jboss-logmanager</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<parent> | ||
<groupId>org.jboss.logmanager</groupId> | ||
<artifactId>jboss-logmanager-parent</artifactId> | ||
<version>3.0.0.Final-SNAPSHOT</version> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.modules</groupId> | ||
<artifactId>jboss-modules</artifactId> | ||
<scope>provided</scope> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.kohsuke.metainf-services</groupId> | ||
<artifactId>metainf-services</artifactId> | ||
<!-- Optional and provided as this is only a compile-time dependency --> | ||
<optional>true</optional> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wildfly.common</groupId> | ||
<artifactId>wildfly-common</artifactId> | ||
</dependency> | ||
|
||
<!-- test dependencies --> | ||
|
||
<!-- Used in a test formatter --> | ||
<dependency> | ||
<groupId>javax.json</groupId> | ||
<artifactId>javax.json-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<!-- JSON implementation --> | ||
<dependency> | ||
<groupId>org.glassfish</groupId> | ||
<artifactId>javax.json</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<configuration> | ||
<doclint>none</doclint> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-source-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<includes> | ||
<include>**/*Tests.java</include> | ||
</includes> | ||
<argLine>-Djava.util.logging.manager=org.jboss.logmanager.LogManager</argLine> | ||
<systemPropertyVariables> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
</systemPropertyVariables> | ||
<trimStackTrace>false</trimStackTrace> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-enforcer-plugin</artifactId> | ||
</plugin> | ||
<!-- Adding OSGI metadata to the JAR without changing the packaging type. --> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||
<manifestEntries> | ||
<Multi-Release>true</Multi-Release> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
<extensions>true</extensions> | ||
<dependencies> | ||
<dependency> | ||
<groupId>biz.aQute.bnd</groupId> | ||
<artifactId>biz.aQute.bndlib</artifactId> | ||
<version>3.5.0</version> | ||
</dependency> | ||
</dependencies> | ||
<configuration> | ||
<instructions> | ||
<_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages> | ||
<Export-Package> | ||
${project.groupId}.*;version=${project.version};-split-package:=error | ||
</Export-Package> | ||
</instructions> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>bundle-manifest</id> | ||
<phase>process-classes</phase> | ||
<goals> | ||
<goal>manifest</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>java9-tests</id> | ||
<activation> | ||
<jdk>[9,</jdk> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>test-compile-java9</id> | ||
<phase>test-compile</phase> | ||
<goals> | ||
<goal>testCompile</goal> | ||
</goals> | ||
<configuration> | ||
<release>9</release> | ||
<buildDirectory>${project.build.directory}</buildDirectory> | ||
<compileSourceRoots>${project.basedir}/src/test/java9</compileSourceRoots> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir> | ||
</systemPropertyVariables> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
46 changes: 46 additions & 0 deletions
46
core/src/main/java/org/jboss/logmanager/ConfiguratorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* | ||
* Copyright 2018 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.jboss.logmanager; | ||
|
||
/** | ||
* Used to create a {@link LogContextConfigurator}. The {@linkplain #priority() priority} is used to determine which | ||
* factory should be used. The lowest priority factory is used. If two factories have the same priority the second | ||
* factory will not be used. The order of loading the factories for determining priority is done via the | ||
* {@link java.util.ServiceLoader#load(Class, ClassLoader)}. | ||
* | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
public interface ConfiguratorFactory { | ||
|
||
/** | ||
* Creates the {@link LogContextConfigurator}. | ||
* | ||
* @return the log context configurator | ||
*/ | ||
LogContextConfigurator create(); | ||
|
||
/** | ||
* The priority for the factory which is used to determine which factory should be used to create a | ||
* {@link LogContextConfigurator}. The lowest priority factory will be used. | ||
* | ||
* @return the priority for this factory | ||
*/ | ||
int priority(); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
53 changes: 53 additions & 0 deletions
53
core/src/main/java/org/jboss/logmanager/ExtErrorManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.jboss.logmanager; | ||
|
||
import java.util.logging.ErrorManager; | ||
|
||
/** | ||
* An extended error manager, which contains additional useful utilities for error managers. | ||
*/ | ||
public abstract class ExtErrorManager extends ErrorManager { | ||
|
||
/** | ||
* Get the name corresponding to the given error code. | ||
* | ||
* @param code the error code | ||
* @return the corresponding name (not {@code null}) | ||
*/ | ||
protected String nameForCode(int code) { | ||
switch (code) { | ||
case CLOSE_FAILURE: return "CLOSE_FAILURE"; | ||
case FLUSH_FAILURE: return "FLUSH_FAILURE"; | ||
case FORMAT_FAILURE: return "FORMAT_FAILURE"; | ||
case GENERIC_FAILURE: return "GENERIC_FAILURE"; | ||
case OPEN_FAILURE: return "OPEN_FAILURE"; | ||
case WRITE_FAILURE: return "WRITE_FAILURE"; | ||
default: return "INVALID (" + code + ")"; | ||
} | ||
} | ||
|
||
public void error(final String msg, final Exception ex, final int code) { | ||
super.error(msg, ex, code); | ||
} | ||
|
||
/** | ||
* Convert the given error to a log record which can be published to handler(s) or stored. Care should | ||
* be taken not to publish the log record to a logger that writes to the same handler that produced the error. | ||
* | ||
* @param msg the error message (possibly {@code null}) | ||
* @param ex the error exception (possibly {@code null}) | ||
* @param code the error code | ||
* @return the log record (not {@code null}) | ||
*/ | ||
protected ExtLogRecord errorToLogRecord(String msg, Exception ex, int code) { | ||
final ExtLogRecord record = new ExtLogRecord(Level.ERROR, "Failed to publish log record (%s[%d]): %s", ExtLogRecord.FormatStyle.PRINTF, getClass().getName()); | ||
final String codeStr = nameForCode(code); | ||
record.setParameters(new Object[] { | ||
codeStr, | ||
Integer.valueOf(code), | ||
msg, | ||
}); | ||
record.setThrown(ex); | ||
record.setLoggerName(""); | ||
return record; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.