jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Improve logging to find out which linked file has a flaw

Open ThiloteE opened this issue 7 months ago • 35 comments

Is your suggestion for improvement related to a problem? Please describe. I have a library with about 200 attached pdf files. When I start JabRef, an index will be created to facilitate full-text search. The indexing gets stuck and there are a lot of error messages in the event log, but I don't know which of the PDF files trigger the errors.

Edit: Since this issue was opened, JabRef switched from postgres back to in-memory search with PR https://github.com/JabRef/jabref/pull/16591, and I haven't tested, if indexing gets stuck there too, but the issue remains the same: it is desirable to identify erroneous files.

How to reproduce:

  1. Start JabRef.
  2. Add a library (a .bib file)
  3. Add a new entry
  4. Configure a file directory under library > library properties
  5. Drag and drop an erroneous pdf file unto the entry, thereby linking the pdf to the entry.
  6. Open "Tools > Rebuild fulltext search index"
  7. Open "Help > View event log"

Describe the solution you'd like Log filenames or at least the citationkeys of the entries containing a linked file that produce an error during indexing. Since it is possible to attach multiple files to one entry, it would be better to log filenames.

Example of entry with broken PDF file that causes errors:

@Article{Khoo202209gpr,
  author           = {Khoo, Nicholas},
  date             = {2022-09},
  journaltitle     = {Political Science},
  title            = {Great power Rivalry and Southeast Asian agency: Southeast Asia in an Era of US-China strategic competition},
  doi              = {10.1080/00323187.2023.2186251},
  issn             = {2041-0611},
  number           = {2–3},
  pages            = {141--154},
  volume           = {74},
  creationdate     = {2025-06-24T21:34:53},
  publisher        = {Informa UK Limited},
}

Khoo202209gpr Khoo (2022-09) Great power Rivalry 141--154.pdf

Khoo202209gpr Khoo (2022-09) Great power Rivalry 141--154 - Event Log.txt

Additional context Would help fixing

  • https://github.com/JabRef/jabref/issues/13048
  • https://github.com/JabRef/jabref/issues/13983

ThiloteE avatar May 05 '26 13:05 ThiloteE

/assign-me

gauravdubey37 avatar May 05 '26 19:05 gauravdubey37

👋 Hey @gauravdubey37, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

In case you encounter failing tests during development, please check our developer FAQs!

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! 🚀

jabref-machine avatar May 05 '26 19:05 jabref-machine

⏰ Assignment Reminder

Hi @gauravdubey37, this is a friendly reminder about your assignment to this issue.

[!WARNING] This issue will be automatically unassigned in 7 days if there's no activity.

Remember that you can ask the JabRef Guru or DeepWiki about anything regarding JabRef. Additionally, our contributing guide has hints on creating a pull request and a link to our Gitter chat.

How to keep your assignment


If you are working on it, you can prevent automatic unassignment by:

  • Submitting a draft pull request with your progress within 7 days
  • Asking for the 📌 Pinned label if you need more time

We appreciate your contribution and are here to help if needed!

github-actions[bot] avatar May 12 '26 12:05 github-actions[bot]

/assign-me

madhav758 avatar May 14 '26 07:05 madhav758

⚠️ Issue Already Assigned

Hi @madhav758, this issue is currently assigned to @gauravdubey37.

[!NOTE] If no progress is made within 14 days, the issue will be automatically unassigned.

Options for contributors
  • Wait for availability: The issue may become available if auto-unassigned
  • Collaborate: You can ask the assignee if they want help
  • Maintainer assistance: A maintainer can add you as co-assignee if appropriate

jabref-machine avatar May 14 '26 07:05 jabref-machine

📋 Assignment Update

Hi @gauravdubey37, due to inactivity, you have been unassigned from this issue.

Next steps


If you still want to work on this:

  • Submit a pull request showing your current state. You will be automatically assigned again.
  • Ask a maintainer to assign you again.

github-actions[bot] avatar May 27 '26 13:05 github-actions[bot]

/assign-me

MateusLyoshka avatar May 27 '26 22:05 MateusLyoshka

Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.

At this point in time, you raised 1 pull request(s) of which 100% (1/1) have been merged.

jabref-machine avatar May 27 '26 22:05 jabref-machine

Hey, I've been working on this issue. I made these changes in DocumentReader.java:

My changes: https://github.com/Chiraggupta0/jabref/commit/a7941f1e3a03b3d356e7cc59c885cedc558119cf

  • Added fileLink to both catch blocks so the filename shows up when an IOException happens
  • Updated addContentIfNotEmpty signature to accept fileLink
  • Added fileLink to the existing debug log before processing starts

