Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error/warning log handling #323

Closed
ptahchiev opened this issue Oct 24, 2017 · 10 comments · Fixed by #961
Closed

Better error/warning log handling #323

ptahchiev opened this issue Oct 24, 2017 · 10 comments · Fixed by #961

Comments

@ptahchiev
Copy link
Contributor

At the moment when I run mvn clean site site:deploy I get this in my log:

[INFO] Rendering 28 Doxia documents: 28 asciidoc
asciidoctor: WARNING: <stdin>: line 20: no callouts refer to list item 1
asciidoctor: WARNING: <stdin>: line 22: no callouts refer to list item 2
asciidoctor: WARNING: <stdin>: line 25: no callouts refer to list item 3
asciidoctor: ERROR: <stdin>: line 106: invalid part, must have at least one section (e.g., chapter, appendix, etc.)

You can see I am rendering 28 documents, and I have errors and warnings in some of them. I can see the line, however I don't know which file is problematic.

@abelsromero
Copy link
Member

It's not the first time we see problems with this. If you see the Doxia module (

public void parse(Reader reader, Sink sink) throws ParseException {
), it provides a Reader object, so we cannot access to the File to log the path it in the same way we do in the default mojo.
The only thing I have found is running Maven in debug mode ('-X'), that way you see a

[DEBUG] Generating C:\home\personal\github\asciidoctor-maven-examples\asciidoc-maven-site-example\target\site\article222.html

It's not the source but the output, but you can see the filename at least and guess the file.

I just checked if there was something new in the Doxia documentation, but found nothing. Maybe there's a way to access the source or some info to log it, but needs further research into Doxia code.

@slachiewicz
Copy link
Contributor

We will try to address this in related to DOXIA-555 issue.

@abelsromero
Copy link
Member

With Asciidoctorj 1.5.8.x new messages that include the file path are shown in the console, which partially resolves this issue. However, this is not ideal and creates a difference with the process-asciidoc mojo which has more advanced features (see logHandler).
For that, I will keep this open to integrate logHandler in the site mojo, I started a POC, but there are some issues with the doxia logger vs maven logger witch may require some boilerplate with Java7. I am moving this to 1.6.0 witch will require Java8 making things easier and cleaner.

@abelsromero abelsromero added this to the 1.6.0 milestone Dec 30, 2018
@abelsromero
Copy link
Member

I did the preoviously mentioned logHandler integration and I hit again the limitations of the Doxia module (unable to get the filename :%). One thing however, is that if you enable the build to fail Doxia will catch the first file that failed and at least show that. Far from perfect, I know.
Also I am keeping an eye on the related DOXIA-555 issue but no progress yet.

For those reasons I will keep this open but reschedule for future realease in case something comes up.

@abelsromero abelsromero removed this from the 2.0.0 milestone Jun 17, 2020
@abelsromero
Copy link
Member

Fix is on the works: apache/maven-doxia#35

@abelsromero
Copy link
Member

abelsromero commented Dec 21, 2021

We are still chasing this, this should make it possible finally apache/maven-doxia-sitetools#19. At least I got it working in a local example overriding doxia-site-renderer (local patched version) and doxia-core (v1.11.1) for maven-site-plugin.

@abelsromero
Copy link
Member

abelsromero commented Jan 13, 2024

Doxia improvements are already in v2.2.5 and older versions.

@abelsromero
Copy link
Member

abelsromero commented Jan 27, 2024

Reference is still obtained as null, need to see why. Setting as milestone as a reminder, will remove if some other Doxia element is still missing.

@abelsromero abelsromero added this to the 3.0.1 milestone Jan 27, 2024
@abelsromero
Copy link
Member

Testing with maven-site-plugin 3.20.0 which comes with Doxia v2 the reference is finally informed 🎉

@abelsromero
Copy link
Member

abelsromero commented Oct 28, 2024

New message [INFO] Issues found in: {file} is added if reference is not empty.

Default behavior:

[INFO] Issues found in: src/site/asciidoc/article.adoc
[INFO] asciidoctor: WARN: line 25: list item index: expected 1, got 2
[INFO] asciidoctor: ERROR: line 27: include file not found: /home/asalgadr/github/asciidoctor-maven-examples/asciidoc-maven-site-parser-example/src/site/asciidoc/missing.adoc

With outputToConsole no activated:

<logHandler>
    <outputToConsole>false</outputToConsole>
</logHandler>
[INFO] Issues found in: src/site/asciidoc/article.adoc

With failIf activated (regardless of outputToConsole).

<logHandler>
   <outputToConsole>true</outputToConsole>
   <failIf>
       <severity>ERROR</severity>
   </failIf>
</logHandler>
[INFO] Issues found in: src/site/asciidoc/article.adoc
[INFO] asciidoctor: ERROR: line 27: include file not found: /home/asalgadr/github/asciidoctor-maven-examples/asciidoc-maven-site-parser-example/src/site/asciidoc/missing.adoc

I wanted to minimize changes, in normal mojo we always print "Converting {file}", so we don't need to do anything special.
Here I changed things a bit to adding logs that are not currently shown, so with outputToConsole mojo prints output during conversion. So when failIf is active too, messages appear once, during conversation and then during error processing to decide if the build should fail.

abelsromero added a commit to abelsromero/asciidoctor-maven-plugin that referenced this issue Oct 28, 2024
This PR uses the new 'reference' parameter in Doxia Parsers
to print the source filename when an issue is detected.
This is comparible and extende the features in 'logHandler'.

Fixes asciidoctor#323
abelsromero added a commit to abelsromero/asciidoctor-maven-plugin that referenced this issue Oct 28, 2024
This PR uses the new 'reference' parameter in Doxia Parsers
to print the source filename when an issue is detected.
This is compatible and extends the features in 'logHandler'.

Fixes asciidoctor#323
abelsromero added a commit to abelsromero/asciidoctor-maven-plugin that referenced this issue Oct 28, 2024
This PR uses the new 'reference' parameter in Doxia Parsers
to print the source filename when an issue is detected.
This is compatible and extends the features in 'logHandler'.

Fixes asciidoctor#323
abelsromero added a commit that referenced this issue Oct 28, 2024
…es (#961)

This PR uses the new 'reference' parameter in Doxia Parsers
to print the source filename when an issue is detected.
This is compatible and extends the features in 'logHandler'.

Fixes #323
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants