You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/01/08 15:48:27 UTC
[maven-doxia] 01/02: [DOXIA-534] Remove Doxia Logging API
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch DOXIA-632
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
commit 1bcf3411a08a788fa3bb9cfba8bae9a415b8ca15
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Fri Dec 31 00:06:34 2021 +0100
[DOXIA-534] Remove Doxia Logging API
This closes #80
---
doxia-core/pom.xml | 9 +-
.../java/org/apache/maven/doxia/DefaultDoxia.java | 5 -
.../apache/maven/doxia/macro/AbstractMacro.java | 28 ---
.../java/org/apache/maven/doxia/macro/Macro.java | 2 -
.../maven/doxia/macro/snippet/SnippetMacro.java | 6 +-
.../apache/maven/doxia/parser/AbstractParser.java | 30 ---
.../maven/doxia/parser/AbstractXmlParser.java | 6 +-
.../java/org/apache/maven/doxia/parser/Parser.java | 4 +-
.../maven/doxia/parser/Xhtml5BaseParser.java | 83 +------
.../apache/maven/doxia/parser/XhtmlBaseParser.java | 82 +------
.../apache/maven/doxia/sink/impl/AbstractSink.java | 26 --
.../maven/doxia/sink/impl/RandomAccessSink.java | 8 -
.../maven/doxia/sink/impl/Xhtml5BaseSink.java | 76 +-----
.../maven/doxia/sink/impl/XhtmlBaseSink.java | 75 +-----
.../org/apache/maven/doxia/util/XmlValidator.java | 33 +--
.../apache/maven/doxia/macro/EchoMacroTest.java | 12 -
.../maven/doxia/module/AbstractIdentityTest.java | 2 -
.../maven/doxia/parser/Xhtml5BaseParserTest.java | 3 -
.../maven/doxia/parser/XhtmlBaseParserTest.java | 5 +-
.../maven/doxia/sink/impl/AbstractSinkTest.java | 4 -
.../org/apache/maven/doxia/sink/impl/TextSink.java | 9 +-
.../apache/maven/doxia/util/XmlValidatorTest.java | 5 +-
doxia-logging-api/pom.xml | 42 ----
.../java/org/apache/maven/doxia/logging/Log.java | 196 ---------------
.../org/apache/maven/doxia/logging/LogEnabled.java | 40 ---
.../maven/doxia/logging/PlexusLoggerWrapper.java | 213 ----------------
.../maven/doxia/logging/SystemStreamLog.java | 271 ---------------------
doxia-logging-api/src/site/apt/index.apt | 27 --
doxia-logging-api/src/site/site.xml | 42 ----
doxia-modules/doxia-module-apt/pom.xml | 11 +-
.../apache/maven/doxia/module/apt/AptParser.java | 90 +------
.../org/apache/maven/doxia/module/apt/AptSink.java | 6 +-
doxia-modules/doxia-module-fml/pom.xml | 9 +
.../maven/doxia/module/fml/FmlContentParser.java | 14 +-
.../apache/maven/doxia/module/fml/FmlParser.java | 71 +-----
doxia-modules/doxia-module-markdown/pom.xml | 7 +
doxia-modules/doxia-module-xdoc/pom.xml | 9 +
.../apache/maven/doxia/module/xdoc/XdocParser.java | 15 +-
.../maven/doxia/module/xdoc/XmlWriterXdocSink.java | 8 -
doxia-modules/doxia-module-xhtml/pom.xml | 11 +-
.../maven/doxia/module/xhtml/XhtmlParser.java | 14 +-
doxia-modules/doxia-module-xhtml5/pom.xml | 9 +
.../maven/doxia/module/xhtml5/Xhtml5Parser.java | 14 +-
doxia-sink-api/pom.xml | 6 -
.../java/org/apache/maven/doxia/sink/Sink.java | 3 -
pom.xml | 19 +-
src/site/resources/images/doxia-deps.png | Bin 22303 -> 31011 bytes
src/site/xdoc/doxia-deps.odg | Bin 12923 -> 12670 bytes
src/site/xdoc/index.xml | 7 +-
49 files changed, 184 insertions(+), 1483 deletions(-)
diff --git a/doxia-core/pom.xml b/doxia-core/pom.xml
index d6185b4..bfe68b3 100644
--- a/doxia-core/pom.xml
+++ b/doxia-core/pom.xml
@@ -39,8 +39,8 @@ under the License.
<artifactId>doxia-sink-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-logging-api</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@@ -86,6 +86,11 @@ under the License.
<artifactId>xmlunit-matchers</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java b/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java
index dae7ec2..90fd183 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/DefaultDoxia.java
@@ -19,7 +19,6 @@ package org.apache.maven.doxia;
* under the License.
*/
-import org.apache.maven.doxia.logging.PlexusLoggerWrapper;
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.parser.Parser;
import org.apache.maven.doxia.parser.manager.ParserManager;
@@ -28,7 +27,6 @@ import org.apache.maven.doxia.sink.Sink;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.io.Reader;
@@ -41,7 +39,6 @@ import java.io.Reader;
*/
@Component( role = Doxia.class )
public class DefaultDoxia
- extends AbstractLogEnabled
implements Doxia
{
@Requirement
@@ -67,8 +64,6 @@ public class DefaultDoxia
{
Parser parser = parserManager.getParser( parserId );
- parser.enableLogging( new PlexusLoggerWrapper( getLogger() ) );
-
parser.parse( source, sink, reference );
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/AbstractMacro.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/AbstractMacro.java
index 391ef93..4374846 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/AbstractMacro.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/AbstractMacro.java
@@ -21,8 +21,6 @@ package org.apache.maven.doxia.macro;
import java.util.Map;
-import org.apache.maven.doxia.logging.Log;
-import org.apache.maven.doxia.logging.SystemStreamLog;
import org.apache.maven.doxia.sink.SinkEventAttributes;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.codehaus.plexus.util.StringUtils;
@@ -36,32 +34,6 @@ import org.codehaus.plexus.util.StringUtils;
public abstract class AbstractMacro
implements Macro
{
- /** Log instance. */
- private Log logger;
-
- /** {@inheritDoc} */
- public void enableLogging( Log log )
- {
- this.logger = log;
- }
-
- /**
- * Returns a logger for this macro.
- * If no logger has been configured, a new SystemStreamLog is returned.
- *
- * @return Log
- * @since 1.1
- */
- protected Log getLog()
- {
- if ( logger == null )
- {
- logger = new SystemStreamLog();
- }
-
- return logger;
- }
-
/**
* Check if the given parameter is required. Throws an
* IllegalArgumentException if paramValue is null or empty.
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/Macro.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/Macro.java
index be52dad..f737468 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/Macro.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/Macro.java
@@ -19,7 +19,6 @@ package org.apache.maven.doxia.macro;
* under the License.
*/
-import org.apache.maven.doxia.logging.LogEnabled;
import org.apache.maven.doxia.sink.Sink;
/**
@@ -29,7 +28,6 @@ import org.apache.maven.doxia.sink.Sink;
* @since 1.0
*/
public interface Macro
- extends LogEnabled
{
/** The Plexus lookup role. */
String ROLE = Macro.class.getName();
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java
index cbff994..b3007a2 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/snippet/SnippetMacro.java
@@ -27,6 +27,8 @@ import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
@@ -42,6 +44,8 @@ import java.util.Map;
public class SnippetMacro
extends AbstractMacro
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( SnippetMacro.class );
+
/**
* Holds the cache.
*/
@@ -205,7 +209,7 @@ public class SnippetMacro
{
if ( ignoreDownloadError )
{
- getLog().debug( "IOException which reading " + url + ": " + e );
+ LOGGER.debug( "Exception while reading '{}'", url, e );
result =
new StringBuffer( "Error during retrieving content skip as ignoreDownloadError activated." );
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
index 8520e43..ee032e7 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractParser.java
@@ -27,8 +27,6 @@ import java.io.StringReader;
import java.util.Properties;
-import org.apache.maven.doxia.logging.Log;
-import org.apache.maven.doxia.logging.SystemStreamLog;
import org.apache.maven.doxia.macro.Macro;
import org.apache.maven.doxia.macro.MacroExecutionException;
import org.apache.maven.doxia.macro.MacroRequest;
@@ -53,9 +51,6 @@ public abstract class AbstractParser
@Requirement
private MacroManager macroManager;
- /** Log instance. */
- private Log logger;
-
/**
* Emit Doxia comment events when parsing comments?
*/
@@ -140,8 +135,6 @@ public abstract class AbstractParser
{
Macro macro = getMacroManager().getMacro( macroId );
- macro.enableLogging( getLog() );
-
macro.execute( sink, request );
}
@@ -228,29 +221,6 @@ public abstract class AbstractParser
return secondParsing;
}
- /** {@inheritDoc} */
- public void enableLogging( Log log )
- {
- this.logger = log;
- }
-
- /**
- * Returns the current logger for this parser.
- * If no logger has been configured yet, a new SystemStreamLog is returned.
- *
- * @return Log
- * @since 1.1
- */
- protected Log getLog()
- {
- if ( logger == null )
- {
- logger = new SystemStreamLog();
- }
-
- return logger;
- }
-
/**
* Gets the current {@link MacroManager}.
*
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
index c0b1ddb..7a1b581 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
@@ -120,7 +120,7 @@ public abstract class AbstractXmlParser
throw new ParseException( "Error reading the model: " + e.getMessage(), e );
}
- new XmlValidator( getLog() ).validate( content );
+ new XmlValidator( ).validate( content );
src = new StringReader( content );
}
@@ -131,13 +131,11 @@ public abstract class AbstractXmlParser
XmlPullParser parser = new MXParser();
parser.setInput( src );
-
+
// allow parser initialization, e.g. for additional entities in XHTML
// Note: do it after input is set, otherwise values are reset
initXmlParser( parser );
- sink.enableLogging( getLog() );
-
parseXml( parser, sink );
}
catch ( XmlPullParserException ex )
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Parser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Parser.java
index 6a2934b..0e1cd39 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Parser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Parser.java
@@ -19,7 +19,6 @@ package org.apache.maven.doxia.parser;
* under the License.
*/
-import org.apache.maven.doxia.logging.LogEnabled;
import org.apache.maven.doxia.sink.Sink;
import java.io.Reader;
@@ -33,7 +32,6 @@ import java.io.Reader;
* @since 1.0
*/
public interface Parser
- extends LogEnabled
{
/** The Plexus lookup role. */
String ROLE = Parser.class.getName();
@@ -57,7 +55,7 @@ public interface Parser
*/
void parse( Reader source, Sink sink )
throws ParseException;
-
+
/**
* Parses the given source model and emits Doxia events into the given sink.
*
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java
index dd10f58..cc8f579 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/Xhtml5BaseParser.java
@@ -20,11 +20,7 @@ package org.apache.maven.doxia.parser;
*/
import java.io.Reader;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
import java.util.Stack;
-import java.util.TreeSet;
import javax.swing.text.html.HTML.Attribute;
@@ -34,9 +30,12 @@ import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.SinkEventAttributes;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.apache.maven.doxia.util.DoxiaUtils;
+
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Common base parser for xhtml5 events.
@@ -45,6 +44,8 @@ public class Xhtml5BaseParser
extends AbstractXmlParser
implements HtmlMarkup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( Xhtml5BaseParser.class );
+
/**
* True if a <script></script> or <style></style> block is read. CDATA sections within are
* handled as rawText.
@@ -75,10 +76,6 @@ public class Xhtml5BaseParser
/** Used to wrap the definedTerm with its definition, even when one is omitted */
boolean hasDefinitionListItem = false;
- /** Map of warn messages with a String as key to describe the error type and a Set as value.
- * Using to reduce warn messages. */
- private Map<String, Set<String>> warnMessages;
-
/** {@inheritDoc} */
@Override
public void parse( Reader source, Sink sink, String reference )
@@ -92,8 +89,6 @@ public class Xhtml5BaseParser
}
finally
{
- logWarnings();
-
setSecondParsing( false );
init();
}
@@ -730,14 +725,8 @@ public class Xhtml5BaseParser
{
if ( !baseStartTag( parser, sink ) )
{
- if ( getLog().isWarnEnabled() )
- {
- String position = "[" + parser.getLineNumber() + ":"
- + parser.getColumnNumber() + "]";
- String tag = "<" + parser.getName() + ">";
-
- getLog().warn( "Unrecognized xml tag: " + tag + " at " + position );
- }
+ LOGGER.warn( "Unrecognized xml tag <{}> at [{}:{}]", parser.getName(),
+ parser.getLineNumber(), parser.getColumnNumber() );
}
}
@@ -996,8 +985,7 @@ public class Xhtml5BaseParser
{
String linkAnchor = DoxiaUtils.encodeId( id, true );
- String msg = "Modified invalid link: '" + id + "' to '" + linkAnchor + "'";
- logMessage( "modifiedLink", msg );
+ LOGGER.debug( "Modified invalid link '{}' to '{}'", id, linkAnchor );
return linkAnchor;
}
@@ -1017,7 +1005,6 @@ public class Xhtml5BaseParser
this.orderedListDepth = 0;
this.headingLevel = 0;
this.inVerbatim = false;
- this.warnMessages = null;
}
private void handleAEnd( Sink sink )
@@ -1049,8 +1036,7 @@ public class Xhtml5BaseParser
{
href = href.substring( 0, hashIndex ) + "#" + DoxiaUtils.encodeId( hash, true );
- String msg = "Modified invalid link: '" + hash + "' to '" + href + "'";
- logMessage( "modifiedLink", msg );
+ LOGGER.debug( "Modified invalid link '{}' to '{}'", hash, href );
}
}
sink.link( href, attribs );
@@ -1254,55 +1240,4 @@ public class Xhtml5BaseParser
sink.tableRows( justif, grid );
}
-
- /**
- * If debug mode is enabled, log the <code>msg</code> as is, otherwise add unique msg in <code>warnMessages</code>.
- *
- * @param key not null
- * @param msg not null
- * @see #parse(Reader, Sink)
- * @since 1.1.1
- */
- private void logMessage( String key, String msg )
- {
- final String log = "[XHTML Parser] " + msg;
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( log );
-
- return;
- }
-
- if ( warnMessages == null )
- {
- warnMessages = new HashMap<>();
- }
-
- Set<String> set = warnMessages.get( key );
- if ( set == null )
- {
- set = new TreeSet<>();
- }
- set.add( log );
- warnMessages.put( key, set );
- }
-
- /**
- * @since 1.1.1
- */
- private void logWarnings()
- {
- if ( getLog().isWarnEnabled() && this.warnMessages != null && !isSecondParsing() )
- {
- for ( Map.Entry<String, Set<String>> entry : this.warnMessages.entrySet() )
- {
- for ( String msg : entry.getValue() )
- {
- getLog().warn( msg );
- }
- }
-
- this.warnMessages = null;
- }
- }
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
index 411b045..1aa9bc2 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/XhtmlBaseParser.java
@@ -20,10 +20,6 @@ package org.apache.maven.doxia.parser;
*/
import java.io.Reader;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
import javax.swing.text.html.HTML.Attribute;
@@ -37,6 +33,8 @@ import org.apache.maven.doxia.util.DoxiaUtils;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Common base parser for xhtml events.
@@ -49,6 +47,8 @@ public class XhtmlBaseParser
extends AbstractXmlParser
implements HtmlMarkup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( XhtmlBaseParser.class );
+
/**
* True if a <script></script> or <style></style> block is read. CDATA sections within are
* handled as rawText.
@@ -76,10 +76,6 @@ public class XhtmlBaseParser
/** Used to wrap the definedTerm with its definition, even when one is omitted */
boolean hasDefinitionListItem = false;
- /** Map of warn messages with a String as key to describe the error type and a Set as value.
- * Using to reduce warn messages. */
- private Map<String, Set<String>> warnMessages;
-
/** {@inheritDoc} */
@Override
public void parse( Reader source, Sink sink, String reference )
@@ -93,8 +89,6 @@ public class XhtmlBaseParser
}
finally
{
- logWarnings();
-
setSecondParsing( false );
init();
}
@@ -740,14 +734,8 @@ public class XhtmlBaseParser
{
if ( !baseStartTag( parser, sink ) )
{
- if ( getLog().isWarnEnabled() )
- {
- String position = "[" + parser.getLineNumber() + ":"
- + parser.getColumnNumber() + "]";
- String tag = "<" + parser.getName() + ">";
-
- getLog().warn( "Unrecognized xml tag: " + tag + " at " + position );
- }
+ LOGGER.warn( "Unrecognized xml tag <{}> at [{}:{}]", parser.getName(),
+ parser.getLineNumber(), parser.getColumnNumber() );
}
}
@@ -1002,8 +990,7 @@ public class XhtmlBaseParser
{
String linkAnchor = DoxiaUtils.encodeId( id, true );
- String msg = "Modified invalid link: '" + id + "' to '" + linkAnchor + "'";
- logMessage( "modifiedLink", msg );
+ LOGGER.debug( "Modified invalid link '{}' to '{}'", id, linkAnchor );
return linkAnchor;
}
@@ -1024,7 +1011,6 @@ public class XhtmlBaseParser
this.sectionLevel = 0;
this.inVerbatim = false;
this.inFigure = false;
- this.warnMessages = null;
}
private void handleAEnd( Sink sink )
@@ -1056,8 +1042,7 @@ public class XhtmlBaseParser
{
href = href.substring( 0, hashIndex ) + "#" + DoxiaUtils.encodeId( hash, true );
- String msg = "Modified invalid link: '" + hash + "' to '" + href + "'";
- logMessage( "modifiedLink", msg );
+ LOGGER.debug( "Modified invalid link '{}' to '{}'", hash, href );
}
}
sink.link( href, attribs );
@@ -1253,55 +1238,4 @@ public class XhtmlBaseParser
sink.tableRows( justif, grid );
}
-
- /**
- * If debug mode is enabled, log the <code>msg</code> as is, otherwise add unique msg in <code>warnMessages</code>.
- *
- * @param key not null
- * @param msg not null
- * @see #parse(Reader, Sink)
- * @since 1.1.1
- */
- private void logMessage( String key, String msg )
- {
- final String log = "[XHTML Parser] " + msg;
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( log );
-
- return;
- }
-
- if ( warnMessages == null )
- {
- warnMessages = new HashMap<>();
- }
-
- Set<String> set = warnMessages.get( key );
- if ( set == null )
- {
- set = new TreeSet<>();
- }
- set.add( log );
- warnMessages.put( key, set );
- }
-
- /**
- * @since 1.1.1
- */
- private void logWarnings()
- {
- if ( getLog().isWarnEnabled() && this.warnMessages != null && !isSecondParsing() )
- {
- for ( Map.Entry<String, Set<String>> entry : this.warnMessages.entrySet() )
- {
- for ( String msg : entry.getValue() )
- {
- getLog().warn( msg );
- }
- }
-
- this.warnMessages = null;
- }
- }
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java
index 4b0c137..e5495cf 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/AbstractSink.java
@@ -19,8 +19,6 @@ package org.apache.maven.doxia.sink.impl;
* under the License.
*/
-import org.apache.maven.doxia.logging.Log;
-import org.apache.maven.doxia.logging.SystemStreamLog;
import org.apache.maven.doxia.markup.Markup;
import org.apache.maven.doxia.sink.Sink;
@@ -34,31 +32,7 @@ import org.apache.maven.doxia.sink.Sink;
public abstract class AbstractSink
implements Sink, Markup
{
- private Log logger;
-
- /** {@inheritDoc} */
- public void enableLogging( Log log )
- {
- this.logger = log;
- }
-
/**
- * Returns a logger for this sink.
- * If no logger has been configured, a new SystemStreamLog is returned.
- *
- * @return Log
- */
- protected Log getLog()
- {
- if ( logger == null )
- {
- logger = new SystemStreamLog();
- }
-
- return logger;
- }
-
- /**
* Parses the given String and replaces all occurrences of
* '\n', '\r' and '\r\n' with the system EOL. All Sinks should
* make sure that text output is filtered through this method.
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/RandomAccessSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/RandomAccessSink.java
index a74bf1e..85665b2 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/RandomAccessSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/RandomAccessSink.java
@@ -27,7 +27,6 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
-import org.apache.maven.doxia.logging.Log;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.SinkEventAttributes;
import org.apache.maven.doxia.sink.SinkFactory;
@@ -1343,11 +1342,4 @@ public class RandomAccessSink
{
currentSink.verbatim_();
}
-
- /** {@inheritDoc} */
- @Override
- public void enableLogging( Log log )
- {
- currentSink.enableLogging( log );
- }
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
index 45d726f..dbf2884 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSink.java
@@ -29,9 +29,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.Stack;
-import java.util.TreeSet;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.html.HTML.Attribute;
@@ -46,6 +44,8 @@ import org.apache.maven.doxia.util.HtmlTools;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Abstract base xhtml5 sink implementation.
@@ -54,6 +54,8 @@ public class Xhtml5BaseSink
extends AbstractXmlSink
implements HtmlMarkup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( Xhtml5BaseSink.class );
+
// ----------------------------------------------------------------------
// Instance fields
// ----------------------------------------------------------------------
@@ -119,10 +121,6 @@ public class Xhtml5BaseSink
* */
protected boolean tableRows = false;
- /** Map of warn messages with a String as key to describe the error type and a Set as value.
- * Using to reduce warn messages. */
- private Map<String, Set<String>> warnMessages;
-
// ----------------------------------------------------------------------
// Constructor
// ----------------------------------------------------------------------
@@ -276,7 +274,6 @@ public class Xhtml5BaseSink
this.evenTableRow = true;
this.tableAttributes = null;
this.tableRows = false;
- this.warnMessages = null;
}
/**
@@ -1455,10 +1452,7 @@ public class Xhtml5BaseSink
if ( this.tableContentWriterStack.isEmpty() )
{
- if ( getLog().isWarnEnabled() )
- {
- getLog().warn( "No table content." );
- }
+ LOGGER.warn( "No table content" );
return;
}
@@ -1809,8 +1803,7 @@ public class Xhtml5BaseSink
{
id = DoxiaUtils.encodeId( name, true );
- String msg = "Modified invalid anchor name: '" + name + "' to '" + id + "'";
- logMessage( "modifiedLink", msg );
+ LOGGER.debug( "Modified invalid anchor name '{}' to '{}'", name, id );
}
MutableAttributeSet att = new SinkEventAttributeSet();
@@ -2184,8 +2177,7 @@ public class Xhtml5BaseSink
if ( !originalComment.equals( comment ) )
{
- getLog().warn( "[Xhtml5 Sink] Modified invalid comment '" + originalComment
- + "' to '" + comment + "'" );
+ LOGGER.warn( "Modified invalid comment '{}' to '{}'", originalComment, comment );
}
final StringBuilder buffer = new StringBuilder( comment.length() + 7 );
@@ -2244,8 +2236,7 @@ public class Xhtml5BaseSink
{
if ( requiredParams == null || !( requiredParams[0] instanceof Integer ) )
{
- String msg = "No type information for unknown event: '" + name + "', ignoring!";
- logMessage( "noTypeInfo", msg );
+ LOGGER.warn( "No type information for unknown event '{}', ignoring!", name );
return;
}
@@ -2270,8 +2261,7 @@ public class Xhtml5BaseSink
if ( tag == null )
{
- String msg = "No HTML tag found for unknown event: '" + name + "', ignoring!";
- logMessage( "noHtmlTag", msg );
+ LOGGER.warn( "No HTML tag found for unknown event '{}', ignoring!", name );
}
else
{
@@ -2289,8 +2279,7 @@ public class Xhtml5BaseSink
}
else
{
- String msg = "No type information for unknown event: '" + name + "', ignoring!";
- logMessage( "noTypeInfo", msg );
+ LOGGER.warn( "No type information for unknown event '{}', ignoring!", name );
}
}
}
@@ -2324,19 +2313,6 @@ public class Xhtml5BaseSink
{
writer.close();
- if ( getLog().isWarnEnabled() && this.warnMessages != null )
- {
- for ( Map.Entry<String, Set<String>> entry : this.warnMessages.entrySet() )
- {
- for ( String msg : entry.getValue() )
- {
- getLog().warn( msg );
- }
- }
-
- this.warnMessages = null;
- }
-
init();
}
@@ -2453,36 +2429,4 @@ public class Xhtml5BaseSink
this.tableCaptionXMLWriterStack.getLast().endElement();
}
}
-
- /**
- * If debug mode is enabled, log the <code>msg</code> as is, otherwise add unique msg in <code>warnMessages</code>.
- *
- * @param key not null
- * @param msg not null
- * @see #close()
- * @since 1.1.1
- */
- private void logMessage( String key, String msg )
- {
- final String mesg = "[XHTML5 Sink] " + msg;
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( mesg );
-
- return;
- }
-
- if ( warnMessages == null )
- {
- warnMessages = new HashMap<>();
- }
-
- Set<String> set = warnMessages.get( key );
- if ( set == null )
- {
- set = new TreeSet<>();
- }
- set.add( mesg );
- warnMessages.put( key, set );
- }
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
index 10d08ec..490b9cd 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSink.java
@@ -28,9 +28,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.Stack;
-import java.util.TreeSet;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.html.HTML.Attribute;
@@ -45,6 +43,8 @@ import org.apache.maven.doxia.util.HtmlTools;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Abstract base xhtml sink implementation.
@@ -57,6 +57,8 @@ public class XhtmlBaseSink
extends AbstractXmlSink
implements HtmlMarkup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( XhtmlBaseSink.class );
+
// ----------------------------------------------------------------------
// Instance fields
// ----------------------------------------------------------------------
@@ -131,10 +133,6 @@ public class XhtmlBaseSink
/** Keep track of the closing tags for inline events. */
protected Stack<List<Tag>> inlineStack = new Stack<>();
- /** Map of warn messages with a String as key to describe the error type and a Set as value.
- * Using to reduce warn messages. */
- private Map<String, Set<String>> warnMessages;
-
// ----------------------------------------------------------------------
// Constructor
// ----------------------------------------------------------------------
@@ -291,7 +289,6 @@ public class XhtmlBaseSink
this.legacyFigureCaption = false;
this.inFigure = false;
this.tableRows = false;
- this.warnMessages = null;
}
/**
@@ -1332,10 +1329,7 @@ public class XhtmlBaseSink
if ( this.tableContentWriterStack.isEmpty() )
{
- if ( getLog().isWarnEnabled() )
- {
- getLog().warn( "No table content." );
- }
+ LOGGER.warn( "No table content" );
return;
}
@@ -1686,8 +1680,7 @@ public class XhtmlBaseSink
{
id = DoxiaUtils.encodeId( name, true );
- String msg = "Modified invalid anchor name: '" + name + "' to '" + id + "'";
- logMessage( "modifiedLink", msg );
+ LOGGER.debug( "Modified invalid anchor name '{}' to '{}'", name, id );
}
MutableAttributeSet att = new SinkEventAttributeSet();
@@ -2035,7 +2028,7 @@ public class XhtmlBaseSink
if ( !originalComment.equals( comment ) )
{
- getLog().warn( "[Xhtml Sink] Modified invalid comment '" + originalComment + "' to '" + comment + "'" );
+ LOGGER.warn( "Modified invalid comment '{}' to '{}'", originalComment, comment );
}
final StringBuilder buffer = new StringBuilder( comment.length() + 7 );
@@ -2094,8 +2087,7 @@ public class XhtmlBaseSink
{
if ( requiredParams == null || !( requiredParams[0] instanceof Integer ) )
{
- String msg = "No type information for unknown event: '" + name + "', ignoring!";
- logMessage( "noTypeInfo", msg );
+ LOGGER.warn( "No type information for unknown event '{}', ignoring!", name );
return;
}
@@ -2120,8 +2112,7 @@ public class XhtmlBaseSink
if ( tag == null )
{
- String msg = "No HTML tag found for unknown event: '" + name + "', ignoring!";
- logMessage( "noHtmlTag", msg );
+ LOGGER.warn( "No HTML tag found for unknown event '{}', ignoring!", name );
}
else
{
@@ -2139,8 +2130,7 @@ public class XhtmlBaseSink
}
else
{
- String msg = "No type information for unknown event: '" + name + "', ignoring!";
- logMessage( "noTypeInfo", msg );
+ LOGGER.warn( "No type information for unknown event '{}', ignoring!", name );
}
}
}
@@ -2174,19 +2164,6 @@ public class XhtmlBaseSink
{
writer.close();
- if ( getLog().isWarnEnabled() && this.warnMessages != null )
- {
- for ( Map.Entry<String, Set<String>> entry : this.warnMessages.entrySet() )
- {
- for ( String msg : entry.getValue() )
- {
- getLog().warn( msg );
- }
- }
-
- this.warnMessages = null;
- }
-
init();
}
@@ -2303,36 +2280,4 @@ public class XhtmlBaseSink
this.tableCaptionXMLWriterStack.getLast().endElement();
}
}
-
- /**
- * If debug mode is enabled, log the <code>msg</code> as is, otherwise add unique msg in <code>warnMessages</code>.
- *
- * @param key not null
- * @param msg not null
- * @see #close()
- * @since 1.1.1
- */
- private void logMessage( String key, String msg )
- {
- final String mesg = "[XHTML Sink] " + msg;
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( mesg );
-
- return;
- }
-
- if ( warnMessages == null )
- {
- warnMessages = new HashMap<>();
- }
-
- Set<String> set = warnMessages.get( key );
- if ( set == null )
- {
- set = new TreeSet<>();
- }
- set.add( mesg );
- warnMessages.put( key, set );
- }
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/util/XmlValidator.java b/doxia-core/src/main/java/org/apache/maven/doxia/util/XmlValidator.java
index b2c3986..f57264f 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/util/XmlValidator.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/util/XmlValidator.java
@@ -27,11 +27,11 @@ import java.util.regex.Pattern;
import javax.xml.XMLConstants;
-import org.apache.maven.doxia.logging.Log;
import org.apache.maven.doxia.markup.XmlMarkup;
import org.apache.maven.doxia.parser.AbstractXmlParser.CachedFileEntityResolver;
import org.apache.maven.doxia.parser.ParseException;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -46,6 +46,8 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/
public class XmlValidator
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( XmlValidator.class );
+
/**
* Doctype pattern i.e. ".*<!DOCTYPE([^>]*)>.*"
* see <a href="http://www.w3.org/TR/REC-xml/#NT-doctypedecl">http://www.w3.org/TR/REC-xml/#NT-doctypedecl</a>.
@@ -58,18 +60,6 @@ public class XmlValidator
/** lazy xmlReader to validate xml content*/
private XMLReader xmlReader;
- private Log logger;
-
- /**
- * Constructor.
- *
- * @param log a logger, not null.
- */
- public XmlValidator( Log log )
- {
- this.logger = log;
- }
-
/**
* Validate an XML content with SAX.
*
@@ -103,7 +93,6 @@ public class XmlValidator
}
// 3 validate content
- getLog().debug( "Validating the content..." );
getXmlReader( hasXsd && hasDoctype ).parse( new InputSource( new StringReader( content ) ) );
}
catch ( IOException | SAXException e )
@@ -122,7 +111,7 @@ public class XmlValidator
{
if ( xmlReader == null )
{
- MessagesErrorHandler errorHandler = new MessagesErrorHandler( getLog() );
+ MessagesErrorHandler errorHandler = new MessagesErrorHandler( );
xmlReader = XMLReaderFactory.createXMLReader();
xmlReader.setFeature( "http://xml.org/sax/features/validation", true );
@@ -136,11 +125,6 @@ public class XmlValidator
return xmlReader;
}
- private Log getLog()
- {
- return logger;
- }
-
/**
* Convenience class to beautify <code>SAXParseException</code> messages.
*/
@@ -161,13 +145,10 @@ public class XmlValidator
private static final Pattern ELEMENT_TYPE_PATTERN =
Pattern.compile( "Element type \".*\" must be declared.", Pattern.DOTALL );
- private final Log log;
-
private boolean hasDtdAndXsd;
- private MessagesErrorHandler( Log log )
+ private MessagesErrorHandler( )
{
- this.log = log;
}
/**
@@ -252,7 +233,7 @@ public class XmlValidator
switch ( type )
{
case TYPE_WARNING:
- log.warn( logMessage );
+ LOGGER.warn( logMessage );
break;
case TYPE_UNKNOWN:
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/macro/EchoMacroTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/macro/EchoMacroTest.java
index 12b2594..2082704 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/macro/EchoMacroTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/macro/EchoMacroTest.java
@@ -68,16 +68,4 @@ public class EchoMacroTest
assertEquals( "verbatim_", event.getName() );
assertFalse( it.hasNext() );
}
-
- /**
- * Test log.
- */
- @Test
- public void testLog()
- {
- EchoMacro macro = new EchoMacro();
- macro.enableLogging( null );
- assertNotNull( macro.getLog() );
- assertNotNull( macro.getLog() );
- }
}
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/module/AbstractIdentityTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/module/AbstractIdentityTest.java
index 9b4d868..a3713d6 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/module/AbstractIdentityTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/module/AbstractIdentityTest.java
@@ -26,7 +26,6 @@ import java.io.Writer;
import org.apache.maven.doxia.AbstractModuleTest;
-import org.apache.maven.doxia.logging.PlexusLoggerWrapper;
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.parser.Parser;
@@ -105,7 +104,6 @@ public abstract class AbstractIdentityTest
writer = new StringWriter();
sink = new TextSink( writer );
Parser parser = createParser();
- parser.enableLogging( new PlexusLoggerWrapper( ( ( DefaultPlexusContainer )getContainer() ).getLogger() ) );
parser.parse( reader, sink );
String actual = writer.toString();
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java
index 3d58d7a..950c627 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/parser/Xhtml5BaseParserTest.java
@@ -21,7 +21,6 @@ package org.apache.maven.doxia.parser;
import java.util.Iterator;
-import org.apache.maven.doxia.logging.Log;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.apache.maven.doxia.sink.impl.SinkEventElement;
import org.apache.maven.doxia.sink.impl.SinkEventTestingSink;
@@ -42,7 +41,6 @@ public class Xhtml5BaseParserTest
protected Parser createParser()
{
parser = new Xhtml5BaseParser();
- parser.getLog().setLogLevel( Log.LEVEL_ERROR );
return parser;
}
@@ -58,7 +56,6 @@ public class Xhtml5BaseParserTest
super.setUp();
parser = new Xhtml5BaseParser();
- parser.getLog().setLogLevel( Log.LEVEL_ERROR );
sink.reset();
}
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
index 58342db..1175974 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/parser/XhtmlBaseParserTest.java
@@ -21,7 +21,6 @@ package org.apache.maven.doxia.parser;
import java.util.Iterator;
-import org.apache.maven.doxia.logging.Log;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.apache.maven.doxia.sink.impl.SinkEventElement;
import org.apache.maven.doxia.sink.impl.SinkEventTestingSink;
@@ -45,7 +44,6 @@ public class XhtmlBaseParserTest
protected Parser createParser()
{
parser = new XhtmlBaseParser();
- parser.getLog().setLogLevel( Log.LEVEL_ERROR );
return parser;
}
@@ -61,7 +59,6 @@ public class XhtmlBaseParserTest
super.setUp();
parser = new XhtmlBaseParser();
- parser.getLog().setLogLevel( Log.LEVEL_ERROR );
sink.reset();
}
@@ -736,7 +733,7 @@ public class XhtmlBaseParserTest
// ampersand should be un-escaped
assertEquals( "http://ex.com/ex.jpg?v=l&l=e", attribs.getAttribute( "src" ) );
}
-
+
public void testUnbalancedDefinitionListItem() throws Exception
{
String text = "<body><dl><dt>key</dt><dd>value</dd></dl>" +
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java
index 4247059..ff6d4dc 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java
@@ -24,10 +24,8 @@ import java.io.IOException;
import java.io.Writer;
import org.apache.maven.doxia.AbstractModuleTest;
-import org.apache.maven.doxia.logging.PlexusLoggerWrapper;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.SinkEventAttributes;
-import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.util.IOUtil;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -57,7 +55,6 @@ public abstract class AbstractSinkTest
testWriter.reset();
sink = createSink( testWriter );
- sink.enableLogging( new PlexusLoggerWrapper( ( ( DefaultPlexusContainer )getContainer() ).getLogger() ) );
}
/**
@@ -1085,7 +1082,6 @@ public abstract class AbstractSinkTest
testWriter.reset();
sink = createSink( testWriter );
- sink.enableLogging( new PlexusLoggerWrapper( ( ( DefaultPlexusContainer )getContainer() ).getLogger() ) );
comment = "-";
sink.comment( comment );
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/TextSink.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/TextSink.java
index 7ec5b61..620bdca 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/TextSink.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/TextSink.java
@@ -25,6 +25,8 @@ import java.io.Writer;
import org.apache.maven.doxia.sink.SinkEventAttributes;
import org.apache.maven.doxia.sink.impl.AbstractSink;
import org.apache.maven.doxia.sink.impl.SinkUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A simple text-based implementation of the <code>Sink</code> interface.
@@ -33,6 +35,7 @@ import org.apache.maven.doxia.sink.impl.SinkUtils;
public class TextSink
extends AbstractSink
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( TextSink.class );
/** For writing the result. */
private final Writer out;
@@ -757,7 +760,7 @@ public class TextSink
}
catch ( IOException e )
{
- getLog().warn( "Could not flush sink: " + e.getMessage(), e );
+ LOGGER.warn( "Could not flush sink", e );
}
}
@@ -770,7 +773,7 @@ public class TextSink
}
catch ( IOException e )
{
- getLog().warn( "Could not close sink: " + e.getMessage(), e );
+ LOGGER.warn( "Could not close sink", e );
}
}
@@ -1071,7 +1074,7 @@ public class TextSink
}
catch ( IOException e )
{
- getLog().warn( "Could not write to sink: " + e.getMessage(), e );
+ LOGGER.warn( "Could not write to sink", e );
}
}
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java
index 40a93d6..4c1f700 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java
@@ -19,8 +19,6 @@ package org.apache.maven.doxia.util;
* under the License.
*/
-import org.apache.maven.doxia.logging.Log;
-import org.apache.maven.doxia.logging.SystemStreamLog;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.xml.XmlStreamReader;
@@ -38,8 +36,7 @@ extends PlexusTestCase
{
String xml = IOUtil.toString( new XmlStreamReader( this.getClass().getResourceAsStream( "/test.xhtml" ) ) );
- Log log = new SystemStreamLog();
- XmlValidator validator = new XmlValidator( log );
+ XmlValidator validator = new XmlValidator( );
validator.validate( xml );
}
diff --git a/doxia-logging-api/pom.xml b/doxia-logging-api/pom.xml
deleted file mode 100644
index f680672..0000000
--- a/doxia-logging-api/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>doxia</artifactId>
- <groupId>org.apache.maven.doxia</groupId>
- <version>2.0.0-M1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>doxia-logging-api</artifactId>
- <name>Doxia :: Logging API</name>
- <description>Doxia Logging API.</description>
-
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/Log.java b/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/Log.java
deleted file mode 100644
index 8b5ad28..0000000
--- a/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/Log.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.apache.maven.doxia.logging;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-/**
- * This interface supplies the API for providing feedback to the user from
- * a Parser or Sink, using standard <code>Doxia</code> channels.
- * <br>
- * There should be no big surprises here, although you may notice that the methods accept
- * <code>java.lang.CharSequence</code> rather than <code>java.lang.String</code>. This is provided mainly as a
- * convenience, to enable developers to pass things like <code>java.lang.StringBuilder</code> directly into the logger,
- * rather than formatting first by calling <code>toString()</code>.
- * <br>
- * Based on <code>org.apache.maven.plugin.logging.Log</code>.
- *
- * @author jdcasey
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public interface Log
-{
- /** Typecode for debugging messages. */
- int LEVEL_DEBUG = 0;
-
- /** Typecode for informational messages. */
- int LEVEL_INFO = 1;
-
- /** Typecode for warning messages. */
- int LEVEL_WARN = 2;
-
- /** Typecode for error messages. */
- int LEVEL_ERROR = 3;
-
- /** Typecode for fatal error messages. */
- int LEVEL_FATAL = 4;
-
- /** Typecode for disabled log levels. */
- int LEVEL_DISABLED = 5;
-
- /**
- * Set the current log level.
- *
- * @param level the log level to set.
- */
- void setLogLevel( int level );
-
- /**
- * <p>isDebugEnabled.</p>
- *
- * @return true if the <b>debug</b> error level is enabled.
- */
- boolean isDebugEnabled();
-
- /**
- * Send a message to the user in the <b>debug</b> error level.
- *
- * @param content the message to log.
- */
- void debug( CharSequence content );
-
- /**
- * Send a message (and accompanying exception) to the user in the <b>debug</b> error level.
- * <br>
- * The error's stacktrace will be output when this error level is enabled.
- *
- * @param content the message to log.
- * @param error the error to log.
- */
- void debug( CharSequence content, Throwable error );
-
- /**
- * Send an exception to the user in the <b>debug</b> error level.
- * <br>
- * The stack trace for this exception will be output when this error level is enabled.
- *
- * @param error the error to log.
- */
- void debug( Throwable error );
-
- /**
- * <p>isInfoEnabled.</p>
- *
- * @return true if the <b>info</b> error level is enabled.
- */
- boolean isInfoEnabled();
-
- /**
- * Send a message to the user in the <b>info</b> error level.
- *
- * @param content the message to log.
- */
- void info( CharSequence content );
-
- /**
- * Send a message (and accompanying exception) to the user in the <b>info</b> error level.
- * <br>
- * The error's stacktrace will be output when this error level is enabled.
- *
- * @param content the message to log.
- * @param error the error to log.
- */
- void info( CharSequence content, Throwable error );
-
- /**
- * Send an exception to the user in the <b>info</b> error level.
- * <br>
- * The stack trace for this exception will be output when this error level is enabled.
- *
- * @param error the error to log.
- */
- void info( Throwable error );
-
- /**
- * <p>isWarnEnabled.</p>
- *
- * @return true if the <b>warn</b> error level is enabled.
- */
- boolean isWarnEnabled();
-
- /**
- * Send a message to the user in the <b>warn</b> error level.
- *
- * @param content the message to log.
- */
- void warn( CharSequence content );
-
- /**
- * Send a message (and accompanying exception) to the user in the <b>warn</b> error level.
- * <br>
- * The error's stacktrace will be output when this error level is enabled.
- *
- * @param content the message to log.
- * @param error the error to log.
- */
- void warn( CharSequence content, Throwable error );
-
- /**
- * Send an exception to the user in the <b>warn</b> error level.
- * <br>
- * The stack trace for this exception will be output when this error level is enabled.
- *
- * @param error the error to log.
- */
- void warn( Throwable error );
-
- /**
- * <p>isErrorEnabled.</p>
- *
- * @return true if the <b>error</b> error level is enabled.
- */
- boolean isErrorEnabled();
-
- /**
- * Send a message to the user in the <b>error</b> error level.
- *
- * @param content the message to log.
- */
- void error( CharSequence content );
-
- /**
- * Send a message (and accompanying exception) to the user in the <b>error</b> error level.
- * <br>
- * The error's stacktrace will be output when this error level is enabled.
- *
- * @param content the message to log.
- * @param error the error to log.
- */
- void error( CharSequence content, Throwable error );
-
- /**
- * Send an exception to the user in the <b>error</b> error level.
- * <br>
- * The stack trace for this exception will be output when this error level is enabled.
- *
- * @param error the error to log.
- */
- void error( Throwable error );
-}
diff --git a/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/LogEnabled.java b/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/LogEnabled.java
deleted file mode 100644
index 6bc9922..0000000
--- a/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/LogEnabled.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.apache.maven.doxia.logging;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-
-/**
- * An interface for <code>Doxia</code> components (mainly Sink, Parser and Macro) that need the ability to log.
- * <br>
- * Based on <code>org.codehaus.plexus.logging.LogEnabled</code>.
- *
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public interface LogEnabled
-{
- /**
- * Enable a <code>Doxia</code> logger for this <code>Doxia</code> component.
- *
- * @param log a Log.
- */
- void enableLogging( Log log );
-}
diff --git a/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/PlexusLoggerWrapper.java b/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/PlexusLoggerWrapper.java
deleted file mode 100644
index 3c7fe45..0000000
--- a/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/PlexusLoggerWrapper.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package org.apache.maven.doxia.logging;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import org.codehaus.plexus.logging.Logger;
-
-/**
- * Wrap a Plexus logger into a Doxia logger.
- * Based on org.apache.maven.plugin.logging.Log.
- *
- * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
- * @since 1.1
- */
-@Deprecated
-public class PlexusLoggerWrapper
- implements Log
-{
- private final Logger logger;
-
- /**
- * <p>Constructor for PlexusLoggerWrapper.</p>
- *
- * @param logger the Plexus logger to wrap.
- */
- public PlexusLoggerWrapper( Logger logger )
- {
- this.logger = logger;
- }
-
- /** {@inheritDoc} */
- public void setLogLevel( int level )
- {
- if ( level <= LEVEL_DEBUG )
- {
- logger.setThreshold( Logger.LEVEL_DEBUG );
- }
- else if ( level <= LEVEL_INFO )
- {
- logger.setThreshold( Logger.LEVEL_INFO );
- }
- else if ( level <= LEVEL_WARN )
- {
- logger.setThreshold( Logger.LEVEL_WARN );
- }
- else if ( level <= LEVEL_ERROR )
- {
- logger.setThreshold( Logger.LEVEL_ERROR );
- }
- else
- {
- logger.setThreshold( Logger.LEVEL_DISABLED );
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @param content a {@link java.lang.CharSequence} object.
- */
- public void debug( CharSequence content )
- {
- logger.debug( toString( content ) );
- }
-
- /** {@inheritDoc} */
- public void debug( CharSequence content, Throwable error )
- {
- logger.debug( toString( content ), error );
- }
-
- /** {@inheritDoc} */
- public void debug( Throwable error )
- {
- logger.debug( "", error );
- }
-
- /** {@inheritDoc} */
- public void info( CharSequence content )
- {
- logger.info( toString( content ) );
- }
-
- /** {@inheritDoc} */
- public void info( CharSequence content, Throwable error )
- {
- logger.info( toString( content ), error );
- }
-
- /**
- * {@inheritDoc}
- *
- * @param error a {@link java.lang.Throwable} object.
- */
- public void info( Throwable error )
- {
- logger.info( "", error );
- }
-
- /**
- * {@inheritDoc}
- *
- * @param content a {@link java.lang.CharSequence} object.
- */
- public void warn( CharSequence content )
- {
- logger.warn( toString( content ) );
- }
-
- /** {@inheritDoc} */
- public void warn( CharSequence content, Throwable error )
- {
- logger.warn( toString( content ), error );
- }
-
- /** {@inheritDoc} */
- public void warn( Throwable error )
- {
- logger.warn( "", error );
- }
-
- /** {@inheritDoc} */
- public void error( CharSequence content )
- {
- logger.error( toString( content ) );
- }
-
- /** {@inheritDoc} */
- public void error( CharSequence content, Throwable error )
- {
- logger.error( toString( content ), error );
- }
-
- /**
- * {@inheritDoc}
- *
- * @param error a {@link java.lang.Throwable} object.
- */
- public void error( Throwable error )
- {
- logger.error( "", error );
- }
-
- /**
- * {@inheritDoc}
- *
- * @return a boolean.
- */
- public boolean isDebugEnabled()
- {
- return logger.isDebugEnabled();
- }
-
- /**
- * {@inheritDoc}
- *
- * @return a boolean.
- */
- public boolean isInfoEnabled()
- {
- return logger.isInfoEnabled();
- }
-
- /**
- * {@inheritDoc}
- *
- * @return a boolean.
- */
- public boolean isWarnEnabled()
- {
- return logger.isWarnEnabled();
- }
-
- /**
- * {@inheritDoc}
- *
- * @return a boolean.
- */
- public boolean isErrorEnabled()
- {
- return logger.isErrorEnabled();
- }
-
- // ----------------------------------------------------------------------
- // Private methods
- // ----------------------------------------------------------------------
-
- private String toString( CharSequence content )
- {
- if ( content == null )
- {
- return "";
- }
-
- return content.toString();
- }
-}
diff --git a/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/SystemStreamLog.java b/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/SystemStreamLog.java
deleted file mode 100644
index 8ec510a..0000000
--- a/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/SystemStreamLog.java
+++ /dev/null
@@ -1,271 +0,0 @@
-package org.apache.maven.doxia.logging;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-/**
- * Logger with "standard" output and error output stream. The log prefix is voluntarily in lower case.
- * <br>
- * Based on <code>org.apache.maven.plugin.logging.SystemStreamLog</code>.
- *
- * @author jdcasey
- * @author ltheussl
- * @since 1.1
- */
-@Deprecated
-public class SystemStreamLog
- implements Log
-{
- private static final String EOL = System.getProperty( "line.separator" );
-
- private int currentLevel = LEVEL_INFO;
-
- /** {@inheritDoc} */
- public void setLogLevel( int level )
- {
- if ( level <= LEVEL_DEBUG )
- {
- currentLevel = LEVEL_DEBUG;
- }
- else if ( level <= LEVEL_INFO )
- {
- currentLevel = LEVEL_INFO;
- }
- else if ( level <= LEVEL_WARN )
- {
- currentLevel = LEVEL_WARN;
- }
- else if ( level <= LEVEL_ERROR )
- {
- currentLevel = LEVEL_ERROR;
- }
- else
- {
- currentLevel = LEVEL_DISABLED;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @param content a {@link java.lang.CharSequence} object.
- */
- public void debug( CharSequence content )
- {
- if ( isDebugEnabled() )
- {
- print( "debug", content );
- }
- }
-
- /** {@inheritDoc} */
- public void debug( CharSequence content, Throwable error )
- {
- if ( isDebugEnabled() )
- {
- print( "debug", content, error );
- }
- }
-
- /** {@inheritDoc} */
- public void debug( Throwable error )
- {
- if ( isDebugEnabled() )
- {
- print( "debug", error );
- }
- }
-
- /** {@inheritDoc} */
- public void info( CharSequence content )
- {
- if ( isInfoEnabled() )
- {
- print( "info", content );
- }
- }
-
- /** {@inheritDoc} */
- public void info( CharSequence content, Throwable error )
- {
- if ( isInfoEnabled() )
- {
- print( "info", content, error );
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @param error a {@link java.lang.Throwable} object.
- */
- public void info( Throwable error )
- {
- if ( isInfoEnabled() )
- {
- print( "info", error );
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @param content a {@link java.lang.CharSequence} object.
- */
- public void warn( CharSequence content )
- {
- if ( isWarnEnabled() )
- {
- print( "warn", content );
- }
- }
-
- /** {@inheritDoc} */
- public void warn( CharSequence content, Throwable error )
- {
- if ( isWarnEnabled() )
- {
- print( "warn", content, error );
- }
- }
-
- /** {@inheritDoc} */
- public void warn( Throwable error )
- {
- if ( isWarnEnabled() )
- {
- print( "warn", error );
- }
- }
-
- /** {@inheritDoc} */
- public void error( CharSequence content )
- {
- if ( isErrorEnabled() )
- {
- System.err.println( "[error] " + content.toString() );
- }
- }
-
- /** {@inheritDoc} */
- public void error( CharSequence content, Throwable error )
- {
- if ( isErrorEnabled() )
- {
- StringWriter sWriter = new StringWriter();
- PrintWriter pWriter = new PrintWriter( sWriter );
-
- error.printStackTrace( pWriter );
-
- System.err.println( "[error] " + content.toString()
- + EOL + EOL + sWriter.toString() );
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @param error a {@link java.lang.Throwable} object.
- */
- public void error( Throwable error )
- {
- if ( isErrorEnabled() )
- {
- StringWriter sWriter = new StringWriter();
- PrintWriter pWriter = new PrintWriter( sWriter );
-
- error.printStackTrace( pWriter );
-
- System.err.println( "[error] " + sWriter.toString() );
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @return a boolean.
- */
- public boolean isDebugEnabled()
- {
- return ( currentLevel <= LEVEL_DEBUG );
- }
-
- /**
- * {@inheritDoc}
- *
- * @return a boolean.
- */
- public boolean isInfoEnabled()
- {
- return ( currentLevel <= LEVEL_INFO );
- }
-
- /**
- * {@inheritDoc}
- *
- * @return a boolean.
- */
- public boolean isWarnEnabled()
- {
- return ( currentLevel <= LEVEL_WARN );
- }
-
- /**
- * {@inheritDoc}
- *
- * @return a boolean.
- */
- public boolean isErrorEnabled()
- {
- return ( currentLevel <= LEVEL_ERROR );
- }
-
- //
- // private
- //
-
- private void print( String prefix, CharSequence content )
- {
- System.out.println( "[" + prefix + "] " + content.toString() );
- }
-
- private void print( String prefix, Throwable error )
- {
- StringWriter sWriter = new StringWriter();
- PrintWriter pWriter = new PrintWriter( sWriter );
-
- error.printStackTrace( pWriter );
-
- System.out.println( "[" + prefix + "] " + sWriter.toString() );
- }
-
- private void print( String prefix, CharSequence content, Throwable error )
- {
- StringWriter sWriter = new StringWriter();
- PrintWriter pWriter = new PrintWriter( sWriter );
-
- error.printStackTrace( pWriter );
-
- System.out.println( "[" + prefix + "] " + content.toString()
- + EOL + EOL + sWriter.toString() );
- }
-}
diff --git a/doxia-logging-api/src/site/apt/index.apt b/doxia-logging-api/src/site/apt/index.apt
deleted file mode 100644
index fd75b48..0000000
--- a/doxia-logging-api/src/site/apt/index.apt
+++ /dev/null
@@ -1,27 +0,0 @@
- --------------
- Maven Doxia Logging API
- --------------
-
- ~~ Licensed to the Apache Software Foundation (ASF) under one
- ~~ or more contributor license agreements. See the NOTICE file
- ~~ distributed with this work for additional information
- ~~ regarding copyright ownership. The ASF licenses this file
- ~~ to you 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.
-
- ~~ NOTE: For help with the syntax of this file, see:
- ~~ http://maven.apache.org/doxia/references/apt-format.html
-
-Deprecation Notice
-
- This Doxia module is deprecated and will be removed in version 2.0.0.
diff --git a/doxia-logging-api/src/site/site.xml b/doxia-logging-api/src/site/site.xml
deleted file mode 100644
index ac3868c..0000000
--- a/doxia-logging-api/src/site/site.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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/DECORATION/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 https://maven.apache.org/xsd/decoration-1.1.0.xsd">
-
- <body>
-
- <menu ref="parent"/>
-
- <menu name="Overview">
- <item name="Introduction" href="index.html"/>
- <item name="JavaDocs" href="apidocs/index.html"/>
- <item name="Source Xref" href="xref/index.html"/>
- <!--item name="FAQ" href="faq.html"/-->
- </menu>
-
- <menu ref="reports"/>
-
- </body>
-
-</project>
\ No newline at end of file
diff --git a/doxia-modules/doxia-module-apt/pom.xml b/doxia-modules/doxia-module-apt/pom.xml
index 67b767c..15e2463 100644
--- a/doxia-modules/doxia-module-apt/pom.xml
+++ b/doxia-modules/doxia-module-apt/pom.xml
@@ -43,6 +43,10 @@ under the License.
<dependencies>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
@@ -56,5 +60,10 @@ under the License.
<artifactId>xmlunit-matchers</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java b/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
index bccaddf..f36b8cd 100644
--- a/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
+++ b/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
@@ -34,6 +34,8 @@ import org.apache.maven.doxia.util.DoxiaUtils;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.Reader;
@@ -41,9 +43,7 @@ import java.io.StringReader;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import java.util.StringTokenizer;
-import java.util.TreeSet;
/**
* The APT parser.
@@ -57,6 +57,8 @@ public class AptParser
extends AbstractTextParser
implements AptMarkup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( AptParser.class );
+
/** Title event id */
private static final int TITLE = 0;
@@ -163,10 +165,6 @@ public class AptParser
/** a line of AptSource. */
protected String line;
- /** Map of warn messages with a String as key to describe the error type and a Set as value.
- * Using to reduce warn messages. */
- protected Map<String, Set<String>> warnMessages;
-
private static final int NUMBER_OF_SPACES = 85;
static
@@ -190,7 +188,7 @@ public class AptParser
{
parse( source, sink, "" );
}
-
+
/** {@inheritDoc} */
@Override
public void parse( Reader source, Sink sink, String reference )
@@ -214,7 +212,6 @@ public class AptParser
this.source = new AptReaderSource( new StringReader( sourceContent ), reference );
this.sink = sink;
- sink.enableLogging( getLog() );
blockFileName = null;
@@ -244,8 +241,6 @@ public class AptParser
}
finally
{
- logWarnings();
-
setSecondParsing( false );
init();
}
@@ -361,10 +356,7 @@ public class AptParser
}
catch ( NumberFormatException e )
{
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( "Not a number: " + text.substring( i + 2, i + 4 ) );
- }
+ LOGGER.debug( "Not a number: {}", text.substring( i + 2, i + 4 ) );
}
i += 3;
@@ -387,10 +379,7 @@ public class AptParser
}
catch ( NumberFormatException e )
{
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( "Not a number: " + text.substring( i + 2, i + 6 ) );
- }
+ LOGGER.debug( "Not a number: {}", text.substring( i + 2, i + 6 ) );
}
i += 5;
@@ -420,12 +409,7 @@ public class AptParser
}
catch ( NumberFormatException e )
{
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug(
- "Not a number: "
- + text.substring( i + 1, i + 1 + octalChars ) );
- }
+ LOGGER.debug( "Not a number: {}", text.substring( i + 1, i + 1 + octalChars ) );
}
i += octalChars;
@@ -480,9 +464,8 @@ public class AptParser
if ( hash.endsWith( ".html" ) && !hash.startsWith( "./" ) )
{
- String msg = "Ambiguous link: '" + hash
- + "'. If this is a local link, prepend \"./\"!";
- logMessage( "ambiguousLink", msg );
+ LOGGER.debug( "Ambiguous link '{}'. If this is a local link, prepend \"./\"!",
+ hash );
}
// link##anchor means literal
@@ -496,8 +479,7 @@ public class AptParser
linkAnchor.substring( 0, hashIndex ) + "#"
+ DoxiaUtils.encodeId( hash, true );
- String msg = "Modified invalid link: '" + hash + "' to '" + linkAnchor + "'";
- logMessage( "modifiedLink", msg );
+ LOGGER.debug( "Modified invalid link '{}' to '{}'", hash, linkAnchor );
}
}
@@ -729,7 +711,6 @@ public class AptParser
this.blockFileName = null;
this.blockLineNumber = 0;
this.line = null;
- this.warnMessages = null;
}
// ----------------------------------------------------------------------
@@ -1605,56 +1586,7 @@ public class AptParser
return buffer.toString().trim();
}
- /**
- * If debug mode is enabled, log the <code>msg</code> as is, otherwise add unique msg in <code>warnMessages</code>.
- *
- * @param key not null
- * @param msg not null
- * @see #parse(Reader, Sink)
- * @since 1.1.1
- */
- private void logMessage( String key, String msg )
- {
- msg = "[APT Parser] " + msg;
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( msg );
-
- return;
- }
-
- if ( warnMessages == null )
- {
- warnMessages = new HashMap<>();
- }
-
- Set<String> set = warnMessages.get( key );
- if ( set == null )
- {
- set = new TreeSet<>();
- }
- set.add( msg );
- warnMessages.put( key, set );
- }
-
- /**
- * @since 1.1.2
- */
- private void logWarnings()
- {
- if ( getLog().isWarnEnabled() && this.warnMessages != null && !isSecondParsing() )
- {
- for ( Map.Entry<String, Set<String>> entry : this.warnMessages.entrySet() )
- {
- for ( String msg : entry.getValue() )
- {
- getLog().warn( msg );
- }
- }
- this.warnMessages = null;
- }
- }
// -----------------------------------------------------------------------
diff --git a/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java b/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
index a00754e..c44281e 100644
--- a/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
+++ b/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
@@ -29,6 +29,8 @@ import org.apache.maven.doxia.sink.SinkEventAttributes;
import org.apache.maven.doxia.sink.impl.AbstractTextSink;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* APT generator implementation.
@@ -42,6 +44,8 @@ public class AptSink
extends AbstractTextSink
implements AptMarkup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( AptSink.class );
+
// ----------------------------------------------------------------------
// Instance fields
// ----------------------------------------------------------------------
@@ -1100,7 +1104,7 @@ public class AptSink
*/
public void unknown( String name, Object[] requiredParams, SinkEventAttributes attributes )
{
- getLog().warn( "[Apt Sink] Unknown Sink event: '" + name + "', ignoring!" );
+ LOGGER.warn( "Unknown Sink event '{}', ignoring!", name );
}
/**
diff --git a/doxia-modules/doxia-module-fml/pom.xml b/doxia-modules/doxia-module-fml/pom.xml
index 4a3042a..3cca1c1 100644
--- a/doxia-modules/doxia-module-fml/pom.xml
+++ b/doxia-modules/doxia-module-fml/pom.xml
@@ -39,6 +39,10 @@ under the License.
<dependencies>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
@@ -49,6 +53,11 @@ under the License.
<artifactId>doxia-test-docs</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlContentParser.java b/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlContentParser.java
index 2cf0451..2912298 100644
--- a/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlContentParser.java
+++ b/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlContentParser.java
@@ -25,6 +25,8 @@ import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Parse Fml questions and answers, these may contain arbitrary xdoc elements.
@@ -36,6 +38,8 @@ public class FmlContentParser
extends Xhtml5BaseParser
implements FmlMarkup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( FmlContentParser.class );
+
/** Empty elements don't write a closing tag. */
private boolean isEmptyElement;
@@ -69,14 +73,8 @@ public class FmlContentParser
handleUnknown( parser, sink, TAG_TYPE_START );
}
- if ( getLog().isDebugEnabled() )
- {
- String position = "[" + parser.getLineNumber() + ":"
- + parser.getColumnNumber() + "]";
- String tag = "<" + parser.getName() + ">";
-
- getLog().debug( "Unrecognized fml tag: " + tag + " at " + position );
- }
+ LOGGER.warn( "Unrecognized fml tag <{}> at [{}:{}]", parser.getName(),
+ parser.getLineNumber(), parser.getColumnNumber() );
}
}
diff --git a/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java b/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
index da334a1..3068d96 100644
--- a/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
+++ b/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
@@ -26,8 +26,6 @@ import java.io.StringWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
import javax.swing.text.html.HTML.Attribute;
@@ -50,6 +48,8 @@ import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Parse a fml model and emit events into the specified doxia Sink.
@@ -63,6 +63,8 @@ public class FmlParser
extends AbstractXmlParser
implements FmlMarkup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( FmlParser.class );
+
/** Collect a faqs model. */
private Faqs faqs;
@@ -75,10 +77,6 @@ public class FmlParser
/** Used to collect text events. */
private StringBuilder buffer;
- /** Map of warn messages with a String as key to describe the error type and a Set as value.
- * Using to reduce warn messages. */
- private Map<String, Set<String>> warnMessages;
-
/** The source content of the input reader. Used to pass into macros. */
private String sourceContent;
@@ -124,8 +122,6 @@ public class FmlParser
}
finally
{
- logWarnings();
-
this.faqs = null;
this.sourceContent = null;
setSecondParsing( false );
@@ -175,8 +171,7 @@ public class FmlParser
{
String linkAnchor = DoxiaUtils.encodeId( currentPart.getId(), true );
- String msg = "Modified invalid link: '" + currentPart.getId() + "' to '" + linkAnchor + "'";
- logMessage( "modifiedLink", msg );
+ LOGGER.debug( "Modified invalid link '{}' to '{}'", currentPart.getId(), linkAnchor );
currentPart.setId( linkAnchor );
}
@@ -201,8 +196,7 @@ public class FmlParser
{
String linkAnchor = DoxiaUtils.encodeId( currentFaq.getId(), true );
- String msg = "Modified invalid link: '" + currentFaq.getId() + "' to '" + linkAnchor + "'";
- logMessage( "modifiedLink", msg );
+ LOGGER.debug( "Modified invalid link '{}' to '{}'", currentFaq.getId(), linkAnchor );
currentFaq.setId( linkAnchor );
}
@@ -434,7 +428,6 @@ public class FmlParser
this.currentFaq = null;
this.currentPart = null;
this.buffer = null;
- this.warnMessages = null;
this.macroName = null;
this.macroParameters = null;
}
@@ -546,7 +539,6 @@ public class FmlParser
throws ParseException
{
FmlContentParser xdocParser = new FmlContentParser();
- xdocParser.enableLogging( getLog() );
sink.head();
sink.title();
@@ -688,55 +680,4 @@ public class FmlParser
sink.link_();
sink.paragraph_();
}
-
- /**
- * If debug mode is enabled, log the <code>msg</code> as is, otherwise add unique msg in <code>warnMessages</code>.
- *
- * @param key not null
- * @param msg not null
- * @see #parse(Reader, Sink)
- * @since 1.1.1
- */
- private void logMessage( String key, String msg )
- {
- msg = "[FML Parser] " + msg;
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( msg );
-
- return;
- }
-
- if ( warnMessages == null )
- {
- warnMessages = new HashMap<>();
- }
-
- Set<String> set = warnMessages.get( key );
- if ( set == null )
- {
- set = new TreeSet<>();
- }
- set.add( msg );
- warnMessages.put( key, set );
- }
-
- /**
- * @since 1.1.1
- */
- private void logWarnings()
- {
- if ( getLog().isWarnEnabled() && this.warnMessages != null && !isSecondParsing() )
- {
- for ( Map.Entry<String, Set<String>> entry : this.warnMessages.entrySet() )
- {
- for ( String msg : entry.getValue() )
- {
- getLog().warn( msg );
- }
- }
-
- this.warnMessages = null;
- }
- }
}
diff --git a/doxia-modules/doxia-module-markdown/pom.xml b/doxia-modules/doxia-module-markdown/pom.xml
index 4a21323..24b2f20 100644
--- a/doxia-modules/doxia-module-markdown/pom.xml
+++ b/doxia-modules/doxia-module-markdown/pom.xml
@@ -76,6 +76,11 @@ under the License.
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -135,6 +140,7 @@ under the License.
<goal>site</goal>
</goals>
</configuration>
+ <!-- Disabling IT for now since we need a Doxia 2.0.0 compatible Site Plugin
<executions>
<execution>
<id>integration-test</id>
@@ -144,6 +150,7 @@ under the License.
</goals>
</execution>
</executions>
+ -->
</plugin>
</plugins>
diff --git a/doxia-modules/doxia-module-xdoc/pom.xml b/doxia-modules/doxia-module-xdoc/pom.xml
index 34b5a28..5f922d6 100644
--- a/doxia-modules/doxia-module-xdoc/pom.xml
+++ b/doxia-modules/doxia-module-xdoc/pom.xml
@@ -39,6 +39,10 @@ under the License.
<dependencies>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
@@ -59,6 +63,11 @@ under the License.
<artifactId>xmlunit-matchers</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
index e1b8184..7eb2918 100644
--- a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
+++ b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocParser.java
@@ -42,6 +42,8 @@ import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Parse an xdoc model and emit events into the specified doxia Sink.
@@ -54,6 +56,8 @@ public class XdocParser
extends XhtmlBaseParser
implements XdocMarkup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( XdocParser.class );
+
/**
* The source content of the input reader. Used to pass into macros.
*/
@@ -144,7 +148,7 @@ public class XdocParser
{
if ( hasTitle )
{
- getLog().warn( "<title> was already defined in <properties>, ignored <title> in <head>." );
+ LOGGER.warn( "<title> was already defined in <properties>, ignored <title> in <head>." );
try
{
@@ -231,13 +235,8 @@ public class XdocParser
handleUnknown( parser, sink, TAG_TYPE_START );
}
- if ( getLog().isDebugEnabled() )
- {
- String position = "[" + parser.getLineNumber() + ":" + parser.getColumnNumber() + "]";
- String tag = "<" + parser.getName() + ">";
-
- getLog().debug( "Unrecognized xdoc tag: " + tag + " at " + position );
- }
+ LOGGER.warn( "Unrecognized xdoc tag <{}> at [{}:{}]", parser.getName(),
+ parser.getLineNumber(), parser.getColumnNumber() );
}
}
diff --git a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XmlWriterXdocSink.java b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XmlWriterXdocSink.java
index 5243c31..674ee30 100644
--- a/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XmlWriterXdocSink.java
+++ b/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XmlWriterXdocSink.java
@@ -71,10 +71,6 @@ public class XmlWriterXdocSink
super.close();
String xdocContent = xdocWriter.toString();
- if ( getLog().isDebugEnabled() )
- {
- getLog().debug( "Xdoc content: " + xdocContent );
- }
StringWriter formattedContent = new StringWriter();
try
{
@@ -82,10 +78,6 @@ public class XmlWriterXdocSink
}
catch ( IOException e )
{
- if ( getLog().isDebugEnabled() )
- {
- getLog().error( "IOException: " + e.getMessage(), e );
- }
formattedContent = new StringWriter();
formattedContent.write( xdocContent );
}
diff --git a/doxia-modules/doxia-module-xhtml/pom.xml b/doxia-modules/doxia-module-xhtml/pom.xml
index 1eaf5b8..d60be28 100644
--- a/doxia-modules/doxia-module-xhtml/pom.xml
+++ b/doxia-modules/doxia-module-xhtml/pom.xml
@@ -39,6 +39,10 @@ under the License.
<dependencies>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
@@ -52,5 +56,10 @@ under the License.
<artifactId>xmlunit-matchers</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java b/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
index fbeeb9a..d337a26 100644
--- a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
+++ b/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
@@ -40,6 +40,8 @@ import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Parse an xhtml model and emit events into a Doxia Sink.
@@ -52,6 +54,8 @@ public class XhtmlParser
extends XhtmlBaseParser
implements XhtmlMarkup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( XhtmlParser.class );
+
/** For boxed verbatim. */
protected boolean boxed;
@@ -166,14 +170,8 @@ public class XhtmlParser
handleUnknown( parser, sink, TAG_TYPE_START );
}
- if ( getLog().isDebugEnabled() )
- {
- String position = "[" + parser.getLineNumber() + ":"
- + parser.getColumnNumber() + "]";
- String tag = "<" + parser.getName() + ">";
-
- getLog().debug( "Unrecognized xhtml tag: " + tag + " at " + position );
- }
+ LOGGER.warn( "Unrecognized xhtml tag <{}> at [{}:{}]", parser.getName(),
+ parser.getLineNumber(), parser.getColumnNumber() );
}
}
diff --git a/doxia-modules/doxia-module-xhtml5/pom.xml b/doxia-modules/doxia-module-xhtml5/pom.xml
index b6080f8..49704f3 100644
--- a/doxia-modules/doxia-module-xhtml5/pom.xml
+++ b/doxia-modules/doxia-module-xhtml5/pom.xml
@@ -39,6 +39,10 @@ under the License.
<dependencies>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
@@ -52,5 +56,10 @@ under the License.
<artifactId>xmlunit-matchers</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java b/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java
index cf79171..be887a7 100644
--- a/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java
+++ b/doxia-modules/doxia-module-xhtml5/src/main/java/org/apache/maven/doxia/module/xhtml5/Xhtml5Parser.java
@@ -40,6 +40,8 @@ import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Parse an xhtml model and emit events into a Doxia Sink.
@@ -49,6 +51,8 @@ public class Xhtml5Parser
extends Xhtml5BaseParser
implements Xhtml5Markup
{
+ private static final Logger LOGGER = LoggerFactory.getLogger( Xhtml5Parser.class );
+
/**
* The role hint for the {@link Xhtml5Parser} Plexus component.
*/
@@ -168,14 +172,8 @@ public class Xhtml5Parser
handleUnknown( parser, sink, TAG_TYPE_START );
}
- if ( getLog().isDebugEnabled() )
- {
- String position = "[" + parser.getLineNumber() + ":"
- + parser.getColumnNumber() + "]";
- String tag = "<" + parser.getName() + ">";
-
- getLog().debug( "Unrecognized xhtml5 tag: " + tag + " at " + position );
- }
+ LOGGER.warn( "Unrecognized xhtml5 tag <{}> at [{}:{}]", parser.getName(),
+ parser.getLineNumber(), parser.getColumnNumber() );
}
}
diff --git a/doxia-sink-api/pom.xml b/doxia-sink-api/pom.xml
index f662d12..38c0c9c 100644
--- a/doxia-sink-api/pom.xml
+++ b/doxia-sink-api/pom.xml
@@ -33,10 +33,4 @@ under the License.
<name>Doxia :: Sink API</name>
<description>Doxia Sink API.</description>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-logging-api</artifactId>
- </dependency>
- </dependencies>
</project>
diff --git a/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java b/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java
index 2eaf255..b5c4e5e 100644
--- a/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java
+++ b/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java
@@ -19,8 +19,6 @@ package org.apache.maven.doxia.sink;
* under the License.
*/
-import org.apache.maven.doxia.logging.LogEnabled;
-
/**
* A <i>Sink</i> consumes Doxia events to produce a resultant output format
* (eg Docbook, PDF, XHTML...).
@@ -56,7 +54,6 @@ import org.apache.maven.doxia.logging.LogEnabled;
* @author ltheussl
*/
public interface Sink
- extends LogEnabled
{
/** The Plexus Sink Role. */
String ROLE = Sink.class.getName();
diff --git a/pom.xml b/pom.xml
index 125f059..88c131e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,7 +55,6 @@ under the License.
</contributors>
<modules>
- <module>doxia-logging-api</module>
<module>doxia-sink-api</module>
<module>doxia-test-docs</module>
<module>doxia-core</module>
@@ -88,6 +87,7 @@ under the License.
<maven.site.path>doxia-archives/doxia-LATEST</maven.site.path>
<checkstyle.violation.ignore>RedundantThrows,NewlineAtEndOfFile,ParameterNumber,MethodLength,FileLength,MethodName,InnerAssignment,MagicNumber</checkstyle.violation.ignore>
<project.build.outputTimestamp>2021-11-28T20:51:17Z</project.build.outputTimestamp>
+ <slf4jVersion>1.7.32</slf4jVersion>
</properties>
<dependencyManagement>
@@ -100,11 +100,6 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-logging-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-test-docs</artifactId>
<version>${project.version}</version>
</dependency>
@@ -190,6 +185,18 @@ under the License.
<version>2.6</version>
</dependency>
+ <!-- SLF4J -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4jVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4jVersion}</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
diff --git a/src/site/resources/images/doxia-deps.png b/src/site/resources/images/doxia-deps.png
index 403b355..ecce966 100644
Binary files a/src/site/resources/images/doxia-deps.png and b/src/site/resources/images/doxia-deps.png differ
diff --git a/src/site/xdoc/doxia-deps.odg b/src/site/xdoc/doxia-deps.odg
index e5b9992..3e9875f 100644
Binary files a/src/site/xdoc/doxia-deps.odg and b/src/site/xdoc/doxia-deps.odg differ
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index cc84617..0f2a25d 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -35,7 +35,7 @@
<p>The actual component is the base component from the whole Doxia suite, with the core parser and sink APIs and
their implementation in supported markup languages.</p>
-
+
<p>It is used by the <a href="../doxia-sitetools">Doxia Sitetools</a> extension,
that adds site and documents support.</p>
@@ -43,7 +43,6 @@
<img src="images/doxia-deps.png" border="0" usemap="#Doxia_dependencies" />
<map name="Doxia_dependencies">
<area shape="rect" coords="0,280,122,308" href="./doxia-test-docs/" />
- <area shape="rect" coords="324,363,481,403" href="./doxia-logging-api/" />
<area shape="rect" coords="135,231,286,261" href="./doxia-sink-api/" />
<area shape="rect" coords="165,180,286,209" href="./doxia-core/" />
<area shape="rect" coords="41,25,118,88" href="./doxia-modules/doxia-module-apt/" />
@@ -51,10 +50,10 @@
<area shape="rect" coords="230,25,313,88" href="./doxia-modules/doxia-module-xhtml/" />
<area shape="rect" coords="325,25,407,88" href="./doxia-modules/doxia-module-xhtml5/" />
<area shape="rect" coords="135,25,213,88" href="./doxia-modules/doxia-module-fml/" />
- <area shape="rect" coords="304,75,336,107" href="./doxia-modules/doxia-module-markdown/" />
+ <area shape="rect" coords="304,75,421,107" href="./doxia-modules/doxia-module-markdown/" />
<area shape="rect" coords="21,1,432,151" href="./doxia-modules/" />
<area shape="rect" coords="308,178,439,208" href="https://github.com/vsch/flexmark-java" />
- <area shape="rect" coords="521,364,676,403" href="https://codehaus-plexus.github.io/" />
+ <area shape="rect" coords="164,280,286,310" href="https://codehaus-plexus.github.io/" />
</map>
</p>