But still couldn't get the filename to show up near the errors. After digging in, I found that the MissingOperandException: Operator Tm has too few operands errors are thrown and logged by PDFBox internally -- they never reach our catch blocks at all. So no matter what I add to the catch blocks, it won't help for this specific case. I also tried changing the debug log to LOGGER.info thinking it would show in the Event Log, but that caused a StackOverflowError and crashed the Event Log UI with hundreds of index exceeds maxCellCount messages (Txt file attached). LOGGER.debug doesn't show up anywhere — not in terminal, not in Event Log. Not sure what the right approach is here. Should the filename be logged as a WARN right before PDFTextStripper.getText() is called? Or is there a better way to associate the filename with PDFBox's own error messages?

No_filename_log_issue#15680.txt StackOverFlow_log_issue#15680.txt

Chiraggupta0 avatar May 28 '26 08:05 Chiraggupta0

Also i have read the Contributing guideline and i know that the issue has been already assigned to someone. The above comment is just me trying to solve the bug for my betterment and understanding and also understanding the codebase better.

Chiraggupta0 avatar May 29 '26 07:05 Chiraggupta0

@MateusLyoshka are you still working on this issue? If you don't respond within a day, I will unassign you. @Chiraggupta0 I strongly appreciate your interest in this issue and that you actually found some approaches that might be a way forward... but if it doesn't work well, if push comes to shove maybe we need to open a PR in the pdfbox repo? For starters, please open a pull-request in the JabRef repository.

I think Warning or Error is the proper level. I don't think we should use debug level during normal JabRef usage. It's only relevant for developing or debugging, though you can trigger debug log level this way:

On Windows:

	.\gradlew.bat :jabgui:run --args="--debug"

On Linux

	./gradlew :jabgui:run --args="--debug"

Check gradle log levels: https://docs.gradle.org/current/userguide/logging.html#logLevels You also can let them write to a text file: .\gradlew.bat :jabgui:run --args="--debug" *> debuglog.txt

That said, next time please ask the person, that is assigned to the issue, if you can contribute here. For good first issues we have a policy of assigning only one contributor to prevent any issues with grading, as we have many student contributors. To me it looks like MateusLyoshka probably has given up on this issue here, but you never know, so please be fair.

ThiloteE avatar Jun 01 '26 19:06 ThiloteE

logger config is handled via tinlyog.properties

Siedlerchr avatar Jun 01 '26 19:06 Siedlerchr

Howto at https://devdocs.jabref.org/code-howtos/logging.html

koppor avatar Jun 01 '26 20:06 koppor

@ThiloteE As suggested, I have opened a PR for the logging improvements discussed above.

Chiraggupta0 avatar Jun 08 '26 16:06 Chiraggupta0

@Chiraggupta0 ... come on, @subhramit gave you nice pointers how to open a PR at: https://github.com/JabRef/jabref/pull/15859#issuecomment-4580050562. Stop completely relying on language models. At the very least, you will have to check their output.

ThiloteE avatar Jun 08 '26 19:06 ThiloteE

@ThiloteE I have opened the pr and made the changes as suggested . please review it. #15926

Chiraggupta0 avatar Jun 11 '26 12:06 Chiraggupta0

/assign-me

aaryansinhaa avatar Jun 12 '26 14:06 aaryansinhaa

Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.

At this point in time, you raised 1 pull request(s) of which 100% (1/1) have been merged.

jabref-machine avatar Jun 12 '26 14:06 jabref-machine

Hey @ThiloteE @koppor @Siedlerchr , I used a somewhat naive brute force way and was able to get a log message:

Indexing encountered warnings or errors for file: /home/aaryan/Downloads/Khoo202209gpr.Khoo.2022-09.Great.power.Rivalry.141--154.pdf

Basically, I compare the count of warning and error messages in JabRef's Event Log before and after parsing the PDF, logging a warning with the file path if new errors are detected. Ofc this is not a very good way;

I am trying to get a better way to handle this, can you give me some similar implementation to follow, would be helpful. Thanks!

aaryansinhaa avatar Jun 14 '26 21:06 aaryansinhaa

actually I have also added a message for parsing in the beginning, and the errors following it will naturally be associated with it Parsing PDF file: /home/aaryan/Downloads/Khoo202209gpr.Khoo.2022-09.Great.power.Rivalry.141--154.pdf

But I believe that Indexing encountered warnings or errors for file: /home/aaryan/Downloads/Khoo202209gpr.Khoo.2022-09.Great.power.Rivalry.141--154.pdf is much more easier to understand

aaryansinhaa avatar Jun 14 '26 21:06 aaryansinhaa